Commit ef19aedc authored by Shayan Hajipour's avatar Shayan Hajipour
Browse files

enabling ipv4 ingress filter for acl support xml in ipinfusion added to acl...

enabling ipv4 ingress filter for acl support xml in ipinfusion added to acl recipe and xml renderer changed to jinja2
parent 7dff96e7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -227,10 +227,10 @@ def edit_config(
                resource_key,resource_value = resource
                chk_string(str_resource_name + '.key', resource_key, allow_empty=False)

                str_config_messages = compose_config(                                                                          # get template for configuration
                    resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor, message_renderer='pyangbind')
                # str_config_messages = compose_config(                                                                          # get template for configuration
                #     resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor, message_renderer=netconf_handler.message_renderer)
                #     resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor, message_renderer='pyangbind')
                str_config_messages = compose_config(                                                                          # get template for configuration
                    resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor, message_renderer=netconf_handler.message_renderer)
                for str_config_message in str_config_messages:                                                                 # configuration of the received templates 
                    if str_config_message is None: raise UnsupportedResourceKeyException(resource_key)
                    logger.debug('[{:s}] str_config_message[{:d}] = {:s}'.format(
+4 −0
Original line number Diff line number Diff line
@@ -118,17 +118,21 @@ def compose_config( # template generation
        templates =[]
        if "acl_ruleset" in resource_key:                                               # MANAGING ACLs
            if True: #vendor == 'ipinfusion': #! ipinfusion proprietary netconf receipe is used temporarily
                enable_ingress_filter_path = 'acl/interfaces/ingress/enable_ingress_filter.xml'
                acl_entry_path = 'acl/acl-set/acl-entry/edit_config_ipinfusion_proprietary.xml'
                acl_ingress_path = 'acl/interfaces/ingress/edit_config_ipinfusion_proprietary.xml'
                data : Dict[str, Any] = acl_cr_to_dict_ipinfusion_proprietary(resource_value, delete=delete)
            else:
                enable_ingress_filter_path = 'acl/interfaces/ingress/enable_ingress_filter.xml'
                acl_entry_path = 'acl/acl-set/acl-entry/edit_config.xml'
                acl_ingress_path = 'acl/interfaces/ingress/edit_config.xml'
                data : Dict[str, Any] = acl_cr_to_dict(resource_value, delete=delete)
            if delete: # unpair acl and interface before removing acl
                templates.append(JINJA_ENV.get_template(acl_ingress_path))
                templates.append(JINJA_ENV.get_template(acl_entry_path))
                templates.append(JINJA_ENV.get_template(enable_ingress_filter_path))
            else:
                templates.append(JINJA_ENV.get_template(enable_ingress_filter_path))
                templates.append(JINJA_ENV.get_template(acl_entry_path))
                templates.append(JINJA_ENV.get_template(acl_ingress_path))
        else:
+9 −0
Original line number Diff line number Diff line
<profiles xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-platform"> 
	<hardware-profile> 
	<filters> 
	<config> 
		<ingress-ipv4-extended {% if operation == "delete" %}operation="delete"{% endif %}></ingress-ipv4-extended>
	</config> 
	</filters> 
	</hardware-profile> 
</profiles>
 No newline at end of file