示例#1
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'acl')
        opaque_args = self.opaque_args

        #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['acl_name'] = config.get_field_value('acl_name')
        inputdict['acl_type'] = config.get_field_value('acl_type')
        inputdict['remark'] = config.get_field_value('remark')
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_delete_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#2
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'dhcp_server')
        opaque_args = self.opaque_args

        #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['pool_name'] = config.get_field_value('pool_name')
        inputdict['pool_vrf'] = config.get_field_value('pool_vrf')
        inputdict['network'] = config.get_field_value('network')
        inputdict['mask'] = config.get_field_value('mask')
        inputdict['domain_name'] = config.get_field_value('domain_name')
        inputdict['dhcp_server_ip'] = config.get_field_value('dhcp_server_ip')
        inputdict['dns_server_ip'] = config.get_field_value('dns_server_ip')
        inputdict['default_router'] = config.get_field_value('default_router')
        inputdict['interface_name'] = config.get_field_value('interface_name')
        inputdict['start_ip'] = config.get_field_value('start_ip')
        inputdict['end_ip'] = config.get_field_value('end_ip')
        inputdict['lease'] = config.get_field_value('lease')
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_delete_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict)
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'snmp_community')
        opaque_args = self.opaque_args

        #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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_update_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#4
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'ssh')
        opaque_args = self.opaque_args

        #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['source_interface'] = config.get_field_value(
            'source_interface')
        inputdict['ssh_version'] = config.get_field_value('ssh_version')
        inputdict['scp_enable'] = config.get_field_value('scp_enable')
        if inputdict.get('scp_enable') is None:
            inputdict['scp_enable'] = 'False'
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_update_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#5
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'tacacs')
        opaque_args = self.opaque_args

        #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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_update_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#6
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'eem_eigrp_adj')
        opaque_args = self.opaque_args

        #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['enable_eigrp_adj_eem'] = config.get_field_value('enable_eigrp_adj_eem')
        inputdict['variable1'] = config.get_field_value('variable1')
        if inputdict.get('variable1') is None:
          inputdict['variable1'] = '$_syslog_msg'
        inputdict['variable2'] = config.get_field_value('variable2')
        if inputdict.get('variable2') is None:
          inputdict['variable2'] = '$_regexp_result'
        inputdict['variable3'] = config.get_field_value('variable3')
        if inputdict.get('variable3') is None:
          inputdict['variable3'] = '$id'
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_delete_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict)
示例#7
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'match_condition')
        opaque_args = self.opaque_args

        #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['match_condition_name'] = config.get_field_value('match_condition_name')
        inputdict['source_condition_type'] = config.get_field_value('source_condition_type')
        inputdict['source_ipv4_address'] = config.get_field_value('source_ipv4_address')
        inputdict['source_ipv4_address_mask'] = config.get_field_value('source_ipv4_address_mask')
        inputdict['dest_condition_type'] = config.get_field_value('dest_condition_type')
        inputdict['destination_ipv4_address'] = config.get_field_value('destination_ipv4_address')
        inputdict['destination_ipv4_address_mask'] = config.get_field_value('destination_ipv4_address_mask')
        inputdict['action'] = config.get_field_value('action')
        inputdict['sequence_number'] = config.get_field_value('sequence_number')
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_update_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict)
示例#8
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'dhcp_pool')
        opaque_args = self.opaque_args

        #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['pool_name'] = config.get_field_value('pool_name')
        inputdict['pool_vrf'] = config.get_field_value('pool_vrf')
        inputdict['network'] = config.get_field_value('network')
        inputdict['mask'] = config.get_field_value('mask')
        inputdict['domain_name'] = config.get_field_value('domain_name')
        inputdict['dhcp_server_ip'] = config.get_field_value('dhcp_server_ip')
        inputdict['dns_server_ip'] = config.get_field_value('dns_server_ip')
        inputdict['default_router'] = config.get_field_value('default_router')
        inputdict['interface_name'] = config.get_field_value('interface_name')
        inputdict['lease'] = config.get_field_value('lease')
        # 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)

        prevconfig = util.parseXmlString(sdata.getPreviousPayload())

        prevconfigdhcp = prevconfig.dhcp_pool

        #Start of Device binding with python bindings
        dhcp_pool_object = dhcp.dhcp()
        dhcp_pool_object.pool_name = prevconfigdhcp.get_field_value(
            'pool_name')
        dhcp_pool_object.pool_vrf = inputdict.get('pool_vrf')
        dhcp_pool_object.network = inputdict.get('network')
        dhcp_pool_object.mask = inputdict.get('mask')
        dhcp_pool_object.domain_name = inputdict.get('domain_name')
        dhcp_pool_object.dhcp_server_ip = inputdict.get('dhcp_server_ip')
        dhcp_pool_object.dns_server_ip = inputdict.get('dns_server_ip')
        dhcp_pool_object.default_router = inputdict.get('default_router')
        dhcp_pool_object.interface_name = inputdict.get('interface_name')
        dhcp_pool_object.lease = inputdict.get('lease')

        dhcp_pool_object_payload = dhcp_pool_object.getxml(filter=True)

        for dev_iterator in dev:
            yang.Sdk.patchData(dev_iterator.url +
                               '/l3features:dhcp-server/dhcp=%s' %
                               (prevconfigdhcp.get_field_value('pool_name')),
                               dhcp_pool_object_payload,
                               sdata,
                               add_reference=True)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_update_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#9
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'dhcp_pool')

        #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['pool_name'] = config.get_field_value('pool_name')
        inputdict['pool_vrf'] = config.get_field_value('pool_vrf')
        inputdict['network'] = config.get_field_value('network')
        inputdict['mask'] = config.get_field_value('mask')
        inputdict['domain_name'] = config.get_field_value('domain_name')
        inputdict['dhcp_server_ip'] = config.get_field_value('dhcp_server_ip')
        inputdict['dns_server_ip'] = config.get_field_value('dns_server_ip')
        inputdict['default_router'] = config.get_field_value('default_router')
        inputdict['interface_name'] = config.get_field_value('interface_name')
        inputdict['lease'] = config.get_field_value('lease')
        # 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

        dhcp_pool_object = dhcp.dhcp()
        dhcp_pool_object.pool_name = inputdict.get('pool_name')
        dhcp_pool_object.pool_vrf = inputdict.get('pool_vrf')
        dhcp_pool_object.network = inputdict.get('network')
        dhcp_pool_object.mask = inputdict.get('mask')
        dhcp_pool_object.domain_name = inputdict.get('domain_name')
        dhcp_pool_object.dhcp_server_ip = inputdict.get('dhcp_server_ip')
        dhcp_pool_object.dns_server_ip = inputdict.get('dns_server_ip')
        dhcp_pool_object.default_router = inputdict.get('default_router')
        dhcp_pool_object.interface_name = inputdict.get('interface_name')
        dhcp_pool_object.lease = inputdict.get('lease')

        #End of Device binding
        devbindobjs[
            'dhcp_server_dhcp_pools_dhcp_pool_object'] = dhcp_pool_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:
        #yang.Sdk.createData(dev_iterator.url,'<dhcp-server/>', sdata.getSession(), True)

        dhcp_pool_object_payload = dhcp_pool_object.getxml(filter=True)
        #log('dhcp_server_excluded_address_object_payload: %s' % (dhcp_server_excluded_address_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '/l3features:dhcp-server',
                                dhcp_pool_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_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)
示例#11
0
    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, '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, '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)
示例#14
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'features')
        opaque_args = self.opaque_args

        #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['cdp'] = config.get_field_value('cdp')
        inputdict['domain_lookup'] = config.get_field_value('domain_lookup')
        inputdict['tcp_small_servers'] = config.get_field_value(
            'tcp_small_servers')
        inputdict['udp_small_servers'] = config.get_field_value(
            'udp_small_servers')
        inputdict['finger'] = config.get_field_value('finger')
        inputdict['source_route'] = config.get_field_value('source_route')
        inputdict['bootp_server'] = config.get_field_value('bootp_server')
        inputdict['http_server'] = config.get_field_value('http_server')
        inputdict['http_secure_server'] = config.get_field_value(
            'http_secure_server')
        inputdict['banner_exec'] = config.get_field_value('banner_exec')
        inputdict['banner_exec_string'] = config.get_field_value(
            'banner_exec_string')
        inputdict['banner_login'] = config.get_field_value('banner_login')
        inputdict['banner_login_string'] = config.get_field_value(
            'banner_login_string')
        inputdict['banner_motd'] = config.get_field_value('banner_motd')
        inputdict['banner_motd_string'] = config.get_field_value(
            'banner_motd_string')
        # END OF FETCHING THE LEAF PARAMETERS

        # Bugzilla Bug ID #16 - Ensure 'no ip identd' pushed to CPE when Day1 service is deleted
        features_object = features.features()
        features_object.ip_identd = "disable"
        features_object.cdp = "disable"
        features_object.domain_lookup = "disable"
        features_object.tcp_small_servers = "disable"
        features_object.udp_small_servers = "disable"
        features_object.finger = "disable"
        features_object.source_route = "disable"
        features_object.bootp_server = "disable"
        features_object.http_server = "disable"
        features_object.http_secure_server = "disable"
        features_object.service_pad = "disable"

        _Gen_obj = getLocalObject(sdata, 'day1service')
        device_mgmt_ip_address = _Gen_obj.day1service.device_ip

        #Fetch Device Object
        dev = getDeviceObject(device_mgmt_ip_address, sdata)

        features_object_payload = features_object.getxml(filter=True)
        #log('features_object_payload: %s' % (features_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '', features_object_payload,
                                sdata.getSession(), False)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_delete_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#15
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'service_timestamps')

        #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['service_timestamps_debug'] = config.get_field_value(
            'service_timestamps_debug')
        if inputdict.get('service_timestamps_debug') is None:
            inputdict['service_timestamps_debug'] = 'True'
        inputdict['service_timestamps_log'] = config.get_field_value(
            'service_timestamps_log')
        if inputdict.get('service_timestamps_log') is None:
            inputdict['service_timestamps_log'] = 'True'
        inputdict['service_password_encryption'] = config.get_field_value(
            'service_password_encryption')
        if inputdict.get('service_password_encryption') is None:
            inputdict['service_password_encryption'] = 'True'
        inputdict['enable_secret'] = config.get_field_value('enable_secret')
        if inputdict.get('enable_secret') is None:
            inputdict['enable_secret'] = 'False'
        inputdict['enable_secret_password'] = config.get_field_value(
            'enable_secret_password')
        inputdict['tcp_keepalives_in'] = config.get_field_value(
            'tcp_keepalives_in')
        if inputdict.get('tcp_keepalives_in') is None:
            inputdict['tcp_keepalives_in'] = 'False'
        # 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
        #service_time_stamps_object = devices.device.service_time_stamps.service_time_stamps()
        service_time_stamps_object = service_time_stamps.service_time_stamps()
        service_time_stamps_object.service_timestamps_debug = inputdict.get(
            'service_timestamps_debug')
        service_time_stamps_object.service_timestamps_log = inputdict.get(
            'service_timestamps_log')
        service_time_stamps_object.service_password_encryption = inputdict.get(
            'service_password_encryption')
        service_time_stamps_object.enable_secret = inputdict.get(
            'enable_secret')
        service_time_stamps_object.enable_secret_password = inputdict.get(
            'enable_secret_password')
        service_time_stamps_object.tcp_keepalives_in = inputdict.get(
            'tcp_keepalives_in')

        #End of Device binding
        devbindobjs['service_time_stamps_object'] = service_time_stamps_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)

        service_time_stamps_object_payload = service_time_stamps_object.getxml(
            filter=True)
        #log('service_time_stamps_object_payload: %s' % (service_time_stamps_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '',
                                service_time_stamps_object_payload,
                                sdata.getSession(), True)
示例#16
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'acl')

        #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['acl_name'] = config.get_field_value('acl_name')
        inputdict['acl_type'] = config.get_field_value('acl_type')
        inputdict['remark'] = config.get_field_value('remark')
        # 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
        #access_lists_object = devices.device.access_lists.access_lists()
        if util.isNotEmpty(inputdict.get('acl_name')):
            #access_lists_access_list_object = devices.device.access_lists.access_list.access_list()
            access_lists_access_list_object = access_lists.access_list.access_list(
            )
            access_lists_access_list_object.name = inputdict.get('acl_name')
            access_lists_access_list_object.start_remark = inputdict.get(
                'remark')
            access_lists_access_list_object.acl_type = inputdict.get(
                'acl_type')

        #End of Device binding
        devbindobjs[
            'access_lists_access_list_object'] = access_lists_access_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)
        """
        for dev_iterator in dev:
            acl_obj = yang.Sdk.getData(dev_iterator.url,'', sdata.getTaskId())
            acl_obj = util.parseXmlString(acl_obj)
            print "the acl_rules_obj is: %s"%(acl_obj)
            if not hasattr(acl_obj.device, 'access_lists'):
                yang.Sdk.createData(dev_iterator.url,'<access-lists/>', sdata.getSession(), True)
        """
        access_lists_access_list_object_payload = access_lists_access_list_object.getxml(
            filter=True)
        #log('access_lists_access_list_object_payload: %s' % (access_lists_access_list_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '/acl:access-lists',
                                access_lists_access_list_object_payload,
                                sdata.getSession(), True)
示例#17
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'banner')

        #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['banner_motd'] = config.get_field_value('banner_motd')
        inputdict['motd-delimiter'] = config.get_field_value('motd-delimiter')
        inputdict['login-delimiter'] = config.get_field_value(
            'login-delimiter')
        inputdict['banner-login'] = config.get_field_value('banner-login')
        # 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
        #banner_object = devices.device.banner.banner()
        banner_object = banner.banner()
        banner_object.motd_message = inputdict.get('banner_motd')
        banner_object.motd_delimiter = inputdict.get('motd_delimiter')
        banner_object.login_message = inputdict.get('banner_login')
        banner_object.login_delimiter = inputdict.get('login_delimiter')

        #End of Device binding
        devbindobjs['banner_object'] = banner_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)

        banner_object_payload = banner_object.getxml(filter=True)
        log('banner_object_payload: %s' % (banner_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '', banner_object_payload,
                                sdata.getSession(), True)
示例#18
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'vty')

        #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'] = config.get_field_value('name')
        inputdict['timeout_in_sec'] = config.get_field_value('timeout_in_sec')
        if inputdict.get('timeout_in_sec') is None:
            inputdict['timeout_in_sec'] = '0'
        inputdict['timeout_in_min'] = config.get_field_value('timeout_in_min')
        if inputdict.get('timeout_in_min') is None:
            inputdict['timeout_in_min'] = '30'
        inputdict['min_vty'] = config.get_field_value('min_vty')
        if inputdict.get('min_vty') is None:
            inputdict['min_vty'] = '0'
        inputdict['max_vty'] = config.get_field_value('max_vty')
        if inputdict.get('max_vty') is None:
            inputdict['max_vty'] = '4'
        inputdict['transport_type'] = config.get_field_value('transport_type')
        if inputdict['transport_type'] is None:
            inputdict['transport_type'] = 'telnet ssh'
        inputdict['acl'] = config.get_field_value('acl')
        inputdict['logging_synchronous'] = config.get_field_value(
            'logging_synchronous')
        if inputdict.get('logging_synchronous') is None:
            inputdict['logging_synchronous'] = 'False'
        inputdict['history_size'] = config.get_field_value('history_size')
        inputdict['no_privilege_level'] = config.get_field_value(
            'no_privilege_level')
        inputdict['no_password'] = config.get_field_value('no_password')
        inputdict['auth_type'] = config.get_field_value('auth_type')
        inputdict['vrf_also'] = config.get_field_value('vrf_also')
        # 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
        #vty_configs_object = devices.device.vty_configs.vty_configs()
        vty_configs_object = vty_configs.vty_configs()
        if util.isNotEmpty(inputdict.get('name')):
            #vty_configs_vty_config_object = devices.device.vty_configs.vty_config.vty_config()
            vty_configs_vty_config_object = vty_configs.vty_config.vty_config()
            vty_configs_vty_config_object.name = "line vty " + inputdict.get(
                'min_vty') + " " + inputdict.get('max_vty')
            vty_configs_vty_config_object.min_vty = inputdict.get('min_vty')
            vty_configs_vty_config_object.max_vty = inputdict.get('max_vty')
            vty_configs_vty_config_object.acl_rule_number = inputdict.get(
                'acl')
            vty_configs_vty_config_object.timeout = inputdict.get(
                'timeout_in_min')
            vty_configs_vty_config_object.transport_types_in = inputdict.get(
                'transport_type')
            vty_configs_vty_config_object.logging_synchronous = inputdict.get(
                'logging_synchronous')
            vty_configs_vty_config_object.history_size = inputdict.get(
                'history_size')
            vty_configs_vty_config_object.no_privilege_level = inputdict.get(
                'no_privilege_level')
            if util.isNotEmpty(inputdict['no_privilege_level']):
                vty_configs_vty_config_object.privilege_level._empty_tag = True
            vty_configs_vty_config_object.no_password = inputdict.get(
                'no_password')
            if inputdict.get('vrf_also') == 'true':
                vty_configs_vty_config_object.vrf = 'vrf-also'
            vty_configs_vty_config_object.auth_type = inputdict.get(
                'auth_type')

        #End of Device binding
        devbindobjs[
            'vty_configs_vty_config_object'] = vty_configs_vty_config_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:
        #yang.Sdk.createData(dev_iterator.url,'<vty-configs/>', sdata.getSession(), True)

        vty_configs_vty_config_object_payload = vty_configs_vty_config_object.getxml(
            filter=True)
        #log('vty_configs_vty_config_object_payload: %s' % (vty_configs_vty_config_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(
                dev_iterator.url + '/basicDeviceConfigs:vty-configs',
                vty_configs_vty_config_object_payload, sdata.getSession(),
                True)
示例#19
0
    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)
示例#20
0
    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)
示例#21
0
    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)
示例#22
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'vty')
        opaque_args = self.opaque_args

        #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['timeout_in_sec'] = config.get_field_value('timeout_in_sec')
        if inputdict.get('timeout_in_sec') is None:
            inputdict['timeout_in_sec'] = '0'
        inputdict['timeout_in_min'] = config.get_field_value('timeout_in_min')
        if inputdict.get('timeout_in_min') is None:
            inputdict['timeout_in_min'] = '30'
        inputdict['min_vty'] = config.get_field_value('min_vty')
        if inputdict.get('min_vty') is None:
            inputdict['min_vty'] = '0'
        inputdict['max_vty'] = config.get_field_value('max_vty')
        if inputdict.get('max_vty') is None:
            inputdict['max_vty'] = '4'
        inputdict['transport_type'] = config.get_field_value('transport_type')
        if inputdict['transport_type'] is None:
            inputdict['transport_type'] = 'telnet ssh'
        inputdict['acl'] = config.get_field_value('acl')
        inputdict['logging_synchronous'] = config.get_field_value(
            'logging_synchronous')
        if inputdict.get('logging_synchronous') is None:
            inputdict['logging_synchronous'] = 'False'
        inputdict['history_size'] = config.get_field_value('history_size')
        inputdict['vrf_also'] = config.get_field_value('vrf_also')
        inputdict['no_privilege_level'] = config.get_field_value(
            'no_privilege_level')
        inputdict['no_password'] = config.get_field_value('no_password')
        # 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)

        #Use the custom method to process the data
        service_customization.ServiceDataCustomization.process_service_delete_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
示例#23
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'ntp_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['ntp_server_ip'] = config.get_field_value('ntp_server_ip')
        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
        #ntp_object = devices.device.ntp.ntp()
        ntp_object = ntp.ntp()
        if util.isNotEmpty(inputdict.get('ntp_server_ip')):
          #ntp_ntp_server_object = devices.device.ntp.ntp_server.ntp_server()
          ntp_ntp_server_object = ntp.ntp_server.ntp_server()
          ntp_ntp_server_object.ntp_server_address = inputdict.get('ntp_server_ip')
          ntp_ntp_server_object.vrf = inputdict.get('vrf_name')


        #End of Device binding
        devbindobjs['ntp_ntp_server_object'] = ntp_ntp_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)

        ntp_ntp_server_object_payload = ntp_ntp_server_object.getxml(filter=True)
        #log('ntp_ntp_server_object_payload: %s' % (ntp_ntp_server_object_payload))
        for dev_iterator in dev:
          yang.Sdk.createData(dev_iterator.url+'/basicDeviceConfigs:ntp',ntp_ntp_server_object_payload, sdata.getSession(), True)
示例#24
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'eem_bgp_adj')

        #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['enable_bgp_adj_eem'] = config.get_field_value(
            'enable_bgp_adj_eem')
        inputdict['variable1'] = config.get_field_value('variable1')
        if inputdict.get('variable1') is None:
            inputdict['variable1'] = '$_syslog_msg'
        inputdict['variable2'] = config.get_field_value('variable2')
        if inputdict.get('variable2') is None:
            inputdict['variable2'] = '$_regexp_result'
        inputdict['variable3'] = config.get_field_value('variable3')
        if inputdict.get('variable3') is None:
            inputdict['variable3'] = '$id'
        # 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,
            id=id,
            device=dev,
            parentobj=parentobj,
            inputdict=inputdict,
            inputkeydict=inputkeydict,
            config=config,
            hopaque=opaque_args)

        #Start of Device binding with python bindings
        #eem_script_object = devices.device.eem_script.eem_script()
        eem_script_object = eem_script.eem_script()
        #eem_script_eem_bgp_adj_object = devices.device.eem_script.eem_bgp_adj.eem_bgp_adj()
        eem_script_eem_bgp_adj_object = eem_script.eem_bgp_adj.eem_bgp_adj()
        eem_script_eem_bgp_adj_object.enable_bgp_adj_eem = inputdict.get(
            'enable_bgp_adj_eem')
        eem_script_eem_bgp_adj_object.variable1 = inputdict.get('variable1')
        eem_script_eem_bgp_adj_object.variable2 = inputdict.get('variable2')
        eem_script_eem_bgp_adj_object.variable3 = inputdict.get('variable3')

        #End of Device binding
        devbindobjs[
            'eem_script_eem_bgp_adj_object'] = eem_script_eem_bgp_adj_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:eem-script'):
                yang.Sdk.createData(dev_iterator.url, '<eem-script/>',
                                    sdata.getSession(), False)

        eem_script_eem_bgp_adj_object_payload = eem_script_eem_bgp_adj_object.getxml(
            filter=True)
        #log('eem_script_eem_bgp_adj_object_payload: %s' % (eem_script_eem_bgp_adj_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '/l3features:eem-script',
                                eem_script_eem_bgp_adj_object_payload,
                                sdata.getSession(), True)
示例#25
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'class_entry')

        #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['class_name'] = config.get_field_value('class_name')
        inputdict['flow_monitor_name'] = config.get_field_value(
            'flow_monitor_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_policy_maps_policy_map_name'] = sdata.getRcPath(
            ).split('/')[-2].split('=')[1]
        inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath(
        ).split('/')[-4].split('=')[1]
        # END OF FETCHING THE PARENT KEY LEAF PARAMETERS
        policy_name = inputkeydict[
            'day1services_day1service_policy_maps_policy_map_name']

        cls_obj = policy_maps.policy_map.class_entry.class_entry()
        cls_obj.class_name = inputdict['class_name']
        cls_obj.flow_monitor_name = inputdict['flow_monitor_name']
        for dev_iterator in dev:
            yang.Sdk.createData(
                dev_iterator.url + "/policy-maps/policy-map=%s" %
                (policy_name), cls_obj.getxml(filter=True), sdata.getSession())

        #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)
示例#26
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'ntp')

        #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['access_group_name'] = config.get_field_value(
            'access_group_name')
        inputdict['ntp_source_interface'] = config.get_field_value(
            'ntp_source_interface')
        inputdict['update_calendar'] = config.get_field_value(
            'update_calendar')
        if inputdict.get('update_calendar') is None:
            inputdict['update_calendar'] = 'False'
        # 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
        #ntp_object = devices.device.ntp.ntp()
        ntp_object = ntp.ntp()
        ntp_object.ntp = inputdict.get('access_group_name')
        ntp_object.ntp_source_interface = inputdict.get('ntp_source_interface')
        ntp_object.update_calendar = inputdict.get('update_calendar')

        #End of Device binding
        devbindobjs['ntp_object'] = ntp_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)

        ntp_object_payload = ntp_object.getxml(filter=True)
        #log('ntp_object_payload: %s' % (ntp_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '', ntp_object_payload,
                                sdata.getSession(), True)
示例#27
0
    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)
示例#28
0
    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)
示例#29
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'features')

        #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['cdp'] = config.get_field_value('cdp')
        inputdict['domain_lookup'] = config.get_field_value('domain_lookup')
        inputdict['tcp_small_servers'] = config.get_field_value(
            'tcp_small_servers')
        inputdict['udp_small_servers'] = config.get_field_value(
            'udp_small_servers')
        inputdict['finger'] = config.get_field_value('finger')
        inputdict['source_route'] = config.get_field_value('source_route')
        inputdict['bootp_server'] = config.get_field_value('bootp_server')
        inputdict['http_server'] = config.get_field_value('http_server')
        inputdict['http_secure_server'] = config.get_field_value(
            'http_secure_server')
        inputdict['banner_exec'] = config.get_field_value('banner_exec')
        inputdict['banner_exec_string'] = config.get_field_value(
            'banner_exec_string')
        inputdict['banner_login'] = config.get_field_value('banner_login')
        inputdict['banner_login_string'] = config.get_field_value(
            'banner_login_string')
        inputdict['banner_motd'] = config.get_field_value('banner_motd')
        inputdict['banner_motd_string'] = config.get_field_value(
            'banner_motd_string')
        # 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
        #features_object = devices.device.features.features()
        features_object = features.features()
        features_object.cdp = inputdict.get('cdp')
        features_object.domain_lookup = inputdict.get('domain_lookup')
        features_object.tcp_small_servers = inputdict.get('tcp_small_servers')
        features_object.udp_small_servers = inputdict.get('udp_small_servers')
        features_object.finger = inputdict.get('finger')
        features_object.source_route = inputdict.get('source_route')
        features_object.bootp_server = inputdict.get('bootp_server')
        features_object.http_server = inputdict.get('http_server')
        features_object.http_secure_server = inputdict.get(
            'http_secure_server')
        features_object.banner_exec = inputdict.get('banner_exec')
        features_object.banner_exec_string = inputdict.get(
            'banner_exec_string')
        features_object.banner_login = inputdict.get('banner_login')
        features_object.banner_login_string = inputdict.get(
            'banner_login_string')
        features_object.banner_motd = inputdict.get('banner_motd')
        features_object.banner_motd_string = inputdict.get(
            'banner_motd_string')
        features_object.ip_identd = "disable"
        features_object.service_pad = "disable"

        #End of Device binding
        devbindobjs['features_object'] = features_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)

        features_object_payload = features_object.getxml(filter=True)
        #log('features_object_payload: %s' % (features_object_payload))
        for dev_iterator in dev:
            yang.Sdk.createData(dev_iterator.url + '', features_object_payload,
                                sdata.getSession(), False)
示例#30
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'match_condition')

        #Fetch Service Model Context Object
        smodelctx = None

        #Fetch Parent Object
        parentobj = None

        dev = []
        inputkeydict = {}
        devbindobjs={}
        inputdict = {}
        opaque_args = self.opaque_args
 
        if config.get_field_value('cidr') == "true":
            prefix_in = config.get_field_value('cidr_value')
            prefix = util.IPPrefix(prefix_in)
            ip_address = prefix.address
            wildcard = prefix.wildcard
            source_ipv4_address = ip_address
            source_ipv4_mask = wildcard
        else:
            source_ipv4_address = config.get_field_value('source_ipv4_address')
            source_ipv4_mask = config.get_field_value('source_ipv4_address_mask')

        if config.get_field_value('cidr') == "true" and config.get_field_value('cidr_destination_value') !=None:
            prefix_in = config.get_field_value('cidr_destination_value')
            prefix = util.IPPrefix(prefix_in)
            ip_address = prefix.address
            wildcard = prefix.wildcard
            destination_ipv4_address = ip_address
            destination_ipv4_mask = wildcard
        else:
            destination_ipv4_address = config.get_field_value('destination_ipv4_address')
            destination_ipv4_mask = config.get_field_value('destination_ipv4_address_mask')

        # START OF FETCHING THE LEAF PARAMETERS
        inputdict['sequence_number'] = config.get_field_value('sequence_number')
        inputdict['match_condition_name'] = config.get_field_value('match_condition_name')
        inputdict['match_packets'] = config.get_field_value('match_packets')
        inputdict['source_condition_type'] = config.get_field_value('source_condition_type')
        inputdict['source_ipv4_address'] = source_ipv4_address
        inputdict['source_ipv4_address_mask'] = source_ipv4_mask
        '''
        if config.get_field_value('dest_condition_type') is None:
          if inputdict['source_condition_type'] == 'host':
            inputdict['dest_condition_type'] = 'host'
          if inputdict['source_condition_type'] == 'cidr':
            inputdict['dest_condition_type'] = 'cidr'
          if inputdict['source_condition_type'] == 'any':
            inputdict['dest_condition_type'] = None
        else:
          inputdict['dest_condition_type'] = config.get_field_value('dest_condition_type')
        inputdict['cidr_destination_value'] = config.get_field_value('cidr_destination_value')
        inputdict['destination_ipv4_address'] = destination_ipv4_address
        inputdict['destination_ipv4_address_mask'] = destination_ipv4_mask
        '''
        inputdict['action'] = config.get_field_value('action')


        acl_name = inputdict['action']

        if inputdict['source_condition_type'] == 'host':
          acl_name = acl_name + ' ' + 'host' + ' '+ inputdict['source_ipv4_address']
        
        if inputdict['source_condition_type'] == "cidr":
          acl_name = acl_name + ' ' + inputdict['source_ipv4_address'] + ' ' + inputdict['source_ipv4_address_mask']

        if inputdict['source_condition_type'] == "any":
	      acl_name = acl_name + ' ' + 'any'

        #if inputdict['dest_condition_type'] == "host" and inputdict['destination_ipv4_address'] != None:
          #acl_name = acl_name + ' ' + 'host' + ' ' + inputdict['destination_ipv4_address']

        #if inputdict['destination_ipv4_address'] != None and inputdict['destination_ipv4_address_mask'] !=None:
          #acl_name = acl_name + ' ' + inputdict['destination_ipv4_address'] + ' ' + inputdict['destination_ipv4_address_mask']

        if inputdict['match_packets']!= None:
	       acl_name = acl_name + ' ' + inputdict['match_packets']
    
        # 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_named_access_lists_acl_acl_name'] = sdata.getRcPath().split('/')[-2].split('=')[1]
        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, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args)

        #Start of Device binding with python bindings
        #access_lists_object = devices.device.access_lists.access_lists()
        _Gen_obj = getLocalObject(sdata, 'acl')
        inputdict['day1services_day1service_named_access_lists_acl_acl_name'] = _Gen_obj.acl.acl_name
        if util.isNotEmpty(inputdict.get('day1services_day1service_named_access_lists_acl_acl_name')):
          #access_lists_access_list_object = devices.device.access_lists.access_list.access_list()
          #access_lists_access_list_acl_rules_object = devices.device.access_lists.access_list.acl_rules.acl_rules()
          if util.isNotEmpty(inputdict.get('match_condition_name')):
            #access_lists_access_list_acl_rules_acl_rule_object = devices.device.access_lists.access_list.acl_rules.acl_rule.acl_rule()
            access_lists_access_list_acl_rules_acl_rule_object = access_lists.access_list.acl_rules.acl_rule.acl_rule()
            #access_lists_access_list_acl_rules_acl_rule_object.name = inputdict.get('match_condition_name')

            access_lists_access_list_acl_rules_acl_rule_object.name = acl_name
            access_lists_access_list_acl_rules_acl_rule_object.linenumber = inputdict.get('sequence_number')
            access_lists_access_list_acl_rules_acl_rule_object.action = inputdict.get('action')
            access_lists_access_list_acl_rules_acl_rule_object.source_condition_type = inputdict.get('source_condition_type')
            access_lists_access_list_acl_rules_acl_rule_object.source_ip = inputdict.get('source_ipv4_address')
            access_lists_access_list_acl_rules_acl_rule_object.source_mask = inputdict.get('source_ipv4_address_mask')
            #access_lists_access_list_acl_rules_acl_rule_object.dest_condition_type = inputdict.get('dest_condition_type')
            #access_lists_access_list_acl_rules_acl_rule_object.dest_ip = inputdict.get('destination_ipv4_address')
            #access_lists_access_list_acl_rules_acl_rule_object.dest_mask = inputdict.get('destination_ipv4_address_mask')
            if inputdict.get('match_packets') != "log":
                access_lists_access_list_acl_rules_acl_rule_object.match_packets = inputdict.get('match_packets')
            else:
                access_lists_access_list_acl_rules_acl_rule_object.extra_options = "log"




        #End of Device binding
        devbindobjs['access_lists_access_list_acl_rules_acl_rule_object'] = access_lists_access_list_acl_rules_acl_rule_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:
          #yang.Sdk.createData(dev_iterator.url+'/access-lists/access-list=%s'%(util.make_interfacename(inputdict.get('day1services_day1service_named_access_lists_acl_acl_name'))),'<acl-rules/>', sdata.getSession(), True)


        access_lists_access_list_acl_rules_acl_rule_object_payload = access_lists_access_list_acl_rules_acl_rule_object.getxml(filter=True)
        #log('access_lists_access_list_acl_rules_acl_rule_object_payload: %s' % (access_lists_access_list_acl_rules_acl_rule_object_payload))
        for dev_iterator in dev:
          yang.Sdk.createData(dev_iterator.url+'/acl:access-lists/access-list=%s/acl-rules'%(util.make_interfacename(inputdict.get('day1services_day1service_named_access_lists_acl_acl_name'))),access_lists_access_list_acl_rules_acl_rule_object_payload, sdata.getSession(), True)