Пример #1
0
 def test_specific_vlanid_inside(self):
     l2network_db.create_vlanids()
     orig_count = len(l2network_db.get_all_vlanids())
     self.assertGreater(orig_count, 0)
     vlan_id = 1007  # inside range dynamically allocated
     self.assertFalse(l2network_db.is_vlanid_used(vlan_id))
     l2network_db.reserve_specific_vlanid(vlan_id, "net-id")
     self.assertTrue(l2network_db.is_vlanid_used(vlan_id))
     count = len(l2network_db.get_all_vlanids())
     self.assertEqual(count, orig_count)
     used = l2network_db.release_vlanid(vlan_id)
     self.assertFalse(used)
     self.assertFalse(l2network_db.is_vlanid_used(vlan_id))
     count = len(l2network_db.get_all_vlanids())
     self.assertEqual(count, orig_count)
     self.teardown_vlanbinding()
     self.teardown_network()
Пример #2
0
 def teste_test_vlanids(self):
     """test vlanid methods"""
     l2network_db.create_vlanids()
     vlanids = l2network_db.get_all_vlanids()
     self.assertTrue(len(vlanids) > 0)
     vlanid = l2network_db.reserve_vlanid()
     used = l2network_db.is_vlanid_used(vlanid)
     self.assertTrue(used)
     used = l2network_db.release_vlanid(vlanid)
     self.assertFalse(used)
Пример #3
0
 def test_specific_vlanid_outside(self):
     l2network_db.create_vlanids()
     orig_count = len(l2network_db.get_all_vlanids())
     self.assertGreater(orig_count, 0)
     vlan_id = 7  # outside range dynamically allocated
     with self.assertRaises(c_exc.VlanIDNotFound):
         l2network_db.is_vlanid_used(vlan_id)
     l2network_db.reserve_specific_vlanid(vlan_id, "net-id")
     self.assertTrue(l2network_db.is_vlanid_used(vlan_id))
     count = len(l2network_db.get_all_vlanids())
     self.assertEqual(count, orig_count + 1)
     used = l2network_db.release_vlanid(vlan_id)
     self.assertFalse(used)
     with self.assertRaises(c_exc.VlanIDNotFound):
         l2network_db.is_vlanid_used(vlan_id)
     count = len(l2network_db.get_all_vlanids())
     self.assertEqual(count, orig_count)
     self.teardown_vlanbinding()
     self.teardown_network()
Пример #4
0
 def teste_test_vlanids(self):
     """test vlanid methods"""
     l2network_db.create_vlanids()
     vlanids = l2network_db.get_all_vlanids()
     self.assertTrue(len(vlanids) > 0)
     vlanid = l2network_db.reserve_vlanid()
     used = l2network_db.is_vlanid_used(vlanid)
     self.assertTrue(used)
     used = l2network_db.release_vlanid(vlanid)
     self.assertFalse(used)
Пример #5
0
 def test_vlanids(self):
     l2network_db.create_vlanids()
     vlanids = l2network_db.get_all_vlanids()
     self.assertGreater(len(vlanids), 0)
     vlanid = l2network_db.reserve_vlanid()
     used = l2network_db.is_vlanid_used(vlanid)
     self.assertTrue(used)
     used = l2network_db.release_vlanid(vlanid)
     self.assertFalse(used)
     self.teardown_vlanbinding()
     self.teardown_network()