SYSTEM INFORMATION TYPE 13 Section 9.1.43a
488312
def systemInformationType13():
    """"""
    a = L2PseudoLength(l2pLength=0x00)
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x0)  # 00000000
    d = Si13RestOctets()
    packet = a / b / c / d
    return packet
510724
byte type() {
    if( _naCnt == -1 ) {        // No rollups yet?
      int nas=0, es=0, nzs=0, ss=0;
      if( _ds != null && _ms != null ) { // UUID?
        for(int i = 0; i< _sparseLen; i++ )
          if( _xs != null && _xs.get(i)==Integer.MIN_VALUE )  nas++;
          else if( _ds[i] !=0 || _ms.get(i) != 0 ) nzs++;
        _uuidCnt = _len -nas;
      } else if( _ds != null ) { // Doubles?
        assert _xs==null;
        for(int i = 0; i < _sparseLen; ++i) {
          if( Double.isNaN(_ds[i]) ) nas++;
          else if( _ds[i]!=0 ) nzs++;
        }
      } else {
        if( _ms != null && _sparseLen > 0) // Longs and categoricals?
          for(int i = 0; i< _sparseLen; i++ )
            if( isNA2(i) ) nas++;
            else {
              if( isCategorical2(i)   ) es++;
              if( _ms.get(i) != 0 ) nzs++;
            }
        if( _is != null )  // Strings
          for(int i = 0; i< _sparseLen; i++ )
            if( isNA2(i) ) nas++;
            else ss++;
      }
      if (_sparseNA) nas += (_len - _sparseLen);
      _nzCnt=nzs;  _catCnt =es;  _naCnt=nas; _strCnt = ss;
    }
    // Now run heuristic for type
    if(_naCnt == _len)          // All NAs ==> NA Chunk
      return Vec.T_BAD;
    if(_strCnt > 0)
      return Vec.T_STR;
    if(_catCnt > 0 && _catCnt + _naCnt + (isSparseZero()? _len-_sparseLen : 0) == _len)
      return Vec.T_CAT; // All are Strings+NAs ==> Categorical Chunk
    // UUIDs?
    if( _uuidCnt > 0 ) return Vec.T_UUID;
    // Larger of time & numbers
    int nums = _len -_naCnt-_timCnt;
    return _timCnt >= nums ? Vec.T_TIME : Vec.T_NUM;
  }
269357
def hardware_info():
    
    try:
        if sys.platform == 'darwin':
            out = _mac_hardware_info()
        elif sys.platform == 'win32':
            out = _win_hardware_info()
        elif sys.platform in ['linux', 'linux2']:
            out = _linux_hardware_info()
        else:
            out = {}
    except:
        return {}
    else:
        return out
239262
def _sysfs_parse(path, base_attr=None, stats=False, config=False, internals=False, options=False):
    '''
    
    '''
    result = {}

    # ---------------- Parse through the interfaces list ----------------
    intfs = __salt__['sysfs.interfaces'](path)

    # Actions, we ignore
    del intfs['w']

    # -------- Sorting hat --------
    binkeys = []
    if internals:
        binkeys.extend(['inter_ro', 'inter_rw'])
    if config:
        binkeys.append('config')
    if stats:
        binkeys.append('stats')

    bintf = {}
    for key in binkeys:
        bintf[key] = []

    for intf in intfs['r']:
        if intf.startswith('internal'):
            key = 'inter_ro'
        elif 'stats' in intf:
            key = 'stats'
        else:
            # What to do with these???
            # I'll utilize 'inter_ro' as 'misc' as well
            key = 'inter_ro'

        if key in bintf:
            bintf[key].append(intf)

    for intf in intfs['rw']:
        if intf.startswith('internal'):
            key = 'inter_rw'
        else:
            key = 'config'

        if key in bintf:
            bintf[key].append(intf)

    if base_attr is not None:
        for intf in bintf:
            bintf[intf] = [sintf for sintf in bintf[intf] if sintf not in base_attr]
        bintf['base'] = base_attr

    mods = {
        'stats': ['internal/bset_tree_stats', 'writeback_rate_debug', 'metadata_written', 'nbuckets', 'written',
                  'average_key_size', 'btree_cache_size'],
    }

    for modt, modlist in mods.items():
        found = []
        if modt not in bintf:
            continue
        for mod in modlist:
            for intflist in bintf.values():
                if mod in intflist:
                    found.append(mod)
                    intflist.remove(mod)
        bintf[modt] += found

    # -------- Fetch SysFS vals --------
    bintflist = [intf for iflist in bintf.values() for intf in iflist]
    result.update(__salt__['sysfs.read'](bintflist, path))

    # -------- Parse through well known string lists --------
    for strlist in ('writeback_rate_debug', 'internal/bset_tree_stats', 'priority_stats'):
        if strlist in result:
            listres = {}
            for line in result[strlist].split('\n'):
                key, val = line.split(':', 1)
                val = val.strip()
                try:
                    val = int(val)
                except Exception:
                    try:
                        val = float(val)
                    except Exception:
                        pass
                listres[key.strip()] = val
            result[strlist] = listres

    # -------- Parse through selection lists --------
    if not options:
        for sellist in ('cache_mode', 'cache_replacement_policy', 'errors'):
            if sellist in result:
                result[sellist] = re.search(r'\[(.+)\]', result[sellist]).groups()[0]

    # -------- Parse through well known bools --------
    for boolkey in ('running', 'writeback_running', 'congested'):
        if boolkey in result:
            result[boolkey] = bool(result[boolkey])

    # -------- Recategorize results --------
    bresult = {}
    for iftype, intflist in bintf.items():
        ifres = {}
        for intf in intflist:
            if intf in result:
                ifres[intf] = result.pop(intf)
        if ifres:
            bresult[iftype] = ifres

    return bresult
438449
def get_type_data(name):
    
    name = name.upper()
    try:
        return {
            'authority': 'birdland.mit.edu',
            'namespace': 'unit system',
            'identifier': name,
            'domain': 'Unit System Types',
            'display_name': JEFFS_UNIT_SYSTEM_TYPES[name] + ' Unit System Type',
            'display_label': JEFFS_UNIT_SYSTEM_TYPES[name],
            'description': ('The unit system type for the ' +
                            JEFFS_UNIT_SYSTEM_TYPES[name] + ' System')
        }
    except KeyError:
        raise NotFound('Unit System Type: ' + name)
712804
def get_sys_info():
    ""

    blob = []

    # commit = cc._git_hash
    # blob.append(('commit', commit))

    try:
        (sysname, nodename, release, version,
         machine, processor) = platform.uname()
        blob.extend([
            ("python", "%d.%d.%d.%s.%s" % sys.version_info[:]),
            ("python-bits", struct.calcsize("P") * 8),
            ("OS", "%s" % (sysname)),
            ("OS-release", "%s" % (release)),
            # ("Version", "%s" % (version)),
            ("machine", "%s" % (machine)),
            ("processor", "%s" % (processor)),
            # ("byteorder", "%s" % sys.byteorder),
            ("LC_ALL", "%s" % os.environ.get('LC_ALL', "None")),
            ("LANG", "%s" % os.environ.get('LANG', "None")),
            ("LOCALE", "%s.%s" % locale.getlocale()),
        ])
    except Exception:
        pass

    return blob
496446
private function _info()
    {
        foreach ($this->_output as $ups) {

            $dev = new UPSDevice();

            // General info
            $dev->setName("EVER");
            $dev->setMode("PowerSoftPlus");
            $maxpwr = 0;
            $load = null;
            if (preg_match('/^Identifier: UPS Model\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setModel(trim($data[1]));
                if (preg_match('/\s(\d*)[^\d]*$/', trim($data[1]), $number)) {
                    $maxpwr=$number[1]*0.65;
                }
            }
            if (preg_match('/^Current UPS state\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setStatus(trim($data[1]));
            }
            if (preg_match('/^Output load\s*:\s*(.*)\s\[\%\]$/m', $ups, $data)) {
               $load = trim($data[1]);
            }
            //wrong Output load issue
            if (($load == 0) && ($maxpwr != 0) && preg_match('/^Effective power\s*:\s*(.*)\s\[W\]$/m', $ups, $data)) {
                $load = 100.0*trim($data[1])/$maxpwr;
            }
            if ($load != null) {
                $dev->setLoad($load);
            }
            // Battery
            if (preg_match('/^Battery voltage\s*:\s*(.*)\s\[Volt\]$/m', $ups, $data)) {
                $dev->setBatteryVoltage(trim($data[1]));
            }
            if (preg_match('/^Battery state\s*:\s*(.*)$/m', $ups, $data)) {
                if (preg_match('/^At full capacity$/', trim($data[1]))) {
                    $dev->setBatterCharge(100);
                } elseif (preg_match('/^(Discharged)|(Depleted)$/', trim($data[1]))) {
                    $dev->setBatterCharge(0);
                }
            }
            // Line
            if (preg_match('/^Input voltage\s*:\s*(.*)\s\[Volt\]$/m', $ups, $data)) {
                $dev->setLineVoltage(trim($data[1]));
            }
            if (preg_match('/^Input frequency\s*:\s*(.*)\s\[Hz\]$/m', $ups, $data)) {
                $dev->setLineFrequency(trim($data[1]));
            }
            $this->upsinfo->setUpsDevices($dev);
        }
    }
208730
def info(name, root=None):
    '''
    
    '''
    if root is not None:
        getspnam = functools.partial(_getspnam, root=root)
    else:
        getspnam = functools.partial(spwd.getspnam)

    try:
        data = getspnam(name)
        ret = {
            'name': data.sp_namp if hasattr(data, 'sp_namp') else data.sp_nam,
            'passwd': data.sp_pwdp if hasattr(data, 'sp_pwdp') else data.sp_pwd,
            'lstchg': data.sp_lstchg,
            'min': data.sp_min,
            'max': data.sp_max,
            'warn': data.sp_warn,
            'inact': data.sp_inact,
            'expire': data.sp_expire}
    except KeyError:
        return {
            'name': '',
            'passwd': '',
            'lstchg': '',
            'min': '',
            'max': '',
            'warn': '',
            'inact': '',
            'expire': ''}
    return ret
1026400
def _assemble_devinfo(self):
        '''
        
        '''
        devtype = {}
        for p in pcap_devices():
            if p.isloop:
                devtype[p.name] = InterfaceType.Loopback
            else:
                if sys.platform == 'linux':
                    st,output = subprocess.getstatusoutput(["iwconfig", p.name])
                    if "no wireless extensions" in output:
                        devtype[p.name] = InterfaceType.Wired
                    else:
                        devtype[p.name] = InterfaceType.Wireless
                elif sys.platform == 'darwin':
                    devtype[p.name] = InterfaceType.Unknown
                else:
                    devtype[p.name] = InterfaceType.Unknown

        devinfo = {}
        ifinfo = net_if_addrs()
        for devname in self._devs:
            ifaddrs = ifinfo.get(devname, None)
            if ifaddrs is None:
                log_warn("Address info for interface {} not found! (skipping)".format(devname))

            if sys.platform == 'darwin':
                layer2addrfam = socket.AddressFamily.AF_LINK
            elif sys.platform == 'linux':
                layer2addrfam = socket.AddressFamily.AF_PACKET
            else:
                raise RuntimeException("Platform not supported")

            macaddr = "00:00:00:00:00:00"
            ipaddr = mask = "0.0.0.0"
            for addrinfo in ifaddrs:
                if addrinfo.family == socket.AddressFamily.AF_INET:
                    ipaddr = IPv4Address(addrinfo.address)
                    mask = IPv4Address(addrinfo.netmask)
                elif addrinfo.family == layer2addrfam:
                    macaddr = EthAddr(addrinfo.address)

            ifnum = socket.if_nametoindex(devname)
            devinfo[devname] = Interface(devname, macaddr, ipaddr, netmask=mask, ifnum=ifnum, iftype=devtype[devname])
        return devinfo
816058
Type readType(int i) {
        int index = poolIdx[i];
        return sigToType(buf, index + 3, getChar(index + 1));
    }
1321404
def systemInformationType2ter():
    """"""
    a = L2PseudoLength(l2pLength=0x12)
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x3)  # 00000011
    d = NeighbourCellsDescription2()
    e = Si2terRestOctets()
    packet = a / b / c / d / e
    return packet
962227
protected function system_memory_info()
    {

        $this->system_memory_kb = array();

        exec("cat /proc/meminfo", $output);
        foreach ($output as $line) {
            $parts = explode(':', $line);

            if (empty($parts[0])) continue;
            // remove the KB sign and reduce it to a key value array
            $this->system_memory_kb[trim($parts[0])] = (int)(!empty($parts[1]) ? trim(str_replace('kB', '', $parts[1])) : null);
        }

        return true;
    }
113820
function NodeInfo() {

    /**
     * the CPU model
     * 
     * @type {String}
     */
    this.model = null;

    /**
     * memory size in kilobytes
     * @type {Number}
     */
    this.memory = 0;

    /**
     * the number of active CPUs
     * @type {Number}
     */
    this.cpus = 0;

    /**
     * expected CPU frequency
     * @type {Number}
     */
    this.mhz = 0;

    /**
     * the number of NUMA cell, 1 for unusual NUMA topologies or uniform memory
     * access; check capabilities XML for the actual NUMA topology
     * @type {Number}
     */
    this.nodes = 0;

    /**
     * number of CPU sockets per node if nodes > 1, 1 in case of unusual NUMA
     * topology
     * @type {Number}
     */
    this.sockets = 0;

    /**
     * number of cores per socket, total number of processors in case of
     * unusual NUMA topolog
     * @type {Number}
     */
    this.cores = 0;

    /**
     * number of threads per core, 1 in case of unusual numa topology
     * @type {Number}
     */
    this.threads = 0;

}
24134
def info(context, keywords, x86, x64, x32, common):
    
    logging.info(_('Current Mode: Find in Linux'))
    database = context.obj['database']
    for one in keywords:
        abis = ['i386', 'x64', 'common', 'x32']
        if x86:
            abis = ['i386']
        if x64:
            abis = ['x64', 'common']
        if x32:
            abis = ['x32', 'common']
        if common:
            abis = ['common']
        items = database.query_item(one, abis)
        if not items:
            logging.warning(_('Item not found: %s %s'), one, abis)
            continue
        for item in items:
            print(item.name, item.abi, item.number)
            decl = database.query_decl(name=item.name)
            if not decl:
                logging.warning(_('Decl not found: %s'), item.name)
                continue
            for one in decl:
                print(one.decl(), '/* {} */'.format(one.filename))
    sys.exit(0)
971786
def system_info(query):
	
	proc = subprocess.Popen(["uname -o"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "operating system : "+str(out),

	proc = subprocess.Popen(["uname"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "kernel : "+str(out),

	proc = subprocess.Popen(["uname -r"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "kernel release : "+str(out),

	proc = subprocess.Popen(["uname -m"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "architecture : "+str(out),

	proc = subprocess.Popen(["uname -n"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "network node name : "+str(out),
1165662
def systemInformationType2bis():
    """"""
    a = L2PseudoLength(l2pLength=0x15)
    b = TpPd(pd=0x6)
    c = MessageType(mesType=0x2)  # 00000010
    d = NeighbourCellsDescription()
    e = RachControlParameters()
    f = Si2bisRestOctets()
    packet = a / b / c / d / e / f
    return packet
848276
def device_info(self):
        
        # get hostname, model, and version from 'show version'
        resp = self._session.get_software_information(format='xml')

        hostname = resp.xpath('//software-information/host-name')[0].text
        model = resp.xpath('//software-information/product-model')[0].text

        version = 'Unknown'
        if resp.xpath('//junos-version'):
            """ case:
                <junos-version>15.1</junos-version>
            """
            try:
                version = resp.xpath('//junos-version')[0].text
            except IndexError:
                pass
        elif resp.xpath("//package-information[name = 'junos-version']"):
            """ case:
                <package-information>
                    <name>junos-version</name>
                    <comment>Junos: 14.2R4</comment>
                </package-information>
           """
            try:
                version = (resp.xpath(
                    "//package-information[name = 'junos-version']/comment"
                    )[0].text).split()[1]
            except IndexError:
                pass
        else:
            """ case:
                <package-information>
                    <name>junos</name>
                    <comment>JUNOS Base OS boot [12.3R5]</comment>
                </package-information>
            """
            try:
                version = ((resp.xpath(
                    '//software-information/package-information/comment'
                    )[0].text.split('[')[1].split(']')[0]))
            except IndexError:
                pass

        # try looking for 'junos-version' for >= 14.2
#        for element in resp.xpath('//software-information'):
#            version = element.findtext('junos-version')

#        if not version:
#            try:
#                version = ((resp.xpath(
#                    '//software-information/package-information/comment')
#                    [0].text.split('[')[1].split(']')[0]))
#            except IndexError:
#                version = 'Unknown'

        # get uptime from 'show system uptime'
        resp = self._session.get_system_uptime_information(format='xml')
        try:
            current_time = resp.xpath('//current-time/date-time')[0].text
        except IndexError:
            current_time = 'Unknown'
        try:
            uptime = resp.xpath('//uptime-information/up-time')[0].text
        except IndexError:
            uptime = 'Unknown'
        # get serial number from 'show chassis hardware'
        show_hardware = self._session.get_chassis_inventory(format='xml')
        # If we're hitting an EX, grab each Routing Engine Serial number
        # to get all RE SNs in a VC
        try:
            chassis_module = show_hardware.xpath(
                '//chassis-inventory/chassis/chassis-module/description'
                )[0].text
        except IndexError:
            chassis_module = 'Unknown'

        if ('EX' or 'ex' or 'Ex') in chassis_module:
            serial_num = ''
            for eng in show_hardware.xpath(
                    '//chassis-inventory/chassis/chassis-module'):
                if 'Routing Engine' in eng.xpath('name')[0].text:
                    serial_num += (eng.xpath('name')[0].text + ' Serial #: ' +
                                   eng.xpath('serial-number')[0].text)
        else:  # Any other device type, just grab chassis SN
            try:
                serial_num = ('Chassis Serial Number: ' + show_hardware.xpath(
                    '//chassis-inventory/chassis/serial-number')[0].text)
            except IndexError:
                serial_num = 'Chassis Serial Number: ' \
                    + 'Unknown (virtual machine?)'
        return ('Hostname: %s\nModel: %s\nJunos Version: %s\n%s\nCurrent Time:'
                ' %s\nUptime: %s\n' %
                (hostname, model, version, serial_num, current_time, uptime))