本文整理汇总了Python中quantum.plugins.linuxbridge.db.l2network_db_v2.get_network_binding函数的典型用法代码示例。如果您正苦于以下问题:Python get_network_binding函数的具体用法?Python get_network_binding怎么用?Python get_network_binding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_network_binding函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_add_network_binding
def test_add_network_binding(self):
self.assertIsNone(lb_db.get_network_binding(self.session,
TEST_NETWORK_ID))
lb_db.add_network_binding(self.session, TEST_NETWORK_ID, PHYS_NET,
1234)
binding = lb_db.get_network_binding(self.session, TEST_NETWORK_ID)
self.assertIsNotNone(binding)
self.assertEqual(binding.network_id, TEST_NETWORK_ID)
self.assertEqual(binding.physical_network, PHYS_NET)
self.assertEqual(binding.vlan_id, 1234)
开发者ID:ewindisch,项目名称:quantum,代码行数:10,代码来源:test_lb_db.py
示例2: test_add_network_binding
def test_add_network_binding(self):
with self.network() as network:
TEST_NETWORK_ID = network['network']['id']
self.assertIsNone(lb_db.get_network_binding(self.session,
TEST_NETWORK_ID))
lb_db.add_network_binding(self.session, TEST_NETWORK_ID, 'vxlan',
PHYS_NET, 1234)
binding = lb_db.get_network_binding(self.session, TEST_NETWORK_ID)
self.assertIsNotNone(binding)
self.assertEqual(binding.network_id, TEST_NETWORK_ID)
self.assertEqual(binding.network_type, 'vxlan')
self.assertEqual(binding.physical_network, PHYS_NET)
self.assertEqual(binding.vlan_id, 1234)
开发者ID:tpaszkowski,项目名称:quantum,代码行数:13,代码来源:test_lb_db.py
示例3: 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 = self.get_port_from_device(device)
if port:
binding = db.get_network_binding(db_api.get_session(),
port['network_id'])
(network_type,
segmentation_id) = constants.interpret_vlan_id(binding.vlan_id)
entry = {'device': device,
'network_type': network_type,
'physical_network': binding.physical_network,
'segmentation_id': segmentation_id,
'network_id': port['network_id'],
'port_id': port['id'],
'admin_state_up': port['admin_state_up']}
if cfg.CONF.AGENT.rpc_support_old_agents:
entry['vlan_id'] = binding.vlan_id
new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up']
else q_const.PORT_STATUS_DOWN)
if port['status'] != new_status:
db.set_port_status(port['id'], new_status)
else:
entry = {'device': device}
LOG.debug(_("%s can not be found in database"), device)
return entry
开发者ID:citrix-openstack,项目名称:neutron,代码行数:29,代码来源:lb_quantum_plugin.py
示例4: 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 = self.get_port_from_device(device)
if port:
binding = db.get_network_binding(db_api.get_session(),
port['network_id'])
entry = {'device': device,
'physical_network': binding.physical_network,
'network_type': binding.network_type,
'vlan_id': binding.vlan_id,
'network_id': port['network_id'],
'port_id': port['id'],
'admin_state_up': port['admin_state_up']}
new_status = (q_const.PORT_STATUS_ACTIVE if port['admin_state_up']
else q_const.PORT_STATUS_DOWN)
if port['status'] != new_status:
db.set_port_status(port['id'], new_status)
else:
entry = {'device': device}
LOG.debug(_("%s can not be found in database"), device)
return entry
开发者ID:tpaszkowski,项目名称:quantum,代码行数:25,代码来源:lb_quantum_plugin.py
示例5: _notify_port_updated
def _notify_port_updated(self, context, port):
binding = db.get_network_binding(context.session,
port['network_id'])
self.notifier.port_update(context, port,
binding.network_type,
binding.physical_network,
binding.vlan_id)
开发者ID:tpaszkowski,项目名称:quantum,代码行数:7,代码来源:lb_quantum_plugin.py
示例6: delete_network
def delete_network(self, context, id):
session = context.session
with session.begin(subtransactions=True):
binding = db.get_network_binding(session, id)
super(LinuxBridgePluginV2, self).delete_network(context, id)
if binding.vlan_id != constants.LOCAL_VLAN_ID:
db.release_network(session, binding.physical_network, binding.vlan_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:lucian,项目名称:quantum,代码行数:10,代码来源:lb_quantum_plugin.py
示例7: _extend_network_dict
def _extend_network_dict(self, context, network):
if self._check_provider_view_auth(context, network):
binding = db.get_network_binding(context.session, network['id'])
network['provider:physical_network'] = binding.physical_network
if binding.vlan_id == lconst.FLAT_VLAN_ID:
network['provider:network_type'] = 'flat'
network['provider:vlan_id'] = None
else:
network['provider:network_type'] = 'vlan'
network['provider:vlan_id'] = binding.vlan_id
开发者ID:missall,项目名称:quantum,代码行数:10,代码来源:lb_quantum_plugin.py
示例8: _extend_network_dict
def _extend_network_dict(self, context, network):
if self._check_provider_view_auth(context, network):
binding = db.get_network_binding(context.session, network['id'])
network[provider.PHYSICAL_NETWORK] = binding.physical_network
if binding.vlan_id == lconst.FLAT_VLAN_ID:
network[provider.NETWORK_TYPE] = 'flat'
network[provider.SEGMENTATION_ID] = None
else:
network[provider.NETWORK_TYPE] = 'vlan'
network[provider.SEGMENTATION_ID] = binding.vlan_id
开发者ID:99cloud,项目名称:quantum,代码行数:10,代码来源:lb_quantum_plugin.py
示例9: update_port
def update_port(self, context, id, port):
original_port = super(LinuxBridgePluginV2, self).get_port(context,
id)
port = super(LinuxBridgePluginV2, self).update_port(context, id, port)
if original_port['admin_state_up'] != port['admin_state_up']:
binding = db.get_network_binding(context.session,
port['network_id'])
self.notifier.port_update(context, port,
binding.physical_network,
binding.vlan_id)
return self._extend_port_dict_binding(context, port)
开发者ID:alexpilotti,项目名称:quantum,代码行数:11,代码来源:lb_quantum_plugin.py
示例10: delete_network
def delete_network(self, context, id):
session = context.session
with session.begin(subtransactions=True):
binding = db.get_network_binding(session, id)
result = super(LinuxBridgePluginV2, self).delete_network(context,
id)
db.release_network(session, binding.physical_network,
binding.vlan_id, self.network_vlan_ranges)
# the network_binding record is deleted via cascade from
# the network record, so explicit removal is not necessary
if self.agent_rpc:
self.notifier.network_delete(self.rpc_context, id)
开发者ID:missall,项目名称:quantum,代码行数:12,代码来源:lb_quantum_plugin.py
示例11: _extend_network_dict_provider
def _extend_network_dict_provider(self, context, network):
binding = db.get_network_binding(context.session, network['id'])
if binding.vlan_id == constants.FLAT_VLAN_ID:
network[provider.NETWORK_TYPE] = constants.TYPE_FLAT
network[provider.PHYSICAL_NETWORK] = binding.physical_network
network[provider.SEGMENTATION_ID] = None
elif binding.vlan_id == constants.LOCAL_VLAN_ID:
network[provider.NETWORK_TYPE] = constants.TYPE_LOCAL
network[provider.PHYSICAL_NETWORK] = None
network[provider.SEGMENTATION_ID] = None
else:
network[provider.NETWORK_TYPE] = constants.TYPE_VLAN
network[provider.PHYSICAL_NETWORK] = binding.physical_network
network[provider.SEGMENTATION_ID] = binding.vlan_id
开发者ID:citrix-openstack,项目名称:neutron,代码行数:14,代码来源:lb_quantum_plugin.py
示例12: _extend_network_dict_provider
def _extend_network_dict_provider(self, context, network):
if self._check_view_auth(context, network, self.network_view):
binding = db.get_network_binding(context.session, network['id'])
if binding.vlan_id == constants.FLAT_VLAN_ID:
network[provider.NETWORK_TYPE] = binding.network_type
network[provider.PHYSICAL_NETWORK] = binding.physical_network
network[provider.SEGMENTATION_ID] = None
elif binding.vlan_id == constants.LOCAL_VLAN_ID:
network[provider.NETWORK_TYPE] = binding.network_type
network[provider.PHYSICAL_NETWORK] = None
network[provider.SEGMENTATION_ID] = None
else:
network[provider.NETWORK_TYPE] = binding.network_type
network[provider.PHYSICAL_NETWORK] = binding.physical_network
network[provider.SEGMENTATION_ID] = binding.vlan_id
开发者ID:tpaszkowski,项目名称:quantum,代码行数:15,代码来源:lb_quantum_plugin.py
示例13: 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 = db.get_port_from_device(device[self.TAP_PREFIX_LEN:])
if port:
binding = db.get_network_binding(db_api.get_session(),
port['network_id'])
entry = {'device': device,
'physical_network': binding.physical_network,
'vlan_id': binding.vlan_id,
'network_id': port['network_id'],
'port_id': port['id'],
'admin_state_up': port['admin_state_up']}
# Set the port status to UP
db.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:apech,项目名称:quantum,代码行数:21,代码来源:lb_quantum_plugin.py
示例14: 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 = self.get_port_from_device(device)
if port:
binding = db.get_network_binding(db_api.get_session(), port["network_id"])
entry = {
"device": device,
"physical_network": binding.physical_network,
"vlan_id": binding.vlan_id,
"network_id": port["network_id"],
"port_id": port["id"],
"admin_state_up": port["admin_state_up"],
}
# Set the port status to UP
db.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:wph540,项目名称:quantum,代码行数:22,代码来源:lb_quantum_plugin.py
注:本文中的quantum.plugins.linuxbridge.db.l2network_db_v2.get_network_binding函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论