analyze_test.py 文件源码

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

项目:nav 作者: UNINETT 项目源码 文件源码
def test_reduce_simple_case_lldp(self):
        graph = nx.MultiDiGraph(name="simple case lldp")
        graph.add_edge(self.switch_a, self.switch_port_a)
        graph.add_edge(self.switch_b, self.switch_port_b)
        graph.add_edge(self.switch_port_a, self.switch_port_b, "lldp")
        graph.add_edge(self.switch_port_b, self.switch_port_a, "lldp")
        reducer = AdjacencyReducer(graph)
        print("input:")
        print(reducer.format_connections())
        reducer.reduce()
        print("result:")
        print(reducer.format_connections())
        result = reducer.graph
        assert result.has_edge(self.switch_port_a, self.switch_port_b)
        assert result.has_edge(self.switch_port_b, self.switch_port_a)
        assert result.out_degree(self.switch_port_a) == 1
        assert result.out_degree(self.switch_port_b) == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号