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


Python portbindings.VNIC_NORMAL属性代码示例

本文整理汇总了Python中neutron_lib.api.definitions.portbindings.VNIC_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Python portbindings.VNIC_NORMAL属性的具体用法?Python portbindings.VNIC_NORMAL怎么用?Python portbindings.VNIC_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在neutron_lib.api.definitions.portbindings的用法示例。


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

示例1: _fake_port_context

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def _fake_port_context(self, fake_segments, host_agents=None):
        network = mock.MagicMock(spec=api.NetworkContext)
        return mock.MagicMock(
            spec=ctx.PortContext,
            current={'id': 'PORTID',
                     portbindings.VNIC_TYPE: portbindings.VNIC_NORMAL},
            segments_to_bind=fake_segments, network=network,
            host_agents=lambda agent_type: host_agents,
            _plugin_context=mock.MagicMock()
        ) 
开发者ID:openstack,项目名称:networking-odl,代码行数:12,代码来源:test_pseudo_agentdb_binding.py

示例2: __init__

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def __init__(self):
        self.vif_details = {portbindings.CAP_PORT_FILTER: True}
        self.supported_vnic_types = [portbindings.VNIC_NORMAL] 
开发者ID:openstack,项目名称:networking-odl,代码行数:5,代码来源:legacy_port_binding.py

示例3: bind_port

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def bind_port(self, port_context):
        """Set binding for all valid segments

        """
        vnic_type = port_context.current.get(portbindings.VNIC_TYPE,
                                             portbindings.VNIC_NORMAL)
        if vnic_type not in self.supported_vnic_types:
            LOG.debug("Refusing to bind due to unsupported vnic_type: %s",
                      vnic_type)
            return

        valid_segment = None
        for segment in port_context.segments_to_bind:
            if self._check_segment(segment):
                valid_segment = segment
                break

        if valid_segment:
            vif_type = self._get_vif_type(port_context)
            LOG.debug("Bind port %(port)s on network %(network)s with valid "
                      "segment %(segment)s and VIF type %(vif_type)r.",
                      {'port': port_context.current['id'],
                       'network': port_context.network.current['id'],
                       'segment': valid_segment, 'vif_type': vif_type})

            port_context.set_binding(
                valid_segment[api.ID], vif_type,
                self.vif_details,
                status=n_const.PORT_STATUS_ACTIVE) 
开发者ID:openstack,项目名称:networking-odl,代码行数:31,代码来源:legacy_port_binding.py

示例4: create

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def create():
        return MidoNetQosDriver(
            name='midonet',
            vif_types=[
                m_const.VIF_TYPE_MIDONET,
            ],
            vnic_types=[
                portbindings.VNIC_NORMAL,
            ],
            supported_rules=SUPPORTED_RULES,
            requires_rpc_notifications=False) 
开发者ID:openstack,项目名称:networking-midonet,代码行数:13,代码来源:driver.py

示例5: __init__

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def __init__(self):
        self.vif_type = const.VIF_TYPE_MIDONET
        self.supported_vnic_types = [portbindings.VNIC_NORMAL]
        self.vif_details = {portbindings.CAP_PORT_FILTER: True,
                            portbindings.VIF_DETAILS_CONNECTIVITY:
                                portbindings.CONNECTIVITY_L2}

        self.client = c_base.load_client(cfg.CONF.MIDONET)
        self.client.initialize()

        qos_driver.register() 
开发者ID:openstack,项目名称:networking-midonet,代码行数:13,代码来源:mech_driver.py

示例6: _update_port_binding

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def _update_port_binding(self, port_res):
        port_res[portbindings.VNIC_TYPE] = portbindings.VNIC_NORMAL
        if cfg.CONF.df.vif_type == portbindings.VIF_TYPE_VHOST_USER:
            port_res[portbindings.VIF_DETAILS].update({
                portbindings.VHOST_USER_SOCKET: df_utils.get_vhu_sockpath(
                    cfg.CONF.df.vhost_sock_dir, port_res['id']
                )
            }) 
开发者ID:openstack,项目名称:dragonflow,代码行数:10,代码来源:mech_driver.py

示例7: _make_driver

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def _make_driver(name='fake-driver',
                 vif_types=[portbindings.VIF_TYPE_OVS],
                 vnic_types=[portbindings.VNIC_NORMAL],
                 supported_rules=SUPPORTED_RULES,
                 requires_rpc_notifications=False):
    return qos_base.DriverBase(
        name, vif_types, vnic_types, supported_rules,
        requires_rpc_notifications=requires_rpc_notifications) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:10,代码来源:test_base.py

示例8: test_is_vnic_compatible

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def test_is_vnic_compatible(self):
        self.assertTrue(
            _make_driver().is_vnic_compatible(portbindings.VNIC_NORMAL))
        self.assertFalse(
            _make_driver().is_vnic_compatible(portbindings.VNIC_BAREMETAL)) 
开发者ID:openstack,项目名称:neutron-lib,代码行数:7,代码来源:test_base.py

示例9: create_port_on_network

# 需要导入模块: from neutron_lib.api.definitions import portbindings [as 别名]
# 或者: from neutron_lib.api.definitions.portbindings import VNIC_NORMAL [as 别名]
def create_port_on_network(self, context, network_id=None,
                               mac_address=None, name=None, host=None,
                               device_id=None,
                               vnic_type=portbindings.VNIC_NORMAL,
                               binding_profile={}):
        """Create a port on a network."""
        ports = []
        if network_id and name:
            filters = {'name': [name]}
            ports = self.driver.plugin.db._core_plugin.get_ports(
                context,
                filters=filters
            )

        if not ports:
            network = self.driver.plugin.db._core_plugin.get_network(
                context,
                network_id
            )

            if not mac_address:
                mac_address = neutron_const.ATTR_NOT_SPECIFIED
            if not host:
                host = ''
            if not name:
                name = ''

            port_data = {
                'tenant_id': network['tenant_id'],
                'name': name,
                'network_id': network_id,
                'mac_address': mac_address,
                'admin_state_up': True,
                'device_owner': 'network:f5lbaasv2',
                'status': neutron_const.PORT_STATUS_ACTIVE,
                'fixed_ips': neutron_const.ATTR_NOT_SPECIFIED
            }
            if device_id:
                port_data['device_id'] = device_id
            port_data[portbindings.HOST_ID] = host
            port_data[portbindings.VNIC_TYPE] = vnic_type
            port_data[portbindings.PROFILE] = binding_profile

            port = self.driver.plugin.db._core_plugin.create_port(
                context, {'port': port_data})
            # Because ML2 marks ports DOWN by default on creation
            update_data = {
                'status': neutron_const.PORT_STATUS_ACTIVE
            }
            self.driver.plugin.db._core_plugin.update_port(
                context, port['id'], {'port': update_data})
            return port

        else:
            return ports[0]

    # return a single active agent to implement cluster wide changes
    # which can not efficiently mapped back to a particulare agent 
开发者ID:F5Networks,项目名称:f5-openstack-lbaasv2-driver,代码行数:60,代码来源:plugin_rpc.py


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