def process_service_create_data(smodelctx, sdata, dev, **kwargs): """ Custom API to modify the inputs""" modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] inputkeydict = kwargs['inputkeydict']
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node transport-options at path day1services/day1service/netflow/netflow/flow-records/flow-record/collect/transport/transport-options') modify = True if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict']
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node snmp at path day1services/day1service/legacy_netflow') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.common_config_def_customization
def process_service_delete_data(smodelctx, sdata, **kwargs): """callback called for delete operation""" modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" %(key,value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.dns_def_customization tclday0config.tclday0config_grouping_lib.dns_def_customization.grouping_delete_dns_def_name_server(smodelctx, sdata, **kwargs)
def process_service_device_bindings(smodelctx, sdata, dev, **kwargs): """ Custom API to modify the device bindings or Call the Business Login Handlers""" modify = True if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] inputkeydict = kwargs['inputkeydict'] devbindobjs = kwargs['devbindobjs']
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'destinations') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['destination_ip_address'] = config.get_field_value('destination_ip_address') inputdict['port'] = config.get_field_value('port') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-3].split('=')[1] #Start of Device binding with python bindings #legacy_netflow_object = devices.device.legacy_netflow.legacy_netflow() legacy_netflow_object = legacy_netflow.legacy_netflow() if util.isNotEmpty(inputdict.get('destination_ip_address')): #legacy_netflow_destinations_object = devices.device.legacy_netflow.destinations.destinations() legacy_netflow_destinations_object = legacy_netflow.destinations.destinations() legacy_netflow_destinations_object.destination_ip_address = inputdict.get('destination_ip_address') legacy_netflow_destinations_object.port = inputdict.get('port') #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) legacy_netflow_destinations_object_payload = legacy_netflow_destinations_object.getxml(filter=True) log('legacy_netflow_destinations_object_payload: %s' % (legacy_netflow_destinations_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url+'/legacy-netflow',legacy_netflow_destinations_object_payload, sdata.getSession(), True)
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node match-condition at path day1services/day1service/named-access-lists/acl/match-condition') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" %(key,value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.access_lists_def_customization tclday0config.tclday0config_grouping_lib.access_lists_def_customization.grouping_update_access_lists_def_acl_match_condition(smodelctx, sdata, **kwargs)
def process_service_device_bindings(smodelctx, sdata, dev, **kwargs): """ Custom API to modify the device bindings or Call the Business Login Handlers""" modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] inputkeydict = kwargs['inputkeydict'] devbindobjs = kwargs['devbindobjs'] import tclday0config.tclday0config_grouping_lib.common_config_def_customization
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'dns') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['lookup_source_interface'] = config.get_field_value('lookup_source_interface') inputdict['domain_name'] = config.get_field_value('domain_name') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-2].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings dns_server_object = dns_server.dns_server() dns_server_object.domain_name = inputdict.get('domain_name') dns_server_object.lookup_source_interface = inputdict.get('lookup_source_interface') #End of Device binding devbindobjs['dns_server_object'] = dns_server_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) dns_server_object_payload = dns_server_object.getxml(filter=True) log('dns_server_object_payload: %s' % (dns_server_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url+'',dns_server_object_payload, sdata.getSession(), True)
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node aaa-servers-private at path day1services/day1service/aaa/aaa-servers-private') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.aaa_group_def_customization tclday0config.tclday0config_grouping_lib.aaa_group_def_customization.grouping_update_aaa_group_def_aaa_servers_private( smodelctx, sdata, **kwargs)
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node excluded-address at path day1services/day1service/dhcp-server/excluded-address') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.dhcp_server_def_customization tclday0config.tclday0config_grouping_lib.dhcp_server_def_customization.grouping_update_dhcp_server_def_excluded_address( smodelctx, sdata, **kwargs)
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node eem-mem-threshold at path day1services/day1service/eem-scripts/eem-script/eem-mem-threshold') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.eem_scripts_def_customization tclday0config.tclday0config_grouping_lib.eem_scripts_def_customization.grouping_update_eem_scripts_def_eem_script_eem_mem_threshold( smodelctx, sdata, **kwargs)
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" #raise Exception('Update forbidden for node interface at path day1services/day1service/netflow/netflow/flow-monitors/flow-monitor/interfaces/interface') modify = False if modify and kwargs is not None: for key, value in kwargs.iteritems(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] import tclday0config.tclday0config_grouping_lib.netflow_def_customization tclday0config.tclday0config_grouping_lib.netflow_def_customization.grouping_update_netflow_def_netflow_flow_monitors_flow_monitor_interfaces_interface( smodelctx, sdata, **kwargs)
def processBeforeReserve(self, session): operations = session.getOperations() """Add any move operations for creation""" log('operations: %s' % (operations)) #yang.moveOperations(operations, ['CreateNETFLOWFlowMonitor'], ['CreateNETFLOWFlowExport','CreateNETFLOWFlowRecord', 'CreateRecordIpv4options', 'CreateRecordTimeStampoptions', 'CreateRecordCounteroptions'], True) #print 'pass01: operations: %s' % (operations) #yang.moveOperations(operations, ['CreateNETFLOWFlowMonitorExporter','CreateNETFLOWFlowMonitorInterface'], ['CreateNETFLOWFlowMonitor'], True) #print 'pass02: operations: %s' % (operations) yang.moveOperations( operations, ['CreateAccessList', 'CreateAclRule'], ['CreateSnmpCommunity', 'UpdateVTYConfig', 'CreateVTYConfig'], False) print 'pass03: operations: %s' % (operations) yang.moveOperations(operations, ['CreateAAA'], ['DeleteRoute'], False) print 'pass04: operations: %s' % (operations)
def process_service_device_bindings(smodelctx, sdata, dev, **kwargs): """ Custom API to modify the device bindings or Call the Business Login Handlers""" modify = True if modify and kwargs is not None: for key, value in kwargs.items(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] inputkeydict = kwargs['inputkeydict'] devbindobjs = kwargs['devbindobjs'] id = kwargs['id'] opaque_args = kwargs['hopaque'] # import tclday0config.tclday0config_grouping_lib.policy_map_def_customization # tclday0config.tclday0config_grouping_lib.policy_map_def_customization.grouping_create_policy_map_def_class_entry(smodelctx, sdata, dev, xpath='day1services/day1service/policy-maps/policy-map/class-entry', **kwargs) if dev is None or (isinstance(dev, list) and len(dev) == 0): return
def process_service_delete_data(smodelctx, sdata, **kwargs): """callback called for delete operation""" modify = True if modify and kwargs is not None: for key, value in kwargs.items(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] dev = kwargs['dev'] id = kwargs['id'] opaque_args = kwargs['hopaque'] # import tclday0config.tclday0config_grouping_lib.policy_map_def_customization # tclday0config.tclday0config_grouping_lib.policy_map_def_customization.grouping_delete_policy_map_def_class_entry(smodelctx, sdata, xpath='day1services/day1service/policy-maps/policy-map/class-entry', **kwargs) if dev is None or (isinstance(dev, list) and len(dev) == 0): return
def process_service_update_data(smodelctx, sdata, **kwargs): """callback called for update operation""" modify = True if modify and kwargs is not None: for key, value in kwargs.items(): log("%s == %s" % (key, value)) if modify: config = kwargs['config'] inputdict = kwargs['inputdict'] id = kwargs['id'] opaque_args = kwargs['hopaque'] #Previous config and previous inputdict pconfig = kwargs['pconfig'] pinputdict = kwargs['pinputdict'] dev = kwargs['dev'] # import tclday0config.tclday0config_grouping_lib.common_config_def_customization # tclday0config.tclday0config_grouping_lib.common_config_def_customization.grouping_update_common_config_def_class_maps_class_map(smodelctx, sdata, xpath='day1services/day1service/class-maps/class-map', **kwargs) if dev is None or (isinstance(dev, list) and len(dev) == 0): return
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'tacacs_user_credentials') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['name'] = config.get_field_value('name') inputdict['username'] = config.get_field_value('username') inputdict['password'] = config.get_field_value('password') inputdict['result'] = config.get_field_value('result') # END OF FETCHING THE LEAF PARAMETERS password1 = util.decode_password(inputdict['password']) inputdict['password'] = password1 _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) device_output = devicemgr.getDeviceById(device_mgmt_ip_address) cred_url = "/app/restconf/data/credentials/credential-sets/credential-set=%s" % ( device_output.device.credential_set) cred_out = yang.Sdk.getData(cred_url, '', sdata.getTaskId()) obj = util.parseXmlString(cred_out) log(obj.credential_set.transport_type) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-3].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #End of Device binding #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) payload = '<input><device-id>%s</device-id><username>%s</username><password>%s</password><transport>%s</transport><terminal-mode>LOGIN</terminal-mode></input>' % ( device_mgmt_ip_address, inputdict['username'], inputdict['password'], obj.credential_set.transport_type) copy_output = yang.Sdk.invokeRpc('controller:check-connectivity', payload) copy_output_tag = '<output>%s</output>' % (copy_output) xml_copyout = util.parseXmlString(copy_output_tag) if xml_copyout.output.result == "SUCCESS": payload = "<%s>%s</%s>" % ('result', 'pass', 'result') yang.Sdk.createData(sdata.getRcPath(), payload, sdata.getSession()) yang.Sdk.append_taskdetail( sdata.getTaskId(), "Authentication passed on device %s with username %s" % (device_mgmt_ip_address, inputdict['username'])) else: payload = "<%s>%s</%s>" % ('result', 'fail', 'result') yang.Sdk.createData(sdata.getRcPath(), payload, sdata.getSession()) yang.Sdk.append_taskdetail(sdata.getTaskId(), xml_copyout.output.message)
def processBeforeReserve(self, session): operations = session.getOperations() """Add any move operations for creation""" log('operations: %s' % (operations))
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'flow_record') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['name'] = config.get_field_value('name') inputdict['record_type'] = config.get_field_value('record_type') inputdict['description'] = config.get_field_value('description') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-5].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #netflow_object = devices.device.netflow.netflow() netflow_object = netflow.netflow() #netflow_flow_records_object = devices.device.netflow.flow_records.flow_records() netflow_flow_records_object = netflow.flow_records.flow_records() if util.isNotEmpty(inputdict.get('name')): #netflow_flow_records_flow_record_object = devices.device.netflow.flow_records.flow_record.flow_record() netflow_flow_records_flow_record_object = netflow.flow_records.flow_record.flow_record() netflow_flow_records_flow_record_object.name = inputdict.get('name') netflow_flow_records_flow_record_object.description = inputdict.get('description') netflow_flow_records_flow_record_object.record_type = inputdict.get('record_type') #End of Device binding devbindobjs['netflow_flow_records_flow_record_object'] = netflow_flow_records_flow_record_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) for dev_iterator in dev: if dev_iterator.device.get_field_value('netflow') == None: yang.Sdk.createData(dev_iterator.url,'<netflow/>', sdata.getSession(), True) if not yang.Sdk.dataExists(dev_iterator.url+'/l3features:netflow/flow-records'): yang.Sdk.createData(dev_iterator.url+'/l3features:netflow','<flow-records/>', sdata.getSession(), False) netflow_flow_records_flow_record_object_payload = netflow_flow_records_flow_record_object.getxml(filter=True) log('netflow_flow_records_flow_record_object_payload: %s' % (netflow_flow_records_flow_record_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url+'/l3features:netflow/flow-records',netflow_flow_records_flow_record_object_payload, sdata.getSession(), True)
def rollbackCreate(self, id, sdata): log('rollback: id = %s, sdata = %s' % (id, sdata)) self.delete(id, sdata)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'name_server') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object #parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args vrf = None rcpath = util.get_parent_rcpath(sdata.getRcPath(), level=2) xml_output = yang.Sdk.getData(rcpath, '', sdata.getTaskId()) parentobj = util.parseXmlString(xml_output) if hasattr(parentobj.day1service, 'vrf'): vrf = parentobj.day1service.vrf # START OF FETCHING THE LEAF PARAMETERS inputdict['name_server'] = config.get_field_value('name_server') inputdict['vrf_name'] = vrf # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-3].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #dns_server_object = devices.device.dns_server.dns_server() dns_server_object = dns_server.dns_server() if util.isNotEmpty(inputdict.get('name_server')): #dns_server_name_server_object = devices.device.dns_server.name_server.name_server() dns_server_name_server_object = dns_server.name_server.name_server( ) dns_server_name_server_object.server = inputdict.get('name_server') dns_server_name_server_object.vrf_name = inputdict.get('vrf_name') #End of Device binding devbindobjs[ 'dns_server_name_server_object'] = dns_server_name_server_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) dns_server_name_server_object_payload = dns_server_name_server_object.getxml( filter=True) log('dns_server_name_server_object_payload: %s' % (dns_server_name_server_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url + '/dns-server', dns_server_name_server_object_payload, sdata.getSession(), True)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'transport_options') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['name'] = config.get_field_value('name') inputdict['transport_option'] = config.get_field_value( 'transport_option') inputdict['tcp_options'] = config.get_field_value('tcp_options') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict[ 'day1services_day1service_netflow_netflow_flow_records_flow_record_name'] = sdata.getRcPath( ).split('/')[-4].split('=')[1] inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-8].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS dev_pro_name = inputdict['name'] if util.isNotEmpty(inputdict['transport_option']): if util.isNotEmpty(inputdict['tcp_options']): dev_pro_name = "collect_transport_%s_%s" % ( inputdict['transport_option'], inputdict['tcp_options']) else: dev_pro_name = "collect_transport_%s" % ( inputdict['transport_option']) #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings netflow_object = devices.device.netflow.netflow() netflow_flow_records_object = devices.device.netflow.flow_records.flow_records( ) _Gen_obj = getLocalObject(sdata, 'flow-record') inputdict[ 'day1services_day1service_netflow_netflow_flow_records_flow_record_name'] = _Gen_obj.flow_record.name if util.isNotEmpty( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' )): netflow_flow_records_flow_record_object = devices.device.netflow.flow_records.flow_record.flow_record( ) netflow_flow_records_flow_record_collect_object = devices.device.netflow.flow_records.flow_record.collect.collect( ) netflow_flow_records_flow_record_collect_transport_object = devices.device.netflow.flow_records.flow_record.collect.transport.transport( ) if util.isNotEmpty(inputdict.get('name')): netflow_flow_records_flow_record_collect_transport_transport_options_object = devices.device.netflow.flow_records.flow_record.collect.transport.transport_options.transport_options( ) netflow_flow_records_flow_record_collect_transport_transport_options_object.name = dev_pro_name netflow_flow_records_flow_record_collect_transport_transport_options_object.transport_option = inputdict.get( 'transport_option') netflow_flow_records_flow_record_collect_transport_transport_options_object.tcp_options = inputdict.get( 'tcp_options') #End of Device binding devbindobjs[ 'netflow_flow_records_flow_record_collect_transport_transport_options_object'] = netflow_flow_records_flow_record_collect_transport_transport_options_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) for dev_iterator in dev: if not yang.Sdk.dataExists( dev_iterator.url + '/l3features:netflow/flow-records/flow-record=%s/collect' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' )))): yang.Sdk.createData( dev_iterator.url + '/l3features:netflow/flow-records/flow-record=%s' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' ))), '<collect/>', sdata.getSession(), False) if not yang.Sdk.dataExists( dev_iterator.url + '/l3features:netflow/flow-records/flow-record=%s/collect/transport' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' )))): yang.Sdk.createData( dev_iterator.url + '/l3features:netflow/flow-records/flow-record=%s/collect' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' ))), '<transport/>', sdata.getSession(), False) netflow_flow_records_flow_record_collect_transport_transport_options_object_payload = netflow_flow_records_flow_record_collect_transport_transport_options_object.getxml( filter=True) log('netflow_flow_records_flow_record_collect_transport_transport_options_object_payload: %s' % (netflow_flow_records_flow_record_collect_transport_transport_options_object_payload )) for dev_iterator in dev: yang.Sdk.createData( dev_iterator.url + '/netflow/flow-records/flow-record=%s/collect/transport' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_records_flow_record_name' ))), netflow_flow_records_flow_record_collect_transport_transport_options_object_payload, sdata.getSession(), True)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'tacacs') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['tacacs_server_group'] = config.get_field_value( 'tacacs_server_group') inputdict['timeout'] = config.get_field_value('timeout') inputdict['delete_dummy_tacacs_route'] = config.get_field_value( 'delete_dummy_tacacs_route') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-2].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings ''' aaa_group_authentication_object = aaa_group.authentication.authentication() aaa_group_authentication_object.server_group = inputdict.get('tacacs_server_group') aaa_group_authentication_object_payload = aaa_group_authentication_object.getxml(filter=True) aaa_group_authorization_object = aaa_group.authorization.authorization() aaa_group_authorization_object.server_group = inputdict.get('tacacs_server_group') aaa_group_authorization_object_payload = aaa_group_authorization_object.getxml(filter=True) aaa_group_accounting_object = aaa_group.accounting.accounting() aaa_group_accounting_object.server_group = inputdict.get('tacacs_server_group') aaa_group_accounting_object_payload = aaa_group_accounting_object.getxml(filter=True) if util.isNotEmpty(inputdict.get('tacacs_server_group')): for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url+'/basicDeviceConfigs:aaa-group', aaa_group_authentication_object_payload, sdata.getSession(), True) yang.Sdk.createData(dev_iterator.url+'/basicDeviceConfigs:aaa-group', aaa_group_authorization_object_payload, sdata.getSession(), True) yang.Sdk.createData(dev_iterator.url+'/basicDeviceConfigs:aaa-group', aaa_group_accounting_object_payload, sdata.getSession(), True) ''' #tacacs_conf_object = devices.device.tacacs_conf.tacacs_conf() tacacs_conf_object = tacacs_conf.tacacs_conf() tacacs_conf_object.timeout = inputdict.get('timeout') tacacs_conf_object.tacacs_server_group = inputdict.get( 'tacacs_server_group') #dummy_route_object = devices.device.routes.route.route() dummy_route_object = routes.route.route() dummy_route_object.dest_ip_address = inputdict.get( 'delete_dummy_tacacs_route') dummy_route_object.dest_mask = '255.255.255.252' #End of Device binding devbindobjs['tacacs_conf_object'] = tacacs_conf_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) tacacs_conf_object_payload = tacacs_conf_object.getxml(filter=True) log('tacacs_conf_object_payload: %s' % (tacacs_conf_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url + '', tacacs_conf_object_payload, sdata.getSession(), True) for dev_iterator in dev: if inputdict['delete_dummy_tacacs_route'] is not None: static_route_url = dev_iterator.url + '/l3features:routes/route=%s,%s' % ( dummy_route_object.dest_ip_address, dummy_route_object.dest_mask) output = yang.Sdk.invokeRpc( 'ncxsdk:get-inbound-references', '<input><rc-path>' + static_route_url + '</rc-path></input>') ref = util.parseXmlString(output) if hasattr(ref.output, 'references'): if hasattr(ref.output.references, 'reference'): for eachreference in util.convert_to_list( ref.output.references.reference): if hasattr(eachreference, 'src_node'): for each_ref in util.convert_to_list( eachreference.src_node): yang.Sdk.removeReference( each_ref, eachreference.dest_node) yang.Sdk.deleteData(static_route_url, '', sdata.getTaskId(), sdata.getSession()) """
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'console') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['console_line'] = config.get_field_value('console_line') inputdict['exec_timeout'] = config.get_field_value('exec_timeout') inputdict['privilege_level'] = config.get_field_value( 'privilege_level') inputdict['logging_synchronous'] = config.get_field_value( 'logging_synchronous') if inputdict.get('logging_synchronous') is None: inputdict['logging_synchronous'] = 'False' inputdict['no_password'] = config.get_field_value('no_password') inputdict['auth_type'] = config.get_field_value('auth_type') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-2].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #console_object = devices.device.console.console() console_object = console.console() console_object.console_line = inputdict.get('console_line') console_object.exec_timeout = inputdict.get('exec_timeout') console_object.privilege_level = inputdict.get('privilege_level') console_object.logging_synchronous = inputdict.get( 'logging_synchronous') console_object.no_password = inputdict.get('no_password') console_object.auth_type = inputdict.get('auth_type') #End of Device binding devbindobjs['console_object'] = console_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) console_object_payload = console_object.getxml(filter=True) log('console_object_payload: %s' % (console_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url + '', console_object_payload, sdata.getSession(), True)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'cpe_finalize') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs={} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['tacacs_credential_set'] = config.get_field_value('tacacs_credential_set') inputdict['device_mgmt_ip'] = config.get_field_value('device_mgmt_ip') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS #inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-2].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #End of Device binding #devbindobjs['dummy_route_object'] = dummy_route_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) if inputdict['tacacs_credential_set'] is not None and inputdict['device_mgmt_ip'] is None: dev_payload = '<device><id>'+ str(device_mgmt_ip_address) +'</id><credential-set>%s</credential-set></device>' % (inputdict['tacacs_credential_set']) elif inputdict['tacacs_credential_set'] is None and inputdict['device_mgmt_ip'] is not None: dev_payload = '<device><id>'+ str(device_mgmt_ip_address) +'</id><mgmt-ip-address>'+inputdict['device_mgmt_ip']+'</mgmt-ip-address><unique-name>'+inputdict['device_mgmt_ip']+'</unique-name></device>' elif inputdict['tacacs_credential_set'] is not None and inputdict['device_mgmt_ip'] is not None: dev_payload = '<device><id>'+ str(device_mgmt_ip_address) +'</id><mgmt-ip-address>'+inputdict['device_mgmt_ip']+'</mgmt-ip-address><unique-name>'+inputdict['device_mgmt_ip']+'</unique-name><credential-set>%s</credential-set></device>' % (inputdict['tacacs_credential_set']) log('device_payload: %s' % (dev_payload)) for dev_iterator in dev: if inputdict['tacacs_credential_set'] is not None and inputdict['device_mgmt_ip'] is not None: yang.Sdk.patchData(dev_iterator.url+'', dev_payload, sdata, add_reference=False) elif inputdict['tacacs_credential_set'] is None and inputdict['device_mgmt_ip'] is not None: yang.Sdk.patchData(dev_iterator.url+'', dev_payload, sdata, add_reference=False) elif inputdict['tacacs_credential_set'] is not None and inputdict['device_mgmt_ip'] is None: yang.Sdk.patchData(dev_iterator.url+'', dev_payload, sdata, add_reference=False)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'snmp_community') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['community_string'] = config.get_field_value( 'community_string') inputdict['permision_type'] = config.get_field_value('permision_type') inputdict['acl_name'] = config.get_field_value('acl_name') inputdict['add_monolith_snmpv3'] = config.get_field_value( 'add_monolith_snmpv3') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-3].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings #snmp_object = devices.device.snmp.snmp() snmp_object = snmp.snmp() if util.isNotEmpty(inputdict.get('community_string')): #snmp_snmp_community_list_object = devices.device.snmp.snmp_community_list.snmp_community_list() snmp_snmp_community_list_object = snmp.snmp_community_list.snmp_community_list( ) snmp_snmp_community_list_object.snmp_string = inputdict.get( 'community_string') snmp_snmp_community_list_object.permission_type = inputdict.get( 'permision_type') snmp_snmp_community_list_object.acl = inputdict.get('acl_name') #End of Device binding devbindobjs[ 'snmp_snmp_community_list_object'] = snmp_snmp_community_list_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) snmp_snmp_community_list_object_payload = snmp_snmp_community_list_object.getxml( filter=True) log('snmp_snmp_community_list_object_payload: %s' % (snmp_snmp_community_list_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url + '/basicDeviceConfigs:snmp', snmp_snmp_community_list_object_payload, sdata.getSession(), True) if util.isNotEmpty(inputdict.get('add_monolith_snmpv3')): snmpv3_group_monolith_payload = ''' <snmp-groups xmlns="http://anutanetworks.com/basicDeviceConfigs"> <group-name>TATA_SNMP</group-name> <snmp-versions> <group-auth-type>priv</group-auth-type> <snmp-version>v3</snmp-version> <view-name>TATA-MONITORING-SNMP</view-name> <group-priviledge>access</group-priviledge> </snmp-versions> </snmp-groups> ''' for dev_iterator in dev: yang.Sdk.createData( dev_iterator.url + '/basicDeviceConfigs:snmp', snmpv3_group_monolith_payload, sdata.getSession(), True) snmpv3_user_monolith_payload = ''' <snmp-users> <user>Tcl@M0nolith</user> <group-name>TATA_SNMP</group-name> <snmp-version>v3</snmp-version> <v3-auth-type>md5</v3-auth-type> <v3-auth-paswd>Tcl4M0nolith</v3-auth-paswd> <encrpt-type>des</encrpt-type> <encrpt-paswd>Tcl4M0nolith</encrpt-paswd> </snmp-users> ''' for dev_iterator in dev: yang.Sdk.createData( dev_iterator.url + '/basicDeviceConfigs:snmp', snmpv3_user_monolith_payload, sdata.getSession(), True)
def processBeforeReserve(self, session): operations = session.getOperations() """Add any move operations for creation""" log('operations: %s' % (operations)) yang.moveOperations(operations, ['CreateAAA'], ['DeleteRoute'], False) print 'pass04: operations: %s' % (operations)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'timeout') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['timeout_type'] = config.get_field_value('timeout_type') inputdict['timeout_value'] = config.get_field_value('timeout_value') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict[ 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name'] = sdata.getRcPath( ).split('/')[-3].split('=')[1] inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-7].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings netflow_object = devices.device.netflow.netflow() netflow_flow_monitors_object = devices.device.netflow.flow_monitors.flow_monitors( ) _Gen_obj = getLocalObject(sdata, 'flow-monitor') inputdict[ 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name'] = _Gen_obj.flow_monitor.name if util.isNotEmpty( inputdict.get( 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name' )): netflow_flow_monitors_flow_monitor_object = devices.device.netflow.flow_monitors.flow_monitor.flow_monitor( ) netflow_flow_monitors_flow_monitor_cache_object = devices.device.netflow.flow_monitors.flow_monitor.cache.cache( ) if util.isNotEmpty(inputdict.get('timeout_type')): netflow_flow_monitors_flow_monitor_cache_timeout_object = devices.device.netflow.flow_monitors.flow_monitor.cache.timeout.timeout( ) netflow_flow_monitors_flow_monitor_cache_timeout_object.timeout_type = inputdict.get( 'timeout_type') netflow_flow_monitors_flow_monitor_cache_timeout_object.timeout_value = inputdict.get( 'timeout_value') #End of Device binding devbindobjs[ 'netflow_flow_monitors_flow_monitor_cache_timeout_object'] = netflow_flow_monitors_flow_monitor_cache_timeout_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) for dev_iterator in dev: if not yang.Sdk.dataExists( dev_iterator.url + '/l3features:netflow/flow-monitors/flow-monitor=%s' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name' )))): yang.Sdk.createData( dev_iterator.url + '/l3features:netflow/flow-monitors/flow-monitor=%s' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name' ))), '<cache/>', sdata.getSession(), False) netflow_flow_monitors_flow_monitor_cache_timeout_object_payload = netflow_flow_monitors_flow_monitor_cache_timeout_object.getxml( filter=True) log('netflow_flow_monitors_flow_monitor_cache_timeout_object_payload: %s' % (netflow_flow_monitors_flow_monitor_cache_timeout_object_payload)) for dev_iterator in dev: yang.Sdk.createData( dev_iterator.url + '/l3features:netflow/flow-monitors/flow-monitor=%s/cache' % (util.make_interfacename( inputdict.get( 'day1services_day1service_netflow_netflow_flow_monitors_flow_monitor_name' ))), netflow_flow_monitors_flow_monitor_cache_timeout_object_payload, sdata.getSession(), True)
def create(self, id, sdata): sdata.getSession().addYangSessionPreReserveProcessor( self.create_pre_processor) #Fetch Local Config Object config = getCurrentObjectConfig(id, sdata, 'flow_exports') #Fetch Service Model Context Object smodelctx = None #Fetch Parent Object parentobj = None dev = [] inputkeydict = {} devbindobjs = {} inputdict = {} opaque_args = self.opaque_args # START OF FETCHING THE LEAF PARAMETERS inputdict['legacy_netflow'] = config.get_field_value('legacy_netflow') if inputdict.get('legacy_netflow') is None: inputdict['legacy_netflow'] = 'False' inputdict['source'] = config.get_field_value('source') inputdict['interface_names'] = config.get_field_value( 'interface_names') inputdict['version'] = config.get_field_value('version') # END OF FETCHING THE LEAF PARAMETERS _Gen_obj = getLocalObject(sdata, 'day1service') device_mgmt_ip_address = _Gen_obj.day1service.device_ip #Fetch Device Object dev = getDeviceObject(device_mgmt_ip_address, sdata) # START OF FETCHING THE PARENT KEY LEAF PARAMETERS inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath( ).split('/')[-4].split('=')[1] # END OF FETCHING THE PARENT KEY LEAF PARAMETERS #Use the custom methods to process the data service_customization.ServiceDataCustomization.process_service_create_data( smodelctx, sdata, dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args) #Start of Device binding with python bindings netflow_object = netflow.netflow() netflow_flow_exports_object = netflow.flow_exports.flow_exports() netflow_flow_exports_object.legacy_netflow = inputdict.get( 'legacy_netflow') netflow_flow_exports_object.source = inputdict.get('source') netflow_flow_exports_object.interface_names = inputdict.get( 'interface_names') netflow_flow_exports_object.version = inputdict.get('version') #End of Device binding devbindobjs[ 'netflow_flow_exports_object'] = netflow_flow_exports_object #Use the custom method to process/create payload service_customization.ServiceDataCustomization.process_service_device_bindings( smodelctx, sdata, dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args) for dev_iterator in dev: if dev_iterator.device.get_field_value('netflow') == None: yang.Sdk.createData(dev_iterator.url, '<netflow/>', sdata.getSession(), False) netflow_flow_exports_object_payload = netflow_flow_exports_object.getxml( filter=True) log('netflow_flow_exports_object_payload: %s' % (netflow_flow_exports_object_payload)) for dev_iterator in dev: yang.Sdk.createData(dev_iterator.url + '/l3features:netflow', netflow_flow_exports_object_payload, sdata.getSession(), True)