Return a set of facts from the devices.
190966
def get_facts(self):
        """"""
        # default values.
        vendor = "Cisco"
        uptime = -1
        serial_number, fqdn, os_version, hostname, domain_name, model = ("",) * 6

        # obtain output from device
        show_ver = self._send_command("show version")
        show_hosts = self._send_command("show hosts")
        show_int_status = self._send_command("show interface status")
        show_hostname = self._send_command("show hostname")

        # uptime/serial_number/IOS version
        for line in show_ver.splitlines():
            if " uptime is " in line:
                _, uptime_str = line.split(" uptime is ")
                uptime = self.parse_uptime(uptime_str)

            if "Processor Board ID" in line:
                _, serial_number = line.split("Processor Board ID ")
                serial_number = serial_number.strip()

            if "system: " in line or "NXOS: " in line:
                line = line.strip()
                os_version = line.split()[2]
                os_version = os_version.strip()

            if "cisco" in line and "hassis" in line:
                match = re.search(r".cisco (.*) \(", line)
                if match:
                    model = match.group(1).strip()
                match = re.search(r".cisco (.* [cC]hassis)", line)
                if match:
                    model = match.group(1).strip()

        hostname = show_hostname.strip()

        # Determine domain_name and fqdn
        for line in show_hosts.splitlines():
            if "Default domain" in line:
                _, domain_name = re.split(r".*Default domain.*is ", line)
                domain_name = domain_name.strip()
                break
        if hostname.count(".") >= 2:
            fqdn = hostname
            # Remove domain name from hostname
            if domain_name:
                hostname = re.sub(re.escape(domain_name) + "$", "", hostname)
                hostname = hostname.strip(".")
        elif domain_name:
            fqdn = "{}.{}".format(hostname, domain_name)

        # interface_list filter
        interface_list = []
        show_int_status = show_int_status.strip()
        # Remove the header information
        show_int_status = re.sub(
            r"(?:^---------+$|^Port .*$|^ .*$)", "", show_int_status, flags=re.M
        )
        for line in show_int_status.splitlines():
            if not line:
                continue
            interface = line.split()[0]
            # Return canonical interface name
            interface_list.append(helpers.canonical_interface_name(interface))

        return {
            "uptime": int(uptime),
            "vendor": vendor,
            "os_version": py23_compat.text_type(os_version),
            "serial_number": py23_compat.text_type(serial_number),
            "model": py23_compat.text_type(model),
            "hostname": py23_compat.text_type(hostname),
            "fqdn": fqdn,
            "interface_list": interface_list,
        }
343264
def dataset(self):
        """"""
        data = tablib.Dataset()
        data.headers = self.keys()

        row = _reduce_datetimes(self.values())
        data.append(row)

        return data
3816
def items(self):
        ""
        return (list(self._pb.IntMap.items()) + list(self._pb.StringMap.items()) +
                list(self._pb.FloatMap.items()) + list(self._pb.BoolMap.items()))
39283
def facts():
    '''
    
    '''
    ret = {}
    try:
        ret['facts'] = __proxy__['junos.get_serialized_facts']()
        ret['out'] = True
    except Exception as exception:
        ret['message'] = 'Could not display facts due to "{0}"'.format(
            exception)
        ret['out'] = False
    return ret
437534
def get_info(self):
        ''''''
        if self._min_disk:
            for path in self._resource_paths:
                usage = psutil.disk_usage(path)

                yield ResourceInfo(path, usage.free, self._min_disk)

        if self._min_memory:
            usage = psutil.virtual_memory()

            yield ResourceInfo(None, usage.available, self._min_memory)
230203
def getDevices(self, status=None):
        
        return [d for d in self.devices.values() if status is None or d.payload.get('status') == status]
1260681
def get_device_names_to_objects(devices):
    '''
    '''

    name_to_object = {}
    for device in devices:
        device_name = get_device_info(device).name
        name_to_object[device_name] = device
    return name_to_object
829342
def scan(self):
        """"""
        devices = []
        diff = 65
        rom = False
        count = 0
        for _ in range(0xff):
            rom, diff = self._search_rom(rom, diff)
            if rom:
                count += 1
                if count > self.maximum_devices:
                    raise RuntimeError(
                        "Maximum device count of {} exceeded."\
                        .format(self.maximum_devices))
                devices.append(OneWireAddress(rom))
            if diff == 0:
                break
        return devices
43417
def info(self):
        """"""

        return self._h._get_resource(
            resource=('apps', self.name),
            obj=App,
        )
244558
def parse_devices(self):
        """"""
        devices = []
        for device in self._channel_dict["devices"]:
            devices.append(Device(device, self._is_sixteen_bit, self._ignore_list))
        return devices
685510
def retrieveVals(self):
        """"""
        if self._diskList:
            self._fetchDevAll('disk', self._diskList, 
                              self._info.getDiskStats)
        if self._mdList:
            self._fetchDevAll('md', self._mdList, 
                              self._info.getMDstats)
        if self._partList:
            self._fetchDevAll('part', self._partList, 
                              self._info.getPartitionStats) 
        if self._lvList:
            self._fetchDevAll('lv', self._lvList, 
                              self._info.getLVstats)
        self._fetchDevAll('fs', self._fsList, 
                          self._info.getFilesystemStats)
704717
def facts(self):
        """"""
        fact = lib.EnvGetNextFact(self._env, ffi.NULL)

        while fact != ffi.NULL:
            yield new_fact(self._env, fact)

            fact = lib.EnvGetNextFact(self._env, fact)
1328435
def info(self):
        """"""
        return {'coordinates': self._coordinates(),
                'imageinfo': self._imageinfo(),
                'miscinfo': self._miscinfo(),
                'unit': self._unit()
                }
1326656
def info(self):
        """"""
        info = []
        # meta data
        meta = self.meta
        for key in meta:
            info.append((key, self.meta[key]))
        # background correction
        for imdat in [self._amp, self._pha]:
            info += imdat.info
        return info
36013
def devices(self):
        """"""
        return [StartActionItem(
            self.start_action,
            i,
            self.state,
            self.path,
            self.raw) for i in range(
                len(self.raw[ROOT_START_ACTION]))]
1266679
def get_fact(fixture, fact_name)
      pointer = fixture.facts

      # Get the fact of interest from the fixture, whether structured or not.
      components = fact_name.split(".")
      first_component = components.shift
      return unless pointer.key?(first_component)

      # For simple non-structured facts, just return the value.
      return pointer[first_component].value if components.empty?

      # Structured facts: dig into the structure.
      pointer = pointer[first_component].value
      last_component = components.pop
      components.each do |part|
        return unless pointer.key?(part)
        return unless pointer[part].is_a?(Hash)
        pointer = pointer[part]
      end
      pointer[last_component]
    end
857524
def extract_facts(rule):
    """"""
    def _extract_facts(ce):
        if isinstance(ce, Fact):
            yield ce
        elif isinstance(ce, TEST):
            pass
        else:
            for e in ce:
                yield from _extract_facts(e)

    return set(_extract_facts(rule))