Delete the openstack router and its interfaces given its name.

        The interfaces should be already removed prior to calling this
        function.
964215
def delete_router_by_name(self, rtr_name, tenant_id):
        
        try:
            routers = self.neutronclient.list_routers()
            rtr_list = routers.get('routers')
            for rtr in rtr_list:
                if rtr_name == rtr['name']:
                    self.neutronclient.delete_router(rtr['id'])
        except Exception as exc:
            LOG.error("Failed to get and delete router by name %(name)s, "
                      "Exc %(exc)s",
                      {'name': rtr_name, 'exc': str(exc)})
            return False
        return True
1152466
def remove_router_interface(self, context, router_info):
        
        if router_info:
            router_name = self._arista_router_name(router_info['id'],
                                                   router_info['name'])
            mlag_peer_failed = False
            for s in self._servers:
                try:
                    self.delete_interface_from_router(router_info['seg_id'],
                                                      router_name, s)
                    if self._mlag_configured:
                        mlag_peer_failed = False
                except Exception:
                    if self._mlag_configured and not mlag_peer_failed:
                        mlag_peer_failed = True
                    else:
                        msg = (_('Failed to add interface to router '
                                 '%s on EOS') % router_name)
                        LOG.exception(msg)
                        raise arista_exc.AristaServicePluginRpcError(msg=msg)
1162566
def vswitch_delete(self, vswitch_name, persist=True):
        
        self._networkops.delete_vswitch(vswitch_name, persist)
706670
def destroy_floating_ip(self, ip_addr):
        
        if self.api_version == 2:
            self.request('/floating_ips/' + ip_addr, method='DELETE')
        else:
            raise DoError(v2_api_required_str)
334343
def delete(self):
        
        resp = self._client.delete(type(self).api_endpoint, model=self)

        if 'error' in resp:
            return False
        self.invalidate()
        return True
719521
def delete(self):
        '''  '''
        self.down()
        fcntl.ioctl(ifconfig.sockfd, SIOCBRDELBR, self.name)
        return self
639630
def remove_router_from_l3_agent(self, l3_agent, router_id):
        """"""
        return self.delete((self.agent_path + self.L3_ROUTERS + "/%s") % (
            l3_agent, router_id))
145691
def delete(options = {})
      options = options.merge(instance_profile_name: @name)
      resp = @client.delete_instance_profile(options)
      resp.data
    end
1302899
def purge_existing_ovb(nova_api, neutron):
    
    LOG.info('Cleaning up OVB environment from the tenant.')
    for server in nova_api.servers.list():
        if server.name in ('bmc', 'undercloud'):
            server.delete()
        if server.name.startswith('baremetal_'):
            server.delete()
    for router in neutron.list_routers().get('routers'):
        if router['name'] not in ('router', 'bmc_router'):
            continue
        for subnet in neutron.list_subnets().get('subnets'):
            if not (subnet['name'].startswith('bmc_eth') or subnet['name'] == 'rdo-m-subnet'):
                continue
            try:
                neutron.remove_interface_router(router['id'], {'subnet_id': subnet['id']})
            except neutronclient.common.exceptions.NotFound:
                pass
    try:
        bmc_router = neutron.list_routers(name='bmc_router').get('routers')[0]
        for port in neutron.list_ports(device_id=bmc_router['id'])['ports']:
            if port.get('device_owner') == 'network:router_gateway':
                continue
            info = {'id': router['id'],
                    'port_id': port['id'],
                    'tenant_id': bmc_router.get('tenant_id'),
                    }
            neutron.remove_interface_router(bmc_router['id'], info)
        neutron.delete_router(bmc_router['id'])
    except IndexError:  # already doesnt exist
        pass

    for _ in range(0, 5):
        try:
            for port in neutron.list_ports()['ports']:
                if port['name'].endswith('_provision'):
                    neutron.delete_port(port['id'])
            for net in neutron.list_networks().get('networks'):
                if not net['name'].startswith('provision_'):
                    continue
                for port in neutron.list_ports(network_id=net['id'])['ports']:
                    if port.get('device_owner') == 'network:router_interface':
                        continue
                    try:
                        neutron.delete_port(port['id'])
                    except neutronclient.common.exceptions.PortNotFoundClient:
                            pass
                    for subnet in neutron.list_subnets(network_id=net['id'])['subnets']:
                        neutron.delete_subnet(subnet['id'])
                neutron.delete_network(net['id'])
        except neutronclient.common.exceptions.Conflict:
            LOG.debug('waiting for all the ports to be freed...')
            time.sleep(5)
        else:
            return
380671
def remove(self, transport):
        
        if transport.uid in self.transports:
            del (self.transports[transport.uid])
20356
def _delete_ubridge_connection(self, adapter_number):
        

        vnet = "ethernet{}.vnet".format(adapter_number)
        if vnet not in self._vmx_pairs:
            raise VMwareError("vnet {} not in VMX file".format(vnet))
        yield from self._ubridge_send("bridge delete {name}".format(name=vnet))
1277649
def delete(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.delete(index=self._name, **kwargs)
134059
def delete_router(self, name, tenant_id, rout_id, subnet_lst):
        
        ret = self.delete_intf_router(name, tenant_id, rout_id, subnet_lst)
        if not ret:
            return False

        try:
            ret = self.neutronclient.delete_router(rout_id)
        except Exception as exc:
            LOG.error("Failed to delete router %(name)s ret %(ret)s "
                      "Exc %(exc)s",
                      {'name': name, 'ret': str(ret), 'exc': str(exc)})
            return False
        return True
933014
def cleanup_interfaces(self):
        
        debug("Cleaning up interfaces...")
        for gpio_id in self._gpio_kernel_interfaces_created:
            # Close the value-file and remove interrupt bindings
            self.del_interrupt_callback(gpio_id)

            # Remove the kernel GPIO interface
            debug("- unexporting GPIO %s" % gpio_id)
            with open(_SYS_GPIO_ROOT + "unexport", "w") as f:
                f.write("%s" % gpio_id)

        # Reset list of created interfaces
        self._gpio_kernel_interfaces_created = []
1314769
def delete(self):
        

        if self._hypervisor and self in self._hypervisor.devices:
            self._hypervisor.devices.remove(self)
        if self._hypervisor and not self._hypervisor.devices:
            yield from self._hypervisor.send('nio_bridge delete "{}"'.format(self._name))
1090778
def destroy(self, si, logger, session, vcenter_data_model, vm_uuid, vm_name, reservation_id):
        
        # disconnect
        self._disconnect_all_my_connectors(session=session, resource_name=vm_name, reservation_id=reservation_id,
                                           logger=logger)
        # find vm
        vm = self.pv_service.find_by_uuid(si, vm_uuid)

        if vm is not None:
            # destroy vm
            result = self.pv_service.destroy_vm(vm=vm, logger=logger)
        else:
            logger.info("Could not find the VM {0},will remove the resource.".format(vm_name))
            result = True

        # delete resources
        self.resource_remover.remove_resource(session=session, resource_full_name=vm_name)
        return result
1018720
def remove(cls, id):
        

        api = Client.instance().api
        api.index(id).delete()