Skip to content

Commit efec77c

Browse files
author
Tobias Hintze
committed
improve granularity of neighbor states
* add loading, exchange, exstart, 2-way, init, attempt, down
1 parent 865f816 commit efec77c

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

bird_ospf.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,24 @@ def OnInit(ax, axd):
4040
## if CacheInterval has expired at that time
4141
def OnUpdate(ax, axd, state):
4242
def state2int(state):
43-
# FIXME i need more samples of `birdc show ospf neighbors`
44-
# for more fine-granular results here...
4543
if state.lower().startswith("full"):
4644
return 8
47-
return 1
45+
elif state.lower().startswith("loading"):
46+
return 7
47+
elif state.lower().startswith("exchange"):
48+
return 6
49+
elif state.lower().startswith("exstart"):
50+
return 5
51+
elif state.lower().startswith("2-way"):
52+
return 4
53+
elif state.lower().startswith("init"):
54+
return 3
55+
elif state.lower().startswith("attempt"):
56+
return 2
57+
elif state.lower().startswith("down"):
58+
return 1
59+
else:
60+
return 1
4861
print('updated bird-ospf state: {0}'.format(time.time()))
4962
## register variables
5063
axd.RegisterVar('ospf', 0)

0 commit comments

Comments
 (0)