args = parser.parse_args() device = urlparse(args.device) # 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 NETCONF provider provider = NetconfServiceProvider(address=device.hostname, port=device.port, username=device.username, password=device.password, protocol=device.scheme) # create CRUD service crud = CRUDService() isis = xr_clns_isis_cfg.Isis() # create object config_isis(isis) # add object configuration # create configuration on NETCONF device crud.create(provider, isis) exit() # End of script
username=device.username, password=device.password, protocol=device.scheme) # Instantiate codec providers with json and xml options json_provider = CodecServiceProvider(type='json') xml_provider = CodecServiceProvider(type='xml') # create CRUD service crud = CRUDService() # create codec service codec = CodecService() # First create the top-level Isis() object isis = Cisco_IOS_XR_clns_isis_cfg.Isis() # Create the list instance ins = Cisco_IOS_XR_clns_isis_cfg.Isis.Instances.Instance() ins.instance_name = 'default' # Set the yfilter attribute of the leaf called 'running' to YFilter.read ins.running = YFilter.read # Append the instance to the parent isis.instances.instance.append(ins) # Call the CRUD read on the top-level isis object # (assuming you have already instantiated the service and provider) # create NETCONF operation