gobgp_monitoring_worker.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:sdwan_orchestrator_with_gobgp 作者: ttsubo 项目源码 文件源码
def _monitoring_loop(self):
        while True:
            eventlet.sleep(1)
            if not result_queue.empty():
                change_result_list = result_queue.get()
                for change_result in change_result_list:
                    host_name = change_result['host_name']
                    neighbor_addr = change_result['neighbor_addr']
                    state = change_result['state']
                    if state == "BGP_FSM_ESTABLISHED":
                        status = 'UP'
                    elif state == "BGP_FSM_IDLE" or state == "BGP_FSM_ACTIVE":
                        status = 'DOWN'
                    while True:
                        eventlet.sleep(1)
                        uuid = self._search_uuid(host_name, neighbor_addr)
                        if uuid:
                            print "### Detect: ", host_name, neighbor_addr, uuid, status
                            self._writeState(uuid, self.resource, status)
                            break
                        else:
                            print ("### retry search uuid")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号