本文整理汇总了Python中quantum.plugins.openvswitch.ovs_db_v2.get_network_binding函数的典型用法代码示例。如果您正苦于以下问题:Python get_network_binding函数的具体用法?Python get_network_binding怎么用?Python get_network_binding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_network_binding函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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(OVSQuantumPluginV2, self).get_port(
context, id)
updated_port = super(OVSQuantumPluginV2, self).update_port(
context, id, port)
need_port_update_notify = self.update_security_group_on_port(
context, id, port, original_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 self._extend_port_dict_binding(context, updated_port)
开发者ID:SangBaisong,项目名称:quantum,代码行数:27,代码来源:ovs_quantum_plugin.py
示例2: update_port
def update_port(self, context, id, port):
original_port = super(OVSQuantumPluginV2, self).get_port(context, id)
port = super(OVSQuantumPluginV2, self).update_port(context, id, port)
if original_port["admin_state_up"] != port["admin_state_up"]:
binding = ovs_db_v2.get_network_binding(None, port["network_id"])
self.notifier.port_update(
context, port, binding.network_type, binding.segmentation_id, binding.physical_network
)
return self._extend_port_dict_binding(context, port)
开发者ID:buzdwj,项目名称:quantum,代码行数:9,代码来源:ovs_quantum_plugin.py
示例3: update_port
def update_port(self, context, id, port):
original_port = super(OVSQuantumPluginV2, self).get_port(context,
id)
port = super(OVSQuantumPluginV2, self).update_port(context, id, port)
if original_port['admin_state_up'] != port['admin_state_up']:
binding = ovs_db_v2.get_network_binding(None,
port['network_id'])
self.notifier.port_update(self.rpc_context, port,
binding.network_type,
binding.segmentation_id,
binding.physical_network)
return port
开发者ID:a3linux,项目名称:quantum,代码行数:12,代码来源:ovs_quantum_plugin.py
示例4: _extend_network_dict_provider
def _extend_network_dict_provider(self, context, network):
if self._check_provider_view_auth(context, network):
binding = ovs_db_v2.get_network_binding(context.session,
network['id'])
network[provider.NETWORK_TYPE] = binding.network_type
if binding.network_type == constants.TYPE_GRE:
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
开发者ID:riverbedstingray,项目名称:quantum,代码行数:14,代码来源:ovs_quantum_plugin.py
示例5: delete_network
def delete_network(self, context, id):
session = context.session
with session.begin(subtransactions=True):
binding = ovs_db_v2.get_network_binding(session, id)
super(OVSQuantumPluginV2, self).delete_network(context, id)
if binding.network_type == constants.TYPE_GRE:
ovs_db_v2.release_tunnel(session, binding.segmentation_id, self.tunnel_id_ranges)
elif binding.network_type in [constants.TYPE_VLAN, constants.TYPE_FLAT]:
ovs_db_v2.release_vlan(
session, binding.physical_network, binding.segmentation_id, self.network_vlan_ranges
)
# the network_binding record is deleted via cascade from
# the network record, so explicit removal is not necessary
self.notifier.network_delete(context, id)
开发者ID:buzdwj,项目名称:quantum,代码行数:14,代码来源:ovs_quantum_plugin.py
示例6: update_port
def update_port(self, context, id, port):
if self.agent_rpc:
original_port = super(OVSQuantumPluginV2, self).get_port(context,
id)
port = super(OVSQuantumPluginV2, self).update_port(context, id, port)
if self.agent_rpc:
if original_port['admin_state_up'] != port['admin_state_up']:
binding = ovs_db_v2.get_network_binding(None,
port['network_id'])
# REVISIT(rkukura): Either all binding data or no
# binding data needed.
self.notifier.port_update(self.rpc_context, port,
binding.segmentation_id)
return port
开发者ID:99cloud,项目名称:quantum,代码行数:14,代码来源:ovs_quantum_plugin.py
示例7: 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 %s details requested from %s", device, 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}
# Set the port status to UP
ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_ACTIVE)
else:
entry = {'device': device}
LOG.debug("%s can not be found in database", device)
return entry
开发者ID:riverbedstingray,项目名称:quantum,代码行数:21,代码来源:ovs_quantum_plugin.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"),
locals())
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:SangBaisong,项目名称:quantum,代码行数:24,代码来源:ovs_quantum_plugin.py
示例9: 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"), locals())
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:buzdwj,项目名称:quantum,代码行数:24,代码来源:ovs_quantum_plugin.py
示例10: _get_segmentation_id
def _get_segmentation_id(self, network_id):
binding_seg_id = odb.get_network_binding(None, network_id)
return binding_seg_id.segmentation_id
开发者ID:ayushjain1310,项目名称:quantum,代码行数:3,代码来源:virt_phy_sw_v2.py
示例11: _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:DestinyOneSystems,项目名称:quantum,代码行数:5,代码来源:virt_phy_sw_v2.py
注:本文中的quantum.plugins.openvswitch.ovs_db_v2.get_network_binding函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论