parser.add_argument("-v", "--verbose", help="print debugging messages", action="store_true") args = parser.parse_args() # log debug messages if verbose argument specified if args.verbose: logger = logging.getLogger("ydk") logger.setLevel(logging.INFO) handler = logging.StreamHandler() formatter = logging.Formatter(("%(asctime)s - %(name)s - " "%(levelname)s - %(message)s")) handler.setFormatter(formatter) logger.addHandler(handler) # create codec provider provider = CodecServiceProvider(type="xml") # create codec service codec = CodecService() arpgmp = xr_ipv4_arp_cfg.Arpgmp() # create object config_arpgmp(arpgmp) # add object configuration # encode and print object print(codec.encode(provider, arpgmp)) exit() # End of script
"--verbose", help="print debugging messages", action="store_true") args = parser.parse_args() # log debug messages if verbose argument specified if args.verbose: logger = logging.getLogger("ydk") logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() formatter = logging.Formatter(("%(asctime)s - %(name)s - " "%(levelname)s - %(message)s")) handler.setFormatter(formatter) logger.addHandler(handler) # create codec provider provider = CodecServiceProvider(type="xml") # create codec service codec = CodecService() arp_redundancy = xr_ipv4_arp_cfg.ArpRedundancy() # create object config_arp_redundancy(arp_redundancy) # add object configuration # encode and print object # print(codec.encode(provider, arp_redundancy)) provider.close() exit() # End of script