{%- if command == "acl" %}
| Access Control List | Access Control Entry | Permission | Logging | Source Network | Destination Network | L3 Protocol | L4 Protocol | Operator | Port |
| ------------------- | -------------------- | ---------- | ------- | -------------- | ------------------- | ----------- | ----------- | -------- | ---- |
{%-    for list in to_parse_access_list %}
{%-        if data_to_template['acls'][list].aces is defined %}
{%-            for ace in data_to_template['acls'][list].aces %}
{%-                if data_to_template['acls'][list].aces[ace].matches.l3 is defined %}
{%-                    if data_to_template['acls'][list].aces[ace].matches.l3.ipv4 is defined %}
{%-                        if data_to_template['acls'][list].aces[ace].matches.l3.ipv4.source_network is defined %}
{%-                            for source_network in data_to_template['acls'][list].aces[ace].matches.l3.ipv4.source_network %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default ("No Logging") }} | {{ data_to_template['acls'][list].aces[ace].matches.l3.ipv4.source_network[source_network] | replace("{'source_network': ","") | replace("}","") | replace("'","") }} | {{ data_to_template['acls'][list].aces[ace].matches.l3.ipv4.destination_network | replace(" {'destination_network':","") | replace("}","") | replace("{","") | replace("'","") | replace(":","") | default("N/A") }} | {{ data_to_template['acls'][list].aces[ace].matches.l3.ipv4.protocol | default("N/A") }} | N/A | N/A | N/A |
{%-                            endfor %}
{%-                       else %}
{%-                           for destination_network in data_to_template['acls'][list].aces[ace].matches.l3.ipv4.destination_network %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default("No Logging") }} | N/A | {{ data_to_template['acls'][list].aces[ace].matches.l3.ipv4.destination_network[destination_network]  | replace(" {'destination_network':","") | replace("}","") | replace("{","") | replace("'","") | replace(":","") | default("NA") }} | {{ data_to_template['acls'][list].aces[ace].matches.l3.ipv4.protocol | default("N/A") }} | N/A | N/A | N/A |
{%-                           endfor %}
{%-                       endif %}
{%-                   endif %}
{%-               endif %}
{%-           endfor %}
{%-       else %}
| {{ list }} | No ACEs | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-       endif %}
{%-    endfor %}
{%-    for list in data_to_template['acls'] %}
{%-        if data_to_template['acls'][list].aces is defined %}
{%-            for ace in data_to_template['acls'][list].aces %}
{%-                if data_to_template['acls'][list].aces[ace].matches.l4 is defined %}
{%-                    if data_to_template['acls'][list].aces[ace].matches.l4.udp is defined %}
{%-                        if data_to_template['acls'][list].aces[ace].matches.l4.udp.source_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default ("No Logging") }} | Source Protocol | N/A | N/A | UDP | {% if data_to_template['acls'][list].aces[ace].matches.l4.udp.source_port.operator is defined %}{{ data_to_template['acls'][list].aces[ace].matches.l4.udp.source_port.operator.operator }} | {{ data_to_template['acls'][list].aces[ace].matches.l4.udp.source_port.operator.port }}{%- else %}N/A | N/A {% endif %} |
{%-                        else %}
{%-                            if data_to_template['acls'][list].aces[ace].matches.l4.udp.destination_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default ("No Logging") }} | N/A | Destination Protocol | N/A | UDP | {% if data_to_template['acls'][list].aces[ace].matches.l4.udp.destination_port.operator is defined %}{{ data_to_template['acls'][list].aces[ace].matches.l4.udp.destination_port.operator.operator }} | {{ data_to_template['acls'][list].aces[ace].matches.l4.udp.destination_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                            endif %}
{%-                        endif %}
{%-                    else %}
{%-                        if data_to_template['acls'][list].aces[ace].matches.l4.tcp is defined %}
{%-                            if data_to_template['acls'][list].aces[ace].matches.l4.tcp.source_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default ("No Logging") }} | Source Protocol | N/A | N/A | TCP | {% if data_to_template['acls'][list].aces[ace].matches.l4.tcp.source_port.operator is defined %}{{ data_to_template['acls'][list].aces[ace].matches.l4.tcp.source_port.operator.operator }} | {{ data_to_template['acls'][list].aces[ace].matches.l4.tcp.source_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                            else %}
{%-                                if data_to_template['acls'][list].aces[ace].matches.l4.tcp.destination_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template['acls'][list].aces[ace].actions.forwarding }} | {{ data_to_template['acls'][list].aces[ace].actions.logging | default ("No Logging") }} | N/A | Destination Protocol | N/A | TCP | {% if data_to_template['acls'][list].aces[ace].matches.l4.tcp.destination_port.operator is defined %}{{ data_to_template['acls'][list].aces[ace].matches.l4.tcp.destination_port.operator.operator }} | {{ data_to_template['acls'][list].aces[ace].matches.l4.tcp.destination_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                                endif %}
{%-                            endif %}
{%-                        endif %}
{%-                    endif %}
{%-                endif %}
{%-            endfor %}
{%-      else %}
| {{ list }} | No ACEs | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-      endif %}
{%-    endfor %}
{%- else %}
{%- if command == "arp" %}
| Interface | Neighbor IP Address | Neighbor MAC Address | Origin | ARP Dynamic Learning Local Proxy Enabled | ARP Dynamic Learning Proxy Enable |
| --------- | ------------------- | -------------------- | ------ | ---------------------------------------- | --------------------------------- |
{%- for interface in data_to_template['interfaces'] %}
{%-     if data_to_template['interfaces'][interface].ipv4 is defined %}
{%-         for neighbor in data_to_template['interfaces'][interface].ipv4.neighbors %}
| {{ interface }} | {{ neighbor }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].link_layer_address }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].origin }} | {{ data_to_template['interfaces'][interface].arp_dynamic_learning.local_proxy_enable }} | {{ data_to_template['interfaces'][interface].arp_dynamic_learning.proxy_enable }} |
{%-         endfor %}
{%-     else %}
| {{ interface }} | N/A | N/A | N/A | {{ data_to_template['interfaces'][interface].arp_dynamic_learning.local_proxy_enable }} | {{ data_to_template['interfaces'][interface].arp_dynamic_learning.proxy_enable }} |
{%-     endif %}
{%- endfor %}
{%- else %}
{%- if command == "bgp" %}
| Instance | BGP ID | State | VRF | Router ID | Cluster ID | Confederation ID | Neighbor | Version | Hold Time | Keep Alive Interval | Local AS | Remote AS | Total Recieved Messages | Total Sent Messages | Connect Last Reset | Reset Reason |
| -------- | ------ | ----- | --- | --------- | ---------- | ---------------- | -------- | ------- | --------- | ------------------- | -------- | --------- | ----------------------- | ------------------- | ------------------ | ------------ |
{%-     for instance in data_to_template['instance'] %}
{%-         for vrf in data_to_template['instance'][instance].vrf %}
{%-             for neighbor in data_to_template['instance'][instance].vrf[vrf].neighbor %}
{%-                 if data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_neighbor_counters is defined %}
| {{ instance }} | {{ data_to_template['instance'][instance].bgp_id }} | {{ data_to_template['instance'][instance].protocol_state }} | {{ vrf }} | {{ data_to_template['instance'][instance].vrf[vrf].router_id }} | {{ data_to_template['instance'][instance].vrf[vrf].cluster_id }} | {{ data_to_template['instance'][instance].vrf[vrf].confederation_identifier }} | {{ neighbor }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_version }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].holdtime }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].keepalive_interval }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].local_as_as_no }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].remote_as }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_neighbor_counters.messages.received.total }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_neighbor_counters.messages.sent.total }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_session_transport.connection.last_reset }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_session_transport.connection.reset_reason }} |
{%-                 else %}
| {{ instance }} | {{ data_to_template['instance'][instance].bgp_id }} | {{ data_to_template['instance'][instance].protocol_state }} | {{ vrf }} | {{ data_to_template['instance'][instance].vrf[vrf].router_id }} | {{ data_to_template['instance'][instance].vrf[vrf].cluster_id }} | {{ data_to_template['instance'][instance].vrf[vrf].confederation_identifier }} | {{ neighbor }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_version }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].holdtime }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].keepalive_interval }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].local_as_as_no }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].remote_as }} | N/A | N/A | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_session_transport.connection.last_reset }} | {{ data_to_template['instance'][instance].vrf[vrf].neighbor[neighbor].bgp_session_transport.connection.reset_reason }} |
{%-                 endif %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{% if command == 'dot1x' %}
| Interface | Client | EAP Method | PAE | Status | Session | Auth Bend | Auth SM State | Max Reauth | Max Requests | Last RX MAC | RX Invalid | RX Error | RX Logoff | RX Response | RX Start | RX Total | TX Requests | TX Request ID | TX Total | Quiet Period | Server Timeout | Supplicant Timeout | TX Period |
| --------- | ------ | ---------- | --- | ------ | ------- | --------- | ------------- | ---------- | ------------ | ----------- | ---------- | -------- | --------- | ----------- | -------- | -------- | ----------- | ------------- | -------- | ------------ | -------------- | ------------------ | --------- |
{%-     for interface in data_to_template.interfaces %}
{%-         if data_to_template.interfaces[interface].clients is defined %}
{%-             for client in data_to_template.interfaces[interface].clients %}
{%-                 for session in data_to_template.interfaces[interface].clients[client].session %}
| {{ interface }} | {{ client }} | {{ data_to_template.interfaces[interface].clients[client].eap_method }} | {{ data_to_template.interfaces[interface].clients[client].pae }} | {{ data_to_template.interfaces[interface].clients[client].status }} | {{ session }} | {{ data_to_template.interfaces[interface].clients[client].session[session].auth_bend_sm_state }} | {{ data_to_template.interfaces[interface].clients[client].session[session].auth_sm_state }} | {{ data_to_template.interfaces[interface].max_reauth_req }} | {{ data_to_template.interfaces[interface].max_req }} | {{ data_to_template.interfaces[interface].statistics.lastrxsrcmac }} | {{ data_to_template.interfaces[interface].statistics.rxinvalid }} | {{ data_to_template.interfaces[interface].statistics.rxlenerr }} | {{ data_to_template.interfaces[interface].statistics.rxlogoff }} | {{ data_to_template.interfaces[interface].statistics.rxresp }} | {{ data_to_template.interfaces[interface].statistics.rxstart }} | {{ data_to_template.interfaces[interface].statistics.rxtotal }} | {{ data_to_template.interfaces[interface].statistics.txreq }} | {{ data_to_template.interfaces[interface].statistics.txreqid }} | {{ data_to_template.interfaces[interface].statistics.txtotal }} | {{ data_to_template.interfaces[interface].timeout.quiet_period }} | {{ data_to_template.interfaces[interface].timeout.server_timeout }} | {{ data_to_template.interfaces[interface].timeout.supp_timeout }} | {{ data_to_template.interfaces[interface].timeout.tx_period }} |
{%-                endfor %}
{%-             endfor %}
{%-         else %}
| {{ interface }} | No Client | N/A | N/A | N/A | No Sessions | N/A | N/A | {{ data_to_template.interfaces[interface].max_reauth_req }} | {{ data_to_template.interfaces[interface].max_req }} | {{ data_to_template.interfaces[interface].statistics.lastrxsrcmac }} | {{ data_to_template.interfaces[interface].statistics.rxinvalid }} | {{ data_to_template.interfaces[interface].statistics.rxlenerr }} | {{ data_to_template.interfaces[interface].statistics.rxlogoff }} | {{ data_to_template.interfaces[interface].statistics.rxresp }} | {{ data_to_template.interfaces[interface].statistics.rxstart }} | {{ data_to_template.interfaces[interface].statistics.rxtotal }} | {{ data_to_template.interfaces[interface].statistics.txreq }} | {{ data_to_template.interfaces[interface].statistics.txreqid }} | {{ data_to_template.interfaces[interface].statistics.txtotal }} | {{ data_to_template.interfaces[interface].timeout.quiet_period }} | {{ data_to_template.interfaces[interface].timeout.server_timeout }} | {{ data_to_template.interfaces[interface].timeout.supp_timeout }} | {{ data_to_template.interfaces[interface].timeout.tx_period }} |
{%-         endif %}
{%-     endfor %}
| System Auth Control | Authorized Clients | Unauthorized Clients | Total Clients |
| ------------------- | ------------------ | -------------------- | ------------- |
| {{ data_to_template.system_auth_control }} | {{ data_to_template.sessions.authorized_clients }} | {{ data_to_template.sessions.unauthorized_clients }} | {{ data_to_template.sessions.total }} |
{%- else %}
{%- if command == "hsrp" %}
| VLAN | Address Family | Version | Group | Active Router | HSRP State | Preempt | IPv4 Address | Virtual IP Learn | Priority | Session Name | Standby IP Address | Standby Router | Hello Timer | Hold Timer | Virtual MAC | Use BIA |
| ---- | -------------- | ------- | ----- | ------------- | ---------- | ------- | ------------ | ---------------- | -------- | ------------ | ------------------ | -------------- | ----------- | ---------- | ----------- | ------- |
{%-     for vlan in data_to_template %}
{%-         for address_family in data_to_template[vlan].address_family %}
{%-             for version in data_to_template[vlan].address_family[address_family].version %}
{%-                 for group in data_to_template[vlan].address_family[address_family].version[version].groups %}
| {{ vlan }} | {{ address_family }} | {{ version }} | {{ group }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].active_router }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].hsrp_router_state }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].preempt }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].primary_ipv4_address.address }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].primary_ipv4_address.virtual_ip_learn }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].priority }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].session_name }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].standby_ip_address }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].standby_router }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].timers.hello_sec }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].timers.hold_sec }} | {{ data_to_template[vlan].address_family[address_family].version[version].groups[group].virtual_mac_address }} | {{ data_to_template[vlan].use_bia }} |
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == 'interface' %}
| Interface | Description | Enabled | Status | Access VLAN | Native VLAN | Switchport | Switchport Mode | Type | Bandwidth | Auto Negotiate | Speed | Duplex | MTU | MAC Address | Physical Address | IP Address | Medium | Delay | Encapsulation | Flow Control Receive | Flow Control Send | Port Channel | Port Channel Member | Last Change | Input Broadcast | Input CRC Errors | Input Errors | Input MAC Pause Frames | Input Multicast | Input Octets | Input Unicast | Input Unknown | Input Total | Output Broadcast | Output Discard | Output Errors | Output MAC Pause Frames | Output Multicast | Output Unicast | Output Total | Last Clear | Input Rate | Load Interval | Output Rate |
| --------- | ----------- | ------- | ------ | ----------- | ----------- | ---------- | --------------- | ---- | --------- | -------------- | ----- | ------ | --- | ----------- | ---------------- | ---------- | ------ | ----- | ------------  | -------------------- | ----------------- | ------------ | ------------------- | ----------- | --------------- | ---------------- | ------------ | ---------------------- | --------------- | ------------ | ------------- | ------------- | ----------- | ---------------- | -------------- | ------------- | ----------------------- | ---------------- | -------------- | ------------ | ---------- | ---------- | ------------- | ----------- |
{%-     for interface in data_to_template %}
| {{ interface }} | {{ data_to_template[interface].description | default("N/A") }} | {{ data_to_template[interface].enabled | default("N/A") }} | {{ data_to_template[interface].oper_status | default("N/A") }} | {% if data_to_template[interface].access_vlan is defined %}{{ data_to_template[interface].access_vlan }}{% else %}N/A{% endif %} | {% if data_to_template[interface].native_vlan is defined %}{{ data_to_template[interface].native_vlan }}{% else %}N/A{% endif %} | {% if data_to_template[interface].switchport_enable is defined %}{{ data_to_template[interface].switchport_enable }}{% else %}N/A{% endif %} | {% if data_to_template[interface].switchport_mode is defined %}{{ data_to_template[interface].switchport_mode }}{% else %}N/A{% endif %} | {% if data_to_template[interface].type is defined %}{{ data_to_template[interface].type }}{% else %}N/A{% endif %} | {% if data_to_template[interface].bandwidth is defined %}{{ data_to_template[interface].bandwidth }}{% else %}N/A{% endif %} | {% if data_to_template[interface].auto_negotiate is defined %}{{ data_to_template[interface].auto_negotiate }}{% else %}N/A{% endif %} | {% if data_to_template[interface].port_speed is defined %}{{ data_to_template[interface].port_speed }}{% else %}N/A{% endif %} | {% if data_to_template[interface].duplex_mode is defined %}{{ data_to_template[interface].duplex_mode }}{% else %}N/A{% endif %} | {% if data_to_template[interface].mtu is defined %}{{ data_to_template[interface].mtu }}{% else %}N/A{% endif %} | {% if data_to_template[interface].mac_address is defined %}{{ data_to_template[interface].mac_address }}{% else %}N/A{% endif %} | {% if data_to_template[interface].phys_address is defined %}{{ data_to_template[interface].phys_address }}{% else %}N/A{% endif %} | {% if data_to_template[interface].ipv4 is defined %}{% for ip_address in data_to_template[interface].ipv4 %}{{ ip_address }}{% endfor %}{% else %}N/A{% endif %} | {% if data_to_template[interface].medium is defined %}{{ data_to_template[interface].medium }}{% else %}N/A{% endif %} | {% if data_to_template[interface].delay is defined %}{{ data_to_template[interface].delay }}{% else %}N/A{% endif %} | {% if data_to_template[interface].encapsulation is defined %}{{ data_to_template[interface].encapsulation.encapsulation }}{% else %}N/A{% endif %} | {% if data_to_template[interface].flow_control is defined %}{{ data_to_template[interface].flow_control.receive }} | {{ data_to_template[interface].flow_control.send }}{% else %}N/A | N/A{% endif %} | {% if data_to_template[interface].port_channel is defined %}{% if data_to_template[interface].port_channel.port_channel_int is defined %}{{ data_to_template[interface].port_channel.port_channel_int }}{% else %}False{% endif %} | {% if data_to_template[interface].port_channel.port_channel_member_intfs is defined %}{% for member in data_to_template[interface].port_channel.port_channel_member_intfs %}{{ member }} {% endfor %}{% else %}{% if data_to_template[interface].port_channel.port_channel_member is defined %}{{ data_to_template[interface].port_channel.port_channel_member }}{% else %}N/A{% endif %}{% endif %}{% endif %} | {% if data_to_template[interface].last_change is defined %}{{ data_to_template[interface].last_change }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters is defined %}{% if data_to_template[interface].counters.in_broadcast_pkts is defined %}{{ data_to_template[interface].counters.in_broadcast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_crc_errors is defined %}{{ data_to_template[interface].counters.in_crc_errors }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_errors is defined %}{{ data_to_template[interface].counters.in_errors }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_mac_pause_frames is defined %}{{ data_to_template[interface].counters.in_mac_pause_frames }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_multicast_pkts is defined %}{{ data_to_template[interface].counters.in_multicast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_octets is defined %}{{ data_to_template[interface].counters.in_octets }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_unicast_pkts is defined %}{{ data_to_template[interface].counters.in_unicast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_unknown_protos is defined %}{{ data_to_template[interface].counters.in_unknown_protos }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.in_pkts is defined %}{{ data_to_template[interface].counters.in_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_broadcast_pkts is defined %}{{ data_to_template[interface].counters.out_broadcast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_discard is defined %}{{ data_to_template[interface].counters.out_discard }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_errors is defined %}{{ data_to_template[interface].counters.out_errors }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_mac_pause_frames is defined %}{{ data_to_template[interface].counters.out_mac_pause_frames }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_multicast_pkts is defined %}{{ data_to_template[interface].counters.out_multicast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_unicast_pkts is defined %}{{ data_to_template[interface].counters.out_unicast_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.out_pkts is defined %}{{ data_to_template[interface].counters.out_pkts }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.last_clear is defined %}{{ data_to_template[interface].counters.last_clear }}{% else %}N/A{% endif %} | {% if data_to_template[interface].counters.rate is defined %}{{ data_to_template[interface].counters.rate.in_rate }} | {{ data_to_template[interface].counters.rate.load_interval }} | {{ data_to_template[interface].counters.rate.out_rate }}{% else %}N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A{% endif %}{% endif %} |
{%-     endfor %}
{%- else %}
{%- if command == "lldp" %}
| Interface | LLDP | Neighbor | Neighbor Port | Neighbor Port Description | Capabilities | Chassis ID | Management Address | System Description |
| --------- | ---- | -------- | ------------- | ------------------------- | ------------ | ---------- | ------------------ | ------------------ |
{%-     for interface in data_to_template['interfaces'] %}
{%-         if data_to_template['interfaces'][interface].port_id is defined %}
{%-             for port in data_to_template['interfaces'][interface].port_id %}
{%-                 for neighbor in data_to_template['interfaces'][interface].port_id[port].neighbors %}
{%-                     for capability in data_to_template['interfaces'][interface].port_id[port].neighbors[neighbor].capabilities %}
| {{ interface }} | {{ data_to_template['interfaces'][interface].enabled }} | {{ neighbor }} | {{ port }} | {{ data_to_template['interfaces'][interface].port_id[port].neighbors[neighbor].port_description }} | {{ capability }} | {{ data_to_template['interfaces'][interface].port_id[port].neighbors[neighbor].chassis_id }} | {{ data_to_template['interfaces'][interface].port_id[port].neighbors[neighbor].management_address }} | {{ data_to_template['interfaces'][interface].port_id[port].neighbors[neighbor].system_description | replace("\n"," ") }} |
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         else %}
| {{ interface }} | {{ data_to_template['interfaces'][interface].enabled }} | No Neighbor | N/A | N/A | N/A | N/A | N/A | N/A |
{%-         endif %}
{%-     endfor %}
| Enabled | Hello Timer | Hold Timer | Aged Out Entries | Frame Discards | Frame Input Errors | Frame Input | Frame Output | TLV Discard | TLV Unknown |
| ------- | ----------- | ---------- | ---------------- | -------------- | ------------------ | ----------- | ------------ | ----------- | ----------- |
| {{ data_to_template.enabled }} | {{ data_to_template.hello_timer }} | {{ data_to_template.hold_timer }} | {{ data_to_template.counters.entries_aged_out }} | {{ data_to_template.counters.frame_discard }} | {{ data_to_template.counters.frame_error_in }} | {{ data_to_template.counters.frame_in }} | {{ data_to_template.counters.frame_out }} | {{ data_to_template.counters.tlv_discard }} | {{ data_to_template.counters.tlv_unknown }} |
{%- else %}
{% if command == "ntp" %}
| VRF | Association Address | Delay | Configured | Local Mode | Offset | Poll | Reach | Receive Time | Reference ID | Stratum |
| --- | ------------------- | ----- | ---------- | ---------- | ------ | ---- | ----- | ------------ | ------------ | ------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-          if data_to_template['vrf'][vrf].associations is defined %}
{%-             for address in data_to_template['vrf'][vrf].associations.address %}
{%-                 for is_conf,value in data_to_template['vrf'][vrf].associations.address[address].local_mode.client.isconfigured.items() %}
| {{ vrf }} | {{ address }} | {{ value.delay }} | {{ value.isconfigured }} | {{ value.local_mode }} | {{ value.offset }} | {{ value.poll }} | {{ value.reach }} | {{ value.receive_time }} | {{ value.refid }} | {{ value.stratum }} |
{%-                 endfor %}
{%-             endfor %}
{%-         endif %}
{%-     endfor %}
| VRF | Server Address | Preferred | Type |
| --- | -------------- | --------- | ---- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address in data_to_template['vrf'][vrf].unicast_configuration.address %}
| {{ vrf }} | {{ address }} | {{ data_to_template['vrf'][vrf].unicast_configuration.address[address].type.server.preferred | default("N/A") }} | {{ data_to_template['vrf'][vrf].unicast_configuration.address[address].type.server.type }} |
{%-         endfor %}
{%-     endfor %}
| Clock Precision | Clock State | Reference Time | Root Dispersion |
| --------------- | ----------- | -------------- | --------------- |
| {{ data_to_template['clock_state'].system_status.clock_precision }} | {{ data_to_template['clock_state'].system_status.clock_state }} | {{ data_to_template['clock_state'].system_status.reference_time }} | {{ data_to_template['clock_state'].system_status.root_dispersion }} |
{%- else %}
{%- if command == "ospf" %}
| VRF | Address Family | Instance | Router ID | Auto Cost Enabled | BFD Enable | Graceful Restart Type | Graceful Restart Enabled | MPLS Auto Config | NSR Enabled | Preference | Paths | SPF Throttle Start | SPF Hold | SPF Maximum | Area | Area Type | SPF Total | MPLS TE | LSA Type | LSA Advertising Router | LSA ID | Number of Links | Link | Link ID | Link Data | Type | Summary | Summary Mask | Topology | Metric | Age | Checksum | Length | Option | Sequence Number | Interface | BFD Enable | Cost | Enabled | Passive | State | Interface Type | Dead Interval | DR IP Address | DR Router ID | Hello Interval | Hello Timer | Priority | Retransmit Interval | Transmit Delay | Neighbor | Neighbor Address | BDR IP Address | Dead Timer | DR IP Address | Neighbor Router ID | State | Event Count | Retransmit Queue |
| --- | -------------- | -------- | --------- | ----------------- | ---------- | --------------------- | ------------------------ | ---------------- | ----------- | ---------- | ----- | ------------------ | -------- | ----------- | ---- | --------- | --------- | ------- | -------- | ---------------------- | ------ | --------------- | ---- | ------- | --------- | ---- | ------- | ------------ | -------- | ------ | --- | -------- | ------ | ------ | --------------- | --------- | ---------- | ---- | ------- | ------- | ----- | -------------- | ------------- | ------------- | ------------ | -------------- | ----------- | -------- | ------------------- | -------------- | -------- | ---------------- | -------------- | ---------- | ------------- | ------------------ | ----- | ----------- | ---------------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         if vrf == "default" %}
{%-             for address_family in data_to_template['vrf'][vrf].address_family %}
{%-                 for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}
{%-                     for graceful_restart in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart %}
{%-                         for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                             for lsa_type in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types %}
{%-                                 for lsa in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas %}
{%-                                     if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router is defined %}
{%-                                         for link in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links %}
{%-                                             for topology in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].topologies %}
{%-                                                 for interface in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces %}
{%-                                                     if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors is defined %}
{%-                                                         for neighbor in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].bfd.enable }} | {{ graceful_restart }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].mpls.ldp.autoconfig }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].nsr.enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference.single_value.all }}{% else %}N/A{% endif %} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.hold }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.maximum }} | {{ area }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].area_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.spf_runs_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls.te.enable }} | {{ lsa_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].adv_router }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].lsa_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.num_of_links }} | {{ link }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].link_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].link_data }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].type }} | NO | N/A | {{ topology }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].topologies[topology].metric }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.age }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.checksum }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.length }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.option }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.seq_num }} | {{ interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].interface_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_ip_addr | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_router_id | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].priority | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay | default ("N/A") }} | {{ neighbor }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].address }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].bdr_ip_addr }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dead_timer }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dr_ip_addr }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].neighbor_router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].statistics.nbr_event_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].statistics.nbr_retrans_qlen }} |
{%-                                                         endfor %}
{%-                                                     else %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].bfd.enable }} | {{ graceful_restart }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].mpls.ldp.autoconfig }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].nsr.enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference.single_value.all }}{% else %}N/A{% endif %} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.hold }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.maximum }} | {{ area }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].area_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.spf_runs_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls.te.enable }} | {{ lsa_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].adv_router }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].lsa_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.num_of_links }} | {{ link }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].link_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].link_data }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].type }} | NO | N/A | {{ topology }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.router.links[link].topologies[topology].metric }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.age }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.checksum }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.length }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.option }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.seq_num }} | {{ interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].interface_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_ip_addr | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_router_id | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].priority | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay | default ("N/A") }} | No Neighbors | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-                                                     endif %}
{%-                                                 endfor %}
{%-                                             endfor %}
{%-                                         endfor %}
{%-                                     else %}
{%-                                         if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.summary is defined %}
{%-                                             for topology in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.summary.topologies %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].bfd.enable }} | {{ graceful_restart }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].mpls is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].mpls.ldp.autoconfig }} | {% else %}N/A | {% endif %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].nsr.enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].preference.single_value.all }} | {% else %}N/A | {% endif %}{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.hold }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.maximum }} | {{ area }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].area_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.spf_runs_count }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls.te.enable }} | {% else %}N/A | {% endif %}{{ lsa_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].adv_router }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].lsa_id }} | N/A | N/A | N/A | N/A | N/A | YES | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.summary.network_mask }} | {{ topology }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.body.summary.topologies[topology].metric }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.age }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.checksum }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.length }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.option }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.seq_num }} | No Interfaces | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | No Neighbors | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-                                             endfor %}
{%-                                         endif %}
{%-                                     endif %}
{%-                                 endfor %}
{%-                             endfor %}
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         else %}
{%-             for address_family in data_to_template['vrf'][vrf].address_family %}
{%-                 for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}\
{%-                     for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                         for interface in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces %}
{%-                             if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors is defined %}
{%-                                 for neighbor in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | {{ area }} | N/A | N/A | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls.te.enable }} | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | NO | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | {{ interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].interface_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_ip_addr | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_router_id | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].priority | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay | default ("N/A") }} | {{ neighbor }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].address }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].bdr_ip_addr }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dead_timer }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dr_ip_addr }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].neighbor_router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].statistics.nbr_event_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].statistics.nbr_retrans_qlen }} |
{%-                                 endfor %}
{%-                             else %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | {{ area }} | N/A | N/A | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].mpls.te.enable }} | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | NO | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | {{ interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }}{% else %}N/A{% endif %} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].interface_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_ip_addr | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dr_router_id | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].priority | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval | default ("N/A") }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay | default ("N/A") }} | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-                             endif %}
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endif %}
{%-     endfor %}
{%- else %}
{%- if command == "platform" %}
| Attributes | Chassis | Chassis Serial Number | Commands | Config Register | Connections | Context Manager | Directory | Image | ISSU Roll Back Timer Reason | ISSU Rollback Timer State | Main Memory | Operating System | Redundancy Communication | Redundancy Mode | RP Uptime | Router Type | Switchover Reason | Version |
| ---------- | ------- | --------------------- | -------- | --------------- | ----------- | --------------- | --------- | ----- | --------------------------- | ------------------------- | ----------- | ---------------- | ------------------------ | --------------- | --------- | ----------- | ----------------- | ------- |
| {{ data_to_template.attributes }} | {{ data_to_template.chassis }} | {{ data_to_template.chassis_sn }} | {{ data_to_template.commands }} | {{ data_to_template.config_register }} | {{ data_to_template.connections }} | {{ data_to_template.context_manager }} | {{ data_to_template.dir }} | {{ data_to_template.image }} | {{ data_to_template.issu_rollback_timer_reason }} | {{ data_to_template.issu_rollback_timer_state }} | {{ data_to_template.main_mem }} | {{ data_to_template.os }} | {{ data_to_template.redundancy_communication }} | {{ data_to_template.redundancy_mode }} | {{ data_to_template.rp_uptime }} | {{ data_to_template.rtr_type }} | {{ data_to_template.switchover_reason }} | {{ data_to_template.version }} |
| Slot | Sub-Slot | Name | Serial Number | State | Config Register | ISSU In Progress | Redundancy State | RP Uptime | System Image |
| ---- | -------- | ---- | ------------- | ----- | --------------- | ---------------- | ---------------- | --------- | ------------ |
{%-     for slot in data_to_template.slot %}
{%-         for subslot in data_to_template.slot[slot] %}
| {{ slot }} | {{ subslot }} | {{ data_to_template.slot[slot][subslot].name }} | {{ data_to_template.slot[slot][subslot].sn }} | {{ data_to_template.slot[slot][subslot].state }} | {% if slot == "rp" %}{{ data_to_template.slot[slot][subslot].config_register }} | {{ data_to_template.slot[slot][subslot].issu.in_progress }} | {{ data_to_template.slot[slot][subslot].redundancy_state }} | {{ data_to_template.slot[slot][subslot].rp_uptime }} | {{ data_to_template.slot[slot][subslot].system_image }}{%- else %}N/A | N/A | N/A | N/A | N/A{%- endif %} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "routing" %}
| VRF | Address Family | Route | Active | Metric | Next Hop Index | Next Hop | Outgoing Interface | Route Preference | Source Protocol |
| --- | -------------- | ----- | ------ | ------ | -------------- | -------- | -------------------| ---------------- | --------------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for route in data_to_template['vrf'][vrf].address_family[address_family].routes %}
{%-                 if data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop is defined %}
{%-                     for next_hop in data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].active }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].metric }} | {{ next_hop }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }} | N/A | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].route_preference }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol }} |
{%-                     endfor %}
{%-                 else %}
{%-                     for outgoing_interface in data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.outgoing_interface %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].active }} | N/A | N/A | N/A | {{ outgoing_interface }} | N/A | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol_codes }} |
{%-                     endfor %}
{%-                 endif %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == 'stp' %}
| BPDU Filter | BPDU Guard | BPDU Guard Recovery Timeout | EtherChannel Misconfig Guard | Loop Guard |
| ----------- | ---------- | --------------------------- | ---------------------------- | ---------- |
| {{ data_to_template['global'].bpdu_filter }} | {{ data_to_template['global'].bpdu_guard }} | {{ data_to_template['global'].bpduguard_timeout_recovery }} | {{ data_to_template['global'].etherchannel_misconfig_guard }} | {{ data_to_template['global'].loop_guard }} |
| Forwarding Delay | Hello Time | Hold Count | Max Age | VLAN | Bridge Address | Bridge Priority | Configured Bridge Priority | Designated Root Address | Designated Root Priority | Forwarding Delay | Hello Time | Hold Count | Hold Time | Max Age | Last Topology Change | Total Topology Changes | Interface | Cost | BPDU Recieved | BPDU Sent | Designated Bridge Address | Designated Bridge Priority | Designated Cost | Designated Port Number | Designated Port Priority | Designated Root Address | Designated Root Priority | Forward Transtions | State | Role |
| ---------------- | ---------- | ---------- | ------- | ---- | -------------- | --------------- | -------------------------- | ----------------------- | ------------------------ | ---------------- | ---------- | ---------- | --------- | ------- | -------------------- | ---------------------- | --------- | ---- | ------------- | --------- | ------------------------- | -------------------------- | --------------- | ---------------------- | ------------------------ | ----------------------- | ------------------------ | ------------------ | ----- | ---- |
{%-     for id in data_to_template['rapid_pvst'] %}
{%-         for vlan in data_to_template['rapid_pvst'][id].vlans %}
{%-             for interface in data_to_template['rapid_pvst'][id].vlans[vlan].interfaces %}
| {{ data_to_template['rapid_pvst'][id].forwarding_delay }} | {{ data_to_template['rapid_pvst'][id].hello_time }} | {{ data_to_template['rapid_pvst'][id].hold_count }} | {{ data_to_template['rapid_pvst'][id].max_age }} | {{ vlan }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].bridge_address }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].bridge_priority }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].configured_bridge_priority }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].designated_root_address }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].designated_root_priority }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].forwarding_delay }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].hello_time }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].hold_count }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].hold_time }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].max_age }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].time_since_topology_change }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].topology_changes }} | {{ interface }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].cost | default("N/A") }} | {% if data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].counters is defined %}{{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].counters.bpdu_received }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].counters.bpdu_sent }}{% else %}N/A | N/A{% endif %} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_bridge_address | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_bridge_priority | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_cost | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_port_num }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_port_priority }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_root_address | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].designated_root_priority | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].forward_transitions | default("N/A") }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].port_state }} | {{ data_to_template['rapid_pvst'][id].vlans[vlan].interfaces[interface].role }} |
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
| Domain | Name | Revision |
| ------ | ---- | -------- |
{%-     for domain in data_to_template['mstp'] %}
| {{ domain }} | {{ data_to_template['mstp'][domain].revision.name | default("Not named") }} | {{ data_to_template['mstp'][domain].revision }} |
{%-     endfor %}
{%- else %}
{%- if command == "vlan" %}
| VLAN | Name | State | Shutdown | Interface |
| ---- | ---- | ----- | -------- | --------- |
{%-     for vlan in data_to_template['vlans'] if (vlan != "configuration") or (vlan != "interface_vlan_enabled") or (vlan != "vn_segment_vlan_based_enabled")  %}
{%-         if data_to_template['vlans'][vlan].interfaces is defined %}
{%-             for interface in data_to_template['vlans'][vlan].interfaces %}
| {{ vlan }} | {{ data_to_template['vlans'][vlan].name }} | {{ data_to_template['vlans'][vlan].state }} | {{ data_to_template['vlans'][vlan].shutdown }} | {{ interface }} |
{%-             endfor %}
{%-         else %}
| {{ vlan }} | {{ data_to_template['vlans'][vlan].name }} | {{ data_to_template['vlans'][vlan].state }} | {{ data_to_template['vlans'][vlan].shutdown }} | N/A |
{%-         endif %}
{%-     endfor %}
| VLAN | IP IGMP Snooping |
| ---- | ---------------- |
{%-     for vlan in data_to_template['vlans'].configuration %}
| {{ vlan }} | {{ data_to_template['vlans'][vlan].ip_igmp_snooping }} |
{%-     endfor %}
| Interface VLAN Enabled | VN Segment VLAN Based Enabled |
| ---------------------- | ----------------------------- |
| {{ data_to_template['vlans'][interface_vlan_enabled] }} | {{ data_to_template['vlans'][vn_segment_vlan_based_enabled] }} |
{%- else %}
{%- if command == 'vrf' %}
| VRF | Description | Address Family | Route Target | Route Target Type | Route Distinguisher |
| --- | ----------- | -------------- | ------------ | ----------------- | ------------------- |
{%-     for vrf in data_to_template['vrfs'] %}
{%-         for address_family in data_to_template['vrfs'][vrf].address_family %}
{%-             if data_to_template['vrfs'][vrf].address_family[address_family].route_targets is defined %}
{%-                 for target in data_to_template['vrfs'][vrf].address_family[address_family].route_targets %}
| {{ vrf }} | {{ data_to_template['vrfs'][vrf].description }} | {{ target }} | {{ data_to_template['vrfs'][vrf].address_family[address_family].route_targets[target].rt_type }} | {{ address_family }} | {{ data_to_template['vrfs'][vrf].route_distinguisher }} |
{%-                 endfor %}
{%-             else %}
| {{ vrf }} | {{ data_to_template['vrfs'][vrf].description }} | N/A | N/A | {{ address_family }} | {{ data_to_template['vrfs'][vrf].route_distinguisher }} |
{%-             endif %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show access-lists" %}
| Access Control List | Access Control Entry | Permission | Logging | Source Network | Destination Network | L3 Protocol | L4 Protocol | Operator | Port |
| ------------------- | -------------------- | ---------- | ------- | -------------- | ------------------- | ----------- | ----------- | -------- | ---- |
{%-     for list in data_to_template %}
{%-         if data_to_template[list].aces is defined %}
{%-             for ace in data_to_template[list].aces %}
{%-                 if data_to_template[list].aces[ace].matches.l3 is defined %}
{%-                     if data_to_template[list].aces[ace].matches.l3.ipv4 is defined %}
{%-                         if data_to_template[list].aces[ace].matches.l3.ipv4.source_network is defined %}
{%-                             for source_network in data_to_template[list].aces[ace].matches.l3.ipv4.source_network %}
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default ("No Logging") }} | {{ data_to_template[list].aces[ace].matches.l3.ipv4.source_network[source_network] | replace("{'source_network': ","") | replace("}","") | replace("'","") }} | {{ data_to_template[list].aces[ace].matches.l3.ipv4.destination_network | replace(" {'destination_network':","") | replace("}","") | replace("{","") | replace("'","") | replace(":","") | default("N/A") }} | {{ data_to_template[list].aces[ace].matches.l3.ipv4.protocol | default("N/A") }} | N/A | N/A | N/A |
{%-                             endfor %}
{%-                         else %}
{%-                             for destination_network in data_to_template[list].aces[ace].matches.l3.ipv4.destination_network %}
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default("No Logging") }} | N/A | {{ data_to_template[list].aces[ace].matches.l3.ipv4.destination_network[destination_network]  | replace(" {'destination_network':","") | replace("}","") | replace("{","") | replace("'","") | replace(":","") | default("NA") }} | {{ data_to_template[list].aces[ace].matches.l3.ipv4.protocol | default("N/A") }} | N/A | N/A | N/A |
{%-                             endfor %}
{%-                         endif %}
{%-                     endif %}
{%-                 endif %}
{%-             endfor %}
{%-         else %}
| {{ list }} | No ACEs | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-         endif %}
{%-     endfor %}
{%-     for list in data_to_template %}
{%-         if data_to_template[list].aces is defined %}
{%-             for ace in data_to_template[list].aces %}
{%-                 if data_to_template[list].aces[ace].matches.l4 is defined %}
{%-                     if data_to_template[list].aces[ace].matches.l4.udp is defined %}
{%-                         if data_to_template[list].aces[ace].matches.l4.udp.source_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default ("No Logging") }} | Source Protocol | N/A | N/A | UDP | {% if data_to_template[list].aces[ace].matches.l4.udp.source_port.operator is defined %}{{ data_to_template[list].aces[ace].matches.l4.udp.source_port.operator.operator }} | {{ data_to_template[list].aces[ace].matches.l4.udp.source_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                         else %}
{%-                             if data_to_template[list].aces[ace].matches.l4.udp.destination_port is defined %}  
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default ("No Logging") }} | N/A | Destination Protocol | N/A | UDP | {% if data_to_template[list].aces[ace].matches.l4.udp.destination_port.operator is defined %}{{ data_to_template[list].aces[ace].matches.l4.udp.destination_port.operator.operator }} | {{ data_to_template[list].aces[ace].matches.l4.udp.destination_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                             endif %}
{%-                         endif %}
{%-                     else %}
{%-                         if data_to_template[list].aces[ace].matches.l4.tcp is defined %}
{%-                             if data_to_template[list].aces[ace].matches.l4.tcp.source_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default ("No Logging") }} | Source Protocol | N/A | N/A | TCP | {% if data_to_template[list].aces[ace].matches.l4.tcp.source_port.operator is defined %}{{ data_to_template[list].aces[ace].matches.l4.tcp.source_port.operator.operator }} | {{ data_to_template[list].aces[ace].matches.l4.tcp.source_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                             else %}
{%-                                 if data_to_template[list].aces[ace].matches.l4.tcp.destination_port is defined %}
| {{ list }} | {{ ace }} | {{ data_to_template[list].aces[ace].actions.forwarding }} | {{ data_to_template[list].aces[ace].actions.logging | default ("No Logging") }} | N/A | Destination Protocol | N/A | TCP | {% if data_to_template[list].aces[ace].matches.l4.tcp.destination_port.operator is defined %}{{ data_to_template[list].aces[ace].matches.l4.tcp.destination_port.operator.operator }} | {{ data_to_template[list].aces[ace].matches.l4.tcp.destination_port.operator.port }}{% else %}N/A | N/A{% endif %} |
{%-                                 endif %}
{%-                             endif %}
{%-                         endif %}
{%-                     endif %}
{%-                 endif %}
{%-             endfor %}
{%-         else %}
| {{ list }} | No ACEs | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
{%-         endif %}
{%-     endfor %}
{%- else %}
{%- if command == "show bgp process vrf all" %}
| BGP Tag | Router ID | BGP PID | BGP State | BGP Started Reason | AS Path Entries | AS Format | Memory State | Mode | Paths Per Attribute | Bytes Used | Entries Pending Delete | VRF | Cluster ID | Configured Router ID | Number of Configured Peers | Number of Established Peers | Pending Peers | VRF ID | VRF RD | VRF State | Address Family | Peer | Active Peers | Aggregates | Networks | Paths | Routes | Table ID | Table State |
| ------- | --------- | ------- | --------- | ------------------ | --------------- | --------- | ------------ | ---- | ------------------- | ---------- | ---------------------- | --- | ---------- | -------------------- | -------------------------- | --------------------------- | ------------- | ------ | ------ | --------- | -------------- | ---- | ------------ | ---------- | -------- | ----- | ------ | -------- | ----------- |
{%-     for vrf in data_to_template.vrf %}
{%-         for address_family in data_to_template.vrf[vrf].address_family %}
{%-             for peer in data_to_template.vrf[vrf].address_family[address_family].peers %}
| {{ data_to_template.bgp_tag }} | {{ data_to_template.vrf[vrf].router_id }} | {{ data_to_template.bgp_pid }} | {{ data_to_template.bgp_protocol_state }} | {{ data_to_template.bgp_protocol_started_reason }} | {{ data_to_template.bgp_as_path_entries }} | {{ data_to_template.bgp_asformat }} | {{ data_to_template.bgp_memory_state }} | {{ data_to_template.bgp_mmode }} | {{ data_to_template.bgp_paths_per_hwm_attr }} | {{ data_to_template.bytes_used }} | {{ data_to_template.entries_pending_delete }} | {{ vrf }} | {{ data_to_template.vrf[vrf].cluster_id }} | {{ data_to_template.vrf[vrf].conf_router_id }} | {{ data_to_template.vrf[vrf].num_conf_peers }} | {{ data_to_template.vrf[vrf].num_established_peers }} | {{ data_to_template.vrf[vrf].num_pending_conf_peers }} | {{ data_to_template.vrf[vrf].vrf_id }} | {{ data_to_template.vrf[vrf].vrf_rd }} | {{ data_to_template.vrf[vrf].vrf_state }} | {{ address_family }} | {{ peer }} | {{ data_to_template.vrf[vrf].address_family[address_family].peers[peer].active_peers }} | {{ data_to_template.vrf[vrf].address_family[address_family].peers[peer].aggregates }} | {{ data_to_template.vrf[vrf].address_family[address_family].peers[peer].networks }} | {{ data_to_template.vrf[vrf].address_family[address_family].peers[peer].paths }} | {{ data_to_template.vrf[vrf].address_family[address_family].peers[peer].routes }} | {{ data_to_template.vrf[vrf].address_family[address_family].table_id }} | {{ data_to_template.vrf[vrf].address_family[address_family].table_state }} |
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show bgp sessions" %}
| Local AS | Total Established Peers | Total Peers | VRF | Router ID | VRF Established Peers | VRF Peers |
| -------- | ----------------------- | ----------- | --- | --------- | --------------------- | --------- |
{%-     for vrf in data_to_template.vrf %}
| {{ data_to_template.local_as }} | {{ data_to_template.total_established_peers }} | {{ data_to_template.total_peers }} | {{ vrf }} | {{ data_to_template.vrf[vrf].router_id }} | {{ data_to_template.vrf[vrf].vrf_established_peers }} | {{ data_to_template.vrf[vrf].vrf_peers }} |
{%-     endfor %}
{% else %}
{%- if command == "show cdp neighbors" %}
| Neighbor | Platform | Local Interface | Remote Interface | Capability | Hold Time |
| -------- | -------- | --------------- | ---------------- | ---------- | --------- |
{%-    for neighbor in data_to_template['cdp'].index %}
| {{ data_to_template['cdp'].index[neighbor].device_id }} | {{ data_to_template['cdp'].index[neighbor].platform }} | {{ data_to_template['cdp'].index[neighbor].local_interface }} | {{ data_to_template['cdp'].index[neighbor].port_id }} | {{ data_to_template['cdp'].index[neighbor].capability }} | {{ data_to_template['cdp'].index[neighbor].hold_time }} |
{%-    endfor %}
{%- else %}
{%- if command == "show cdp neighbors detail" %}
| Local Interface | Device ID | Remote Interface | IP Address | Platform | Native VLAN | Hold Time | Duplex | Capaibilities | Software Version |
| --------------- | --------- | ---------------- | ---------- | -------- | ----------- | --------- | ------ | ------------- | ---------------- |
{%-     for neighbor in data_to_template['index'] %}
{%-         for ip_address in data_to_template['index'][neighbor].entry_addresses %}
| {{ data_to_template['index'][neighbor].local_interface }} | {{ data_to_template['index'][neighbor].device_id }} | {{ data_to_template['index'][neighbor].port_id }} | {{ ip_address }} | {{ data_to_template['index'][neighbor].platform }} | {{ data_to_template['index'][neighbor].native_vlan }} | {{ data_to_template['index'][neighbor].hold_time }} | {{ data_to_template['index'][neighbor].duplex_mode }} | {{ data_to_template['index'][neighbor].capabilities }} | {{ data_to_template['index'][neighbor].software_version | replace("\n"," ") }} |
{%-         endfor %}
{%-     endfor %}
| Total CDP Neighbors |
| ------------------- |
| {{ data_to_template.total_entries_displayed }} |
{%- else %}
{%- if command == 'show environment' %}
| Switch | Temperature State | Inlet Temperature State | Inlet Temp Value | Inlet Temp Yellow | Inlet Temp Red | Hot Spot Temperature State | Hot Temp Value | Hot Temp Yellow | Hot Temp Red |
| ------ | ----------------- | ----------------------- | ---------------- | ----------------- | -------------- | -------------------------- | -------------- | --------------- | ------------ |
{%-     for switch in data_to_template['switch'] %}
{%-         for fan in data_to_template['switch'][switch].fan %}
| {{ switch }} | {{ data_to_template['switch'][switch].system_temperature_state }} | {{ data_to_template['switch'][switch].inlet_temperature.state }} | {{ data_to_template['switch'][switch].inlet_temperature.value }} | {{ data_to_template['switch'][switch].inlet_temperature.yellow_threshold }} | {{ data_to_template['switch'][switch].inlet_temperature.red_threshold }} | {{ data_to_template['switch'][switch].hotspot_temperature.state }} | {{ data_to_template['switch'][switch].hotspot_temperature.value }} | {{ data_to_template['switch'][switch].hotspot_temperature.yellow_threshold }} | {{ data_to_template['switch'][switch].hotspot_temperature.red_threshold }} |
{%-         endfor %}
| Switch | Power Supply | Power Supply PID | PoE Power | Serial Number | State | Status | System Power | Watts | Fan | Fan State |
| ------ | ------------ | ---------------- | --------- | ------------- | ----- | ------ | ------------ | ----- | --- | --------- |
{%-         for power_supply in data_to_template['switch'][switch].power_supply %}
| {{ switch }} | {{ power_supply }} | {{ data_to_template['switch'][switch].power_supply[power_supply].pid | default("N/A") }} | {{ data_to_template['switch'][switch].power_supply[power_supply].poe_power | default("N/A") }} | {{ data_to_template['switch'][switch].power_supply[power_supply].serial_number | default("N/A") }} | {{ data_to_template['switch'][switch].power_supply[power_supply].state }} | {{ data_to_template['switch'][switch].power_supply[power_supply].status }} | {{ data_to_template['switch'][switch].power_supply[power_supply].system_power | default("N/A") }} | {{ data_to_template['switch'][switch].power_supply[power_supply].watts | default("N/A") }} | {{ fan }} | {{ data_to_template['switch'][switch].fan[fan].state }} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show etherchannel summary" %}
| Port-Channel | Bundle ID | Name | Status | Protocol | Flags | Member Interface | Memeber Bundled | Member Flags |
| ------------ | --------- | ---- | ------ | -------- | ----- | ---------------- | --------------- | ------------ |
{%-     for interface in data_to_template['interfaces'] %}
{%-         for member in data_to_template['interfaces'][interface].members %}
| {{ interface }} | {{ data_to_template['interfaces'][interface].bundle_id }} | {{ data_to_template['interfaces'][interface].name }} | {{ data_to_template['interfaces'][interface].oper_status }} | {{ data_to_template['interfaces'][interface].protocol | default("Mode On") }} | {{ data_to_template['interfaces'][interface].flags }} | {{ member }} | {{ data_to_template['interfaces'][interface].members[member].bundled }} | {{ data_to_template['interfaces'][interface].members[member].flags }} |
{%-         endfor %}
{%-     endfor %}
| Number of Aggregators | Number of LAG in use |
| --------------------- | -------------------- |
| {{ data_to_template.number_of_aggregators }} | {{ data_to_template.number_of_lag_in_use }} |
{%- else %}
{% if command == "show interfaces" %}
| Interface | Description | Type | Connected | Enabled | Bandwidth | Port Speed | Port Duplex | IPv4 Address | Line Protocol | Operational Status | MAC Address | Media Type | Delay | Encapsulation | Keepalive | MTU | Port Channel Member | Port Channel Member Interface | Input CRC Errors | Input Errors | Output Errors | Input Packets | Output Packets | QoS Strategy | Input Queue Drops | Total Output Drops |
| --------- | ----------- | ---- | --------- | ------- | --------- | ---------- | ----------- | ------------ | ------------- | ------------------ | ----------- | ---------- | ----- | ------------- | --------- | --- | ------------------- | ----------------------------- | ---------------- | ------------ | ------------- | ------------- | -------------- | ------------ | ----------------- | ------------------ |
{%-     for interface in data_to_template %}
{%-         if ( (data_to_template[interface].port_channel.port_channel_member_intfs is defined) and (data_to_template[interface].ipv4 is defined)) %}
{%-             for member_interface in data_to_template[interface].port_channel.port_channel_member_intfs %}
{%-                 for ip_address in data_to_template[interface].ipv4 %}
| {{ interface }} | {{ data_to_template[interface].description | default ("No Description") }} | {{ data_to_template[interface].type }} | {{ data_to_template[interface].connected | default ("Not Connected") }} | {{ data_to_template[interface].enabled | default ("Not Enabled" ) }} | {{ data_to_template[interface].bandwidth }} | {{ data_to_template[interface].port_speed | default ("N/A")}} | {{ data_to_template[interface].duplex_mode | default ("N/A") }} | {{ ip_address }} | {{ data_to_template[interface].line_protocol }} | {{ data_to_template[interface].oper_status }} | {{ data_to_template[interface].mac_address }} | {{ data_to_template[interface].media_type | default ("N/A")}} | {{ data_to_template[interface].delay }} | {{ data_to_template[interface].encapsulations.encapsulation }} | {{ data_to_template[interface].keepalive | default ("N/A")}} | {{ data_to_template[interface].mtu }} | {{ data_to_template[interface].port_channel.port_channel_member }} | {{ member_interface }} | {% if data_to_template[interface].counters is defined %}{{ data_to_template[interface].counters.in_crc_errors }} | {{ data_to_template[interface].counters.in_errors }} | {{ data_to_template[interface].counters.out_errors }} | {{ data_to_template[interface].counters.in_pkts }} | {{ data_to_template[interface].counters.out_pkts }} | {% else %}N/A | N/A | N/A | N/A | N/A | {% endif %}{% if data_to_template[interface].queues is defined %}{{ data_to_template[interface].queues.queue_strategy }} | {{ data_to_template[interface].queues.input_queue_drops }} | {{ data_to_template[interface].queues.total_output_drop }}{% else %}N/A | N/A | N/A{% endif %} |
{%-                 endfor %}
{%-             endfor %}
{%-         elif data_to_template[interface].port_channel.port_channel_member_intfs is defined %}
{%-             for member_interface in data_to_template[interface].port_channel.port_channel_member_intfs %}
| {{ interface }} | {{ data_to_template[interface].description | default ("No Description") }} | {{ data_to_template[interface].type }} | {{ data_to_template[interface].connected | default ("Not Connected") }} | {{ data_to_template[interface].enabled | default ("Not Enabled" ) }} | {{ data_to_template[interface].bandwidth }} | {{ data_to_template[interface].port_speed | default ("N/A")}} | {{ data_to_template[interface].duplex_mode | default ("N/A")}} | No IP Address | {{ data_to_template[interface].line_protocol }} | {{ data_to_template[interface].oper_status }} | {{ data_to_template[interface].mac_address }} | {{ data_to_template[interface].media_type | default ("N/A")}} | {{ data_to_template[interface].delay }} | {{ data_to_template[interface].encapsulations.encapsulation }} | {{ data_to_template[interface].keepalive | default ("N/A")}} | {{ data_to_template[interface].mtu }} | {{ data_to_template[interface].port_channel.port_channel_member }} | {{ member_interface }} | {% if data_to_template[interface].counters is defined %}{{ data_to_template[interface].counters.in_crc_errors }} | {{ data_to_template[interface].counters.in_errors }} | {{ data_to_template[interface].counters.out_errors }} | {{ data_to_template[interface].counters.in_pkts }} | {{ data_to_template[interface].counters.out_pkts }} | {% else %}N/A | N/A | N/A | N/A | N/A | {% endif %}{% if data_to_template[interface].queues is defined %}{{ data_to_template[interface].queues.queue_strategy }} | {{ data_to_template[interface].queues.input_queue_drops }} | {{ data_to_template[interface].queues.total_output_drop }}{% else %}N/A | N/A | N/A{% endif %} |
{%-             endfor %}
{%-         elif data_to_template[interface].port_channel.port_channel_member_intfs is defined %}
{%-             for ip_address in data_to_template[interface].ipv4 %}
| {{ interface }} | {{ data_to_template[interface].description | default ("No Description") }} | {{ data_to_template[interface].type }} | {{ data_to_template[interface].connected | default ("Not Connected") }} | {{ data_to_template[interface].enabled | default ("Not Enabled" ) }} | {{ data_to_template[interface].bandwidth }} | {{ data_to_template[interface].port_speed | default ("N/A")}} | {{ data_to_template[interface].duplex_mode | default ("N/A")}} | {{ ip_address }} | {{ data_to_template[interface].line_protocol }} | {{ data_to_template[interface].oper_status }} | {{ data_to_template[interface].mac_address }} | {{ data_to_template[interface].media_type | default ("N/A")}} | {{ data_to_template[interface].delay }} | {{ data_to_template[interface].encapsulations.encapsulation }} | {{ data_to_template[interface].keepalive | default ("N/A")}} | {{ data_to_template[interface].mtu }} | {{ data_to_template[interface].port_channel.port_channel_member }} | Stand Alone Port | {% if data_to_template[interface].counters is defined %}{{ data_to_template[interface].counters.in_crc_errors }} | {{ data_to_template[interface].counters.in_errors }} | {{ data_to_template[interface].counters.out_errors }} | {{ data_to_template[interface].counters.in_pkts }} | {{ data_to_template[interface].counters.out_pkts }} | {% else %}N/A | N/A | N/A | N/A | N/A | {% endif %}{% if data_to_template[interface].queues is defined %}{{ data_to_template[interface].queues.queue_strategy }} | {{ data_to_template[interface].queues.input_queue_drops }} | {{ data_to_template[interface].queues.total_output_drop }}{% else %}N/A | N/A | N/A{% endif %} |
{%-             endfor %}
{%-         else %}
| {{ interface }} | {{ data_to_template[interface].description | default ("No Description") }} | {{ data_to_template[interface].type }} | {{ data_to_template[interface].connected | default ("Not Connected") }} | {{ data_to_template[interface].enabled | default ("Not Enabled" ) }} | {{ data_to_template[interface].bandwidth }} | {{ data_to_template[interface].port_speed | default ("N/A")}} | {{ data_to_template[interface].duplex_mode | default ("N/A")}} | No IP Address | {{ data_to_template[interface].line_protocol }} | {{ data_to_template[interface].oper_status }} | {{ data_to_template[interface].mac_address }} | {{ data_to_template[interface].media_type | default ("N/A")}} | {{ data_to_template[interface].delay }} | {{ data_to_template[interface].encapsulations.encapsulation }} | {{ data_to_template[interface].keepalive | default ("N/A")}} | {{ data_to_template[interface].mtu }} | {{ data_to_template[interface].port_channel.port_channel_member }} | Stand Alone Port | {% if data_to_template[interface].counters is defined %}{{ data_to_template[interface].counters.in_crc_errors }} | {{ data_to_template[interface].counters.in_errors }} | {{ data_to_template[interface].counters.out_errors }} | {{ data_to_template[interface].counters.in_pkts }} | {{ data_to_template[interface].counters.out_pkts }} | {% else %}N/A | N/A | N/A | N/A | N/A | {% endif %}{% if data_to_template[interface].queues is defined %}{{ data_to_template[interface].queues.queue_strategy }} | {{ data_to_template[interface].queues.input_queue_drops }} | {{ data_to_template[interface].queues.total_output_drop }}{% else %}N/A | N/A | N/A{% endif %} |
{%-         endif %}
{%-     endfor %}
{%- else %}
{%- if command == "show interfaces status" %}
| Interface | Name | Status | Speed | Duplex | VLAN |
| --------- | ---- | ------ | ----- | ------ | ---- |
{%-     for interface in data_to_template['interfaces'] %}
| {{ interface }} | {{ data_to_template['interfaces'][interface].name | default("Not Named") }} | {{ data_to_template['interfaces'][interface].status }} | {{ data_to_template['interfaces'][interface].port_speed }} | {{ data_to_template['interfaces'][interface].duplex_code }} | {{ data_to_template['interfaces'][interface].vlan }} |
{%-     endfor %}
{%- else %}
{%- if command == "show interfaces trunk" %}
| Interface | Encapsulation | Mode | Native Vlan | Status | Allowed on Trunk | STP Forwarding |
| --------- | ------------- | ---- | ----------- | ------ | ---------------- | -------------- |
{%-     for interface in data_to_template['interface'] %}
| {{ interface }} | {{ data_to_template['interface'][interface].encapsulation }} | {{ data_to_template['interface'][interface].mode }} | {{ data_to_template['interface'][interface].native_vlan }} | {{ data_to_template['interface'][interface].status }} | {{ data_to_template['interface'][interface].vlans_allowed_on_trunk }} | {{ data_to_template['interface'][interface].vlans_in_stp_forwarding_not_pruned }} |
{%-     endfor %}
{%- else %}
{%- if command == "show inventory" %}
| Slot | Part | Description | PID | Serial Number | Virtual ID |
| ---- | ---- | ----------- | --- | ------------- | ---------- |
{%-     for slot in data_to_template['main'] %}
{%-        for part in data_to_template['main'][slot] %}
| {{ slot }} | {{ part }} | {{ data_to_template['main'][slot][part].descr }} | {{ data_to_template['main'][slot][part].pid }} | {{ data_to_template['main'][slot][part].sn }} | {{ data_to_template['main'][slot][part].vid }} |
{%-         endfor %}
{%-     endfor %}
{%-     for slot in data_to_template['slot'] %}
{%-         for part in data_to_template['slot'][slot] %}
{%-             for part_number in data_to_template['slot'][slot][part] %}
| {{ slot }} | {{ part_number }} | {{ data_to_template['slot'][slot][part][part_number].descr }} | {{ data_to_template['slot'][slot][part][part_number].pid }} | {{ data_to_template['slot'][slot][part][part_number].sn }} | {{ data_to_template['slot'][slot][part][part_number].vid }} |
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == 'show ip arp' %}
| Interface | Neighbor IP Address | MAC Address | Type | Origin | Age | Protocol |
| --------- | ------------------- | ----------- | ---- | ------ | --- | -------- |
{%-     for interface in data_to_template['interfaces'] %}
{%-         for neighbor in data_to_template['interfaces'][interface].ipv4.neighbors %}
| {{ interface }} | {{ neighbor }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].link_layer_address }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].type }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].origin }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].age }} | {{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].protocol }} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip interface brief" %}
| Interface | IP Address | Status | Protocol | Method | Interface is OK |
| --------- | ---------- | ------ | -------- | ------ | --------------- |
{%-     for interface in data_to_template['interface'] %}
| {{ interface }} | {{ data_to_template['interface'][interface].ip_address }} | {{ data_to_template['interface'][interface].status }} | {{ data_to_template['interface'][interface].protocol }} | {{ data_to_template['interface'][interface].method }} | {{ data_to_template['interface'][interface].interface_is_ok }} |
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf" %}
| VRF | Address Family | Instance | Router ID | Area | Area Transit | Area Type | Summary | NSSA | Enabled | Interface Count | SPF Last Executed | Total SPF | Area LSA Count | Auto Cost Enable | Reference Bandwidth | BFD Enabled | Elapsed Time | Event Log Enabled | Graceful Restart Type | Graceful Restart Enabled | LLS | NSR Enable | External LSA | Total Areas | Total Normal Areas | Total NSSA Areas | Total Stub Areas |
| --- | -------------- | -------- | --------- | ---- | ------------ | --------- | ------- | ---- | ------- | --------------- | ----------------- | --------- | -------------- | ---------------- | ------------------- | ----------- | ------------ | ----------------- | --------------------- | ------------------------ | --- | ---------- | ------------ | ----------- | ------------------ | ---------------- | ---------------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}
{%-                 for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                     for graceful_restart in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].router_id }} | {{ area }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].area_transit }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].area_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].summary }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].nssa }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.interfaces_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.spf_last_executed }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.spf_runs_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].statistics.area_scope_lsa_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.reference_bandwidth }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].elapsed_time }} | {% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].event_log is defined %}YES{% else %}NO{% endif %} | {{ graceful_restart }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].lls }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].nsr.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.external_lsa }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].total_areas }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].total_normal_areas }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].total_nssa_areas }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].total_stub_areas }} |
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf database" %}
| VRF | Address Family | Instance | Area | LSA Type | LSA | Age | Link Count | Check Sum | Sequence Number |
| --- | -------------- | -------- | ---- | -------- | --- | --- | ---------- | --------- | --------------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}
{%-                 for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                     for lsa_type in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types %}
{%-                         for lsa in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ area }} | {{ lsa_type }} | {{ lsa }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.age }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.link_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.checksum }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsas[lsa].ospfv2.header.seq_num }} |
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf interface" %}
| VRF | Address Family | Instance | Area | Interface | Name | Interface Type | Passive | IP Address | Router ID | BFD | Cost | Dead Interval | Enabled | Graceful Restart Type | GR Helper | Hello Interval | Hello Timer | Index | Retransmit Interval | State | Neighbor Count | Transmit Delay | Wait Interval |
| --- | -------------- | -------- | ---- | --------- | ---- | -------------- | ------- | ---------- | --------- | --- | ---- | ------------- | ------- | --------------------- | --------- | -------------- | ----------- | ----- | ------------------- | ----- | -------------- | -------------- | ------------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}
{%-                 for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                     for interface in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces %}
{%-                         for graceful_restart in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].graceful_restart %}
| {{ vrf }} | {{ address_family }} | {{ instance }} | {{ area }} | {{ interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].name }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].interface_type }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].ip_address }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].bfd.enable }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }} | {{ graceful_restart }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].graceful_restart[graceful_restart].helper }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].index }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.nbr_count }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].wait_interval }} |
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf neighbor" %}
| Interface | Neighbor | Address | Dead Time | Priority | State |
| --------- | -------- | ------- | --------- | ---------| ----- |
{%-     for interface in data_to_template['interfaces'] %}
{%-         for neighbor in data_to_template['interfaces'][interface].neighbors %}
| {{ interface }} | {{ neighbor }} | {{ data_to_template['interfaces'][interface].neighbors[neighbor].address }} | {{ data_to_template['interfaces'][interface].neighbors[neighbor].dead_time }} | {{ data_to_template['interfaces'][interface].neighbors[neighbor].priority }} | {{ data_to_template['interfaces'][interface].neighbors[neighbor].state }} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf neighbor detail" %}
| VRF | Instance | Area | Interface | Neighbor | Neighbor Address | Neighbor Router ID | Index | Priority | State | Dead Time | Total Retransmissions | Uptime |
| --- | -------- | ---- | --------- | -------- | ---------------- | ------------------ | ----- | -------- | ----- | --------- | --------------------- | ------ |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for instance in data_to_template['vrf'][vrf].address_family[address_family].instance %}
{%-                 for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}
{%-                     for interface in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces %}
{%-                         for neighbor in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors %}
| {{ vrf }} | {{ instance }} | {{ area }} | {{ interface }} | {{ neighbor }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].address }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].neighbor_router_id }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].index }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].priority }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].state }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dead_timer }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].statistics.total_retransmission }} | {{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].uptime }} |
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip route" %}
| VRF | Address Family | Route | Active | Metric | Route Preference | Source Protocol | Source Protocol Code | Next Hop Number | Next Hop | Outgoing Interface | Updated |
| --- | -------------- | ----- | ------ | ------ | ---------------- | --------------- | -------------------- | --------------- | -------- | ------------------ | ------- |
{%-     for vrf in data_to_template['vrf'] %}
{%-         for address_family in data_to_template['vrf'][vrf].address_family %}
{%-             for route in data_to_template['vrf'][vrf].address_family[address_family].routes %}
{%-                 if data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list is defined %}
{%-                     for next_hop in data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].active }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].metric }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].route_preference }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol_codes }} | {{ next_hop }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].outgoing_interface }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }} |
{%-                     endfor %}
{%-                 else %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].active }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].metric }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].route_preference }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol }} | {{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].source_protocol_codes }} | {{ next_hop }} | N/A | N/A | N/A |
{%-                 endif %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == 'show license summary' %}
| Name | License | Entitlement | Count | Status |
| ---- | ------- | ----------- | ----- | ------ |
{%-     for license in data_to_template['license_usage'] %}
| {{ license }} | {{ data_to_template['license_usage'][license].license }} | {{ data_to_template['license_usage'][license].entitlement }} | {{ data_to_template['license_usage'][license].count }} | {{ data_to_template['license_usage'][license].status }} |
{%-     endfor %}
{%- else %}
{%- if command == "show mac address-table" %}
| VLAN | MAC Address | Interface | Entry Type |
| ---- | ----------- | --------- | ---------- |
{%-     for vlan in data_to_template['mac_table'].vlans %}
{%-         for mac in data_to_template['mac_table'].vlans[vlan].mac_addresses %}
{%-             for interface in data_to_template['mac_table'].vlans[vlan].mac_addresses[mac].interfaces %}
| {{ vlan }} | {{ mac }} | {{ interface }} | {{ data_to_template['mac_table'].vlans[vlan].mac_addresses[mac].interfaces[interface].entry_type }} |
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ntp associations" %}
| Server Address | Reference Clock | Stratum | Poll | Reach | Delay | Offset | Dispersion |
| -------------- | --------------- | ------- | ---- | ----- | ----- | ------ | ---------- |
{%-     for peer in data_to_template.peer %}
| {{ peer }} | {{ data_to_template['peer'][peer]['local_mode']['client']['refid'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['stratum'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['poll'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['reach'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['delay'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['offset'] }} | {{ data_to_template['peer'][peer]['local_mode']['client']['offset'] }} |
{%-     endfor %}
| Clock State |
| ----------- |
| {{ data_to_template['clock_state']['system_status']['clock_state'] }} |
{%- else %}
{%- if command == "show version" %}
| Hostname | Platform | Chassis | Version | Image ID | OS | Uptime | Last Reload | Last Reload Reason | Interfaces | Total Memory | Used Memeory | Serial Number | License Type |
| -------- | -------- | ------- | ------- | -------- | -- | ------ | ----------- | ------------------ | ---------- | ------------ | ------------ | ------------- | ------------ |
| {{ data_to_template['version'].hostname }} | {{ data_to_template['version'].platform }} | {{ data_to_template['version'].chassis }} | {{ data_to_template['version'].version }} | {{ data_to_template['version'].image_id }} | {{ data_to_template['version'].os }} | {{ data_to_template['version'].uptime }} | {{ data_to_template['version'].system_restarted_at }} | {{ data_to_template['version'].last_reload_reason }} | {{ data_to_template['version'].number_of_intfs | replace("{","") | replace("}","") }} | {{ data_to_template['version'].main_mem }} | {{ data_to_template['version'].mem_size | replace("{","") | replace("}","") }} | {{ data_to_template['version'].chassis_sn }} | {{ data_to_template['version'].license_type }} |
{%- else %}
{%- if command == "show vlan" %}
| VLAN | Interface | Name | State | Shutdown | MTU |
| ---- | --------- | ---- | ----- | -------- | --- |
{%-     for vlan in data_to_template['vlans'] %}
{%-         for interface in data_to_template['vlans'][vlan].interfaces %}
| {{ vlan }} | {{ interface }} | {{ data_to_template['vlans'][vlan].name }} | {{ data_to_template['vlans'][vlan].state }} | {{ data_to_template['vlans'][vlan].shutdown }} | {{ data_to_template['vlans'][vlan].mtu }} |
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show vrf" %}
| VRF | Protocols | Interfaces |
| --- | -------- | ---------- |
{%-     for vrf in to_parse_vrf %}
{%-         for interface in to_parse_vrf[vrf].interfaces %}
{%-             for protocol in to_parse_vrf[vrf].protocols %}
{%-                 if interface != "ipv4" %}
| {{ vrf }} | {{ protocol }} | {{ interface }} |
{%-                 endif %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}