def vlanid=(vlan)

  end
771119
def parse(landata)
      if !landata.nil? && !landata.empty?
        landata.lines.each do |line|
          # clean up the data from spaces
          next if line.match(/#+/)
          next if line.match(/Section/i)
          line.gsub!(/\t/, '')
          item = line.split(/\s+/)
          key = item.first.strip.downcase
          value = item.last.strip
          @info[key] = value
        end
      end
      @info
    end
478246
def mac(self):
        
        res = 'Port       Mac                VLAN\n'
        result = (yield from self._node._hypervisor.send('ethsw show_mac_addr_table {}'.format(self._node.name)))
        for line in result:
            mac, vlan, nio = line.replace('  ', ' ').split(' ')
            mac = mac.replace('.', '')
            mac = "{}:{}:{}:{}:{}:{}".format(
                mac[0:2],
                mac[2:4],
                mac[4:6],
                mac[6:8],
                mac[8:10],
                mac[10:12])
            for port_number, switch_nio in self._node.nios.items():
                if switch_nio.name == nio:
                    res += 'Ethernet' + str(port_number) + '  ' + mac + '  ' + vlan + '\n'
                    break
        return res
501203
def default(self, vid):
        
        command = 'default vlan %s' % vid
        return self.configure(command) if isvlan(vid) else False
868430
def set_all_vlan_states(self, nexus_host, vlanid_range):
        """"""

        starttime = time.time()

        if not vlanid_range:
            LOG.warning("Exiting set_all_vlan_states: "
                        "No vlans to configure")
            return

        # Eliminate possible whitespace and separate vlans by commas
        vlan_id_list = re.sub(r'\s', '', vlanid_range).split(',')
        if not vlan_id_list or not vlan_id_list[0]:
            LOG.warning("Exiting set_all_vlan_states: "
                        "No vlans to configure")
            return

        path_str, body_vlan_all = self.start_create_vlan()
        while vlan_id_list:
            rangev = vlan_id_list.pop(0)
            if '-' in rangev:
                fr, to = rangev.split('-')
                max = int(to) + 1
                for vlan_id in range(int(fr), max):
                    body_vlan_all = self.get_create_vlan(
                        nexus_host, vlan_id, 0, body_vlan_all)
            else:
                body_vlan_all = self.get_create_vlan(
                    nexus_host, rangev, 0, body_vlan_all)

        body_vlan_all = self.end_create_vlan(body_vlan_all)
        self.send_edit_string(
            nexus_host, path_str, body_vlan_all)

        self.capture_and_print_timeshot(
            starttime, "set_all_vlan_states",
            switch=nexus_host)
1038150
def delete(self, ids):
        
        url = build_uri_with_ids('api/v3/vlan/%s/', ids)

        return super(ApiVlan, self).delete(url)
803389
def client_end_all():
    
    for request, socket, context in CLIENTS.values()[:]:
        client_end(request, socket, context)
574240
def create_vlan(self):
        """"""
        return Vlan(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1129181
def device=(veth)
      sudo "ip link set dev #{veth} netns #{name}"

      vlan_suffix = @vlan ? ".#{@vlan}" : ''
      if @vlan
        sudo "ip netns exec #{name} ip link set #{veth} up"
        sudo "ip netns exec #{name} "\
             "ip link add link #{veth} name "\
             "#{veth}#{vlan_suffix} type vlan id #{@vlan}"
      end
      if @mac_address
        sudo "ip netns exec #{name} "\
             "ip link set #{veth}#{vlan_suffix} address #{@mac_address}"
      end
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"
      sudo "ip netns exec #{name} "\
           "ip addr replace #{@ip_address}/#{@netmask} "\
           "dev #{veth}#{vlan_suffix}"
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"

      @route.add name
    end
80421
def _port_action_vlan(self, port, segment, func, vni):
        """"""

        # Verify segment.
        if not self._is_valid_segment(segment):
            return

        device_id = self._get_port_uuid(port)

        if nexus_help.is_baremetal(port):
            host_id = port.get('dns_name')
        else:
            host_id = port.get(bc.portbindings.HOST_ID)

        vlan_id = segment.get(api.SEGMENTATION_ID)
        is_provider = nxos_db.is_provider_vlan(vlan_id)

        settings = {"vlan_id": vlan_id,
                    "device_id": device_id,
                    "host_id": host_id}
        missing_fields = [field for field, value in settings.items()
                          if (field != 'host_id' and not value)]
        if not missing_fields:
            func(port, vlan_id, device_id, host_id, vni, is_provider)
        else:
            raise excep.NexusMissingRequiredFields(
                fields=' '.join(missing_fields))
925613
def bd_total_range_with_vlans
      hash = Vlan.vlans
      arr = []
      hash.keys.each do |id|
        arr << id.to_i
      end
      Utils.array_to_str(arr)
      ret_arr = []
      ret_arr << Utils.array_to_str(arr)
    end
386971
def create_vlan(self, nexus_host, vlanid, vni):
        """"""

        starttime = time.time()
        path_snip, body_snip = self.start_create_vlan()
        body_snip = self.get_create_vlan(nexus_host, vlanid, vni, body_snip)
        body_snip = self.end_create_vlan(body_snip)

        self.send_edit_string(nexus_host, path_snip, body_snip)

        self.capture_and_print_timeshot(
            starttime, "create_vlan_seg",
            switch=nexus_host)
838536
def configure_vlan(self, vid, commands):
        
        commands = make_iterable(commands)
        commands.insert(0, 'vlan %s' % vid)
        return self.configure(commands)
974666
def get_vlan_from_query_reply(self, reply, vsiid, mac):
        
        hints_ret, fail_reason = self.check_hints(reply)
        if not hints_ret:
            LOG.error("Incorrect hints found %s", reply)
            return constants.INVALID_VLAN, fail_reason
        check_filter, fail_reason = self.check_filter_validity(reply, "filter")
        if not check_filter:
            return constants.INVALID_VLAN, fail_reason
        try:
            verify_flag, fail_reason = self.crosscheck_query_vsiid_mac(
                reply, vsiid, mac)
            if not verify_flag:
                return constants.INVALID_VLAN, fail_reason
            filter_val = reply.partition("filter")[2]
            len_fil = len(filter_val)
            vlan_val = filter_val[4:len_fil].split('-')[0]
            vlan = int(vlan_val)
        except ValueError:
            fail_reason = vdp_const.format_failure_reason % (reply)
            LOG.error("%s", fail_reason)
            return constants.INVALID_VLAN, fail_reason
        return vlan, None
636876
def ltrim(self, name, start, end):
        
        with self.pipe as pipe:
            return pipe.ltrim(self.redis_key(name), start, end)
1298041
def addr=(addr)
      @addr = addr
      @me = Node.new @id, @addr, true
      Directory[@id].address = addr
      ObjectSpace.define_finalizer(me, proc { Directory.remove @id })
    end
603259
def cli(env, identifier):
    """"""

    mgr = SoftLayer.FirewallManager(env.client)
    firewall_type, firewall_id = firewall.parse_id(identifier)

    if not (env.skip_confirmations or
            formatting.confirm("This action will cancel a firewall from your "
                               "account. Continue?")):
        raise exceptions.CLIAbort('Aborted.')

    if firewall_type in ['vs', 'server']:
        mgr.cancel_firewall(firewall_id, dedicated=False)
    elif firewall_type == 'vlan':
        mgr.cancel_firewall(firewall_id, dedicated=True)
    else:
        raise exceptions.CLIAbort('Unknown firewall type: %s' % firewall_type)

    env.fout('Firewall with id %s is being cancelled!' % identifier)
1310113
def _finalize():
    """"""
    from .memory import MemBlock
    from pyrtl.corecircuits import select
    for lhs in _predicate_map:
        # handle memory write ports
        if isinstance(lhs, MemBlock):
            p, (addr, data, enable) = _predicate_map[lhs][0]
            combined_enable = select(p, truecase=enable, falsecase=Const(0))
            combined_addr = addr
            combined_data = data

            for p, (addr, data, enable) in _predicate_map[lhs][1:]:
                combined_enable = select(p, truecase=enable, falsecase=combined_enable)
                combined_addr = select(p, truecase=addr, falsecase=combined_addr)
                combined_data = select(p, truecase=data, falsecase=combined_data)

            lhs._build(combined_addr, combined_data, combined_enable)

        # handle wirevector and register assignments
        else:
            if isinstance(lhs, Register):
                result = lhs  # default for registers is "self"
            elif isinstance(lhs, WireVector):
                result = 0  # default for wire is "0"
            else:
                raise PyrtlInternalError('unknown assignment in finalize')
            predlist = _predicate_map[lhs]
            for p, rhs in predlist:
                result = select(p, truecase=rhs, falsecase=result)
            lhs._build(result)