--------------------------
 switchport_pvlan_mapping_remove?
 This is a helper to check if command needs to be removed entirely.

 should_primary: the new primary vlan value
        Returns: the current vlan range
345776
def switchport_pvlan_mapping_remove?(should_primary)
      is_primary, is_range = switchport_pvlan_mapping

      if (is_primary != should_primary) && !is_primary.nil?
        cli_error_check(
          config_set('interface', 'switchport_pvlan_mapping',
                     name: @name, state: 'no', primary: '', vlan: ''))
        is_range = []
      end
      is_range
    end
407915
def Delete(self):
		

		self.public_ip.ports = [o for o in self.public_ip.ports if o!=self]

		return(self.public_ip.Update())
516539
def switchport_pvlan_trunk_allowed_vlan
      return nil if switchport_mode == :disabled
      vlans = config_get('interface', 'switchport_pvlan_trunk_allowed_vlan',
                         name: @name)
      vlans = vlans.join(',') if vlans.is_a?(Array)
      vlans = Utils.normalize_range_array(vlans, :string) unless vlans == 'none'
      vlans
    end
817783
def _delete_switch_entry(self, port, vlan_id, device_id, host_id, vni,
                             is_provider_vlan):
        

        connections = self._get_active_port_connections(port, host_id)

        # (nexus_port,switch_ip) will be unique in each iteration.
        # But switch_ip will repeat if host has >1 connection to same switch.
        # So track which switch_ips already have vlan removed in this loop.
        vlan_already_removed = []
        for switch_ip, intf_type, nexus_port, is_native, _ in connections:

            # if there are no remaining db entries using this vlan on this
            # nexus switch port then remove vlan from the switchport trunk.
            port_id = nexus_help.format_interface_name(intf_type, nexus_port)
            auto_create = True
            auto_trunk = True
            if is_provider_vlan:
                auto_create = cfg.CONF.ml2_cisco.provider_vlan_auto_create
                auto_trunk = cfg.CONF.ml2_cisco.provider_vlan_auto_trunk

            try:
                nxos_db.get_port_vlan_switch_binding(port_id, vlan_id,
                                                     switch_ip)
            except excep.NexusPortBindingNotFound:
                pass
            else:
                continue

            if auto_trunk:
                self.driver.disable_vlan_on_trunk_int(
                    switch_ip, vlan_id, intf_type, nexus_port,
                    is_native)

            # if there are no remaining db entries using this vlan on this
            # nexus switch then remove the vlan.
            if auto_create:
                try:
                    nxos_db.get_nexusvlan_binding(vlan_id, switch_ip)
                except excep.NexusPortBindingNotFound:
                    # Do not perform a second time on same switch
                    if switch_ip not in vlan_already_removed:
                        self.driver.delete_vlan(switch_ip, vlan_id)
                        vlan_already_removed.append(switch_ip)

            self._delete_port_channel_resources(
                host_id, switch_ip, intf_type, nexus_port, port_id)

        if nexus_help.is_baremetal(port):
            connections = self._get_baremetal_connections(
                port, False, True)
            for switch_ip, intf_type, nexus_port, is_native, _ in connections:
                if_id = nexus_help.format_interface_name(
                    intf_type, nexus_port)
                try:
                    mapping = nxos_db.get_switch_if_host_mappings(
                        switch_ip, if_id)
                    ch_grp = mapping[0].ch_grp
                except excep.NexusHostMappingNotFound:
                    ch_grp = 0
                bind_port_id = nexus_help.format_interface_name(
                    intf_type, nexus_port, ch_grp)
                binding = nxos_db.get_port_switch_bindings(
                    bind_port_id,
                    switch_ip)
                if not binding:
                    nxos_db.remove_host_mapping(if_id, switch_ip)
94203
public void remove(Object primaryKey)
                    throws RemoteException,
                    RemoveException,
                    FinderException
    {
        // d141216 method rewritten to avoid calling preinvoke/postinvoke
        //         twice in code path (i.e. don't just call remove on the
        //         bean after it is activated).  With the re-write, the
        //         bean will be activated and removed in the same tran
        //         as defined by the tx attribute on home.remove().

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "remove(pk) : " + primaryKey);

        homeEnabled();

        // Session beans and MDBs cannot be removed using this method.
        // For session beans, the spec calls for throwing an exception
        // to indicate this (no PK). MDB section not specific, thus do
        // the same for consistency.

        if (statefulSessionHome || statelessSessionHome || messageDrivenHome)
        {
            throw new RemoveException();
        }

        BeanId beanId = ivEntityHelper.remove(this, primaryKey);

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "remove(pk) : " + beanId);
    }
985874
def _remove_vlan_from_vnic_templates(self, handle, vlan_id, ucsm_ip):
        """"""
        ucsm = CONF.ml2_cisco_ucsm.ucsms[ucsm_ip]
        vnic_template_info = ucsm.vnic_template_list.values()

        vlan_name = self.make_vlan_name(vlan_id)

        if not vnic_template_info:
            # Nothing to do
            return
        try:
            for temp_info in vnic_template_info:
                vnic_template = temp_info.template
                vnic_template_path = temp_info.path

                vnic_template_full_path = (vnic_template_path +
                    const.VNIC_TEMPLATE_PREFIX + str(vnic_template))
                LOG.debug('vnic_template_full_path: %s',
                    vnic_template_full_path)
                mo = handle.query_dn(vnic_template_full_path)
                if not mo:
                    LOG.error('UCS Manager network driver could '
                              'not find VNIC template %s at',
                        vnic_template_full_path)
                    continue

                vlan_dn = (vnic_template_full_path +
                    const.VLAN_PATH_PREFIX + vlan_name)
                LOG.debug('VNIC Template VLAN path; %s', vlan_dn)
                eth_if = handle.query_dn(vlan_dn)

                if not eth_if:
                    LOG.error('UCS Manager network driver could not '
                              'delete VLAN %(vlan_name)s from VNIC '
                              'template %(vnic_template_full_path)s',
                        {'vlan_name': vlan_name,
                        'vnic_template_full_path':
                        vnic_template_full_path})
                if eth_if:
                    handle.remove_mo(eth_if)
            handle.commit()
            return True
        except Exception as e:
            return self._handle_ucsm_exception(e, 'VNIC Template',
                                               vlan_id, ucsm_ip)
1209223
def remove_tcp_port(self, port):
        

        if port in self._used_tcp_ports:
            self._used_tcp_ports.remove(port)
457702
def port(self, port=None):
        
        if (port is None) or (port == self.__port):
            return self.__port
        # when port change ensure old socket is close
        self.close()
        # valid port ?
        if 0 < int(port) < 65536:
            self.__port = int(port)
            return self.__port
        else:
            return None
256238
def remove_port(zone, port, permanent=True):
    '''
    
    '''
    cmd = '--zone={0} --remove-port={1}'.format(zone, port)

    if permanent:
        cmd += ' --permanent'

    return __firewall_cmd(cmd)
1202774
def parse_vlan_range_mappings(mappings):
    
    _mappings = parse_mappings(mappings)
    if not _mappings:
        return {}

    mappings = {}
    for p, r in six.iteritems(_mappings):
        mappings[p] = tuple(r.split(':'))

    return mappings
23650
def remove_vm_slot_option(self, vmname, slot, option):
        
        if not isinstance(vmname, basestring):
            raise TypeError("vmname can only be an instance of type basestring")
        if not isinstance(slot, baseinteger):
            raise TypeError("slot can only be an instance of type baseinteger")
        if not isinstance(option, DhcpOpt):
            raise TypeError("option can only be an instance of type DhcpOpt")
        self._call("removeVmSlotOption",
                     in_p=[vmname, slot, option])
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
1212952
async def delete_port_mapping(self, external_port: int, protocol: str) -> None:
        
        return await self.gateway.commands.DeletePortMapping(
            NewRemoteHost="", NewExternalPort=external_port, NewProtocol=protocol
        )
344610
def adapter_remove_nio_binding(self, adapter_number):
        

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

        if self.is_running():
            yield from self._ubridge_send("bridge delete {name}".format(name="VBOX-{}-{}".format(self._id, adapter_number)))
        vm_state = yield from self._get_vm_state()
        if vm_state == "running":
            yield from self._control_vm("setlinkstate{} off".format(adapter_number + 1))

        nio = adapter.get_nio(0)
        if isinstance(nio, NIOUDP):
            self.manager.port_manager.release_udp_port(nio.lport, self._project)
        adapter.remove_nio(0)

        log.info("VirtualBox VM '{name}' [{id}]: {nio} removed from adapter {adapter_number}".format(name=self.name,
                                                                                                     id=self.id,
                                                                                                     nio=nio,
                                                                                                     adapter_number=adapter_number))
        return nio
907652
synchronized boolean removeMapping(String virtualHost, HttpContext context)
    {
        boolean existing=false;
        if (_virtualHostMap!=null)
        {
            PathMap contextMap=(PathMap)_virtualHostMap.get(virtualHost);
            
            Iterator i2=contextMap.values().iterator();
            while(i2.hasNext())
            {
                List contextList = (List)i2.next();
                if (contextList.remove(context))
                    existing=true;                
                if (contextList.size()==0)
                    i2.remove();
            }
        }
        return existing;
    }
1122156
def _remove_vlan_from_all_service_profiles(self, handle, vlan_id, ucsm_ip):
        """"""
        service_profile_list = []
        for key, value in six.iteritems(self.ucsm_sp_dict):
            if (ucsm_ip in key) and value:
                service_profile_list.append(value)

        if not service_profile_list:
            # Nothing to do
            return

        try:
            for service_profile in service_profile_list:
                virtio_port_list = (
                    CONF.ml2_cisco_ucsm.ucsms[ucsm_ip].ucsm_virtio_eth_ports)
                eth_port_paths = ["%s%s" % (service_profile, ep)
                    for ep in virtio_port_list]

                # 1. From the Service Profile config, access the
                # configuration for its ports.
                # 2. Check if that Vlan has been configured on each port
                # 3. If Vlan config found, remove it.
                obj = handle.query_dn(service_profile)

                if obj:
                    # Check if this vlan_id has been configured on the
                    # ports in this Service profile
                    for eth_port_path in eth_port_paths:
                        eth = handle.query_dn(eth_port_path)
                        if eth:
                            vlan_name = self.make_vlan_name(vlan_id)
                            vlan_path = eth_port_path + "/if-" + vlan_name
                            vlan = handle.query_dn(vlan_path)
                            if vlan:
                                # Found vlan config. Now remove it.
                                handle.remove_mo(vlan)
            handle.commit()

        except Exception as e:
            # Raise a Neutron exception. Include a description of
            # the original  exception.
            raise cexc.UcsmConfigDeleteFailed(config=vlan_id,
                                              ucsm_ip=ucsm_ip,
                                              exc=e)
1023061
def delete_vlan(self, nexus_host, vlanid):
        """"""
        starttime = time.time()

        path_snip = snipp.PATH_VLAN % vlanid
        self.client.rest_delete(path_snip, nexus_host)

        self.capture_and_print_timeshot(
            starttime, "del_vlan",
            switch=nexus_host)