Exemplo n.º 1
0
    def test_map_edges(self):
        s = slices[0]
        l_edges = vlan.edges_of_topo(s.l_topo)
        p_edges = vlan.edges_of_topo(topo)
        mapped = vlan.map_edges(l_edges, s.node_map, s.port_map)
        switches = [(s1, s2) for (s1, p1), (s2, p2) in mapped]

        # Verify all the expected switch links
        self.assertItemsEqual([(1, 3), (1, 4), (3, 1), (4, 1)], switches)
        # Verify that all the port labels are what they are in the topology
        for ((s1, p1), (s2, p2)) in mapped:
            self.assertEqual((s2, p2), topo.node[s1]['port'][p1])
Exemplo n.º 2
0
    def test_edges_of_topo(self):
        edges = vlan.edges_of_topo(topo)

        # Verify all the expected switch links
        switches = [(s1, s2) for (s1, p1), (s2, p2) in edges]
        self.assertItemsEqual([(1, 3), (1, 4), (1, 5),
                               (2, 3), (2, 4), (2, 5),
                               (3, 1), (3, 2),
                               (4, 1), (4, 2),
                               (5, 1), (5, 2)],
                              switches)
        # Verify that all the port labels are what they are in the topology
        for ((s1, p1), (s2, p2)) in edges:
            self.assertEqual((s2, p2), topo.node[s1]['port'][p1])