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

Python api.network_get函数代码示例

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

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



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

示例1: delete_network

    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        LOG.debug("delete_network() called\n")
        net = db.network_get(net_id)
        if net:
            if len(net[const.NETWORKPORTS]) > 0:
                ports_on_net = db.port_list(net_id)
                for port in ports_on_net:
                    if port[const.INTERFACEID]:
                        raise exc.NetworkInUse(net_id=net_id)
                for port in ports_on_net:
                    self.delete_port(tenant_id, net_id, port[const.UUID])

            self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
            net_dict = cutil.make_net_dict(net[const.UUID],
                                           net[const.NETWORKNAME],
                                           [])
            self._release_vlan_for_tenant(tenant_id, net_id)
            cdb.remove_vlan_binding(net_id)
            db.network_destroy(net_id)
            return net_dict
        # Network not found
        raise exc.NetworkNotFound(net_id=net_id)
开发者ID:pestrunk,项目名称:quantum-1,代码行数:26,代码来源:l2network_plugin.py


示例2: plug_interface

 def plug_interface(self, tenant_id, net_id, port_id,
                    remote_interface_id):
     """
     Provides connectivity to a remote interface to the
     specified Virtual Network.
     """
     LOG.debug("plug_interface() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id == None:
         raise cexc.InvalidAttach(port_id=port_id, net_id=net_id,
                                 att_id=remote_interface_id)
     attachment_id = attachment_id[:const.UUID_LENGTH]
     remote_interface_id = remote_interface_id[:const.UUID_LENGTH]
     if remote_interface_id != attachment_id:
         LOG.debug("Existing attachment_id:%s, remote_interface_id:%s" % \
                   (attachment_id, remote_interface_id))
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id,
                                                     net_id, port_id,
                                                     attachment_id])
     db.port_unset_attachment(net_id, port_id)
     db.port_set_attachment(net_id, port_id, attachment_id)
开发者ID:pestrunk,项目名称:quantum-1,代码行数:25,代码来源:l2network_plugin.py


示例3: test_list_ports

    def test_list_ports(self, tenant_id='test_network'):
        """
        Tests listing of all the Ports.
        """

        LOG.debug("test_list_ports - START")
        new_net_dict = self._l2network_plugin.create_network(
                        tenant_id, self.network_name)
        port_dict = self._l2network_plugin.create_port(
                        tenant_id, new_net_dict[const.NET_ID], self.port_state)
        port_dict2 = self._l2network_plugin.create_port(
                        tenant_id, new_net_dict[const.NET_ID], self.port_state)
        port_list = self._l2network_plugin.get_all_ports(
                        tenant_id, new_net_dict[const.NET_ID])
        port_temp_list = [port_dict, port_dict2]
        network = db.network_get(new_net_dict[const.NET_ID])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = self._make_port_dict(port[const.UUID],
                                            port[const.PORTSTATE],
                                            port[const.NETWORKID],
                                            port[const.INTERFACEID])
            ports_on_net.append(new_port)
        self.assertEqual(len(port_list), 2)
        self.assertTrue(port_list[0] in port_temp_list)
        self.assertTrue(port_list[1] in port_temp_list)
        self.assertTrue(ports_on_net[0] in port_temp_list)
        self.assertTrue(ports_on_net[1] in port_temp_list)

        self.tearDownPortOnly(tenant_id, new_net_dict[const.NET_ID],
                              port_dict[const.PORT_ID])
        self.tearDownNetworkPort(tenant_id, new_net_dict[const.NET_ID],
                                 port_dict2[const.PORT_ID])
        LOG.debug("test_list_ports - END")
开发者ID:pestrunk,项目名称:quantum-1,代码行数:35,代码来源:test_l2networkApi.py


示例4: update_network

 def update_network(self, tenant_id, net_id, **kwargs):
     """
     Updates the symbolic name belonging to a particular
     Virtual Network.
     """
     LOG.debug("UCSVICPlugin:update_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     network = db.network_get(net_id)
     net_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
     return net_dict
开发者ID:nitishb,项目名称:quantum,代码行数:10,代码来源:cisco_ucs_plugin.py


示例5: 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("unplug_interface() called\n")
     network = db.network_get(net_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id,
                                                  port_id])
     db.port_unset_attachment(net_id, port_id)
开发者ID:Oneiroi,项目名称:quantum,代码行数:10,代码来源:l2network_plugin.py


示例6: 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")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id, kwargs])
        self._validate_port_state(kwargs["state"])
        db.port_update(port_id, net_id, **kwargs)

        new_port_dict = cutil.make_port_dict(port_id, kwargs["state"], net_id, None)
        return new_port_dict
开发者ID:wendy-king,项目名称:x7_venv,代码行数:12,代码来源:l2network_plugin.py


示例7: _get_network

 def _get_network(self, tenant_id, network_id):
     """
     Gets the NETWORK ID
     """
     network = db.network_get(network_id)
     if not network:
         raise exc.NetworkNotFound(net_id=network_id)
     vlan = cdb.get_vlan_binding(network_id)
     return {const.NET_ID: network_id, const.NET_NAME: network.name,
             const.NET_PORTS: network.ports,
             const.NET_VLAN_NAME: vlan.vlan_name,
             const.NET_VLAN_ID: vlan.vlan_id}
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:12,代码来源:cisco_nexus_plugin.py


示例8: create_network

 def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id, **kwargs):
     """
     Creates a new Virtual Network, and assigns it
     a symbolic name.
     """
     LOG.debug("UCSVICPlugin:create_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip, self._ucsm_username, self._ucsm_password)
     network = db.network_get(net_id)
     ports_on_net = []
     new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)
     return new_network_dict
开发者ID:nitishb,项目名称:quantum,代码行数:12,代码来源:cisco_ucs_plugin.py


示例9: delete_network

 def delete_network(self, tenant_id, net_id, **kwargs):
     """
     Deletes the network with the specified network identifier
     belonging to the specified tenant.
     """
     LOG.debug("UCSVICPlugin:delete_network() called\n")
     self._set_ucsm(kwargs[const.DEVICE_IP])
     net = db.network_get(net_id)
     vlan_binding = cdb.get_vlan_binding(net[const.UUID])
     vlan_name = vlan_binding[const.VLANNAME]
     self._driver.delete_vlan(vlan_name, self._ucsm_ip, self._ucsm_username, self._ucsm_password)
     net_dict = cutil.make_net_dict(net[const.UUID], net[const.NETWORKNAME], [])
     return net_dict
开发者ID:nitishb,项目名称:quantum,代码行数:13,代码来源:cisco_ucs_plugin.py


示例10: get_network

 def get_network(self, network_id):
     """Get a network"""
     net = []
     try:
         for net in db.network_get(network_id):
             LOG.debug("Getting network: %s" % net.uuid)
             net_dict = {}
             net_dict["tenant-id"] = net.tenant_id
             net_dict["net-id"] = str(net.uuid)
             net_dict["net-name"] = net.name
             net.append(net_dict)
     except Exception, exc:
         LOG.error("Failed to get network: %s" % str(exc))
开发者ID:BillTheBest,项目名称:quantum,代码行数:13,代码来源:test_database.py


示例11: 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("get_port_details() called\n")
     network = db.network_get(net_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
     port = db.port_get(net_id, port_id)
     new_port_dict = cutil.make_port_dict(
         port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
     )
     return new_port_dict
开发者ID:wendy-king,项目名称:x7_venv,代码行数:13,代码来源:l2network_plugin.py


示例12: delete_service

def delete_service(tenant_id, service_instance_id, *args):
    """
    Removes a service and all the network configuration
    """
    l2db.initialize()
    print ("Terminating Service VM")
    service_logic = servlogcs.ServicesLogistics()
    vms_list = []
    vms_list.append(servconts.DELETE_VM_CMD)
    vms_list.append(service_instance_id)

    if not service_logic.image_exist(service_instance_id):
        print ("Service VM does not exist")
        sys.exit()

    result = subprocess.call(vms_list)
    service_logic.image_shutdown_verification(service_instance_id)

    client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id)
    service_nets = sdb.get_service_bindings(service_instance_id)
    print ("Terminating Ports and Networks")
    network_name = db.network_get(service_nets.mngnet_id)
    port_id_net = db.port_list(service_nets.mngnet_id)
    for ports_uuid in port_id_net:
        client.delete_port(service_nets.mngnet_id, ports_uuid.uuid)
    client.delete_network(service_nets.mngnet_id)
    network_name = db.network_get(service_nets.nbnet_id)
    port_id_net = db.port_list(service_nets.nbnet_id)
    for ports_uuid in port_id_net:
        client.delete_port(service_nets.nbnet_id, ports_uuid.uuid)
    client.delete_network(service_nets.nbnet_id)
    network_name = db.network_get(service_nets.sbnet_id)
    port_id_net = db.port_list(service_nets.sbnet_id)
    for ports_uuid in port_id_net:
        client.delete_port(service_nets.sbnet_id, ports_uuid.uuid)
    client.delete_network(service_nets.sbnet_id)
    service_list = sdb.remove_services_binding(service_instance_id)
    print ("Configuration Removed Successfully")
开发者ID:Blackspan,项目名称:quantum,代码行数:38,代码来源:service_insertion.py


示例13: unplug_interface

 def unplug_interface(self, tenant_id, net_id, port_id):
     """
     Removes connectivity of a remote interface to the
     specified Virtual Network.
     """
     LOG.debug("unplug_interface() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_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)
     self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
     attachment_id = attachment_id[: const.UUID_LENGTH]
     attachment_id = attachment_id + const.UNPLUGGED
     db.port_unset_attachment(net_id, port_id)
     db.port_set_attachment(net_id, port_id, attachment_id)
开发者ID:wendy-king,项目名称:x7_venv,代码行数:16,代码来源:l2network_plugin.py


示例14: get_all_ports

    def get_all_ports(self, tenant_id, net_id):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        LOG.debug("get_all_ports() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        return ports_on_net
开发者ID:wendy-king,项目名称:x7_venv,代码行数:17,代码来源:l2network_plugin.py


示例15: 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("plug_interface() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if attachment_id and remote_interface_id != attachment_id:
         raise exc.PortInUse(port_id=port_id, net_id=net_id,
                             att_id=attachment_id)
     self._invoke_device_plugins(self._func_name(), [tenant_id,
                                                     net_id, port_id,
                                                     remote_interface_id])
     if attachment_id == None:
         db.port_set_attachment(net_id, port_id, remote_interface_id)
开发者ID:Oneiroi,项目名称:quantum,代码行数:18,代码来源:l2network_plugin.py


示例16: get_network_details

    def get_network_details(self, tenant_id, net_id):
        """
        Gets the details of a particular network
        """
        LOG.debug("get_network_details() called\n")
        network = db.network_get(net_id)
        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id])
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)

        return new_network
开发者ID:wendy-king,项目名称:x7_venv,代码行数:18,代码来源:l2network_plugin.py


示例17: 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 should first be un-plugged and
     then the port can be deleted.
     """
     LOG.debug("delete_port() called\n")
     network = db.network_get(net_id)
     port = db.port_get(net_id, port_id)
     attachment_id = port[const.INTERFACEID]
     if not attachment_id:
         self._invoke_device_plugins(self._func_name(), [tenant_id, net_id, port_id])
         db.port_destroy(net_id, port_id)
         new_port_dict = cutil.make_port_dict(port_id, None, None, None)
         return new_port_dict
     else:
         raise exc.PortInUse(port_id=port_id, net_id=net_id, att_id=attachment_id)
开发者ID:wendy-king,项目名称:x7_venv,代码行数:18,代码来源:l2network_plugin.py


示例18: tearDown

    def tearDown(self):
        """Tear down our tests"""
        try:
            port = db.port_get(self.net_id, self.port_id)
            self._l2network_multiblade.delete_port([tenant_id, self.net_id, self.port_id])
        except exc.NetworkNotFound:
            # We won't always have a port to remove
            pass
        except exc.PortNotFound:
            # We won't always have a port to remove
            pass

        try:
            net = db.network_get(self.net_id)
            self._l2network_multiblade.delete_network([tenant_id, self.net_id])
        except exc.NetworkNotFound:
            # We won't always have a network to remove
            pass
        db.clear_db()
开发者ID:ramdurairaj,项目名称:quantum,代码行数:19,代码来源:test_l2network_multi_blade.py


示例19: get_network_details

    def get_network_details(self, tenant_id, net_id, **kwargs):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        LOG.debug("UCSVICPlugin:get_network_details() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        network = db.network_get(net_id)
        ports_list = network[const.NETWORKPORTS]
        ports_on_net = []
        for port in ports_list:
            new_port = cutil.make_port_dict(
                port[const.UUID], port[const.PORTSTATE], port[const.NETWORKID], port[const.INTERFACEID]
            )
            ports_on_net.append(new_port)

        new_network = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], ports_on_net)

        return new_network
开发者ID:nitishb,项目名称:quantum,代码行数:19,代码来源:cisco_ucs_plugin.py


示例20: test_show_network

    def test_show_network(self, net_tenant_id=None):
        """
        Tests display of details of a Virtual Network .
        """

        LOG.debug("test_show_network - START")
        if net_tenant_id:
            tenant_id = net_tenant_id
        else:
            tenant_id = self.tenant_id
        new_net_dict = self._l2network_plugin.create_network(
                        tenant_id, self.network_name)
        result_net_dict = self._l2network_plugin.get_network_details(
                                tenant_id, new_net_dict[const.NET_ID])
        net = db.network_get(new_net_dict[const.NET_ID])
        self.assertEqual(net[const.UUID], new_net_dict[const.NET_ID])
        self.assertEqual(
                new_net_dict[const.NET_ID], result_net_dict[const.NET_ID])
        self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
        LOG.debug("test_show_network - END")
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:20,代码来源:test_l2networkApi.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python api.port_create函数代码示例发布时间:2022-05-26
下一篇:
Python api.network_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