Beispiel #1
0
 def teardown(self):
     self.ip.release()
     remove_link('bala_port0')
     remove_link('bala_port1')
     remove_link('dummyX')
     remove_link('bala')
     remove_link('bv101')
Beispiel #2
0
 def test_route_table_2048(self):
     require_user('root')
     naddr = str(self.ipnets[1].network)
     ifaddr1 = self.ifaddr()
     ifaddr2 = self.ifaddr()
     self.ip.link('set', index=self.ifaces[0], state='up')
     self.ip.addr('add', self.ifaces[0], address=ifaddr1, mask=24)
     self.ip.route('add', dst=naddr, mask=24, gateway=ifaddr2, table=2048)
     assert grep('ip route show table 2048',
                 pattern='%s/24.*%s' % (naddr, ifaddr2))
     remove_link('bala')
Beispiel #3
0
 def test_route_table_2048(self):
     require_user('root')
     self.ip.link('set', index=self.ifaces[0], state='up')
     self.ip.addr('add', self.ifaces[0], address='172.16.0.2', mask=24)
     self.ip.route('add',
                   dst='172.16.1.0',
                   mask=24,
                   gateway='172.16.0.1',
                   table=2048)
     assert grep('ip route show table 2048',
                 pattern='172.16.1.0/24.*172.16.0.1')
     remove_link('bala')
Beispiel #4
0
 def test_route_table_2048(self):
     require_user('root')
     self.ip.link('set', index=self.ifaces[0], state='up')
     self.ip.addr('add', self.ifaces[0], address='172.16.0.2', mask=24)
     self.ip.route('add',
                   prefix='172.16.1.0',
                   mask=24,
                   gateway='172.16.0.1',
                   table=2048)
     assert grep('ip route show table 2048',
                 pattern='172.16.1.0/24.*172.16.0.1')
     remove_link('bala')
Beispiel #5
0
 def test_route(self):
     require_user('root')
     create_link('bala', 'dummy')
     dev = self.ip.link_lookup(ifname='bala')[0]
     self.ip.link('set', index=dev, state='up')
     self.ip.addr('add', dev, address='172.16.0.2', mask=24)
     self.ip.route('add',
                   prefix='172.16.1.0',
                   mask=24,
                   gateway='172.16.0.1')
     assert grep('ip route show', pattern='172.16.1.0/24.*172.16.0.1')
     remove_link('bala')
Beispiel #6
0
 def test_route_table_2048(self):
     require_user('root')
     create_link('bala', 'dummy')
     dev = self.ip.link_lookup(ifname='bala')[0]
     self.ip.link('set', index=dev, state='up')
     self.ip.addr('add', dev, address='172.16.0.2', mask=24)
     self.ip.route('add',
                   prefix='172.16.1.0',
                   mask=24,
                   gateway='172.16.0.1',
                   table=2048)
     assert grep('ip route show table 2048',
                 pattern='172.16.1.0/24.*172.16.0.1')
     remove_link('bala')
Beispiel #7
0
 def test_route_table_2048(self):
     require_user('root')
     naddr = str(self.ipnets[1].network)
     ifaddr1 = self.ifaddr()
     ifaddr2 = self.ifaddr()
     self.ip.link('set', index=self.ifaces[0], state='up')
     self.ip.addr('add', self.ifaces[0], address=ifaddr1, mask=24)
     self.ip.route('add',
                   dst=naddr,
                   mask=24,
                   gateway=ifaddr2,
                   table=2048)
     assert grep('ip route show table 2048',
                 pattern='%s/24.*%s' % (naddr, ifaddr2))
     remove_link('bala')
Beispiel #8
0
    def test_freeze_del(self):
        require_user("root")

        interface = self.ip.interfaces[self.ifd]

        # set up the interface
        with interface as i:
            i.add_ip("172.16.0.1/24")
            i.add_ip("172.16.1.1/24")
            i.up()

        # check
        assert ("172.16.0.1", 24) in interface.ipaddr
        assert ("172.16.1.1", 24) in interface.ipaddr
        assert interface.flags & 1

        interface.freeze()

        # delete interface with an external routine
        remove_link(interface.ifname)

        # wait for a second
        time.sleep(1)

        # check if it is back
        ipdb = IPDB()
        try:
            ifc = ipdb.interfaces[self.ifd]
            assert ("172.16.0.1", 24) in ifc.ipaddr
            assert ("172.16.1.1", 24) in ifc.ipaddr
            assert ifc.flags & 1
        except:
            raise
        finally:
            interface.unfreeze()
            ipdb.release()
Beispiel #9
0
    def test_freeze_del(self):
        require_user('root')

        interface = self.ip.interfaces[self.ifd]

        # set up the interface
        with interface as i:
            i.add_ip('172.16.0.1/24')
            i.add_ip('172.16.1.1/24')
            i.up()

        # check
        assert ('172.16.0.1', 24) in interface.ipaddr
        assert ('172.16.1.1', 24) in interface.ipaddr
        assert interface.flags & 1

        interface.freeze()

        # delete interface with an external routine
        remove_link(interface.ifname)

        # wait for a second
        time.sleep(1)

        # check if it is back
        ipdb = IPDB()
        try:
            ifc = ipdb.interfaces[self.ifd]
            assert ('172.16.0.1', 24) in ifc.ipaddr
            assert ('172.16.1.1', 24) in ifc.ipaddr
            assert ifc.flags & 1
        except:
            raise
        finally:
            interface.unfreeze()
            ipdb.release()
Beispiel #10
0
 def teardown(self):
     self.ip.release()
     remove_link('dummyX')
Beispiel #11
0
 def teardown(self):
     remove_link('dummyX')
Beispiel #12
0
 def teardown(self):
     remove_link(self.ifname)
Beispiel #13
0
 def teardown(self):
     self.ip.release()
     remove_link('dummyX')
Beispiel #14
0
 def teardown(self):
     remove_link('dummyX')
Beispiel #15
0
 def teardown(self):
     remove_link(self.ifname)
Beispiel #16
0
 def teardown(self):
     self.ip.release()
     self.release.set()
     remove_link('dummyX')
     remove_link('bala')