Esempio n. 1
0
def portstr(port):
    formatstr = '%-11s %-13s %-16s %-16s %-16s'
    modtype = type_to_str(port.port_type)
    if modtype is 'UNKNOWN':
        return "%-11s No Module" % port.port_name
    return formatstr % (port.port_name, modtype,
                        oom_get_keyvalue(port, 'VENDOR_PN'),
                        oom_get_keyvalue(port, 'VENDOR_SN'),
                        oom_get_keyvalue(port, 'VENDOR_NAME'))
Esempio n. 2
0
#! /usr/bin/python
#
# inventory.py
#
# OOM script to inventory the modules in a switch
#
from oom import *
from oom.oomlib import type_to_str

formatstr = '%-10s %-16s %-13s %-16s %-16s'
print
print formatstr % ('Port Name', 'Vendor', 'Type', 'Part #', 'Serial #')
print
for port in oom_get_portlist():
    modtype = type_to_str(port.port_type)
    if modtype == 'UNKNOWN':
        modtype = 'No Module'
    print formatstr % (port.port_name, oom_get_keyvalue(
        port, 'VENDOR_NAME'), modtype, oom_get_keyvalue(
            port, 'VENDOR_PN'), oom_get_keyvalue(port, 'VENDOR_SN'))
print
Esempio n. 3
0
#! /usr/bin/python
#
# inventory.py
#
# OOM script to inventory the modules in a switch
#
from oom import *
from oom.oomlib import type_to_str

formatstr = '%-10s %-16s %-13s %-16s %-16s'
print
print formatstr % ('Port Name', 'Vendor', 'Type', 'Part #', 'Serial #')
print
for port in oom_get_portlist():
    modtype = type_to_str(port.port_type)
    if modtype == 'UNKNOWN':
        modtype = 'No Module'
    print formatstr % (port.port_name,
                       oom_get_keyvalue(port, 'VENDOR_NAME'),
                       modtype,
                       oom_get_keyvalue(port, 'VENDOR_PN'),
                       oom_get_keyvalue(port, 'VENDOR_SN'))
print
Esempio n. 4
0

portlist = oom_get_portlist()
numports = len(portlist)
print numports
pcycle = 0
pcount = 0
try:
    while 1:
        lines = 0
        while lines < numlines:
            pnum = (pcount) % numports
            pcount += 1
            port = portlist[pnum]
            outstr = str.format("{:6} {:10}",
                                port.port_name, type_to_str(port.port_type))
            keylist = port.fmap
            if keylist == {}:
                continue
            keylist = port.fmap["SERIAL_ID"]
            keyoff = 0
            while len(outstr) < linelen:
                temp = (pcycle + keyoff) % len(keylist)
                keyoff += 1
                key = keylist[temp % len(keylist)]
                if len(port.mmap[key]) >= 6:
                    if port.mmap[key][1] == 'get_bytes':
                        val = oom_get_keyvalue(port, key)
                        outstr += key + ': ' + hexstr(val) + '; '
                    else:
                        outstr += key + ': ' \
Esempio n. 5
0
    linelen = int(parms[2])

portlist = oom_get_portlist()
numports = len(portlist)
print numports
pcycle = 0
pcount = 0
try:
    while 1:
        lines = 0
        while lines < numlines:
            pnum = (pcount) % numports
            pcount += 1
            port = portlist[pnum]
            outstr = str.format("{:6} {:10}", port.port_name,
                                type_to_str(port.port_type))
            keylist = port.fmap
            if keylist == {}:
                continue
            keylist = port.fmap["SERIAL_ID"]
            keyoff = 0
            while len(outstr) < linelen:
                temp = (pcycle + keyoff) % len(keylist)
                keyoff += 1
                key = keylist[temp % len(keylist)]
                if len(port.mmap[key]) >= 6:
                    if port.mmap[key][1] == 'get_bytes':
                        val = oom_get_keyvalue(port, key)
                        outstr += key + ': ' + hexstr(val) + '; '
                    else:
                        outstr += key + ': ' \