List VRFs.

            Maps to the function :py:func:`nipap.backend.Nipap.list_vrf` in the
            backend. Please see the documentation for the backend function for
            information regarding input arguments and return values.
420936
def list(cls, vrf=None):
        

        if vrf is None:
            vrf = {}

        xmlrpc = XMLRPCConnection()
        try:
            vrf_list = xmlrpc.connection.list_vrf(
                {
                    'vrf': vrf,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)

        res = list()
        for v in vrf_list:
            res.append(VRF.from_dict(v))

        return res
317321
def list_folders(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_folders function must be called with '
            '-f or --function.'
        )

    return {'Folders': salt.utils.vmware.list_folders(_get_si())}
150435
def map(self, func):
        
        return TList([func(k, v) for k, v in self.items()])
334613
def list(self, filterfn=lambda x: True):
        
        return [self / p for p in self.listdir() if filterfn(self / p)]
309488
def get_network_instances(self, name=""):
        

        # command 'show vrf detail' returns all VRFs with detailed information
        # format: list of dictionaries with keys such as 'vrf_name' and 'rd'
        command = "show vrf detail"
        vrf_table_raw = self._get_command_table(command, "TABLE_vrf", "ROW_vrf")

        # command 'show vrf interface' returns all interfaces including their assigned VRF
        # format: list of dictionaries with keys 'if_name', 'vrf_name', 'vrf_id' and 'soo'
        command = "show vrf interface"
        intf_table_raw = self._get_command_table(command, "TABLE_if", "ROW_if")

        # create a dictionary with key = 'vrf_name' and value = list of interfaces
        vrf_intfs = defaultdict(list)
        for intf in intf_table_raw:
            vrf_intfs[intf["vrf_name"]].append(py23_compat.text_type(intf["if_name"]))

        vrfs = {}
        for vrf in vrf_table_raw:
            vrf_name = py23_compat.text_type(vrf.get("vrf_name"))
            vrfs[vrf_name] = {}
            vrfs[vrf_name]["name"] = vrf_name

            # differentiate between VRF type 'DEFAULT_INSTANCE' and 'L3VRF'
            if vrf_name == "default":
                vrfs[vrf_name]["type"] = "DEFAULT_INSTANCE"
            else:
                vrfs[vrf_name]["type"] = "L3VRF"

            vrfs[vrf_name]["state"] = {
                "route_distinguisher": py23_compat.text_type(vrf.get("rd"))
            }

            # convert list of interfaces (vrf_intfs[vrf_name]) to expected format
            # format = dict with key = interface name and empty values
            vrfs[vrf_name]["interfaces"] = {}
            vrfs[vrf_name]["interfaces"]["interface"] = dict.fromkeys(
                vrf_intfs[vrf_name], {}
            )

        # if name of a specific VRF was passed as an argument
        # only return results for this particular VRF
        if name:
            if name in vrfs.keys():
                return {py23_compat.text_type(name): vrfs[name]}
            else:
                return {}
        # else return results for all VRFs
        else:
            return vrfs
504678
def list_items(self, package_keyname, **kwargs):
        
        get_kwargs = {}
        get_kwargs['mask'] = kwargs.get('mask', ITEM_MASK)

        if 'filter' in kwargs:
            get_kwargs['filter'] = kwargs['filter']

        package = self.get_package_by_key(package_keyname, mask='id')
        items = self.package_svc.getItems(id=package['id'], **get_kwargs)
        return items
555561
def vrrp_list(app, instance_name=None):
    
    list_request = vrrp_event.EventVRRPListRequest(instance_name)
    list_request.dst = vrrp_event.VRRP_MANAGER_NAME
    return app.send_request(list_request)
1164349
def sr_list(call=None):
    '''
    

    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'This function must be called with -f, --function argument.'
        )
    ret = {}
    session = _get_session()
    srs = session.xenapi.SR.get_all()
    for sr in srs:
        sr_record = session.xenapi.SR.get_record(sr)
        ret[sr_record['name_label']] = sr_record
    return ret
470779
def map(self, callback):
        
        return self.__class__(list(map(callback, self.items)))
456216
def map(self, function):
        
        if isinstance(self.slice, slice):
            for i in range(*self.slice.indices(len(self.layout.fields))):
                function(self.layout.fields[i])

        elif isinstance(self.slice, list):
            # A list of pointers  Ex: [[[0, 0], 'div'], [[0, 2, 3], 'field_name']]
            for pointer in self.slice:
                position = pointer[0]

                layout_object = self.layout.fields[position[0]]
                for i in position[1:]:
                    previous_layout_object = layout_object
                    layout_object = layout_object.fields[i]

                # If update_attrs is applied to a string, we call to its wrapping layout object
                if (
                    function.__name__ == 'update_attrs'
                    and isinstance(layout_object, string_types)
                ):
                    function(previous_layout_object)
                else:
                    function(layout_object)
179306
def add_vrf(arg, opts, shell_opts):
    

    v = VRF()
    v.rt = opts.get('rt')
    v.name = opts.get('name')
    v.description = opts.get('description')
    v.tags = list(csv.reader([opts.get('tags', '')], escapechar='\\'))[0]

    for avp in opts.get('extra-attribute', []):
        try:
            key, value = avp.split('=', 1)
        except ValueError:
            print("ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp, file=sys.stderr)
            return
        v.avps[key] = value

    try:
        v.save()
    except pynipap.NipapError as exc:
        print("Could not add VRF to NIPAP: %s" % str(exc), file=sys.stderr)
        sys.exit(1)

    print("Added %s" % (vrf_format(v)))
1018954
def list_datastores(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_datastores function must be called with '
            '-f or --function.'
        )

    return {'Datastores': salt.utils.vmware.list_datastores(_get_si())}
953188
def view_vrf(arg, opts, shell_opts):
    

    if arg is None:
        print("ERROR: Please specify the RT of the VRF to view.", file=sys.stderr)
        sys.exit(1)

    # interpret as default VRF (ie, RT = None)
    if arg.lower() in ('-', 'none'):
        arg = None

    try:
        v = VRF.search({
            'val1': 'rt',
            'operator': 'equals',
            'val2': arg }
            )['result'][0]
    except (KeyError, IndexError):
        print("VRF with [RT: %s] not found." % str(arg), file=sys.stderr)
        sys.exit(1)

    print("-- VRF")
    print("  %-26s : %d" % ("ID", v.id))
    print("  %-26s : %s" % ("RT", v.rt))
    print("  %-26s : %s" % ("Name", v.name))
    print("  %-26s : %s" % ("Description", v.description))

    print("-- Extra Attributes")
    if v.avps is not None:
        for key in sorted(v.avps, key=lambda s: s.lower()):
            print("  %-26s : %s" % (key, v.avps[key]))

    print("-- Tags")
    for tag_name in sorted(v.tags, key=lambda s: s.lower()):
        print("  %s" % tag_name)
    # statistics
    if v.total_addresses_v4 == 0:
        used_percent_v4 = 0
    else:
        used_percent_v4 = (float(v.used_addresses_v4)/v.total_addresses_v4)*100
    if v.total_addresses_v6 == 0:
        used_percent_v6 = 0
    else:
        used_percent_v6 = (float(v.used_addresses_v6)/v.total_addresses_v6)*100
    print("-- Statistics")
    print("  %-26s : %s" % ("IPv4 prefixes", v.num_prefixes_v4))
    print("  %-26s : %.0f / %.0f (%.2f%% of %.0f)" % ("IPv4 addresses Used / Free",
            v.used_addresses_v4, v.free_addresses_v4, used_percent_v4,
            v.total_addresses_v4))
    print("  %-26s : %s" % ("IPv6 prefixes", v.num_prefixes_v6))
    print("  %-26s : %.4e / %.4e (%.2f%% of %.4e)" % ("IPv6 addresses Used / Free",
            v.used_addresses_v6, v.free_addresses_v6, used_percent_v6,
            v.total_addresses_v6))
63971
def pyvcf_calls_to_sample_info_list(calls):
    
    return OrderedDict(
        (call.sample, call.data._asdict()) for call in calls)
1149288
def list_functions(region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    ret = []
    for funcs in __utils__['boto3.paged_call'](conn.list_functions):
        ret += funcs['Functions']
    return ret
846444
def _map_arguments(self, args):
        
        data = args.get('data')
        comp = args.get('comp')
        library = args.get('library')
        dry_run = args.get('dry_run', False)

        self._set_link('sum-rings', SumRings_SG,
                       library=library,
                       outdir=args['outdir'],
                       dry_run=dry_run)

        self._set_link('srcmaps-diffuse', SrcmapsDiffuse_SG,
                       comp=comp, data=data,
                       library=library,
                       make_xml=args['make_xml'],
                       dry_run=dry_run)

        self._set_link('vstack-diffuse', Vstack_SG,
                       comp=comp, data=data,
                       library=library,
                       dry_run=dry_run)
1374034
def list_action(**kwargs):
    
    def decorator(func):
        func.action = True
        func.detail = False
        func.kwargs = kwargs
        return func
    return decorator