Esempio n. 1
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'flow_record')
        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['description'] = config.get_field_value('description')
        inputdict['record_type'] = config.get_field_value('record_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)

        #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)
Esempio n. 2
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'service_timestamps')
        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['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)

        #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)
Esempio n. 3
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'syslog')
        opaque_args = self.opaque_args

        #Fetch Service Model Context Object
        smodelctx = None

        #Fetch Parent Object
        parentobj = getParentObject(sdata)

        dev = []
        inputkeydict = {}
        devbindobjs={}
        inputdict = {}
        opaque_args = self.opaque_args

        # START OF FETCHING THE LEAF PARAMETERS
        inputdict['logging_source_interface'] = config.get_field_value('logging_source_interface')
        inputdict['vrf_name'] = config.get_field_value('vrf_name')
        inputdict['buffer_size'] = config.get_field_value('buffer_size')
        inputdict['logging_trap'] = config.get_field_value('logging_trap')
        inputdict['logging_facility'] = config.get_field_value('logging_facility')
        inputdict['no_logging_console'] = config.get_field_value('no_logging_console')
        # 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)
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'aaa_servers_private')
        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['aaa_server_ip'] = config.get_field_value('aaa_server_ip')
        inputdict['privilege_level'] = config.get_field_value('privilege_level')
        inputdict['privilege_key'] = config.get_field_value('privilege_key')
        # 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)
Esempio n. 5
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'snmp')
        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['write_community_string'] = config.get_field_value('write_community_string')
        inputdict['acl_name'] = config.get_field_value('acl_name')
        inputdict['snmp_ifmib_ifindex_persist'] = config.get_field_value('snmp_ifmib_ifindex_persist')
        inputdict['trap_source'] = config.get_field_value('trap_source')
        # 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)
Esempio n. 6
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'aaa')
        opaque_args = self.opaque_args

        #Fetch Service Model Context Object
        smodelctx = None

        #Fetch Parent Object
        parentobj = getParentObject(sdata)

        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['vrf'] = config.get_field_value('vrf')
        inputdict['source_interface'] = config.get_field_value('source_interface')
        inputdict['aaa_new_model'] = config.get_field_value('aaa_new_model')
        if inputdict.get('aaa_new_model') is None:
          inputdict['aaa_new_model'] = '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)
Esempio n. 7
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

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

        #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['low_ipaddress'] = config.get_field_value('low_ipaddress')
        inputdict['high_ipaddress'] = config.get_field_value('high_ipaddress')
        inputdict['vrf_name'] = config.get_field_value('vrf_name')
        # END OF FETCHING THE LEAF PARAMETERS

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

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

        # START OF FETCHING THE PARENT KEY LEAF PARAMETERS
        inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-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_server_object = devices.device.dhcp_server.dhcp_server()
        if util.isNotEmpty(inputdict.get('low_ipaddress')):
          #dhcp_server_excluded_address_object = devices.device.dhcp_server.excluded_address.excluded_address()
          dhcp_server_excluded_address_object = dhcp_server.excluded_address.excluded_address()
          dhcp_server_excluded_address_object.low_ipaddress = inputdict.get('low_ipaddress')
          dhcp_server_excluded_address_object.high_ipaddress = inputdict.get('high_ipaddress')
          dhcp_server_excluded_address_object.vrf_name = inputdict.get('vrf_name')


        #End of Device binding
        devbindobjs['dhcp_server_excluded_address_object'] = dhcp_server_excluded_address_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_server_excluded_address_object_payload = dhcp_server_excluded_address_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_server_excluded_address_object_payload, sdata.getSession(), True)
Esempio n. 8
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.create_pre_processor)

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

        #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['device_ip'] = config.get_field_value('device_ip')
        inputdict['vrf'] = config.get_field_value('vrf')
        inputdict['created_on'] = config.get_field_value('created_on')
        inputdict['created_by'] = config.get_field_value('created_by')
        # END OF FETCHING THE LEAF PARAMETERS

        #Fetch Device Object
        dev = getDeviceObject(config.get_field_value('device_ip'))
        self.opaque_args['hireachy_device'] = dev

        #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)
Esempio n. 9
0
    def update(self, id, sdata):
        #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

        _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)
Esempio n. 10
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'eem_cpu_threshold')
        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['rising_threshold'] = config.get_field_value(
            'rising_threshold')
        inputdict['rising_threshold_interval'] = config.get_field_value(
            'rising_threshold_interval')
        inputdict['falling_threshold'] = config.get_field_value(
            'falling_threshold')
        inputdict['falling_threshold_interval'] = config.get_field_value(
            'falling_threshold_interval')
        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)
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

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

        #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['aaa_server_ip'] = config.get_field_value('aaa_server_ip')
        inputdict['privilege_level'] = config.get_field_value('privilege_level')
        inputdict['privilege_key'] = config.get_field_value('privilege_key')
        # 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
        #aaa_group_object = aaa_group.aaa_group()
        if util.isNotEmpty(inputdict.get('aaa_server_ip')):
          aaa_group_aaa_servers_private_object = aaa_group.aaa_servers_private.aaa_servers_private()
          aaa_group_aaa_servers_private_object.aaa_server_private = inputdict.get('aaa_server_ip')
          aaa_group_aaa_servers_private_object.privilege_level = inputdict.get('privilege_level')
          aaa_group_aaa_servers_private_object.privilege_key = inputdict.get('privilege_key')


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

        aaa_group_aaa_servers_private_object_payload = aaa_group_aaa_servers_private_object.getxml(filter=True)
        log('aaa_group_aaa_servers_private_object_payload: %s' % (aaa_group_aaa_servers_private_object_payload))
        for dev_iterator in dev:
          yang.Sdk.createData(dev_iterator.url+'/aaa-group',aaa_group_aaa_servers_private_object_payload, sdata.getSession(), True)
Esempio n. 12
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

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

        #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['system_shutdown'] = config.get_field_value('system_shutdown')
        inputdict['snmp_ifmib_ifindex_persist'] = config.get_field_value('snmp_ifmib_ifindex_persist')
        inputdict['trap_source'] = config.get_field_value('trap_source')
        # 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_name'] = 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
        #snmp_object = devices.device.snmp.snmp()
        snmp_object = snmp.snmp()
        snmp_object.trap_source = inputdict.get('trap_source')
        snmp_object.system_shutdown = inputdict.get('system_shutdown')
        snmp_object.snmp_ifmib_ifindex_persist = inputdict.get('snmp_ifmib_ifindex_persist')


        #End of Device binding
        devbindobjs['snmp_object'] = snmp_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_object_payload = snmp_object.getxml(filter=True)
        log('snmp_object_payload: %s' % (snmp_object_payload))
        for dev_iterator in dev:
          yang.Sdk.createData(dev_iterator.url+'',snmp_object_payload, sdata.getSession(), False)
Esempio n. 13
0
    def create(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(self.create_pre_processor)

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

        #Fetch Service Model Context Object
        smodelctx = None

        #Fetch Parent Object
        parentobj = None

        dev = []
        inputkeydict = {}
        devbindobjs={}
        inputdict = {}
        opaque_args = self.opaque_args

        # START OF FETCHING THE LEAF PARAMETERS
        inputdict['destination_ip_address'] = config.get_field_value('destination_ip_address')
        inputdict['port'] = config.get_field_value('port')
        # END OF FETCHING THE LEAF PARAMETERS

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

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

        # START OF FETCHING THE PARENT KEY LEAF PARAMETERS
        inputkeydict['day1services_day1service_device_ip'] = sdata.getRcPath().split('/')[-3].split('=')[1]

        #Start of Device binding with python bindings
        #legacy_netflow_object = devices.device.legacy_netflow.legacy_netflow()
        legacy_netflow_object = legacy_netflow.legacy_netflow()
        if util.isNotEmpty(inputdict.get('destination_ip_address')):
          #legacy_netflow_destinations_object = devices.device.legacy_netflow.destinations.destinations()
          legacy_netflow_destinations_object = legacy_netflow.destinations.destinations()
          legacy_netflow_destinations_object.destination_ip_address = inputdict.get('destination_ip_address')
          legacy_netflow_destinations_object.port = inputdict.get('port')


        #Use the custom methods to process the data
        service_customization.ServiceDataCustomization.process_service_create_data(smodelctx, sdata, dev, id=id, device=dev, parentobj=parentobj, inputdict=inputdict, inputkeydict=inputkeydict, config=config, hopaque=opaque_args)

        #Use the custom method to process/create payload
        service_customization.ServiceDataCustomization.process_service_device_bindings(smodelctx, sdata, dev, id=id, device=dev, inputdict=inputdict, inputkeydict=inputkeydict, parentobj=parentobj, config=config, devbindobjs=devbindobjs, hopaque=opaque_args)

        legacy_netflow_destinations_object_payload = legacy_netflow_destinations_object.getxml(filter=True)
        log('legacy_netflow_destinations_object_payload: %s' % (legacy_netflow_destinations_object_payload))
        for dev_iterator in dev:
          yang.Sdk.createData(dev_iterator.url+'/legacy-netflow',legacy_netflow_destinations_object_payload, sdata.getSession(), True)
Esempio n. 14
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'interface')
        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['if_tag'] = config.get_field_value('if_tag')
        inputdict['interface_name'] = config.get_field_value('interface_name')
        inputdict['correlate'] = config.get_field_value('correlate')
        if inputdict.get('correlate') is None:
            inputdict['correlate'] = 'event if_1'
        inputdict['variable1'] = config.get_field_value('variable1')
        if inputdict.get('variable1') is None:
            inputdict['variable1'] = '$_interface_name'
        inputdict['variable2'] = config.get_field_value('variable2')
        if inputdict.get('variable2') is None:
            inputdict['variable2'] = '$_interface_delta_value'
        inputdict['variable3'] = config.get_field_value('variable3')
        if inputdict.get('variable3') is None:
            inputdict['variable3'] = '$_interface_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)

        #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)
Esempio n. 15
0
    def update(self, id, sdata):
        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'legacy_netflow')
        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'] = config.get_field_value('source')
        inputdict['version'] = config.get_field_value('version')
        inputdict['interface_names'] = config.get_field_value(
            'interface_names')
        # END OF FETCHING THE LEAF PARAMETERS

        pinputdict = {}

        # START OF FETCHING THE PREVIOUS LEAF PARAMETERS
        pinputdict['source'] = pconfig.get_field_value('source')
        pinputdict['version'] = pconfig.get_field_value('version')
        pinputdict['interface_names'] = pconfig.get_field_value(
            'interface_names')
        _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,
            pconfig=pconfig,
            hopaque=opaque_args,
            inputdict=inputdict,
            pinputdict=pinputdict)
Esempio n. 16
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'console')
        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['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)

        #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)
Esempio n. 17
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

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

        #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)
Esempio n. 18
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #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_delete_data(
            smodelctx,
            sdata,
            id=id,
            dev=dev,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)

        #TO TEST Side Effects of rolling back to dummy static route
        """
Esempio n. 19
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'ntp')
        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['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)

        #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)
Esempio n. 20
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'flow_export')
        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['description'] = config.get_field_value('description')
        inputdict['destination'] = config.get_field_value('destination')
        inputdict['source'] = config.get_field_value('source')
        inputdict['vrf'] = config.get_field_value('vrf')
        inputdict['udp_port_value'] = config.get_field_value('udp_port_value')
        inputdict['template_timeout'] = config.get_field_value(
            'template_timeout')
        # 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,
            parentobj=parentobj,
            config=config,
            hopaque=opaque_args,
            inputdict=inputdict)
Esempio n. 21
0
    def delete(self, id, sdata):
        sdata.getSession().addYangSessionPreReserveProcessor(
            self.delete_pre_processor)

        #Fetch Local Config Object
        config = getCurrentObjectConfig(id, sdata, 'day1service')
        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['device_ip'] = config.get_field_value('device_ip')
        inputdict['vrf'] = config.get_field_value('vrf')
        # END OF FETCHING THE LEAF PARAMETERS

        #Fetch Device Object
        dev = getDeviceObject(config.get_field_value('device_ip'))
        self.opaque_args['hireachy_device'] = dev

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

        #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_delete_data(smodelctx, sdata, id=id, dev=dev, parentobj=parentobj, config=config, hopaque=opaque_args, inputdict=inputdict)
Esempio n. 23
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)
Esempio n. 24
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)
Esempio n. 25
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)
    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)
Esempio n. 27
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)
Esempio n. 28
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)
Esempio n. 29
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)
Esempio n. 30
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)