def run(self): import json self.view_tree.fetch(max_depth = -1) data = [] for depth, node in self.view_tree.traverse(include_depth = True): data.append(node.dictDescribe()) cprint(json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))) return 0
def run(self): import json self.view_tree.fetch(max_depth=-1) data = [] for depth, node in self.view_tree.traverse(include_depth=True): data.append(node.dictDescribe()) cprint( json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))) return 0
def _displayAttributes(self, device, show_hidden): if len(device.attributes) > 0: for attr in device.attributes: if not show_hidden and attr.attributes.get('hidden', False) is True: continue if attr.atype == 'text' and len(attr.value.strip()) == 0: continue cprint('%-20s %s' % (attr.name.lower() + ':', attr.value)) print
def main(argv): """Main siptracklib commandline client entry point. This is basically just an exception wrapper for run_siptrack. """ try: return run_siptrack(argv[1:]) except SiptrackCommandError, e: cprint('ERROR: %s' % (e)) return 1
def run(self, display_attributes=False): self.view_tree.fetch(max_depth=-1) exclude = ['attribute'] if display_attributes: exclude = [] for depth, node in self.view_tree.traverse(exclude=exclude, include_depth=True): cprint('%s%s' % (depth * ' ', node.describe())) return 0
def _displayNetworks(self, device): networks = [ str(network) for network in device.listNetworks(include_ranges=False, include_interfaces=True) ] if len(networks) > 0: cprint('IP-addresses:') cprint(' %s' % (' '.join(networks))) print
def run(self, display_attributes = False): self.view_tree.fetch(max_depth = -1) exclude = ['attribute'] if display_attributes: exclude = [] for depth, node in self.view_tree.traverse(exclude = exclude, include_depth = True): cprint('%s%s' % (depth * ' ', node.describe())) return 0
def main(argv): """Main siptracklib commandline client entry point. This is basically just an exception wrapper for run_siptrack. """ try: return run_siptrack(argv[1:]) except SiptrackCommandError, e: cprint("ERROR: %s" % (e)) return 1
def _displayAssociatedDevices(self, device): assoc_devices = device.listAssociations(include = ['device']) assoc_devices += device.listReferences(include = ['device']) if len(assoc_devices) > 0: cprint('Associated devices:') for node in assoc_devices: node_path = [] cur = node while cur.class_name == 'device': node_path.insert(0, cur) cur = cur.parent names = [n.attributes.get('name', 'UNKNOWN') for n in node_path] cprint(' %15s: %s' % (node.attributes.get('class', ' - '), ' / '.join(names))) print()
def _displayAssociatedDevices(self, device): assoc_devices = device.listAssociations(include=['device']) assoc_devices += device.listReferences(include=['device']) if len(assoc_devices) > 0: cprint('Associated devices:') for node in assoc_devices: node_path = [] cur = node while cur.class_name == 'device': node_path.insert(0, cur) cur = cur.parent names = [ n.attributes.get('name', 'UNKNOWN') for n in node_path ] cprint( ' %15s: %s' % (node.attributes.get('class', ' - '), ' / '.join(names))) print()
def show_version(): """Print program version information.""" cprint('siptrack %s' % (siptracklib.__version__)) cprint('Written by Simon Ekstrand.') cprint('') cprint(siptracklib.__copyright__)
def _displayDisabled(self, device): if device.attributes.get('disabled', False) is True: cprint('THIS DEVICE IS CURRENTLY DISABLED')
def run(self, oid): node = self.object_store.getOID(oid) cprint(node.class_name) return 0
def run(self): cprint('Server said: %s' % (self.transport.cmd.ping())) return 0
cm.config.update(optdict) if len(argv) == 0: from siptracklib.help import show_global_help show_global_help() return 1 return run_command(cm, argv[0], argv[1:]) def main(argv): """Main siptracklib commandline client entry point. This is basically just an exception wrapper for run_siptrack. """ try: return run_siptrack(argv[1:]) except SiptrackCommandError, e: cprint('ERROR: %s' % (e)) return 1 except SiptrackError, e: cprint('ERROR: %s' % (e)) return 1 except KeyboardInterrupt: cprint('ERROR: command interrupted by user') # except Exception, e: # cprint('ERROR: %s' % (e)) # return 1 return 0
def _displayNetworks(self, device): networks = [str(network) for network in device.listNetworks(include_ranges=False, include_interfaces=True)] if len(networks) > 0: cprint('IP-addresses:') cprint(' %s' % (' '.join(networks))) print
if len(argv) == 0: from siptracklib.help import show_global_help show_global_help() return 1 return run_command(cm, argv[0], argv[1:]) def main(argv): """Main siptracklib commandline client entry point. This is basically just an exception wrapper for run_siptrack. """ try: return run_siptrack(argv[1:]) except SiptrackCommandError, e: cprint("ERROR: %s" % (e)) return 1 except SiptrackError, e: cprint("ERROR: %s" % (e)) return 1 except KeyboardInterrupt: cprint("ERROR: command interrupted by user") # except Exception, e: # cprint('ERROR: %s' % (e)) # return 1 return 0