Exemplo n.º 1
0
    def add_link(self, node1, node2, bandwidth):
        link = Link(node1.get_id(), node2.get_id(), bandwidth, bandwidth)
        end_point = link.get_end_points()

        if link in self.links:
            raise Exception("Link already exist...")
        else:
            self.links[end_point] = link
            node1.add_link(link)
            node2.add_link(link)

        self.links[end_point] = link
Exemplo n.º 2
0
    def add_link(self, node1, node2, bandwidth):
        link = Link(node1.get_id(), node2.get_id(), bandwidth, bandwidth)
        end_point = link.get_end_points()

        if link in self.links:
            raise Exception("Link already exist...")
        else:
            self.links[end_point] = link
            node1.add_link(link)
            node2.add_link(link)

        self.links[end_point] = link
 def test_link(self):
     link1 = Link('host1', 'host2', 1000)
     self.assert_(link1.get_bandwidth() == 1000)
     self.assert_(link1.get_end_points() == ('host1', 'host2'))
     self.assert_(not link1.get_flows())
 def test_link(self):
     link1 = Link('host1', 'host2', 1000)
     self.assert_(link1.get_bandwidth() == 1000)
     self.assert_(link1.get_end_points() == ('host1', 'host2'))
     self.assert_(not link1.get_flows())