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


Python ovs_db_v2.release_vlan函数代码示例

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


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

示例1: test_sync_with_allocated_false

    def test_sync_with_allocated_false(self):
        vlan_ids = set()
        for x in moves.xrange(VLAN_MIN, VLAN_MAX + 1):
            physical_network, vlan_id = ovs_db_v2.reserve_vlan(self.session)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop(),
                               VLAN_RANGES)
        ovs_db_v2.sync_vlan_allocations({})
开发者ID:PFZheng,项目名称:neutron,代码行数:12,代码来源:test_ovs_db.py

示例2: test_specific_vlan_outside_pool

    def test_specific_vlan_outside_pool(self):
        vlan_id = VLAN_MAX + 5
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET, vlan_id))
        ovs_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)
        self.assertTrue(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                      vlan_id).allocated)

        with testtools.ExpectedException(n_exc.VlanIdInUse):
            ovs_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)

        ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET, vlan_id))
开发者ID:PFZheng,项目名称:neutron,代码行数:12,代码来源:test_ovs_db.py

示例3: test_vlan_pool

    def test_vlan_pool(self):
        vlan_ids = set()
        for x in moves.xrange(VLAN_MIN, VLAN_MAX + 1):
            physical_network, vlan_id = ovs_db_v2.reserve_vlan(self.session)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        with testtools.ExpectedException(n_exc.NoNetworkAvailable):
            physical_network, vlan_id = ovs_db_v2.reserve_vlan(self.session)

        ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop(),
                               VLAN_RANGES)
        physical_network, vlan_id = ovs_db_v2.reserve_vlan(self.session)
        self.assertEqual(physical_network, PHYS_NET)
        self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
        self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
        vlan_ids.add(vlan_id)

        for vlan_id in vlan_ids:
            ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_id,
                                   VLAN_RANGES)
开发者ID:PFZheng,项目名称:neutron,代码行数:23,代码来源:test_ovs_db.py


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