Ensures that the named port exists on bridge, eventually deletes it.
    If bridge is not set, port is removed from  whatever bridge contains it.

    Args:
        name: The name of the port.
        bridge: The name of the bridge.
167257
def absent(name, bridge=None):
    '''
    

    '''
    ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
    bridge_exists = False
    if bridge:
        bridge_exists = __salt__['openvswitch.bridge_exists'](bridge)
        if bridge_exists:
            port_list = __salt__['openvswitch.port_list'](bridge)
        else:
            port_list = ()
    else:
        port_list = [name]

    # Comment and change messages
    comments = {}
    comments['comment_bridge_notexists'] = 'Bridge {0} does not exist.'.format(bridge)
    comments['comment_port_notexists'] = 'Port {0} does not exist on bridge {1}.'.format(name, bridge)
    comments['comment_port_deleted'] = 'Port {0} deleted.'.format(name)
    comments['comment_port_notdeleted'] = 'Unable to delete port {0}.'.format(name)
    comments['changes_port_deleted'] = {name: {'old': 'Port named {0} may exist.'.format(name),
                                   'new': 'Deleted port {0}.'.format(name),
                                   }
                            }

    # Dry run, test=true mode
    if __opts__['test']:
        if bridge and not bridge_exists:
            ret['result'] = None
            ret['comment'] = comments['comment_bridge_notexists']
        elif name not in port_list:
            ret['result'] = True
            ret['comment'] = comments['comment_port_notexists']
        else:
            ret['result'] = None
            ret['comment'] = comments['comment_port_deleted']
        return ret

    if bridge and not bridge_exists:
        ret['result'] = False
        ret['comment'] = comments['comment_bridge_notexists']
    elif name not in port_list:
        ret['result'] = True
        ret['comment'] = comments['comment_port_notexists']
    else:
        if bridge:
            port_remove = __salt__['openvswitch.port_remove'](br=bridge, port=name)
        else:
            port_remove = __salt__['openvswitch.port_remove'](br=None, port=name)

        if port_remove:
            ret['result'] = True
            ret['comment'] = comments['comment_port_deleted']
            ret['changes'] = comments['changes_port_deleted']
        else:
            ret['result'] = False
            ret['comment'] = comments['comment_port_notdeleted']

    return ret
70434
def _onAs( self, name ):
        "  "
        if self.__lastImport.what:
            self.__lastImport.what[ -1 ].alias = name
        else:
            self.__lastImport.alias = name
        return
1185548
def exists(self, name):
        
        with self.pipe as pipe:
            return pipe.exists(self.redis_key(name))
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))
112813
def bridge_exists(br):
    '''
    
    '''
    cmd = 'ovs-vsctl br-exists {0}'.format(br)
    result = __salt__['cmd.run_all'](cmd)
    retcode = result['retcode']
    return _retcode_to_bool(retcode)
104917
def validate_name(self, name: str):
        
        parts = self.NAME_SPLIT_RE.split(name)
        for part in parts:
            if not part.isidentifier() or keyword.iskeyword(part):
                raise ValueError('Incorrect route name {!r}, '
                                 'the name should be a sequence of '
                                 'python identifiers separated '
                                 'by dash, dot or column'.format(name))
        if name in self._named_resources:
            raise ValueError('Duplicate {!r}, '
                             'already handled by {!r}'
                             .format(name, self._named_resources[name]))
795427
public static base_response delete(nitro_service client, String name) throws Exception {
		netbridge deleteresource = new netbridge();
		deleteresource.name = name;
		return deleteresource.delete_resource(client);
	}
341491
def _process_removed_port(self, device):
        """"""
        LOG.debug("Trying to remove the port %r", device)
        self._update_port_status_cache(device, device_bound=False)
        self._port_unbound(device, vnic_deleted=True)

        LOG.debug("The port was successfully removed.")
        self._removed_ports.discard(device)
348868
def port(self, name):
        
        for p in self.ports:
            if p.name == name:
                return p
421069
def remove_connection(self, alias):
        
        errors = 0
        for d in (self._conns, self._kwargs):
            try:
                del d[alias]
            except KeyError:
                errors += 1

        if errors == 2:
            raise KeyError('There is no connection with alias %r.' % alias)
322823
def remove_udp_port(self, port):
        

        if port in self._used_udp_ports:
            self._used_udp_ports.remove(port)
184345
def delete_object(connection, container: str, object_meta_data: dict) -> None:
    
    connection.delete_object(container, object_meta_data['name'])
505144
def __find(self, name):
        
        port = None
        if not len(self.__ports):
            raise Exception('No ports defined: %s' % self.__qn)
        if isinstance(name, int):
            qn = '%s[%d]' % (self.__qn, name)
            try:
                port = self.__ports[name]
            except IndexError:
                raise PortNotFound(qn)
        else:
            qn = '.'.join((self.__qn, name))
            for p in self.__ports:
                if name == p.name:
                    port = p
                    break
        if port is None:
            raise PortNotFound(qn)
        qn = '.'.join((self.__qn, port.name))
        return MethodSelector(self.__client, port.methods, qn)
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']}
392354
def update_nio(self, port_number, nio):
        

        bridge_name = "{}-{}".format(self._id, port_number)
        if self._ubridge_hypervisor and self._ubridge_hypervisor.is_running():
            yield from self._ubridge_apply_filters(bridge_name, nio.filters)
1173418
def remove_nio(self, port_number):
        

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

        nio = self._mappings[port_number]
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        yield from Bridge.remove_nio(self, nio)

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

        del self._mappings[port_number]
        return nio
786756
def absent(name):
    '''
    
    '''
    ret = {'changes': {},
           'comment': '',
           'name': name,
           'result': True}

    # Make name all Uppers since make.conf uses all Upper vars
    upper_name = name.upper()

    old_value = __salt__['makeconf.get_var'](upper_name)

    if old_value is None:
        msg = 'Variable {0} is already absent from make.conf'
        ret['comment'] = msg.format(name)
    else:
        if __opts__['test']:
            msg = 'Variable {0} is set to be removed from make.conf'
            ret['comment'] = msg.format(name)
            ret['result'] = None
        else:
            __salt__['makeconf.remove_var'](upper_name)

            new_value = __salt__['makeconf.get_var'](upper_name)
            if new_value is not None:
                msg = 'Variable {0} failed to be removed from make.conf'
                ret['comment'] = msg.format(name)
                ret['result'] = False
            else:
                msg = 'Variable {0} was removed from make.conf'
                ret['comment'] = msg.format(name)
                ret['result'] = True
    return ret