def test_path_with_node_set(self):
        man = TopologyManager(CONFIG_FILE)
        topo = man.get_topology()

        # Get a path
        path = nx.shortest_path(topo, source="atl-switch", target="mia-switch")

        # Should return 1
        vlan = man.find_vlan_on_path(path)
        self.failUnlessEqual(vlan, 1)

        # Add VLAN 1 to one of the points on the path
        man.topo.node["mia-switch"]['vlans_in_use'].append(1)

        # Should return 2
        vlan = man.find_vlan_on_path(path)
        self.failUnlessEqual(vlan, 2)
    def test_path_edge_filled(self):
        man = TopologyManager(CONFIG_FILE)
        topo = man.get_topology()

        # Get a path
        path = nx.shortest_path(topo, source="atl-switch", target="mia-switch")

        # Should return 1
        vlan = man.find_vlan_on_path(path)
        self.failUnlessEqual(vlan, 1)

        # Add VLANs 1-4090 to one of the points on the path
        man.topo.edge["mia-switch"]["atl-switch"]['vlans_in_use'] = range(
            1, 4090)
        # Should return None
        vlan = man.find_vlan_on_path(path)
        self.failUnlessEqual(vlan, None)
    def test_path_empty(self):
        man = TopologyManager(CONFIG_FILE)
        topo = man.get_topology()

        # Get a path
        path = nx.shortest_path(topo, source="atl-switch", target="mia-switch")

        # It should return 1
        vlan = man.find_vlan_on_path(path)
        self.failUnlessEqual(vlan, 1)