• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ovs_db_v2.get_network_binding函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_add_network_binding

 def test_add_network_binding(self):
     with self.network() as network:
         TEST_NETWORK_ID = network['network']['id']
         self.assertIsNone(ovs_db_v2.get_network_binding(self.session,
                                                         TEST_NETWORK_ID))
         ovs_db_v2.add_network_binding(self.session, TEST_NETWORK_ID,
                                       'vlan', PHYS_NET, 1234)
         binding = ovs_db_v2.get_network_binding(self.session,
                                                 TEST_NETWORK_ID)
         self.assertIsNotNone(binding)
         self.assertEqual(binding.network_id, TEST_NETWORK_ID)
         self.assertEqual(binding.network_type, 'vlan')
         self.assertEqual(binding.physical_network, PHYS_NET)
         self.assertEqual(binding.segmentation_id, 1234)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:14,代码来源:test_ovs_db.py


示例2: update_port

    def update_port(self, context, id, port):
        session = context.session
        need_port_update_notify = False
        with session.begin(subtransactions=True):
            original_port = super(OVSNeutronPluginV2, self).get_port(
                context, id)
            updated_port = super(OVSNeutronPluginV2, self).update_port(
                context, id, port)
            if addr_pair.ADDRESS_PAIRS in port['port']:
                need_port_update_notify |= (
                    self.update_address_pairs_on_port(context, id, port,
                                                      original_port,
                                                      updated_port))
            need_port_update_notify |= self.update_security_group_on_port(
                context, id, port, original_port, updated_port)
            self._process_portbindings_create_and_update(context,
                                                         port['port'],
                                                         updated_port)
            need_port_update_notify |= self._update_extra_dhcp_opts_on_port(
                context, id, port, updated_port)

        need_port_update_notify |= self.is_security_group_member_updated(
            context, original_port, updated_port)
        if original_port['admin_state_up'] != updated_port['admin_state_up']:
            need_port_update_notify = True

        if need_port_update_notify:
            binding = ovs_db_v2.get_network_binding(None,
                                                    updated_port['network_id'])
            self.notifier.port_update(context, updated_port,
                                      binding.network_type,
                                      binding.segmentation_id,
                                      binding.physical_network)
        return updated_port
开发者ID:ArifovicH,项目名称:neutron,代码行数:34,代码来源:ovs_neutron_plugin.py


示例3: test_add_network_binding

 def test_add_network_binding(self):
     params = {'provider:network_type': 'vlan',
               'provider:physical_network': PHYS_NET,
               'provider:segmentation_id': 1234}
     params['arg_list'] = tuple(params.keys())
     with self.network(**params) as network:
         TEST_NETWORK_ID = network['network']['id']
         binding = ovs_db_v2.get_network_binding(self.session,
                                                 TEST_NETWORK_ID)
         self.assertIsNotNone(binding)
         self.assertEqual(binding.network_id, TEST_NETWORK_ID)
         self.assertEqual(binding.network_type, 'vlan')
         self.assertEqual(binding.physical_network, PHYS_NET)
         self.assertEqual(binding.segmentation_id, 1234)
开发者ID:PFZheng,项目名称:neutron,代码行数:14,代码来源:test_ovs_db.py


示例4: _extend_network_dict_provider

 def _extend_network_dict_provider(self, context, network):
     binding = ovs_db_v2.get_network_binding(context.session,
                                             network['id'])
     network[provider.NETWORK_TYPE] = binding.network_type
     if binding.network_type in constants.TUNNEL_NETWORK_TYPES:
         network[provider.PHYSICAL_NETWORK] = None
         network[provider.SEGMENTATION_ID] = binding.segmentation_id
     elif binding.network_type == constants.TYPE_FLAT:
         network[provider.PHYSICAL_NETWORK] = binding.physical_network
         network[provider.SEGMENTATION_ID] = None
     elif binding.network_type == constants.TYPE_VLAN:
         network[provider.PHYSICAL_NETWORK] = binding.physical_network
         network[provider.SEGMENTATION_ID] = binding.segmentation_id
     elif binding.network_type == constants.TYPE_LOCAL:
         network[provider.PHYSICAL_NETWORK] = None
         network[provider.SEGMENTATION_ID] = None
开发者ID:JoeMido,项目名称:neutron,代码行数:16,代码来源:ovs_neutron_plugin.py


示例5: update_port

    def update_port(self, context, id, port):
        session = context.session
        need_port_update_notify = False
        changed_fixed_ips = 'fixed_ips' in port['port']
        with session.begin(subtransactions=True):
            original_port = super(OVSNeutronPluginV2, self).get_port(
                context, id)
            updated_port = super(OVSNeutronPluginV2, self).update_port(
                context, id, port)
            if addr_pair.ADDRESS_PAIRS in port['port']:
                need_port_update_notify |= (
                    self.update_address_pairs_on_port(context, id, port,
                                                      original_port,
                                                      updated_port))
            elif changed_fixed_ips:
                self._check_fixed_ips_and_address_pairs_no_overlap(
                    context, updated_port)
            need_port_update_notify |= self.update_security_group_on_port(
                context, id, port, original_port, updated_port)
            self._process_portbindings_create_and_update(context,
                                                         port['port'],
                                                         updated_port)
            need_port_update_notify |= self._update_extra_dhcp_opts_on_port(
                context, id, port, updated_port)

        secgrp_member_updated = self.is_security_group_member_updated(
            context, original_port, updated_port)
        need_port_update_notify |= secgrp_member_updated
        if original_port['admin_state_up'] != updated_port['admin_state_up']:
            need_port_update_notify = True

        if need_port_update_notify:
            binding = ovs_db_v2.get_network_binding(None,
                                                    updated_port['network_id'])
            self.notifier.port_update(context, updated_port,
                                      binding.network_type,
                                      binding.segmentation_id,
                                      binding.physical_network)

        if secgrp_member_updated:
            old_set = set(original_port.get(ext_sg.SECURITYGROUPS))
            new_set = set(updated_port.get(ext_sg.SECURITYGROUPS))
            self.notifier.security_groups_member_updated(
                context,
                old_set ^ new_set)

        return updated_port
开发者ID:VeenaSL,项目名称:sriov,代码行数:47,代码来源:ovs_neutron_plugin.py


示例6: update_port

    def update_port(self, context, id, port):
        forward_ports = self._process_nat_update(context, port['port'], id)

        session = context.session
        need_port_update_notify = False
        changed_fixed_ips = 'fixed_ips' in port['port']
        with session.begin(subtransactions=True):
            original_port = super(OVSNeutronPluginV2, self).get_port(
                context, id)
            updated_port = super(OVSNeutronPluginV2, self).update_port(
                context, id, port)
            if addr_pair.ADDRESS_PAIRS in port['port']:
                self._delete_allowed_address_pairs(context, id)
                self._process_create_allowed_address_pairs(
                    context, updated_port,
                    port['port'][addr_pair.ADDRESS_PAIRS])
                need_port_update_notify = True
            elif changed_fixed_ips:
                self._check_fixed_ips_and_address_pairs_no_overlap(
                    context, updated_port)

            if forward_ports:
                ovs_db_v2.clear_port_forwarding(session, updated_port['id'])
                ovs_db_v2.add_port_forwarding(session, updated_port['id'], forward_ports)
            self._extend_port_dict_nat(context, updated_port)

            need_port_update_notify |= self.update_security_group_on_port(
                context, id, port, original_port, updated_port)
            self._process_portbindings_create_and_update(context,
                                                         port['port'],
                                                         updated_port)
            need_port_update_notify |= self._update_extra_dhcp_opts_on_port(
                context, id, port, updated_port)

        need_port_update_notify |= self.is_security_group_member_updated(
            context, original_port, updated_port)
        if original_port['admin_state_up'] != updated_port['admin_state_up']:
            need_port_update_notify = True

        if need_port_update_notify:
            binding = ovs_db_v2.get_network_binding(None,
                                                    updated_port['network_id'])
            self.notifier.port_update(context, updated_port,
                                      binding.network_type,
                                      binding.segmentation_id,
                                      binding.physical_network)
        return updated_port
开发者ID:TDJIOLee,项目名称:xos,代码行数:47,代码来源:ovs_neutron_plugin.py


示例7: retrieve_utif_info

 def retrieve_utif_info(self, context, neutron_port):
     plugin = manager.NeutronManager.get_plugin()
     session = context.session
     network_id = neutron_port["network_id"]
     network_binding = ovs_db_v2.get_network_binding(session, network_id)
     if not network_binding["segmentation_id"]:
         raise exc.UtifInfoError(
             err_msg=_("No segmentation_id found for the network, "
                       "please be sure that tenant_network_type is vlan"))
     network = plugin._get_network(context, network_id)
     is_gw = neutron_port["device_owner"] == "network:router_gateway"
     result = h_info.UtifInfo(vlan=network_binding["segmentation_id"],
                              network_name=network["name"],
                              network_id=network["id"],
                              is_gw=is_gw,
                              owner_tenant=network["tenant_id"],
                              port_id=neutron_port["id"],
                              mac_address=neutron_port["mac_address"])
     return result
开发者ID:CampHarmony,项目名称:neutron,代码行数:19,代码来源:openvswitch_support.py


示例8: get_device_details

 def get_device_details(self, rpc_context, **kwargs):
     """Agent requests device details."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s details requested from %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = ovs_db_v2.get_port(device)
     if port:
         binding = ovs_db_v2.get_network_binding(None, port['network_id'])
         entry = {'device': device,
                  'network_id': port['network_id'],
                  'port_id': port['id'],
                  'admin_state_up': port['admin_state_up'],
                  'network_type': binding.network_type,
                  'segmentation_id': binding.segmentation_id,
                  'physical_network': binding.physical_network}
         new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up']
                       else q_const.PORT_STATUS_DOWN)
         if port['status'] != new_status:
             ovs_db_v2.set_port_status(port['id'], new_status)
     else:
         entry = {'device': device}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:kavonm,项目名称:neutron,代码行数:24,代码来源:ovs_neutron_plugin.py


示例9: _get_segmentation_id

 def _get_segmentation_id(self, network_id):
     binding_seg_id = odb.get_network_binding(None, network_id)
     if not binding_seg_id:
         raise cexc.NetworkSegmentIDNotFound(net_id=network_id)
     return binding_seg_id.segmentation_id
开发者ID:AsherBond,项目名称:quantum,代码行数:5,代码来源:virt_phy_sw_v2.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ovs_db_v2.get_port函数代码示例发布时间:2022-05-27
下一篇:
Python ovs_db_v2.add_tunnel_endpoint函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap