当前位置: 首页>>代码示例>>Python>>正文


Python n1kv_db_v2.get_vlan_allocation函数代码示例

本文整理汇总了Python中neutron.plugins.cisco.db.n1kv_db_v2.get_vlan_allocation函数的典型用法代码示例。如果您正苦于以下问题:Python get_vlan_allocation函数的具体用法?Python get_vlan_allocation怎么用?Python get_vlan_allocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_vlan_allocation函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_specific_vlan_inside_pool

    def test_specific_vlan_inside_pool(self):
        vlan_id = VLAN_MIN + 5
        self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET, vlan_id).allocated)
        n1kv_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)
        self.assertTrue(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET, vlan_id).allocated)

        self.assertRaises(n_exc.VlanIdInUse, n1kv_db_v2.reserve_specific_vlan, self.session, PHYS_NET, vlan_id)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id)
        self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET, vlan_id).allocated)
开发者ID:gjholler,项目名称:neutron,代码行数:10,代码来源:test_n1kv_db.py

示例2: test_create_network_profile_populate_vlan_segment_pool

 def test_create_network_profile_populate_vlan_segment_pool(self):
     db_session = db.get_session()
     net_p_dict = self._prepare_net_profile_data("vlan")
     net_p_req = self.new_create_request("network_profiles", net_p_dict)
     self.deserialize(self.fmt, net_p_req.get_response(self.ext_api))
     for vlan in range(VLAN_MIN, VLAN_MAX + 1):
         self.assertIsNotNone(n1kv_db_v2.get_vlan_allocation(db_session, PHYS_NET, vlan))
         self.assertFalse(n1kv_db_v2.get_vlan_allocation(db_session, PHYS_NET, vlan).allocated)
     self.assertRaises(c_exc.VlanIDNotFound, n1kv_db_v2.get_vlan_allocation, db_session, PHYS_NET, VLAN_MIN - 1)
     self.assertRaises(c_exc.VlanIDNotFound, n1kv_db_v2.get_vlan_allocation, db_session, PHYS_NET, VLAN_MAX + 1)
开发者ID:dreamhost,项目名称:quantum,代码行数:10,代码来源:test_n1kv_plugin.py

示例3: test_sync_vlan_allocations_unallocated_vlans

 def test_sync_vlan_allocations_unallocated_vlans(self):
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN).allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN + 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MAX - 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MAX).allocated)
开发者ID:PFZheng,项目名称:neutron,代码行数:15,代码来源:test_n1kv_db.py

示例4: test_create_network_rollback_deallocate_vlan_segment

 def test_create_network_rollback_deallocate_vlan_segment(self):
     """Test vlan segment deallocation on network create failure."""
     profile_obj = self._make_test_profile(name='test_profile',
                                           segment_range='20-23')
     data = self._prepare_net_data(profile_obj.id)
     client_patch = mock.patch(n1kv_client.__name__ + ".Client",
                               new=fake_client.TestClientInvalidResponse)
     client_patch.start()
     self.new_create_request('networks', data)
     db_session = db.get_session()
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(db_session,
                                                     PHYS_NET,
                                                     20).allocated)
开发者ID:AsherBond,项目名称:quantum,代码行数:13,代码来源:test_n1kv_plugin.py

示例5: test_delete_network_profile_deallocate_vlan_segment_pool

 def test_delete_network_profile_deallocate_vlan_segment_pool(self):
     db_session = db.get_session()
     net_p_dict = self._prepare_net_profile_data('vlan')
     net_p_req = self.new_create_request('network_profiles', net_p_dict)
     net_p = self.deserialize(self.fmt,
                              net_p_req.get_response(self.ext_api))
     self.assertIsNotNone(n1kv_db_v2.get_vlan_allocation(db_session,
                                                         PHYS_NET,
                                                         VLAN_MIN))
     self._delete('network_profiles', net_p['network_profile']['id'])
     for vlan in range(VLAN_MIN, VLAN_MAX + 1):
         self.assertRaises(c_exc.VlanIDNotFound,
                           n1kv_db_v2.get_vlan_allocation,
                           db_session,
                           PHYS_NET,
                           vlan)
开发者ID:aignatov,项目名称:neutron,代码行数:16,代码来源:test_n1kv_plugin.py

示例6: test_specific_vlan_outside_pool

    def test_specific_vlan_outside_pool(self):
        vlan_id = VLAN_MAX + 5
        self.assertRaises(c_exc.VlanIDNotFound,
                          n1kv_db_v2.get_vlan_allocation,
                          self.session,
                          PHYS_NET,
                          vlan_id)
        n1kv_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)
        self.assertTrue(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET,
                                                       vlan_id).allocated)

        self.assertRaises(q_exc.VlanIdInUse,
                          n1kv_db_v2.reserve_specific_vlan,
                          self.session,
                          PHYS_NET,
                          vlan_id)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
        self.assertRaises(c_exc.VlanIDNotFound,
                          n1kv_db_v2.get_vlan_allocation,
                          self.session,
                          PHYS_NET,
                          vlan_id)
开发者ID:ChengZuo,项目名称:neutron,代码行数:23,代码来源:test_n1kv_db.py

示例7: test_sync_vlan_allocations_unallocated_vlans

 def test_sync_vlan_allocations_unallocated_vlans(self):
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN).allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN + 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MAX - 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MAX).allocated)
     n1kv_db_v2.sync_vlan_allocations(self.session, UPDATED_VLAN_RANGES)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN + 20).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MIN + 20 + 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET,
                                                     VLAN_MAX + 20 - 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET,
                                                     VLAN_MAX + 20).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET_2,
                                                     VLAN_MIN + 40).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET_2,
                                                     VLAN_MIN + 40 + 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET_2,
                                                     VLAN_MAX + 40 - 1).
                      allocated)
     self.assertFalse(n1kv_db_v2.get_vlan_allocation(self.session,
                                                     PHYS_NET_2,
                                                     VLAN_MAX + 40).
                      allocated)
开发者ID:ChengZuo,项目名称:neutron,代码行数:47,代码来源:test_n1kv_db.py


注:本文中的neutron.plugins.cisco.db.n1kv_db_v2.get_vlan_allocation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。