예제 #1
0
     # ======================================
     # Actually populate data if you provided a widget identifier
 if "widget" == query.lower() and len(widgetId) > 0:
     widget = Widget()
     # ===============================
     # Interface Overview Widget Data
     # ===============================
     if widgetId.lower() == "interfaceoverview":
         # generic info group
         widget.setKeyAndValue(
             "generic info",
             {
                 "name": interface.name(i),
                 "human name": interface.humanName(i),
                 "virtual": "Yes" if interface.virtual(i) else "No",
                 "speed": interface.speed(i) if interface.speed(i) else "Unknown",
                 "mtu": interface.mtu(i),
                 "bpf filter": interface.bpf(i) or "none",
             },
         )
         # interface time group
         # suspended at the moment
         # widget.setKeyAndValue('interface time', interface.time(i))
         # interface address info
         widget.setKeyAndValue(
             "interface address",
             {
                 "IPv4 address": interface.ipv4(i),
                 "IPv6 address": interface.ipv6(i),
                 "network": interface.network(i),
                 "active host number": interface.numHosts(i),
예제 #2
0
form = cgi.FieldStorage()

name = form.getvalue('name', default="")
mode = form.getvalue('mode', default="")

rsp = {}

try:
    for i in range(interface.numInterfaces()):
        if ((len(name) == 0) or (name == interface.name(i))):
            info = {}
            info['name'] = interface.name(i)
            info['humanName'] = interface.humanName(i)
            info['time'] = interface.time(i)
            info['virtual'] = interface.virtual(i)
            info['speed'] = interface.speed(i)
            info['mtu'] = interface.mtu(i)
            info['bpf'] = interface.bpf(i)

            addr = {}
            addr['ipv4'] = interface.ipv4(i)
            addr['network'] = interface.network(i)
            addr['numHosts'] = interface.numHosts(i)
            addr['ipv6'] = interface.ipv6(i)
            info['address'] = addr

            if ((len(mode) == 0) or not (mode == "list")):
                stats = {}
                stats['pktsStats'] = interface.pktsStats(i)
                stats['bytesStats'] = interface.bytesStats(i)
                stats['throughputStats'] = interface.throughputStats(i)
예제 #3
0
 #   W I D G E T  D A T A  E M I T T E R
 # ======================================
 # Actually populate data if you provided a widget identifier
 if ('widget' == query.lower() and len(widgetId) > 0):
     widget = Widget()
     # ===============================
     # Interface Overview Widget Data
     # ===============================
     if (widgetId.lower() == "interfaceoverview"):
         # generic info group
         widget.setKeyAndValue(
             'generic info', {
                 'name': interface.name(i),
                 'human name': interface.humanName(i),
                 'virtual': 'Yes' if interface.virtual(i) else 'No',
                 'speed': interface.speed(i)
                 if interface.speed(i) else 'Unknown',
                 'mtu': interface.mtu(i),
                 'bpf filter': interface.bpf(i) or 'none'
             })
         # interface time group
         # suspended at the moment
         # widget.setKeyAndValue('interface time', interface.time(i))
         # interface address info
         widget.setKeyAndValue(
             'interface address', {
                 'IPv4 address': interface.ipv4(i),
                 'IPv6 address': interface.ipv6(i),
                 'network': interface.network(i),
                 'active host number': interface.numHosts(i)
             })
예제 #4
0
form = cgi.FieldStorage();

name = form.getvalue('name', default="")
mode = form.getvalue('mode', default="")

rsp = {}

try:
 for i in range(interface.numInterfaces()):
   if((len(name) == 0) or (name == interface.name(i))):
        info = {}
        info['name'] = interface.name(i)
        info['humanName'] = interface.humanName(i)
        info['time'] = interface.time(i)
        info['virtual'] = interface.virtual(i)
        info['speed'] = interface.speed(i)
        info['mtu'] = interface.mtu(i)
        info['bpf'] = interface.bpf(i)

	addr = {}
        addr['ipv4'] = interface.ipv4(i)
        addr['network'] = interface.network(i)
        addr['numHosts'] = interface.numHosts(i)
	addr['ipv6'] = interface.ipv6(i)
	info['address'] = addr

	if((len(mode) == 0) or not(mode == "list")):
		stats = {}
		stats['pktsStats'] = interface.pktsStats(i)
		stats['bytesStats'] = interface.bytesStats(i)
		stats['throughputStats'] = interface.throughputStats(i)