Paragon-neo/100G: Some simple REST examples
Checking the status of the ethernet ports
def is_link_up(port):
eth_link = "UNDEFINED"
link_state = "UNDEFINED"
leds = calnexGet("results/statusleds")
if port == 0:
eth_link = 'ethLink_0'
else:
eth_link = 'ethLink_1'
for led in leds:
if led['Name'] == eth_link:
link_state = led['State']
if link_state == 'Link':
return True
else:
return False
def is_good_pkts(port):
eth_pkts = "UNDEFINED"
pkts_state = "UNDEFINED"
leds = calnexGet("results/statusleds")
if port == 0:
eth_pkts = 'ethPkt_0'
else:
eth_pkts = 'ethPkt_1'
for led in leds:
if led['Name'] == eth_pkts:
pkts_state = led['State']
if pkts_state == 'GoodPackets':
return True
else:
return False
Checking the status of the reference input
def is_ref_locked():
leds = calnexGet("results/statusleds")
for led in leds:
if led['Name'] == 'refInClk':
state = led['State']
if state == 'Signal':
return True
else:
return False
Checking the status of wander generation
def is_synce_wander_generation_running():
state = calnexGetVal("app/generation/synce/wander", "RunState")
if state == "Stopped":
return False
else:
return True