def test_disassociate_portprofile(self, tenant_id='test_tenant', ): """ Tests disassociation of a port-profile """ LOG.debug("test_disassociate_portprofile - 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.state) port_profile_dict = self._l2network_plugin.create_portprofile( tenant_id, self.profile_name, self.qos) port_profile_id = port_profile_dict['profile_id'] self._l2network_plugin.associate_portprofile( tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID], port_profile_id) self._l2network_plugin.disassociate_portprofile( tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID], port_profile_id) port_profile_associate = cdb.get_pp_binding(tenant_id, port_profile_id) self.assertEqual(port_profile_associate, []) self.tearDownPortProfile(tenant_id, port_profile_id) self.tearDownNetworkPort( tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID]) LOG.debug("test_disassociate_portprofile - END")
def _make_portprofile_assc_list(self, tenant_id, profile_id): plist = cdb.get_pp_binding(tenant_id, profile_id) assc_list = [] for port in plist: assc_list.append(port[const.PORTID]) return assc_list
def test_disassociate_portprofile( self, tenant_id='test_tenant', ): """ Tests disassociation of a port-profile """ LOG.debug("test_disassociate_portprofile - 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.state) port_profile_dict = self._l2network_plugin.create_portprofile( tenant_id, self.profile_name, self.qos) port_profile_id = port_profile_dict['profile_id'] self._l2network_plugin.associate_portprofile( tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID], port_profile_id) self._l2network_plugin.disassociate_portprofile( tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID], port_profile_id) port_profile_associate = cdb.get_pp_binding(tenant_id, port_profile_id) self.assertEqual(port_profile_associate, []) self.tearDownPortProfile(tenant_id, port_profile_id) self.tearDownNetworkPort(tenant_id, new_net_dict[const.NET_ID], port_dict[const.PORT_ID]) LOG.debug("test_disassociate_portprofile - END")
def make_portprofile_assc_list(tenant_id, profile_id): """Helper function to create port profile association list""" plist = cdb.get_pp_binding(tenant_id, profile_id) assc_list = [] for port in plist: assc_list.append(port[const.PORTID]) return assc_list
def delete_portprofile(self, tenant_id, profile_id): """Delete portprofile""" LOG.debug("delete_portprofile() called\n") try: portprofile = cdb.get_portprofile(tenant_id, profile_id) except Exception: raise cexc.PortProfileNotFound(tenant_id=tenant_id, portprofile_id=profile_id) plist = cdb.get_pp_binding(tenant_id, profile_id) if plist: raise cexc.PortProfileInvalidDelete(tenant_id=tenant_id, profile_id=profile_id) else: cdb.remove_portprofile(tenant_id, profile_id)