def test_get_floating_ips(self):
     vif = fake_network_cache_model.new_vif()
     vif['network']['subnets'][0]['ips'][0].add_floating_ip('192.168.1.1')
     ninfo = model.NetworkInfo([vif,
             fake_network_cache_model.new_vif(
                 {'address':'bb:bb:bb:bb:bb:bb'})])
     self.assertEqual(ninfo.floating_ips(), ['192.168.1.1'])
Пример #2
0
 def test_get_floating_ips(self):
     vif = fake_network_cache_model.new_vif()
     vif['network']['subnets'][0]['ips'][0].add_floating_ip('192.168.1.1')
     ninfo = model.NetworkInfo([
         vif,
         fake_network_cache_model.new_vif({'address': 'bb:bb:bb:bb:bb:bb'})
     ])
     self.assertEqual(ninfo.floating_ips(), ['192.168.1.1'])
 def test_create_model(self):
     ninfo = model.NetworkInfo([fake_network_cache_model.new_vif(),
             fake_network_cache_model.new_vif(
                 {'address':'bb:bb:bb:bb:bb:bb'})])
     self.assertEqual(ninfo.fixed_ips(),
             [fake_network_cache_model.new_ip({'address': '192.168.1.100'}),
              fake_network_cache_model.new_ip(
                 {'address': '192.168.1.101'})] * 4)
Пример #4
0
 def test_create_model(self):
     ninfo = model.NetworkInfo([
         fake_network_cache_model.new_vif(),
         fake_network_cache_model.new_vif({'address': 'bb:bb:bb:bb:bb:bb'})
     ])
     self.assertEqual(ninfo.fixed_ips(), [
         fake_network_cache_model.new_ip({'address': '192.168.1.100'}),
         fake_network_cache_model.new_ip({'address': '192.168.1.101'})
     ] * 4)
 def test_vif_get_fixed_ips(self):
     vif = fake_network_cache_model.new_vif()
     fixed_ips = vif.fixed_ips()
     ips = [fake_network_cache_model.new_ip(dict(address='192.168.1.100')),
             fake_network_cache_model.new_ip(
                     dict(address='192.168.1.101'))] * 2
     self.assertEqual(fixed_ips, ips)
Пример #6
0
 def test_vif_get_fixed_ips(self):
     vif = fake_network_cache_model.new_vif()
     fixed_ips = vif.fixed_ips()
     ips = [
         fake_network_cache_model.new_ip(dict(address='192.168.1.100')),
         fake_network_cache_model.new_ip(dict(address='192.168.1.101'))
     ] * 2
     self.assertEqual(fixed_ips, ips)
Пример #7
0
 def test_hydrate(self):
     new_vif = dict(id=1,
                    address='127.0.0.1',
                    network=fake_network_cache_model.new_network())
     vif = model.VIF.hydrate(fake_network_cache_model.new_vif())
     self.assertEqual(vif['id'], 1)
     self.assertEqual(vif['address'], 'aa:aa:aa:aa:aa:aa')
     self.assertEqual(vif['network'],
                      fake_network_cache_model.new_network())
 def test_hydrate(self):
     new_vif = dict(
         id=1,
         address='127.0.0.1',
         network=fake_network_cache_model.new_network())
     vif = model.VIF.hydrate(fake_network_cache_model.new_vif())
     self.assertEqual(vif['id'], 1)
     self.assertEqual(vif['address'], 'aa:aa:aa:aa:aa:aa')
     self.assertEqual(vif['network'],
             fake_network_cache_model.new_network())
 def test_vif_get_labeled_ips(self):
     vif = fake_network_cache_model.new_vif()
     labeled_ips = vif.labeled_ips()
     ip_dict = {
         'network_id': 1,
         'ips': [fake_network_cache_model.new_ip(
                     {'address': '192.168.1.100'}),
                 fake_network_cache_model.new_ip(
                     {'address': '192.168.1.101'})] * 2,
         'network_label': 'public'}
     self.assertEqual(labeled_ips, ip_dict)
Пример #10
0
 def test_vif_get_labeled_ips(self):
     vif = fake_network_cache_model.new_vif()
     labeled_ips = vif.labeled_ips()
     ip_dict = {
         'network_id':
         1,
         'ips': [
             fake_network_cache_model.new_ip({'address': '192.168.1.100'}),
             fake_network_cache_model.new_ip({'address': '192.168.1.101'})
         ] * 2,
         'network_label':
         'public'
     }
     self.assertEqual(labeled_ips, ip_dict)
 def test_vif_get_floating_ips(self):
     vif = fake_network_cache_model.new_vif()
     vif['network']['subnets'][0]['ips'][0].add_floating_ip('192.168.1.1')
     floating_ips = vif.floating_ips()
     self.assertEqual(floating_ips, ['192.168.1.1'])
 def test_create_vif(self):
     vif = fake_network_cache_model.new_vif()
     self.assertEqual(vif['id'], 1)
     self.assertEqual(vif['address'], 'aa:aa:aa:aa:aa:aa')
     self.assertEqual(vif['network'],
             fake_network_cache_model.new_network())
Пример #13
0
 def test_vif_get_floating_ips(self):
     vif = fake_network_cache_model.new_vif()
     vif['network']['subnets'][0]['ips'][0].add_floating_ip('192.168.1.1')
     floating_ips = vif.floating_ips()
     self.assertEqual(floating_ips, ['192.168.1.1'])
Пример #14
0
 def test_create_vif(self):
     vif = fake_network_cache_model.new_vif()
     self.assertEqual(vif['id'], 1)
     self.assertEqual(vif['address'], 'aa:aa:aa:aa:aa:aa')
     self.assertEqual(vif['network'],
                      fake_network_cache_model.new_network())