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


Python ovs_db_v2.sync_vlan_allocations函数代码示例

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


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

示例1: __init__

 def __init__(self, configfile=None):
     self.extra_binding_dict = {
         portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS,
         portbindings.CAPABILITIES: {
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases}}
     ovs_db_v2.initialize()
     self._parse_network_vlan_ranges()
     ovs_db_v2.sync_vlan_allocations(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.OVS.tenant_network_type
     if self.tenant_network_type not in [constants.TYPE_LOCAL,
                                         constants.TYPE_VLAN,
                                         constants.TYPE_GRE,
                                         constants.TYPE_VXLAN,
                                         constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                   "Server terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
     self.tunnel_id_ranges = []
     if self.enable_tunneling:
         self._parse_tunnel_id_ranges()
         ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
     elif self.tenant_network_type in constants.TUNNEL_NETWORK_TYPES:
         LOG.error(_("Tunneling disabled but tenant_network_type is '%s'. "
                   "Server terminated!"), self.tenant_network_type)
         sys.exit(1)
     self.setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver
     )
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver
     )
开发者ID:brandon-adams,项目名称:neutron,代码行数:35,代码来源:ovs_neutron_plugin.py

示例2: 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

示例3: __init__

 def __init__(self, configfile=None):
     super(OVSNeutronPluginV2, self).__init__()
     self.base_binding_dict = {
         portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS,
         portbindings.VIF_DETAILS: {
             # TODO(rkukura): Replace with new VIF security details
             portbindings.CAP_PORT_FILTER:
             'security-group' in self.supported_extension_aliases,
             portbindings.OVS_HYBRID_PLUG: True}}
     self._parse_network_vlan_ranges()
     ovs_db_v2.sync_vlan_allocations(self.network_vlan_ranges)
     self.tenant_network_type = cfg.CONF.OVS.tenant_network_type
     if self.tenant_network_type not in [svc_constants.TYPE_LOCAL,
                                         svc_constants.TYPE_VLAN,
                                         svc_constants.TYPE_GRE,
                                         svc_constants.TYPE_VXLAN,
                                         svc_constants.TYPE_NONE]:
         LOG.error(_("Invalid tenant_network_type: %s. "
                   "Server terminated!"),
                   self.tenant_network_type)
         sys.exit(1)
     self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
     self.tunnel_type = None
     if self.enable_tunneling:
         self.tunnel_type = (cfg.CONF.OVS.tunnel_type or
                             svc_constants.TYPE_GRE)
     elif cfg.CONF.OVS.tunnel_type:
         self.tunnel_type = cfg.CONF.OVS.tunnel_type
         self.enable_tunneling = True
     self.tunnel_id_ranges = []
     if self.enable_tunneling:
         self._parse_tunnel_id_ranges()
         ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
     elif self.tenant_network_type in constants.TUNNEL_NETWORK_TYPES:
         LOG.error(_("Tunneling disabled but tenant_network_type is '%s'. "
                   "Server terminated!"), self.tenant_network_type)
         sys.exit(1)
     self.setup_rpc()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver
     )
     self.router_scheduler = importutils.import_object(
         cfg.CONF.router_scheduler_driver
     )
开发者ID:Simplit-openapps,项目名称:neutron,代码行数:44,代码来源:ovs_neutron_plugin.py

示例4: test_sync_vlan_allocations

    def test_sync_vlan_allocations(self):
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MIN - 1))
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN + 1).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX - 1).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX).allocated)
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MAX + 1))

        ovs_db_v2.sync_vlan_allocations(UPDATED_VLAN_RANGES)

        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MIN + 5 - 1))
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN + 5).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN + 5 + 1).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX + 5 - 1).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX + 5).
                         allocated)
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MAX + 5 + 1))

        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                        VLAN_MIN + 20 - 1))
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                       VLAN_MIN + 20).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                       VLAN_MIN + 20 + 1).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                       VLAN_MAX + 20 - 1).
                         allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                       VLAN_MAX + 20).
                         allocated)
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                        VLAN_MAX + 20 + 1))

        ovs_db_v2.sync_vlan_allocations(VLAN_RANGES)

        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MIN - 1))
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MIN + 1).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX - 1).allocated)
        self.assertFalse(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                       VLAN_MAX).allocated)
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET,
                                                        VLAN_MAX + 1))

        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                        VLAN_MIN + 20))
        self.assertIsNone(ovs_db_v2.get_vlan_allocation(PHYS_NET_2,
                                                        VLAN_MAX + 20))
开发者ID:PFZheng,项目名称:neutron,代码行数:69,代码来源:test_ovs_db.py

示例5: setUp

 def setUp(self):
     super(VlanAllocationsTest, self).setUp()
     db.configure_db()
     ovs_db_v2.sync_vlan_allocations(VLAN_RANGES)
     self.session = db.get_session()
     self.addCleanup(db.clear_db)
开发者ID:PFZheng,项目名称:neutron,代码行数:6,代码来源:test_ovs_db.py

示例6: setUp

 def setUp(self):
     super(VlanAllocationsTest, self).setUp()
     ovs_db_v2.sync_vlan_allocations(VLAN_RANGES)
     self.session = db.get_session()
开发者ID:savoirfairelinux,项目名称:neutron,代码行数:4,代码来源:test_ovs_db.py


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