def _monitor_neighbor(self):
with hide('running', 'stdout'):
while True:
eventlet.sleep(1)
try:
results = {}
cmd = 'gobgp -j neighbor -u {0}'.format(self.mgmt_addr)
output = local(cmd, capture=True)
ret = json.loads(output)
for i in range(len(ret)):
addr = ret[i]['conf']['remote_ip']
state = ret[i]['info']['bgp_state']
results[addr] = state
change_result_list = self._extract_change_state(results)
if change_result_list != []:
result_queue.put(change_result_list)
except:
continue
gobgp_monitoring_worker.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录