Detach a nic from a bridge

        :param nic: nic name to detach
350241
def nic_remove(self, nic):
        

        args = {
            'nic': nic,
        }

        self._nic_remove_chk.check(args)

        return self._client.json('bridge.nic-remove', args)
563241
def nics(self):
        
        # We do here some lazy loading.
        if not self._nics:
            self._nics = NicManager(self)
        return self._nics
336599
def _delete_ubridge_connection(self, port_number):
        

        bridge_name = "{}-{}".format(self._id, port_number)
        yield from self._ubridge_send("bridge delete {name}".format(name=bridge_name))
813357
def delete(name, force=False):
    '''
    
    '''
    ret = {}

    if name not in list_nictags():
        return True

    cmd = 'nictagadm delete {0}{1}'.format("-f " if force else "", name)
    res = __salt__['cmd.run_all'](cmd)

    if res['retcode'] == 0:
        return True
    else:
        return {'Error': 'failed to delete nictag.' if 'stderr' not in res and res['stderr'] == '' else res['stderr']}
690369
function detach() {
      proxySocket.destroySoon();
      proxySocket.removeListener('end', listeners.onIncomingClose);
      proxySocket.removeListener('data', listeners.onIncoming);
      reverseProxy.incoming.socket.destroySoon();
      reverseProxy.incoming.socket.removeListener('end', listeners.onOutgoingClose);
      reverseProxy.incoming.socket.removeListener('data', listeners.onOutgoing);
    }
240112
def get_nic_mtu(nic):
    """"""
    cmd = ['ip', 'addr', 'show', nic]
    ip_output = subprocess.check_output(cmd).decode('UTF-8').split('\n')
    mtu = ""
    for line in ip_output:
        words = line.split()
        if 'mtu' in words:
            mtu = words[words.index("mtu") + 1]
    return mtu
724359
def nics_skip(name, nics, ipv6):
    '''
    
    '''
    return nics_skipped(name, nics=nics, ipv6=ipv6)
783388
def remove_nio(self, port_number):
        

        if port_number not in self._nios:
            raise DynamipsError("Port {} is not allocated".format(port_number))

        # remove VCs mapped with the port
        for source, destination in self._active_mappings.copy().items():
            source_port, source_dlci = source
            destination_port, destination_dlci = destination
            if port_number == source_port:
                log.info('Frame Relay switch "{name}" [{id}]: unmapping VC between port {source_port} DLCI {source_dlci} and port {destination_port} DLCI {destination_dlci}'.format(name=self._name,
                                                                                                                                                                                     id=self._id,
                                                                                                                                                                                     source_port=source_port,
                                                                                                                                                                                     source_dlci=source_dlci,
                                                                                                                                                                                     destination_port=destination_port,
                                                                                                                                                                                     destination_dlci=destination_dlci))
                yield from self.unmap_vc(source_port, source_dlci, destination_port, destination_dlci)
                yield from self.unmap_vc(destination_port, destination_dlci, source_port, source_dlci)

        nio = self._nios[port_number]
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)

        log.info('Frame Relay switch "{name}" [{id}]: NIO {nio} removed from port {port}'.format(name=self._name,
                                                                                                 id=self._id,
                                                                                                 nio=nio,
                                                                                                 port=port_number))

        del self._nios[port_number]
        return nio
556938
def detach(self, connection_info):
        
        fcp = connection_info['zvm_fcp']
        fcp = fcp.lower()
        target_wwpn = connection_info['target_wwpn']
        target_lun = connection_info['target_lun']
        assigner_id = connection_info['assigner_id']
        assigner_id = assigner_id.upper()
        multipath = connection_info['multipath']
        os_version = connection_info['os_version']
        mount_point = connection_info['mount_point']

        if not zvmutils.check_userid_exist(assigner_id):
            LOG.error("Guest '%s' does not exist" % assigner_id)
            raise exception.SDKObjectNotExistError(
                    obj_desc=("Guest '%s'" % assigner_id), modID='volume')
        else:
            self._detach(fcp, assigner_id, target_wwpn, target_lun,
                         multipath, os_version, mount_point)
695686
def vlan_id(self):
        
        nicids = self.nicid.split('-')
        if nicids:
            u = []
            for vlan in nicids:
                if vlan.split('.')[-1] not in u:
                    u.append(vlan.split('.')[-1])
            return '-'.join(u)
1207597
def detach_hardware(self, ticket_id=None, hardware_id=None):
        
        return self.ticket.removeAttachedHardware(hardware_id, id=ticket_id)
151864
async def teardown_conn(self, context):
        """"""

        client_id = context.user_data

        self._logger.info("Tearing down client connection: %s", client_id)
        if client_id not in self.clients:
            self._logger.warning("client_id %s did not exist in teardown_conn", client_id)
        else:
            del self.clients[client_id]
69629
def get_nic_hwaddr(nic):
    """"""
    cmd = ['ip', '-o', '-0', 'addr', 'show', nic]
    ip_output = subprocess.check_output(cmd).decode('UTF-8')
    hwaddr = ""
    words = ip_output.split()
    if 'link/ether' in words:
        hwaddr = words[words.index('link/ether') + 1]
    return hwaddr
351700
def adapter_remove_nio_binding(self, adapter_number):
        

        try:
            adapter = self._ethernet_adapters[adapter_number]
        except IndexError:
            raise VMwareError("Adapter {adapter_number} doesn't exist on VMware VM '{name}'".format(name=self.name,
                                                                                                    adapter_number=adapter_number))

        nio = adapter.get_nio(0)
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        adapter.remove_nio(0)
        if self._started and self._ubridge_hypervisor:
            yield from self._delete_ubridge_connection(adapter_number)

        log.info("VMware VM '{name}' [{id}]: {nio} removed from adapter {adapter_number}".format(name=self.name,
                                                                                                 id=self.id,
                                                                                                 nio=nio,
                                                                                                 adapter_number=adapter_number))

        return nio
973646
def delete(self, bridge):
        
        args = {
            'name': bridge,
        }

        self._bridge_chk.check(args)

        return self._client.json('bridge.delete', args)
6195
def _networking(self):
        

        bridge_name = "IOL-BRIDGE-{}".format(self.application_id + 512)
        try:
            # delete any previous bridge if it exists
            yield from self._ubridge_send("iol_bridge delete {name}".format(name=bridge_name))
        except UbridgeError:
            pass
        yield from self._ubridge_send("iol_bridge create {name} {bridge_id}".format(name=bridge_name, bridge_id=self.application_id + 512))

        bay_id = 0
        for adapter in self._adapters:
            unit_id = 0
            for unit in adapter.ports.keys():
                nio = adapter.get_nio(unit)
                if nio and isinstance(nio, NIOUDP):
                    yield from self._ubridge_send("iol_bridge add_nio_udp {name} {iol_id} {bay} {unit} {lport} {rhost} {rport}".format(name=bridge_name,
                                                                                                                                       iol_id=self.application_id,
                                                                                                                                       bay=bay_id,
                                                                                                                                       unit=unit_id,
                                                                                                                                       lport=nio.lport,
                                                                                                                                       rhost=nio.rhost,
                                                                                                                                       rport=nio.rport))
                    if nio.capturing:
                        yield from self._ubridge_send('iol_bridge start_capture {name} "{output_file}" {data_link_type}'.format(name=bridge_name,
                                                                                                                                output_file=nio.pcap_output_file,
                                                                                                                                data_link_type=re.sub("^DLT_", "", nio.pcap_data_link_type)))

                    yield from self._ubridge_apply_filters(bay_id, unit_id, nio.filters)
                unit_id += 1
            bay_id += 1

        yield from self._ubridge_send("iol_bridge start {name}".format(name=bridge_name))
1215077
def remove_nio(self, nio):
        
        if self._hypervisor:
            yield from self._hypervisor.send('nio_bridge remove_nio "{name}" {nio}'.format(name=self._name, nio=nio))
        self._nios.remove(nio)