def test_list_portprofile(self, tenant_id='test_tenant'): """ Tests listing of port-profiles """ LOG.debug("test_list_portprofile - tenant id: %s - START", tenant_id) profile_name2 = tenant_id + '_port_profile2' qos2 = tenant_id + 'qos2' port_profile_dict1 = self._l2network_plugin.create_portprofile( tenant_id, self.profile_name, self.qos) port_profile_dict2 = self._l2network_plugin.create_portprofile( tenant_id, profile_name2, qos2) port_profile_id1 = port_profile_dict1['profile_id'] port_profile_id2 = port_profile_dict2['profile_id'] list_all_portprofiles = self._l2network_plugin.get_all_portprofiles( tenant_id) port_profile_list = [port_profile_dict1, port_profile_dict2] pplist = cdb.get_all_portprofiles() new_pplist = [] for pp in pplist: new_pp = self._make_portprofile_dict(tenant_id, pp[const.UUID], pp[const.PPNAME], pp[const.PPQOS]) new_pplist.append(new_pp) self.assertTrue(new_pplist[0] in port_profile_list) self.assertTrue(new_pplist[1] in port_profile_list) self.tearDownPortProfile(tenant_id, port_profile_id1) self.tearDownPortProfile(tenant_id, port_profile_id2) LOG.debug("test_list_portprofile - tenant id: %s - END", tenant_id)
def get_all_portprofiles(self, tenant_id): """Get all port profiles""" LOG.debug("get_all_portprofiles() called\n") pplist = cdb.get_all_portprofiles() new_pplist = [] for portprofile in pplist: new_pp = cutil.make_portprofile_dict( tenant_id, portprofile[const.UUID], portprofile[const.PPNAME], portprofile[const.PPQOS] ) new_pplist.append(new_pp) return new_pplist
def get_all_portprofiles(self, tenant_id): """Get all port profiles""" LOG.debug("get_all_portprofiles() called\n") pplist = cdb.get_all_portprofiles() new_pplist = [] for portprofile in pplist: new_pp = cutil.make_portprofile_dict(tenant_id, portprofile[const.UUID], portprofile[const.PPNAME], portprofile[const.PPQOS]) new_pplist.append(new_pp) return new_pplist
def get_all_portprofiles(self): """Get all portprofiles""" pps = [] try: for portprof in l2network_db.get_all_portprofiles(): LOG.debug("Getting port profile : %s" % portprof.uuid) pp_dict = {} pp_dict["portprofile-id"] = str(portprof.uuid) pp_dict["portprofile-name"] = portprof.name pp_dict["vlan-id"] = str(portprof.vlan_id) pp_dict["qos"] = portprof.qos pps.append(pp_dict) except Exception, exc: LOG.error("Failed to get all port profiles: %s" % str(exc))