{% set acl_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/acl/' in config.custom.resource_key %}
{% if 'acl-set' in config.custom.resource_key %}
{% set acl_name = config.custom.resource_key.split('acl-set[')[1].split('][')[0] %}
{% else %}
{% set acl_name = config.custom.resource_key.split('ress[')[1].split('][')[0] %}
{% endif %}
{% if acl_name|length == 0 %}
{% set acl_name = 'Undefined' %}
{% endif %}
{% if acl_name not in acl_names %}
{% set _ = acl_names.append(acl_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for acl_name in acl_names %}
{{ acl_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/acl/' in config.custom.resource_key and acl_name in config.custom.resource_key.split('][')[0] %}
{% if 'acl-entry' in config.custom.resource_key %}
{% set rule_number = config.custom.resource_key.split('acl-entry[')[1].split(']')[0] %}
{% set pol_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/routing_policy/' in config.custom.resource_key %}
{% if 'policy_definition' in config.custom.resource_key %}
{% set pol_name = config.custom.resource_key.split('policy_definition[')[1].split(']')[0] %}
{% endif %}
{% if pol_name|length == 0 %}
{% set pol_name = 'Undefined' %}
{% endif %}
{% if pol_name not in pol_names %}
{% set _ = pol_names.append(pol_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for pol_name in pol_names %}
{{ pol_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/routing_policy/' in config.custom.resource_key and pol_name in config.custom.resource_key.split('[')[1].split(']')[0] %}
{% if 'policy_definition' not in config.custom.resource_key %}
{{ config.custom.resource_value }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
VRFs
VRF default
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/network_instance' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in 'default' %}
{% if ']/' in config.custom.resource_key%}
{% set aux = config.custom.resource_key.split(']/')[1].split('[')[0] %}
{% set vpn_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/network_instance' in config.custom.resource_key %}
{% if 'L3VRF' in config.custom.resource_value %}
{% set vpn_name = config.custom.resource_key.split('network_instance[')[1].split(']')[0] %}
{% if vpn_name not in vpn_names %}
{% set _ = vpn_names.append(vpn_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for vpn_name in vpn_names %}
{{ vpn_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/network_instance' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in vpn_name %}
{% if ']/' in config.custom.resource_key%}
{% set aux = config.custom.resource_key.split(']/')[1].split('[')[0] %}
{% set vpn_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/network_instance' in config.custom.resource_key %}
{% if 'L2VSI' in config.custom.resource_value %}
{% set vpn_name = config.custom.resource_key.split('network_instance[')[1].split(']')[0] %}
{% if vpn_name not in vpn_names %}
{% set _ = vpn_names.append(vpn_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for vpn_name in vpn_names %}
{{ vpn_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/network_instance' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in vpn_name %}
{% if ']/' in config.custom.resource_key%}
{% set aux = config.custom.resource_key.split(']/')[1].split('[')[0] %}
{% set interface_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface[' in config.custom.resource_key %}
{% if 'ethernetCsmacd' in config.custom.resource_value %}
{% set interface_name = config.custom.resource_key.split('interface[')[1].split(']')[0] %}
{% set interface_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface[' in config.custom.resource_key %}
{% if 'softwareLoopback' in config.custom.resource_value %}
{% set interface_name = config.custom.resource_key.split('interface[')[1].split(']')[0] %}
{% if interface_name not in interface_names %}
{% set _ = interface_names.append(interface_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for interface_name in interface_names %}
{{ interface_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in interface_name %}
{% if 'subinterface' in config.custom.resource_key %}
{% set subinterface_name = config.custom.resource_key.split('subinterface[')[1].split(']')[0] %}
{% set interface_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface[' in config.custom.resource_key %}
{% if 'l3ipvlan' in config.custom.resource_value %}
{% set interface_name = config.custom.resource_key.split('interface[')[1].split(']')[0] %}
{% if interface_name not in interface_names %}
{% set _ = interface_names.append(interface_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for interface_name in interface_names %}
{{ interface_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface' in config.custom.resource_key and '/subinterface' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in interface_name %}
{{ config.custom.resource_value }}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
Interfaces L2
{% set interface_names = [] %}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if '/interface[' in config.custom.resource_key %}
{% if 'l2vlan' in config.custom.resource_value or 'mplsTunnel' in config.custom.resource_value %}
{% set interface_name = config.custom.resource_key.split('interface[')[1].split(']')[0] %}
{% if interface_name not in interface_names %}
{% set _ = interface_names.append(interface_name) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for interface_name in interface_names %}
{{ interface_name }}
{% for config in device.device_config.config_rules %}
{% if config.WhichOneof('config_rule') == 'custom' %}
{% if 'subinterface' in config.custom.resource_key %}
{% if '/interface' in config.custom.resource_key and '/subinterface' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in interface_name %}
{{ config.custom.resource_value }}
{% endif %}
{% else %}
{% if '/interface' in config.custom.resource_key and config.custom.resource_key.split('[')[1].split(']')[0] in interface_name %}