• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.port_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update_port

 def update_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     LOG.debug("update_port() called\n")
     port = db.port_get(port_id, net_id)
     db.port_update(port_id, net_id, **kwargs)
     return self._make_port_dict(port)
开发者ID:OpenStack-Kha,项目名称:quantum,代码行数:8,代码来源:ovs_quantum_plugin.py


示例2: update_port

 def update_port(self, tenant_id, net_id, port_id, **kwargs):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     db.port_update(port_id, net_id, **kwargs)
     return self._make_port_dict(port)
开发者ID:jkoelker,项目名称:quantum,代码行数:8,代码来源:ovs_quantum_plugin.py


示例3: update_port

 def update_port(self, tenant_id, net_id, port_id, port_state):
     """
     Updates the state of a port on the specified Virtual Network.
     """
     LOG.debug("update_port() called\n")
     port = db.port_get(port_id, net_id)
     db.port_set_state(port_id, net_id, port_state)
     return self._make_port_dict(str(port.uuid), port.state,
                                     port.network_id, port.interface_id)
开发者ID:Oneiroi,项目名称:quantum,代码行数:9,代码来源:ovs_quantum_plugin.py


示例4: _get_port

 def _get_port(self, tenant_id, network_id, port_id):
     net = self._get_network(tenant_id, network_id)
     try:
         port = db.port_get(port_id, network_id)
     except:
         raise exc.PortNotFound(net_id=network_id, port_id=port_id)
     # Port must exist and belong to the appropriate network.
     if port['network_id'] != net['uuid']:
         raise exc.PortNotFound(net_id=network_id, port_id=port_id)
     return port
开发者ID:asomya,项目名称:quantum,代码行数:10,代码来源:SamplePlugin.py


示例5: _get_port

 def _get_port(self, tenant_id, network_id, port_id):
     network = self._get_network(tenant_id, network_id)
     port = db.port_get(port_id, network_id)
     # Port must exist and belong to the appropriate network.
     if port.network_id != network_id:
         LOG.warning("_get_port(): mismatch network_id = %s, "
                     "port_id = %s, port.network_id = %s" %
                     (network_id, port_id, port.network_id))
         raise exc.PortNotFound(net_id=network_id, port_id=port_id)
     return port
开发者ID:yasuhito,项目名称:quantum-nec-of-plugin,代码行数:10,代码来源:nec_plugin.py


示例6: _verify_unplug_iface

 def _verify_unplug_iface(self, network_id, port_id):
         # Verification - get raw result from db
         port = db.port_get(port_id, network_id)
         # Fill CLI template
         output = cli.prepare_output("unplug_iface", self.tenant_id,
                                     dict(network_id=network_id,
                                          port_id=port['uuid']))
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:10,代码来源:test_cli.py


示例7: get_port_details

 def get_port_details(self, tenant_id, net_id, port_id):
     """
     This method allows the user to retrieve a remote interface
     that is attached to this particular port.
     """
     LOG.debug("LinuxBridgePlugin.get_port_details() called")
     network = db.network_get(net_id)
     port = db.port_get(port_id, net_id)
     new_port_dict = cutil.make_port_dict(port)
     return new_port_dict
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:10,代码来源:LinuxBridgePlugin.py


示例8: _verify_update_port

 def _verify_update_port(self, network_id, port_id):
         # Verification - get raw result from db
         port = db.port_get(port_id, network_id)
         port_data = {'id': port.uuid, 'state': port.state}
         # Fill CLI template
         output = cli.prepare_output('update_port', self.tenant_id,
                                     dict(network_id=network_id,
                                          port=port_data))
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:11,代码来源:test_cli.py


示例9: unplug_interface

 def unplug_interface(self, tenant_id, net_id, port_id):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.unplug_interface() called")
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id is None:
         return
     db.port_unset_attachment(port_id, net_id)
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
开发者ID:LuizOz,项目名称:quantum,代码行数:13,代码来源:LinuxBridgePlugin.py


示例10: plug_interface

 def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
     """
     Attaches a remote interface to the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.plug_interface() called")
     network = db.network_get(net_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
     db.port_set_attachment(port_id, net_id, remote_interface_id)
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:13,代码来源:LinuxBridgePlugin.py


示例11: unplug_interface

 def unplug_interface(self, tenant_id, net_id, port_id):
     """
     Detaches a remote interface from the specified port on the
     specified Virtual Network.
     """
     LOG.debug("LinuxBridgePlugin.unplug_interface() called")
     network = db.network_get(net_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id == None:
         raise exc.InvalidDetach(port_id=port_id, net_id=net_id,
                                 att_id=remote_interface_id)
     db.port_unset_attachment(port_id, net_id)
     db.port_update(port_id, net_id, op_status=OperationalStatus.DOWN)
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:14,代码来源:LinuxBridgePlugin.py


示例12: get_port

 def get_port(self, net_id, port_id):
     """Get a port"""
     port_list = []
     port = db.port_get(net_id, port_id)
     try:
         LOG.debug("Getting port: %s" % port.uuid)
         port_dict = {}
         port_dict["port-id"] = str(port.uuid)
         port_dict["net-id"] = str(port.network_id)
         port_dict["int-id"] = port.interface_id
         port_dict["state"] = port.state
         port_list.append(port_dict)
         return port_list
     except Exception, exc:
         LOG.error("Failed to get port: %s" % str(exc))
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:15,代码来源:test_database.py


示例13: _verify_show_iface

    def _verify_show_iface(self, network_id, port_id):
            # Verification - get raw result from db
            port = db.port_get(port_id, network_id)
            iface = {'id': port.interface_id or '<none>'}

            # Fill CLI template
            output = cli.prepare_output('show_iface',
                                        self.tenant_id,
                                        dict(network_id=network_id,
                                             port_id=port.uuid,
                                             iface=iface),
                                        self.version)
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:bhuvan,项目名称:python-quantumclient,代码行数:15,代码来源:test_cli.py


示例14: _verify_show_port

    def _verify_show_port(self, network_id, port_id):
            # Verification - get raw result from db
            port = db.port_get(port_id, network_id)
            port_data = {'id': port.uuid,
                         'state': port.state,
                         'attachment': {'id': port.interface_id or '<none>'},
                         'op-status': port.op_status}

            # Fill CLI template
            output = cli.prepare_output('show_port',
                                        self.tenant_id,
                                        dict(network_id=network_id,
                                             port=port_data),
                                        self.version)
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:bhuvan,项目名称:python-quantumclient,代码行数:17,代码来源:test_cli.py


示例15: _verify_show_port

    def _verify_show_port(self, network_id, port_id):
            # Verification - get raw result from db
            # TODO(salvatore-orlando): Must resolve this issue with
            # attachment in separate bug fix.
            port = db.port_get(port_id, network_id)
            port_data = {'id': port.uuid, 'state': port.state,
                         'attachment': "<none>"}
            if port.interface_id is not None:
                port_data['attachment'] = port.interface_id

            # Fill CLI template
            output = cli.prepare_output('show_port', self.tenant_id,
                                        dict(network_id=network_id,
                                             port=port_data))
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')
开发者ID:OpenStack-Kha,项目名称:python-quantumclient,代码行数:17,代码来源:test_cli.py


示例16: delete_port

 def delete_port(self, tenant_id, net_id, port_id):
     """
     Deletes a port on a specified Virtual Network,
     if the port contains a remote interface attachment,
     the remote interface is first un-plugged and then the port
     is deleted.
     """
     LOG.debug("LinuxBridgePlugin.delete_port() called")
     network = db.network_get(net_id)
     port = db.port_get(port_id, net_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         db.port_destroy(port_id, net_id)
         new_port_dict = cutil.make_port_dict(port)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
开发者ID:CiscoSystems,项目名称:QL3Proto,代码行数:18,代码来源:LinuxBridgePlugin.py


示例17: get_interface_details

 def get_interface_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     res = db.port_get(port_id, net_id)
     return res.interface_id
开发者ID:jkoelker,项目名称:quantum,代码行数:4,代码来源:ovs_quantum_plugin.py


示例18: get_port_details

 def get_port_details(self, tenant_id, net_id, port_id):
     db.validate_port_ownership(tenant_id, net_id, port_id)
     port = db.port_get(port_id, net_id)
     return self._make_port_dict(port)
开发者ID:jkoelker,项目名称:quantum,代码行数:4,代码来源:ovs_quantum_plugin.py


示例19: get_port_details

 def get_port_details(self, tenant_id, net_id, port_id):
     port = db.port_get(port_id, net_id)
     return self._make_port_dict(str(port.uuid), port.state,
                             port.network_id, port.interface_id)
开发者ID:Oneiroi,项目名称:quantum,代码行数:4,代码来源:ovs_quantum_plugin.py


示例20: get_interface_details

 def get_interface_details(self, tenant_id, net_id, port_id):
     res = db.port_get(port_id, net_id)
     return res.interface_id
开发者ID:OpenStack-Kha,项目名称:quantum,代码行数:3,代码来源:ovs_quantum_plugin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.port_list函数代码示例发布时间:2022-05-26
下一篇:
Python api.port_create函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap