Python neutron_lib.api.definitions.portbindings.VNIC_NORMAL Examples
The following are 9
code examples of neutron_lib.api.definitions.portbindings.VNIC_NORMAL().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
neutron_lib.api.definitions.portbindings
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: test_pseudo_agentdb_binding.py From networking-odl with Apache License 2.0 | 5 votes |
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() )
Example #2
Source File: legacy_port_binding.py From networking-odl with Apache License 2.0 | 5 votes |
def __init__(self): self.vif_details = {portbindings.CAP_PORT_FILTER: True} self.supported_vnic_types = [portbindings.VNIC_NORMAL]
Example #3
Source File: legacy_port_binding.py From networking-odl with Apache License 2.0 | 5 votes |
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)
Example #4
Source File: driver.py From networking-midonet with Apache License 2.0 | 5 votes |
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)
Example #5
Source File: mech_driver.py From networking-midonet with Apache License 2.0 | 5 votes |
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()
Example #6
Source File: mech_driver.py From dragonflow with Apache License 2.0 | 5 votes |
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'] ) })
Example #7
Source File: test_base.py From neutron-lib with Apache License 2.0 | 5 votes |
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)
Example #8
Source File: test_base.py From neutron-lib with Apache License 2.0 | 5 votes |
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))
Example #9
Source File: plugin_rpc.py From f5-openstack-lbaasv2-driver with Apache License 2.0 | 4 votes |
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