def uadiscover(): parser = argparse.ArgumentParser(description="Performs OPC UA discovery and prints information on servers and endpoints.") add_minimum_args(parser) parser.add_argument("-n", "--network", action="store_true", help="Also send a FindServersOnNetwork request to server") #parser.add_argument("-s", #"--servers", #action="store_false", #help="send a FindServers request to server") #parser.add_argument("-e", #"--endpoints", #action="store_false", #help="send a GetEndpoints request to server") args = parser.parse_args() logging.basicConfig(format="%(levelname)s: %(message)s", level=getattr(logging, args.loglevel)) if args.network: client = Client(args.url, timeout=args.timeout) print("Performing discovery at {}\n".format(args.url)) for i, server in enumerate(client.find_all_servers_on_network(), start=1): print('Server {}:'.format(i)) #for (n, v) in application_to_strings(server): #print(' {}: {}'.format(n, v)) print('') client = Client(args.url, timeout=args.timeout) print("Performing discovery at {}\n".format(args.url)) for i, server in enumerate(client.find_all_servers(), start=1): print('Server {}:'.format(i)) for (n, v) in application_to_strings(server): print(' {}: {}'.format(n, v)) print('') client = Client(args.url, timeout=args.timeout) for i, ep in enumerate(client.get_server_endpoints(), start=1): print('Endpoint {}:'.format(i)) for (n, v) in endpoint_to_strings(ep): print(' {}: {}'.format(n, v)) print('') sys.exit(0)
def uadiscover(): parser = argparse.ArgumentParser(description="Performs OPC UA discovery and prints information on servers and endpoints.") add_minimum_args(parser) args = parser.parse_args() logging.basicConfig(format="%(levelname)s: %(message)s", level=getattr(logging, args.loglevel)) client = Client(args.url, timeout=args.timeout) for i, server in enumerate(client.find_all_servers(), start=1): print('Server {}:'.format(i)) for (n, v) in application_to_strings(server): print(' {}: {}'.format(n, v)) print('') client = Client(args.url, timeout=args.timeout) for i, ep in enumerate(client.get_server_endpoints()): print('Endpoint {}:'.format(i)) for (n, v) in endpoint_to_strings(ep): print(' {}: {}'.format(n, v)) print('') sys.exit(0)