Example #1
0
 def test_getRules_4(self):
     topo = FatTree(k=8)
     net = Mininet(topo=topo, controller=None)
     ft = FatTreeConverted.from_mininet(net)
     rules, s_d = ft.getRules()
     net.stop()
     self.assertEqual(64, len(s_d))
 def test_assertOddK(self):
     k = 3
     try:
         FatTree(k)
     except Exception:
         self.assertTrue(True)
     else:
         self.assertTrue(False)
Example #3
0
def run():
    topo = FatTree(6)
    net = Mininet(topo=topo, link=TCLink, controller=None)
    net.start()
    # sleep(5)
    # Mininet API for the experiment
    #  sysctl -w net.ipv4.neigh.default.gc_thresh1=4098
    # increase the arp table cache
    print("ARP TABLES")

    net.staticArp()
    ft = FatTreeConverted.from_mininet(net)
    rules, s_d = ft.getRules()
    ovs_rules = ft.getOVSRules(rules=rules)
    for switch in net.switches:
        print(switch.name)
        rl = ovs_rules[switch.name]
        for r in rl:
            cmd = "bash -c 'ovs-ofctl add-flow {} {}'".format(switch.name, r)
            print(switch.name, cmd)
            switch.cmd(cmd)
        print()
    print(ovs_rules)
    # Run the CLI
    for s, d in s_d:
        print(s, d)
        ploss = net.ping([net.getNodeByName(s), net.getNodeByName(d)])
        if ploss > 0:
            print(s, d, "PACKET LOSS!")
            break
        print(ploss)

    results = iperf(net, s_d)
    print(results)

    CLI(net)
    net.stop()
 def test_instanceType(self):
     net = FatTree(4)
     self.assertTrue(issubclass(type(net), Topo))
 def test_linkNumber(self):
     k = 6
     net = FatTree(k)
     links = len(net.links())
     exp_links = ((k / 2)**2) * k * 2 + k * ((k / 2)**2)
     self.assertEqual(exp_links, links)
 def test_hostNumber_1(self):
     k = 6
     net = FatTree(k)
     hosts = len(net.hosts())
     self.assertEqual((((k / 2)**2) * k), hosts)