Example #1
0
    def test_list_networks(self, tenant_id='test_network'):
        """
        Tests listing of all the Virtual Networks .
        """

        LOG.debug("test_list_networks - START")
        new_net_dict = self._l2network_plugin.create_network(
            tenant_id, self.network_name)
        new_net_dict2 = self._l2network_plugin.create_network(
            tenant_id, 'test_net2')
        net_list = self._l2network_plugin.get_all_networks(tenant_id)
        net_temp_list = [new_net_dict, new_net_dict2]
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = self._make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)
        self.assertEqual(len(net_list), 2)
        self.assertTrue(net_list[0] in net_temp_list)
        self.assertTrue(net_list[1] in net_temp_list)
        self.assertTrue(new_networks_list[0] in net_temp_list)
        self.assertTrue(new_networks_list[1] in net_temp_list)
        self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
        self.tearDownNetwork(tenant_id, new_net_dict2[const.NET_ID])
        LOG.debug("test_list_networks - END")
    def test_list_networks(self, tenant_id='test_network'):
        """
        Tests listing of all the Virtual Networks .
        """

        LOG.debug("test_list_networks - START")
        new_net_dict = self._l2network_plugin.create_network(
                                tenant_id, self.network_name)
        new_net_dict2 = self._l2network_plugin.create_network(
                                tenant_id, 'test_net2')
        net_list = self._l2network_plugin.get_all_networks(tenant_id)
        net_temp_list = [new_net_dict, new_net_dict2]
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = self._make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)
        self.assertEqual(len(net_list), 2)
        self.assertTrue(net_list[0] in net_temp_list)
        self.assertTrue(net_list[1] in net_temp_list)
        self.assertTrue(new_networks_list[0] in net_temp_list)
        self.assertTrue(new_networks_list[1] in net_temp_list)
        self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
        self.tearDownNetwork(tenant_id, new_net_dict2[const.NET_ID])
        LOG.debug("test_list_networks - END")
Example #3
0
 def get_all_networks(self, tenant_id):
     """Get all networks"""
     nets = []
     try:
         for net in db.network_list(tenant_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
             nets.append(net_dict)
     except Exception, exc:
         LOG.error("Failed to get all networks: %s" % str(exc))
Example #4
0
 def get_all_networks(self, tenant_id):
     """Get all networks"""
     nets = []
     try:
         for net in db.network_list(tenant_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
             nets.append(net_dict)
     except Exception, exc:
         LOG.error("Failed to get all networks: %s" % str(exc))
Example #5
0
    def get_all_networks(self, tenant_id):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("get_all_networks() called\n")
        self._invoke_device_plugins(self._func_name(), [tenant_id])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Example #6
0
    def get_all_networks(self, tenant_id, **kwargs):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICPlugin:get_all_networks() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID], network[const.NETWORKNAME], [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Example #7
0
    def get_all_networks(self, tenant_id):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("get_all_networks() called\n")
        self._invoke_device_plugins(self._func_name(), [tenant_id])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)

        return new_networks_list
Example #8
0
    def get_all_networks(self, tenant_id, **kwargs):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant.
        """
        LOG.debug("UCSVICPlugin:get_all_networks() called\n")
        self._set_ucsm(kwargs[const.DEVICE_IP])
        networks_list = db.network_list(tenant_id)
        new_networks_list = []
        for network in networks_list:
            new_network_dict = cutil.make_net_dict(network[const.UUID],
                                                   network[const.NETWORKNAME],
                                                   [])
            new_networks_list.append(new_network_dict)

        return new_networks_list