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


Python ovs_db_v2.get_port函数代码示例

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


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

示例1: update_device_down

 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     host = kwargs.get('host')
     port = ovs_db_v2.get_port(device)
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     if port:
         entry = {'device': device,
                  'exists': True}
         plugin = manager.NeutronManager.get_plugin()
         if (host and
             not plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(_("Device %(device)s not bound to the"
                         " agent host %(host)s"),
                       {'device': device, 'host': host})
         elif port['status'] != q_const.PORT_STATUS_DOWN:
             # Set port status to DOWN
             ovs_db_v2.set_port_status(port['id'],
                                       q_const.PORT_STATUS_DOWN)
     else:
         entry = {'device': device,
                  'exists': False}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:kavonm,项目名称:neutron,代码行数:26,代码来源:ovs_neutron_plugin.py

示例2: update_device_up

 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s up on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = ovs_db_v2.get_port(device)
     if port:
         if port['status'] != q_const.PORT_STATUS_ACTIVE:
             ovs_db_v2.set_port_status(port['id'],
                                       q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
开发者ID:ader1990,项目名称:neutron,代码行数:13,代码来源:ovs_neutron_plugin.py

示例3: update_device_down

 def update_device_down(self, rpc_context, **kwargs):
     """Device no longer exists on agent."""
     # TODO(garyk) - live migration and port status
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     LOG.debug(_("Device %(device)s no longer exists on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     port = ovs_db_v2.get_port(device)
     if port:
         entry = {'device': device,
                  'exists': True}
         if port['status'] != q_const.PORT_STATUS_DOWN:
             # Set port status to DOWN
             ovs_db_v2.set_port_status(port['id'], q_const.PORT_STATUS_DOWN)
     else:
         entry = {'device': device,
                  'exists': False}
         LOG.debug(_("%s can not be found in database"), device)
     return entry
开发者ID:ader1990,项目名称:neutron,代码行数:19,代码来源:ovs_neutron_plugin.py

示例4: update_device_up

 def update_device_up(self, rpc_context, **kwargs):
     """Device is up on agent."""
     agent_id = kwargs.get('agent_id')
     device = kwargs.get('device')
     host = kwargs.get('host')
     port = ovs_db_v2.get_port(device)
     LOG.debug(_("Device %(device)s up on %(agent_id)s"),
               {'device': device, 'agent_id': agent_id})
     plugin = manager.NeutronManager.get_plugin()
     if port:
         if (host and
             not plugin.get_port_host(rpc_context, port['id']) == host):
             LOG.debug(_("Device %(device)s not bound to the"
                         " agent host %(host)s"),
                       {'device': device, 'host': host})
             return
         elif port['status'] != q_const.PORT_STATUS_ACTIVE:
             ovs_db_v2.set_port_status(port['id'],
                                       q_const.PORT_STATUS_ACTIVE)
     else:
         LOG.debug(_("%s can not be found in database"), device)
开发者ID:kavonm,项目名称:neutron,代码行数:21,代码来源:ovs_neutron_plugin.py

示例5: 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


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