--------------------------
 interf_vlan_list_delta is a helper function for the private_vlan_mapping
 property. It walks the delta hash and adds/removes each target private
 vlan.
968034
def interf_vlan_list_delta(property, is_list, should_list)
      pr_vlan = should_list[0]
      if is_list[0].eql? should_list[0]
        should_list = should_list[1].split(',')
        is_list = is_list[1].split(',')

        should_list_new = prepare_array(should_list)
        is_list_new = prepare_array(is_list)
        configure_private_vlan_host_property(property, should_list_new,
                                             is_list_new, pr_vlan)
      else
        case property
        when :mapping_trunk
          return
        end
        # If primary vlan are different we can simply replacing the all
        # config
        if should_list == default_switchport_mode_private_vlan_host_promisc
          result = config_set('DEPRECATED',
                              'switchport_mode_private_vlan_host_promiscous',
                              name: @name, state: 'no',
                              vlan_pr: '', vlans: '')

        else
          result = config_set('DEPRECATED',
                              'switchport_mode_private_vlan_host_promiscous',
                              name: @name, state: '',
                              vlan_pr: pr_vlan, vlans: should_list[1])

        end
        cli_error_check(result)
      end
    end
672347
private static void compareLists(Delta delta, Collection deltas, LinkedList stack, ID idFetcher)
    {
        List srcList = (List) delta.srcValue;
        List targetList = (List) delta.targetValue;
        int srcLen = srcList.size();
        int targetLen = targetList.size();

        if (srcLen != targetLen)
        {
            delta.setCmd(LIST_RESIZE);
            delta.setOptionalKey(targetLen);
            deltas.add(delta);
        }

        final String sysId = "(" + System.identityHashCode(srcList) + ')';
        for (int i = targetLen - 1; i >= 0; i--)
        {
            final Object targetValue = targetList.get(i);
            String srcPtr = sysId + '{' + i + '}';

            if (i < srcLen)
            {   // Do positional check
                final Object srcValue = srcList.get(i);

                if (targetValue == null || srcValue == null)
                {
                    if (srcValue != targetValue)
                    {   // element was nulled out, create a command to copy it (no need to recurse [add to stack] because null has no depth)
                        copyListElement(delta, deltas, srcPtr, srcValue, targetValue, i);
                    }
                }
                else if (isIdObject(srcValue, idFetcher) && isIdObject(targetValue, idFetcher))
                {
                    Object srcId = idFetcher.getId(srcValue);
                    Object targetId = idFetcher.getId(targetValue);

                    if (targetId.equals(srcId))
                    {   // No need to copy, same object in same List position, but it's fields could have changed, so add the object to
                        // the stack for further graph delta comparison.
                        stack.push(new Delta(delta.id, delta.fieldName, srcPtr, srcValue, targetValue, i));
                    }
                    else
                    {   // IDs do not match?  issue a set-element-command
                        copyListElement(delta, deltas, srcPtr, srcValue, targetValue, i);
                    }
                }
                else if (!DeepEquals.deepEquals(srcValue, targetValue))
                {
                    copyListElement(delta, deltas, srcPtr, srcValue, targetValue, i);
                }
            }
            else
            {   // Target is larger than source - elements have been added, issue a set-element-command for each new position one at the end
                copyListElement(delta, deltas, srcPtr, null, targetValue, i);
            }
        }
    }
1216817
def list_nodes(conn=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called with -f or --function.'
        )

    if not conn:
        conn = get_conn()   # pylint: disable=E0602

    nodes = conn.list_nodes()
    ret = {}
    for node in nodes:
        ret[node.name] = {
            'id': node.id,
            'image': node.image,
            'name': node.name,
            'private_ips': node.private_ips,
            'public_ips': node.public_ips,
            'size': node.size,
            'state': node_state(node.state)
        }
    return ret
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)
280614
def subnets_list(resource_group_name, vnet_name, address_prefix = nil)
      list = network_resource_client.subnets.list(resource_group_name, vnet_name)
      !address_prefix.nil? && !list.empty? ? subnets_list_for_specific_address_space(address_prefix, list) : list
    end
855842
def get_interface_addresses():
    

    addresses = []
    ifaces = netifaces.interfaces()
    for iface in ifaces:
        addrs = netifaces.ifaddresses(iface)
        families = addrs.keys()

        # put IPv4 to the end so it lists as the main iface address
        if netifaces.AF_INET in families:
            families.remove(netifaces.AF_INET)
            families.append(netifaces.AF_INET)

        for family in families:
            for addr in addrs[family]:
                address = {
                    'name': iface,
                    'family': family,
                    'ip': addr['addr'],
                }
                addresses.append(address)

    return addresses
708864
def ipv6_range_to_list(start_packed, end_packed):
    

    new_list = list()
    start = int(binascii.hexlify(start_packed), 16)
    end = int(binascii.hexlify(end_packed), 16)
    for value in range(start, end + 1):
        high = value >> 64
        low = value & ((1 << 64) - 1)
        new_ip = inet_ntop(socket.AF_INET6,
                           struct.pack('!2Q', high, low))
        new_list.append(new_ip)
    return new_list
896424
def network_list(provider):
    '''
    

    '''
    client = _get_client()
    return client.extra_action(action='network_list', provider=provider, names='names')
980760
function Delta(id, silent) {
    var scutt = Scuttlebutt(id)
        , delta = new EventEmitter()
        , updates = {}
        , state = { id: scutt.id }
        , log = silent ? noop : error

    id = delta.id = scutt.id

    scutt.applyUpdate = applyUpdate
    // history is a global variable -.-
    scutt.history = $history

    delta.validate = validate
    delta.set = set
    delta.get = get
    delta.has = has
    // stupid tokens
    delta.delete = $delete
    delta.toJSON = toJSON
    delta.createStream = scutt.createStream.bind(scutt)

    return delta

    function applyUpdate(update) {
        var key = update[0]
            , value = update[1]
            , recentUpdate = updates[key]

        // If the most recent update for that key is newer then the incoming
        // update. Then ignore it
        if (recentUpdate && recentUpdate[2] > update[2]) {
            return
        }

        updates[key] = update

        if (value === undefined) {
            delete state[key]
        } else {
            state[key] = value
        }

        delta.emit("change", key, value)
        delta.emit("change:" + key, value)

        return true
    }

    function $history(sources) {
        return reduce(updates, isRecent, sources, []).sort(byTimestamp)
    }

    function validate(changes) {
        try {
            delta.emit("validate", changes)
            return true
        } catch (e) {
            log("[DELTA-STREAM]: validation", e.message, e)
            return false
        }
    }

    function set(key, value) {
        if (key === "id" && value !== id) {
            console.log("invalid", key, value)
            throw Error("id cannot be changed")
        }

        if (typeof key === "string") {
            scutt.localUpdate(key, value)
        } else {
            forEach(key, setKeyValue)
        }
    }

    function setKeyValue(value, key) {
        set(key, value)
    }

    function get(key) {
        return state[key]
    }

    function has(key) {
        return key in state
    }

    function $delete(key) {
        set(key, undefined)
    }

    function toJSON() {
        return state
    }
}
9633
def ifaces(cls, name):
        
        ifaces = Iface.list({'vlan_id': cls.usable_id(name)})
        ret = []
        for iface in ifaces:
            ret.append(Iface.info(iface['id']))
        return ret
842835
def create_vlan(self, id_vlan):
        

        vlan_map = dict()

        vlan_map['vlan_id'] = id_vlan

        code, xml = self.submit({'vlan': vlan_map}, 'PUT', 'vlan/create/')

        return self.response(code, xml)
442723
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:
            handle.StartTransaction()
            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.GetManagedObject(
                        None,
                        self.ucsmsdk.LsServer.ClassId(),
                        {self.ucsmsdk.LsServer.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.GetManagedObject(
                            obj, self.ucsmsdk.VnicEther.ClassId(),
                            {self.ucsmsdk.VnicEther.DN: eth_port_path},
                            True)
                        if eth:
                            vlan_name = self.make_vlan_name(vlan_id)
                            vlan_path = eth_port_path + "/if-" + vlan_name
                            vlan = handle.GetManagedObject(eth,
                                self.ucsmsdk.VnicEtherIf.ClassId(),
                                {self.ucsmsdk.VnicEtherIf.DN: vlan_path})
                            if vlan:
                                # Found vlan config. Now remove it.
                                handle.RemoveManagedObject(vlan)
            handle.CompleteTransaction()

        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)
229831
def change_vlan_id(self, vlan_id):
        
        first, _ = self.nicid.split('.')
        self.update(nicid='{}.{}'.format(first, str(vlan_id)))
464616
def list_nodes(call=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes function must be called '
            'with -f or --function.'
        )

    providers = __opts__.get('providers', {})

    ret = {}
    providers_to_check = [_f for _f in [cfg.get('libvirt') for cfg in six.itervalues(providers)] if _f]
    for provider in providers_to_check:
        conn = __get_conn(provider['url'])
        domains = conn.listAllDomains()
        for domain in domains:
            data = {
                'id': domain.UUIDString(),
                'image': '',
                'size': '',
                'state': VIRT_STATE_NAME_MAP[domain.state()[0]],
                'private_ips': [],
                'public_ips': get_domain_ips(domain, libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)}
            # TODO: Annoyingly name is not guaranteed to be unique, but the id will not work in other places
            ret[domain.name()] = data

    return ret
702738
def ipv4_range_to_list(start_packed, end_packed):
    

    new_list = list()
    start = struct.unpack('!L', start_packed)[0]
    end = struct.unpack('!L', end_packed)[0]
    for value in range(start, end + 1):
        new_ip = socket.inet_ntoa(struct.pack('!L', value))
        new_list.append(new_ip)
    return new_list
185499
def fill_dcnm_net_info(self, tenant_id, direc, vlan_id=0,
                           segmentation_id=0):
        
        serv_obj = self.get_service_obj(tenant_id)
        fw_dict = serv_obj.get_fw_dict()
        fw_id = fw_dict.get('fw_id')
        net_dict = {'status': 'ACTIVE', 'admin_state_up': True,
                    'tenant_id': tenant_id, 'provider:network_type': 'local',
                    'vlan_id': vlan_id, 'segmentation_id': segmentation_id}
        if vlan_id == 0:
            net_dict.update({'mob_domain': False, 'mob_domain_name': None})
        else:
            net_dict.update({'mob_domain': True})
        # TODO(padkrish) NWK ID are not filled.
        if direc == 'in':
            name = fw_id[0:4] + fw_const.IN_SERVICE_NWK + (
                fw_id[len(fw_id) - 4:])
            net_dict.update({'name': name, 'part_name': None,
                             'config_profile': self.serv_host_prof,
                             'fwd_mode': self.serv_host_mode})
        else:
            name = fw_id[0:4] + fw_const.OUT_SERVICE_NWK + (
                fw_id[len(fw_id) - 4:])
            net_dict.update({'name': name,
                             'part_name': fw_const.SERV_PART_NAME,
                             'config_profile': self.serv_ext_prof,
                             'fwd_mode': self.serv_ext_mode})
        return net_dict
226062
def attach_intf_router(self, tenant_id, tenant_name, router_id):
        
        in_sub = self.get_in_subnet_id(tenant_id)
        out_sub = self.get_out_subnet_id(tenant_id)
        # Modify Hard coded Name fixme
        subnet_lst = set()
        subnet_lst.add(in_sub)
        subnet_lst.add(out_sub)
        ret = self.os_helper.add_intf_router(router_id, tenant_id, subnet_lst)
        return ret, in_sub, out_sub