コード例 #1
0
    def test_local_auto_with_dynamic_address_from_ra(self):
        IPV6_NETADDRESS = '2001:1:1:1'
        IPV6_NETPREFIX_LEN = '64'
        with veth_pair() as (server, client):
            with dnsmasq_run(server, ipv6_slaac_prefix=IPV6_NETADDRESS + '::'):
                with wait_for_ipv6(client):
                    ipwrapper.linkSet(client, ['up'])
                    ipwrapper.linkSet(server, ['up'])
                    ipwrapper.addrAdd(server,
                                      IPV6_NETADDRESS + '::1',
                                      IPV6_NETPREFIX_LEN,
                                      family=6)

                # Expecting link and global addresses on client iface
                # The addresses are given randomly, so we sort them
                ip_addrs = sorted(addresses.getIpAddrs()[client],
                                  key=lambda ip: ip['address'])
                self.assertEqual(2, len(ip_addrs))

                self.assertTrue(addresses.is_dynamic(ip_addrs[0]))
                self.assertEqual('global', ip_addrs[0]['scope'])
                self.assertEqual(IPV6_NETADDRESS,
                                 ip_addrs[0]['address'][:len(IPV6_NETADDRESS)])

                self.assertEqual('link', ip_addrs[1]['scope'])
コード例 #2
0
ファイル: netinfo_test.py プロジェクト: vjuranek/vdsm
 def test_local_auto_with_static_address_without_ra_server(self, nic0):
     ipwrapper.addrAdd(nic0, '2001::88', IPV6_PREFIX_LENGTH, family=6)
     ip_addrs = addresses.getIpAddrs()[nic0]
     assert addresses.is_ipv6_local_auto(nic0)
     assert 2 == len(ip_addrs), ip_addrs
     assert addresses.is_ipv6(ip_addrs[0])
     assert not addresses.is_dynamic(ip_addrs[0])
コード例 #3
0
ファイル: netinfo_test.py プロジェクト: xiaojiongming/vdsm
 def test_local_auto_with_static_address_without_ra_server(self):
     with dummy_device() as dev:
         ipwrapper.addrAdd(dev, '2001::88', '64', family=6)
         ip_addrs = addresses.getIpAddrs()[dev]
         self.assertTrue(addresses.is_ipv6_local_auto(dev))
         self.assertEqual(2, len(ip_addrs))
         self.assertTrue(addresses.is_ipv6(ip_addrs[0]))
         self.assertTrue(not addresses.is_dynamic(ip_addrs[0]))
コード例 #4
0
ファイル: netinfo_test.py プロジェクト: nirs/vdsm
 def test_local_auto_with_static_address_without_ra_server(self):
     with dummy_device() as dev:
         ipwrapper.addrAdd(dev, '2001::88', '64', family=6)
         ip_addrs = addresses.getIpAddrs()[dev]
         self.assertTrue(addresses.is_ipv6_local_auto(dev))
         self.assertEqual(2, len(ip_addrs), ip_addrs)
         self.assertTrue(addresses.is_ipv6(ip_addrs[0]))
         self.assertTrue(not addresses.is_dynamic(ip_addrs[0]))
コード例 #5
0
ファイル: netinfo_test.py プロジェクト: kumarchandan786/vdsm
 def test_local_auto_with_static_address_without_ra_server(self):
     with dummy_device() as dev:
         ipwrapper.addrAdd(dev, '2001::88', '64', family=6)
         ip_addrs = addresses.getIpAddrs()[dev]
         assert addresses.is_ipv6_local_auto(dev)
         assert 2 == len(ip_addrs), ip_addrs
         assert addresses.is_ipv6(ip_addrs[0])
         assert not addresses.is_dynamic(ip_addrs[0])
コード例 #6
0
ファイル: netinfo_test.py プロジェクト: guozhonghua216/vdsm
 def test_local_auto_with_static_address_without_ra_server(self, nic0):
     Interface.from_existing_dev_name(nic0).add_ip('2001::88',
                                                   IPV6_PREFIX_LENGTH,
                                                   IpFamily.IPv6)
     ip_addrs = addresses.getIpAddrs()[nic0]
     assert addresses.is_ipv6_local_auto(nic0)
     assert 2 == len(ip_addrs), ip_addrs
     assert addresses.is_ipv6(ip_addrs[0])
     assert not addresses.is_dynamic(ip_addrs[0])
コード例 #7
0
ファイル: netinfo_test.py プロジェクト: guozhonghua216/vdsm
    def test_local_auto_with_dynamic_address_from_ra(self, dynamic_ipv6_iface):
        # Expecting link and global addresses on client iface
        # The addresses are given randomly, so we sort them
        ip_addrs = sorted(
            addresses.getIpAddrs()[dynamic_ipv6_iface],
            key=lambda ip: ip['address'],
        )
        assert len(ip_addrs) == 2

        assert addresses.is_dynamic(ip_addrs[0])
        assert ip_addrs[0]['scope'] == 'global'
        assert ip_addrs[0]['address'].startswith(IPV6_ADDR_BASE)

        assert ip_addrs[1]['scope'] == 'link'
コード例 #8
0
ファイル: netinfo_test.py プロジェクト: nirs/vdsm
    def test_local_auto_with_dynamic_address_from_ra(self):
        IPV6_NETADDRESS = '2001:1:1:1'
        IPV6_NETPREFIX_LEN = '64'
        with veth_pair() as (server, client):
            ipwrapper.addrAdd(server, IPV6_NETADDRESS + '::1',
                              IPV6_NETPREFIX_LEN, family=6)
            ipwrapper.linkSet(server, ['up'])
            with dnsmasq_run(server, ipv6_slaac_prefix=IPV6_NETADDRESS + '::'):
                with wait_for_ipv6(client):
                    ipwrapper.linkSet(client, ['up'])

                # Expecting link and global addresses on client iface
                # The addresses are given randomly, so we sort them
                ip_addrs = sorted(addresses.getIpAddrs()[client],
                                  key=lambda ip: ip['address'])
                self.assertEqual(2, len(ip_addrs), ip_addrs)

                self.assertTrue(addresses.is_dynamic(ip_addrs[0]))
                self.assertEqual('global', ip_addrs[0]['scope'])
                self.assertEqual(IPV6_NETADDRESS,
                                 ip_addrs[0]['address'][:len(IPV6_NETADDRESS)])

                self.assertEqual('link', ip_addrs[1]['scope'])