def _add_router_integration_interface(self, tenant_id, name, lrouter, lswitch): # create logic switch port try: ls_port = nvplib.create_lport( self.cluster, lswitch['uuid'], tenant_id, '', '', lrouter['uuid'], True) except NvpApiClient.NvpApiException: msg = (_("An exception occured while creating a port " "on lswitch %s") % lswitch['uuid']) LOG.exception(msg) raise q_exc.NeutronException(message=msg) # create logic router port try: neutron_port_id = '' pname = name[:36] + '-lp' admin_status_enabled = True lr_port = nvplib.create_router_lport( self.cluster, lrouter['uuid'], tenant_id, neutron_port_id, pname, admin_status_enabled, [vcns_const.INTEGRATION_LR_IPADDRESS]) except NvpApiClient.NvpApiException: msg = (_("Unable to create port on NVP logical router %s") % name) LOG.exception(msg) nvplib.delete_port(self.cluster, lswitch['uuid'], ls_port['uuid']) raise q_exc.NeutronException(message=msg) # attach logic router port to switch port try: self._update_router_port_attachment( self.cluster, None, lrouter['uuid'], {}, lr_port['uuid'], 'PatchAttachment', ls_port['uuid'], None) except NvpApiClient.NvpApiException as e: # lr_port should have been deleted nvplib.delete_port(self.cluster, lswitch['uuid'], ls_port['uuid']) raise e