Commit c59ac309 authored by Martín Ferrari's avatar Martín Ferrari

more test; change in API for tunnels

parent eb1a7279
......@@ -21,7 +21,8 @@ print "Nodes started with pids: %d and %d" % (a.pid, b.pid)
# interface object maps to a veth pair with one end in a netns
if0 = a.add_if(mac_address = '42:71:e0:90:ca:42')
if1 = b.add_if(mtu = 1492)
if2 = b.add_tunnel_if() # tun device, for connecting to the outside world
# for using with a tun device, to connect to the outside world
if2 = b.import_if('tun0')
# each Link is a linux bridge, all the parameters are applied to the associated
# interfaces as tc qdiscs.
......
......@@ -9,7 +9,24 @@ class TestInterfaces(unittest.TestCase):
# def setUp(self):
# pass
def test_interfaces(self):
pass
node0 = netns.Node()
if0 = a.add_if(mac_address = '42:71:e0:90:ca:42', mtu = 1492)
self.assertEquals(if0.mac_address, '42:71:e0:90:ca:42')
if0.mac_address = '4271E090CA42'
self.assertEquals(if0.mac_address, '42:71:e0:90:ca:42')
self.assertRaises(BaseException, setattr, if0, 'mac_address', 'foo')
self.assertRaises(BaseException, setattr, if0, 'mac_address',
'12345678901')
self.assertEquals(if0.mtu, 1492)
self.assertRaises(BaseException, setattr, if0, 'mtu', 0)
self.assertRaises(BaseException, setattr, if0, 'mtu', 65537)
# FIXME: run-time tests
dummyname = "dummy%d" % os.getpid()
self.assertEquals(
os.system("ip link add name %s type dummy" % dummyname), 0)
if1 = a.import_if(dummyname)
if __name__ == '__main__':
unittest.main()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment