{%- if command == "acl" %}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['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 %}
Total Entries,Input Drops,Input Reply Packets,Input Request Packets,Input Total,Incomplete Total,Output Drops,Output Gratuitous Packets,Output Reply Packets,Output Request Packets,Output Total
{{ data_to_template['statistics'].entries_total }},{{ data_to_template['statistics'].in_drops }},{{ data_to_template['statistics'].in_replies_pkts }},{{ data_to_template['statistics'].in_requests_pkts }},{{ data_to_template['statistics'].in_total | default("N/A") }},{{ data_to_template['statistics'].incomplete_total }},{{ data_to_template['statistics'].out_drops | default("N/A") }},{{ data_to_template['statistics'].out_gratuitous_pkts | default("N/A") }},{{ data_to_template['statistics'].out_replies_pkts }},{{ data_to_template['statistics'].out_requests_pkts }},{{ data_to_template['statistics'].out_total| default("N/A") }}
{%- 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 %}
{{ 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 }}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- 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"," ") | replace(","," ") }}
{%-                     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 %}
Hello Timer,Hold Timer,Aged Out Entries,Frame Discards,Frame Input Errors,Frame Input,Frame Output,TLV Unknown
{{ 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_unknown }}
Suppress TLV Advertisement Management Address,Suppress TLV Advertisement Port Description,Suppress TLV Advertisement System Capabilities,Suppress TLV Advertisement System Description,Suppress TLV Advertisement System Name
{{ data_to_template.suppress_tlv_advertisement.management_address }},{{ data_to_template.suppress_tlv_advertisement.port_description }},{{ data_to_template.suppress_tlv_advertisement.system_capabilities }},{{ data_to_template.suppress_tlv_advertisement.system_description }},{{ data_to_template.suppress_tlv_advertisement.system_name }}
{%- 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,Source,Type,VRF
{%-     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.source }},{{ data_to_template['vrf'][vrf].unicast_configuration.address[address].type.server.type }},{{ data_to_template['vrf'][vrf].unicast_configuration.address[address].type.server.vrf }}
{%-         endfor %}
{%-     endfor %}
Association Address,Clock State,Clock Stratum,Root Delay
{{ data_to_template['clock_state'].system_status.associations_address }},{{ data_to_template['clock_state'].system_status.clock_state }},{{ data_to_template['clock_state'].system_status.clock_stratum }},{{ data_to_template['clock_state'].system_status.root_delay }}
{%- else %}
{%- if command == 'ospf' %}VRF,Address Family,Instance,Auto Cost Enabled,Reference Bandwidth,Instance Enable,Graceful Restart Type,Graceful Restart Enable,Restart Timer,NSR Enable,Preference,Router ID,SPF Paths,LSA Hold,LSA Max,LSA Start,SPF Hold,SPF Max,SPF Start,Area,Area Type,LSA Type,LSA,Advertising Router,Age,Checksum,Length,Option,Sequence Number,Subnet Mask,Number of Links,Link,Link Data,Link Type,Topology,Metric,Interface,Enabled,BFD,Cost,Dead Interval,Hello Interval,Hello Timer,Interface Type,Neighbor,Neighbor Address,Dead Timer,Last State Change,State,NBR Events,Passive,Retransmit Interval,Link LSA Checksum,Link LSA Count,Transmit Delay,MPLS LDP Auto Config,MPLS LDP Sync,Area LSA Checksum,Area LSA Count,SPF Count
{%-     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 graceful_restart_type in data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart %}
{%-                     if data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas is defined %}
{%-                         for area in data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas %}
{%-                             if data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].database is defined %}
{%-                                 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].lsa_type == 1 %}
{%-                                             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 %}
{{ vrf }},{{ address_family }},{{ instance }},{{ 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].enable }},{{ graceful_restart_type }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].restart_interval }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].nsr.enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].preference.single_value.all }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].router_id }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.paths }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.hold }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.maximum }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.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 }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }},{{ area }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].area_type }},{{ lsa_type }},{{ lsa }},{{ 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].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 }},N/A,{{ 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_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 }},{{ 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 }},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,{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].mpls.ldp.auto_config }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].mpls.ldp.sync }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].statistics.area_scope_lsa_cksum_sum }},{{ 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].areas[area].statistics.spf_runs_count }}
{%-                                                 endfor %}
{%-                                             endfor %}
{%-                                         endif %}
{%-                                         if data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].database.lsa_types[lsa_type].lsa_type == 3 %}
{%-                                             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].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].enable }},{{ graceful_restart_type }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].restart_interval }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].nsr.enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].preference.single_value.all }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].router_id }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.paths }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.hold }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.maximum }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.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 }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }},{{ area }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].area_type }},{{ lsa_type }},{{ lsa }},{{ 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].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 }},{{ 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 }},N/A,N/A,N/A,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.summary.topologies[topology].metric }},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,{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].mpls.ldp.auto_config }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].mpls.ldp.sync }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].statistics.area_scope_lsa_cksum_sum }},{{ 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].areas[area].statistics.spf_runs_count }}
{%-                                             endfor %}
{%-                                         endif %}
{%-                                     endfor %}
{%-                                 endfor %}
{%-                             endif %}
{%-                             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 }},{{ address_family }},{{ instance }},{{ 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].enable }},{{ graceful_restart_type }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].restart_interval }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].nsr.enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].preference.single_value.all }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].router_id }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.paths }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.hold }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.maximum }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.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 }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }},{{ area }},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,{{ interface }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].enable }},{{ 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].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].interface_type }},{{ 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].dead_timer }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].last_state_change }},{{ 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].passive }},{{ 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].statistics.link_scope_lsa_cksum_sum }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.link_scope_lsa_count }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay }},N/A,N/A,N/A,N/A,N/A
{%-                                 endfor %}
{%-                             endfor %}
{%-                         endfor %}
{%-                     else %}
{{ vrf }},{{ address_family }},{{ instance }},{{ 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].enable }},{{ graceful_restart_type }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart_type].restart_interval }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].nsr.enable }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].preference.single_value.all }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].router_id }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.paths }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.hold }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.maximum }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.lsa.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 }},{{ data_to_template.vrf[vrf].address_family[address_family].instance[instance].spf_control.throttle.spf.start }},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,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,N/A
{%-                     endif %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "platform" %}Device Type,Chassis,Serial Number,Uptime,Directory,Total Disk,Used Disk,Free Disk,Image,Main Memory,OS,Version
{{ data_to_template.rtr_type | default("N/A") }},{{ data_to_template.chassis | default("N/A") }},{{ data_to_template.chassis_sn | default("N/A") }},{{ data_to_template.rp_uptime | default("N/A") }},{{ data_to_template.dir | default("N/A") }},{{ data_to_template.disk_total_space | default("N/A") }},{{ data_to_template.disk_used_space | default("N/A") }},{{ data_to_template.disk_free_space | default("N/A") }},{{ data_to_template.image | default("N/A") }},{{ data_to_template.main_mem | default("N/A") }},{{ data_to_template.os | default("N/A") }},{{ data_to_template.version | default("N/A") }}
Slot Name,Slot Serial Number,Slot State,Redundancy State,RP Boot Image,RP Uptime
{%-     for slot in data_to_template.slot %}
{%-         for sub_slot in data_to_template.slot[slot] %}
{{ data_to_template.slot[slot][sub_slot].name | default("N/A") }},{{ data_to_template.slot[slot][sub_slot].sn | default("N/A") }},{{ data_to_template.slot[slot][sub_slot].state | default("N/A") }},{% if slot == "rp" %}{{ data_to_template.slot[slot][sub_slot].redundancy_state | default("N/A") }},{{ data_to_template.slot[slot][sub_slot].rp_boot_image | default("N/A") }},{{ data_to_template.slot[slot][sub_slot].rp_uptime | default("N/A") }},{% else %}N/A,N/A,N/A,{% endif %}
{%-          endfor %}
{%-     endfor %}
Virtual Device Name,Virtual Device Status,Virtual Interface,Virtual Interface Type,Virtual Interface Status
{%-     for virtual_device in data_to_template.virtual_device %}
{%-         for interface in data_to_template.virtual_device[virtual_device].membership %}
{{ data_to_template.virtual_device[virtual_device].vd_name | default("N/A") }},{{ data_to_template.virtual_device[virtual_device].vd_status | default("N/A") }},{{ interface }},{{ data_to_template.virtual_device[virtual_device].membership[interface].type | default("N/A") }},{{ data_to_template.virtual_device[virtual_device].membership[interface].status | default("N/A") }}
{%-         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 == "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'].configuration[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,Address Family,Route Distinguisher
{%-     for vrf in data_to_template['vrfs'] %}
{%-         for address_family in data_to_template['vrfs'][vrf].address_family %}
{{ vrf }},{{ address_family }},{{ data_to_template['vrfs'][vrf].route_distinguisher }}
{%-         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" %}Switch,Neighbor,Platform,Local Interface,Remote Interface,Capability,Hold Time
{%-     for neighbor in data_to_template['cdp'].index %}
{{ hostname}},{{ 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" %}Switch,Local Interface,Neighbor,Platform,Remote Interface,Remote Interface Address,Neighbor Management Address,Neighbor Capabilities,Duplex Mode,Hold Time,Native VLAN,Software Version,System Name,VTP Domain,Physical Location,Advertisement Version
{%-     for neighbor in data_to_template['index'] %}
{{ hostname}},{{ data_to_template['index'][neighbor].local_interface }},{{ data_to_template['index'][neighbor].device_id }},{{ data_to_template['index'][neighbor].platform }},{{ data_to_template['index'][neighbor].port_id }},{{ data_to_template['index'][neighbor].interface_addresses | replace("{'","") | replace("'","") | replace(":","") | replace("{}}","") | replace(",","") }},{{ data_to_template['index'][neighbor].management_addresses | replace("{'","") | replace("'","") | replace(":","") | replace("}","") | replace("{}","") | replace("{","") }},{{ data_to_template['index'][neighbor].capabilities }},{{ data_to_template['index'][neighbor].duplex_mode }},{{ data_to_template['index'][neighbor].hold_time }},{{ data_to_template['index'][neighbor].native_vlan }},{{ data_to_template['index'][neighbor].software_version | replace(","," ") | replace("\n"," ") }},{{ data_to_template['index'][neighbor].system_name | default("N/A") }},{{ data_to_template['index'][neighbor].vtp_management_domain | default("N/A") }},{{ data_to_template['index'][neighbor].physical_location | default("N/A") }},{{ data_to_template['index'][neighbor].advertisement_ver }}
{%-     endfor %}
Total CDP Neighbors
{{ data_to_template.total_entries_displayed }}
{%- else %}
{%- if command == "show environment" %}Fan,Direction,Model,Status,Air Filter,Fan Zone Speed
{%- for fan in data_to_template.fans %}
{%-     if (fan != "fan_air_filter") and (fan != "fan_zone_speed") %}
{{ fan }},{{ data_to_template.fans[fan].direction }},{% if data_to_template.fans[fan].model is defined %}{{ data_to_template.fans[fan].model }}{% else %}N/A{% endif %},{{ data_to_template.fans[fan].status }},{{ data_to_template.fans.fan_air_filter }},{{ data_to_template.fans.fan_zone_speed }}
{%-     endif %}
{%- endfor %}
Power Supply,Actual Input,Actual Output,Model,Status,Capacity,Voltage,Config Mode,Operation Mode,Total Grid A,Total Grid B,Total Power Capacity,Total Power Cumulative,Total Power Input,Total Power Output
{%- for power_supply in data_to_template.power.power_supply %}
{{ power_supply }},{{ data_to_template.power.power_supply[power_supply].actual_input_watts }},{{ data_to_template.power.power_supply[power_supply].actual_output_watts }},{{ data_to_template.power.power_supply[power_supply].model }},{{ data_to_template.power.power_supply[power_supply].status }},{{ data_to_template.power.power_supply[power_supply].total_capacity_watts }},{{ data_to_template.power.voltage }},{{ data_to_template.power.power_supply_mode.config_mode }},{{ data_to_template.power.power_supply_mode.oper_mode }},{{ data_to_template.power.power_usage_summary.total_grid_a_power_watts }},{{ data_to_template.power.power_usage_summary.total_grid_b_power_watts }},{{ data_to_template.power.power_usage_summary.total_power_capacity_watts }},{{ data_to_template.power.power_usage_summary.total_power_cumulative_watts }},{{ data_to_template.power.power_usage_summary.total_power_input_watts }},{{ data_to_template.power.power_usage_summary.total_power_output_watts }}
{%- endfor %}
Temperature Area,Current Temp,Major Threshold,Minor Threshold,Status
{%- for temp_number in data_to_template.temperature %}
{%-     for area in data_to_template.temperature[temp_number] %}
{{ area }},{{ data_to_template.temperature[temp_number][area].current_temp_celsius }},{{ data_to_template.temperature[temp_number][area].major_threshold_celsius }},{{ data_to_template.temperature[temp_number][area].minor_threshold_celsius }},{{ data_to_template.temperature[temp_number][area].status }}
{%-     endfor %}
{%- endfor %}
{%- else %}
{%- if command == "show port-channel summary" %}Port-Channel,Bundle ID,Layer,Type,Status,Protocol,Member Interface,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].layer }},{{ data_to_template['interfaces'][interface].type }},{{ data_to_template['interfaces'][interface].oper_status }},{{ data_to_template['interfaces'][interface].protocol }},{{ member }},{{ data_to_template['interfaces'][interface].members[member].flags }}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show interface" %}Interface,Description,Admin State,Enabled,Operational Status,Line Protocol,Link State,MAC Address,Phsyical Address,IP Address,Port Speed,Duplex,Bandwidth,Delay,Media Type,Ether Type,Medium,MTU,Port Mode,Type,Port Channel Interface,Port Channel Member,Last Link Flap,Interface Reset,Dedicated Interface,Efficient Ethernet,Encapsulation,Flow Control Send,Flow Control Receive,Auto MDIX,Reliability,Switchport Monitor,Beacon,Auto State,RX Load,TX Load,Input Bad Etype Drop,Input Broadcast,Input CRC Errors,Input Discard,Input Errors,Input Down Drop,Input Ignored,Input MAC Pause Frames,Input Multicast,Input No Buffer,Input Octets,Input Overrun,Input Oversize Frame,Input Total,Input Runts,Input Short Frame,Input Underrun,Input Unicast,Input Unknown,Input Watchdog,Input With Dribble,Output Babble,Output Broadcast,Output Collision,Output Deferred,Output Discard,Output Errors,Output Jumbo,Output Late Collision,Output Lost Carrier,Output MAC Pause Frames,Output Multicast,Output No Carrier,Output Octets,Output Total,Output Unicast,Last Counter Clear,Input rate,Input Rate Packets,Output Rate,Output Rate Packets,Load Interval,RX,TX
{%-     for interface in data_to_template %}
{{ interface }},{% if data_to_template[interface].description is defined %}{{ data_to_template[interface].description }}{% else %}N/A{% endif %},{% if data_to_template[interface].admin_state is defined %}{{ data_to_template[interface].admin_state }}{% else %}N/A{% endif %},{% if data_to_template[interface].enabled is defined %}{{ data_to_template[interface].enabled }}{% else %}N/A{% endif %},{% if data_to_template[interface].oper_status is defined %}{{ data_to_template[interface].oper_status }}{% else %}N/A{% endif %},{% if data_to_template[interface].line_protocol is defined %}{{ data_to_template[interface].line_protocol }}{% else %}N/A{% endif %},{% if data_to_template[interface].link_state is defined %}{{ data_to_template[interface].link_state }}{% 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 in data_to_template[interface].ipv4 %}{{ ip }}{% endfor%}{% 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].bandwidth is defined %}{{ data_to_template[interface].bandwidth }}{% 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].media_type is defined %}{{ data_to_template[interface].media_type }}{% else %}N/A{% endif %},{% if data_to_template[interface].ethertype is defined %}{{ data_to_template[interface].ethertype }}{% 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].mtu is defined %}{{ data_to_template[interface].mtu }}{% else %}N/A{% endif %},{% if data_to_template[interface].port_mode is defined %}{{ data_to_template[interface].port_mode }}{% else %}N/A{% endif %},{% if data_to_template[interface].types is defined %}{{ data_to_template[interface].types }}{% else %}N/A{% endif %},{% if (data_to_template[interface].port_channel) and (data_to_template[interface].port_channel.port_channel_int) is defined %}{{ data_to_template[interface].port_channel.port_channel_int }}{% else %}{% if (data_to_template[interface].port_channel) and (data_to_template[interface].port_channel.port_channel_member_intfs) is defined %}{{ interface }}{% else %}N/A{% endif %}{% endif %},{% if (data_to_template[interface].port_channel) and (data_to_template[interface].port_channel.port_channel_member) is defined %}{{ data_to_template[interface].port_channel.port_channel_member }}{% else %}{% if (data_to_template[interface].port_channel) and (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 %}N/A{% endif %}{% endif %},{% if data_to_template[interface].last_link_flapped is defined %}{{ data_to_template[interface].last_link_flapped }}{% else %}N/A{% endif %},{% if data_to_template[interface].interface_reset is defined %}{{ data_to_template[interface].interface_reset }}{% else %}N/A{% endif %},{% if data_to_template[interface].dedicated_interface is defined %}{{ data_to_template[interface].dedicated_interface }}{% else %}N/A{% endif %},{% if data_to_template[interface].efficient_ethernet is defined %}{{ data_to_template[interface].efficient_ethernet }}{% else %}N/A{% endif %},{% if data_to_template[interface].encapsulations is defined %}{{ data_to_template[interface].encapsulations.encapsulation }}{% else %}N/A{% endif %},{% if data_to_template[interface].flow_control is defined %}{{ data_to_template[interface].flow_control.send }},{{ data_to_template[interface].flow_control.receive }}{% else %}N/A,N/A{% endif %},{% if data_to_template[interface].auto_mdix is defined %}{{ data_to_template[interface].auto_mdix }}{% else %}N/A{% endif %},{% if data_to_template[interface].reliability is defined %}{{ data_to_template[interface].reliability }}{% else %}N/A{% endif %},{% if data_to_template[interface].switchport_monitor is defined %}{{ data_to_template[interface].switchport_monitor }}{% else %}N/A{% endif %},{% if data_to_template[interface].beacon is defined %}{{ data_to_template[interface].beacon }}{% else %}N/A{% endif %},{% if data_to_template[interface].autostate is defined %}{{ data_to_template[interface].autostate }}{% else %}N/A{% endif %},{% if data_to_template[interface].rxload is defined %}{{ data_to_template[interface].rxload }}{% else %}N/A{% endif %},{% if data_to_template[interface].txload is defined %}{{ data_to_template[interface].txload }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters is defined %}{% if data_to_template[interface].counters.in_bad_etype_drop is defined %}{{ data_to_template[interface].counters.in_bad_etype_drop }}{% else %}N/A{% endif %},{% 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_discard is defined %}{{ data_to_template[interface].counters.in_discard }}{% 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_if_down_drop is defined %}{{ data_to_template[interface].counters.in_if_down_drop }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.in_ignored is defined %}{{ data_to_template[interface].counters.in_ignored }}{% 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_no_buffer is defined %}{{ data_to_template[interface].counters.in_no_buffer }}{% 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_overrun is defined %}{{ data_to_template[interface].counters.in_overrun }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.in_oversize_frame is defined %}{{ data_to_template[interface].counters.in_oversize_frame }}{% 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.in_runts is defined %}{{ data_to_template[interface].counters.in_runts }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.in_short_frame is defined %}{{ data_to_template[interface].counters.in_short_frame }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.in_underrun is defined %}{{ data_to_template[interface].counters.in_underrun }}{% 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_watchdog is defined %}{{ data_to_template[interface].counters.in_watchdog }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.in_with_dribble is defined %}{{ data_to_template[interface].counters.in_with_dribble }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.out_babble is defined %}{{ data_to_template[interface].counters.out_babble }}{% 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_collision is defined %}{{ data_to_template[interface].counters.out_collision }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.out_deferred is defined %}{{ data_to_template[interface].counters.out_deferred }}{% 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_jumbo_packets is defined %}{{ data_to_template[interface].counters.out_jumbo_packets }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.out_late_collision is defined %}{{ data_to_template[interface].counters.out_late_collision }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.out_lost_carrier is defined %}{{ data_to_template[interface].counters.out_lost_carrier }}{% 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_no_carrier is defined %}{{ data_to_template[interface].counters.out_no_carrier }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.out_octets is defined %}{{ data_to_template[interface].counters.out_octets }}{% 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.out_unicast_pkts is defined %}{{ data_to_template[interface].counters.out_unicast_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 %}{% if data_to_template[interface].counters.rate.in_rate is defined %}{{ data_to_template[interface].counters.rate.in_rate }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.rate.in_rate_pkts is defined %}{{ data_to_template[interface].counters.rate.in_rate_pkts }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.rate.out_rate is defined %}{{ data_to_template[interface].counters.rate.out_rate }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.rate.out_rate_pkts is defined %}{{ data_to_template[interface].counters.rate.out_rate_pkts }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.rate.load_interval is defined %}{{ data_to_template[interface].counters.rate.load_interval }}{% else %}N/A{% endif %}{% else %}N/A,N/A,N/A,N/A,N/A{% endif %},{% if data_to_template[interface].counters.rx is defined %}{{ data_to_template[interface].counters.rx }}{% else %}N/A{% endif %},{% if data_to_template[interface].counters.tx is defined %}{{ data_to_template[interface].counters.tx }}{% else %}N/A{% endif %}{% 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,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,N/A,N/A,N/A,N/A{% endif %}
{%- endfor %}
{% else %}
{%- if command == "show interface status" %}Interface,Status,Type,VLAN,Port Speed,Duplex
{%-     for interface in data_to_template.interfaces %}
{{ interface }},{{ data_to_template.interfaces[interface].status }},{{ data_to_template.interfaces[interface].type }},{{ data_to_template.interfaces[interface].vlan }},{{ data_to_template.interfaces[interface].port_speed }},{{ data_to_template.interfaces[interface].duplex_code }}
{%-     endfor %}
{%- else %}
{%- if command == "show interface transceiver" %}Interface,Transceiver Present,Transceiver Type,Name,Nominal Bitrate,Part Number,Revision,Serial Number
{%-     for interface in data_to_template %}
{%-         if data_to_template[interface].transceiver_present %}
{{ interface }},{{ data_to_template[interface].transceiver_present }},{{ data_to_template[interface].transceiver_type }},{{ data_to_template[interface].name }},{{ data_to_template[interface].nominal_bitrate }},{{ data_to_template[interface].part_number }},{{ data_to_template[interface].revision }},{{ data_to_template[interface].serial_number }}
{%-         else %}
{{ interface }},N/A,N/A,N/A,N/A,N/A,N/A,N/A
{%-         endif %}
{%- endfor %}
{%- else %}
{%- if command == "show inventory" %}Slot,Description,PID,Serial Number
{%-     for part in data_to_template['name'] %}
{{ part }},{{ data_to_template['name'][part].description | replace(",","") }},{{ data_to_template['name'][part].pid }},{{ data_to_template['name'][part].serial_number }}
{%-     endfor %}
{%- else %}
{% if command == "show ip arp vrf all" %}Interface,Neighbor IP Address,MAC Address,Origin,Age
{%-     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].origin }},{{ data_to_template['interfaces'][interface].ipv4.neighbors[neighbor].age }}
{%-         endfor %}
{%-     endfor %}
Total Entries
{{ data_to_template['statistics'].entries_total }}
{%- else %}
{%- if command == "show ip interface brief" %}Interface,IP Address,Status
{%-     for interface in data_to_template['interface'] %}
{%-         if data_to_template['interface'][interface].vlan_id is defined %}
{%-             for vlan_id in data_to_template['interface'][interface].vlan_id %}
{{ interface }},{{ data_to_template['interface'][interface].vlan_id[vlan_id].ip_address }},{{ data_to_template['interface'][interface].vlan_id[vlan_id].interface_status }}
{%-             endfor %}
{%-         else %}
{{ interface }},{{ data_to_template['interface'][interface].ip_address }},{{ data_to_template['interface'][interface].interface_status }}
{%-         endif %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf" %}VRF,Address Family,Instance,Router ID,Area,Area Type,Authentication,Existed,Enabled,Active Interfaces,Passive Interfaces,Loopback Interfaces,Total Interfaces,Total SPF,Last SPF,Auto Cost Unit,Auto Cost Enabled,Reference Bandwidth,Discard External Route,Discard Interal Route,Graceful Restart Type,Graceful Restart Enabled,Restart Interval,State,NSR Enabled,Active Normal Areas,Active NSSA Areas,Active Stub Areas,Total Active Areas,Number of Paths
{%-     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 graceful_restart in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart %}
{%-                     if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas is defined %}
{%-                         for area in data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas %}                        
{{ 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].areas[area].area_type }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].authentication }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].existed }},{{ 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].numbers.active_interfaces }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].numbers.passive_interfaces }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].numbers.loopback_interfaces }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].numbers.interfaces }},{{ 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.spf_last_run_time }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.bandwidth_unit }},{{ 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].discard_route_external }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].discard_route_internal }},{{ 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].graceful_restart[graceful_restart].restart_interval }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].state }},{{ 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.active_areas.normal }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.nssa }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.stub }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.total }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths }}
{%-                         endfor %}
{%-                     else %}
{{ vrf }},{{ address_family }},{{ instance }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].router_id}},No Areas,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].auto_cost.bandwidth_unit }},{{ 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].discard_route_external }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].discard_route_internal }},{{ 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].graceful_restart[graceful_restart].restart_interval }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].graceful_restart[graceful_restart].state }},{{ 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.active_areas.normal }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.nssa }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.stub }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].numbers.active_areas.total }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].spf_control.paths }}
{%-                     endif %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf interface" %}VRF,Address Family,Instance,Area,Interface,Name,BFD,Cost,Dead Interval,Enabled,Hello Interval,Hello Timer,Index,Interface Type,IP Address,Line Protocol,Passive,Retransmit Interval,State,LSA Checksums,LSA Count,Neighbor Adjacencies,Neighbor Flooding,Total Neighbors,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 %}
{{ 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].bfd.enable }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval }}{% else %}N/A{% endif %},{{ 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].hello_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval }}{% else %}N/A{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer }}{% else %}N/A{% endif %},{{ 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].interface_type }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].ip_address is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].ip_address }}{% else %}N/A{% endif %},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].line_protocol }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval }}{% else %}N/A{% endif %},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.link_scope_lsa_cksum_sum }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.link_scope_lsa_count }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.num_nbrs_adjacent }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.num_nbrs_flooding }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.total_neighbors }},{% else %}N/A,N/A,N/A,N/A,N/A,{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay }}{% else %}N/A{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].wait_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].wait_interval }}{% else %}N/A{% endif %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf interface vrf all" %}VRF,Address Family,Instance,Area,Interface,Name,BFD,Cost,Dead Interval,Enabled,Hello Interval,Hello Timer,Index,Interface Type,IP Address,Line Protocol,Passive,Retransmit Interval,State,LSA Checksums,LSA Count,Neighbor Adjacencies,Neighbor Flooding,Total Neighbors,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 %}
{{ 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].bfd.enable }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].cost }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].dead_interval }}{% else %}N/A{% endif %},{{ 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].hello_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_interval }}{% else %}N/A{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].hello_timer }}{% else %}N/A{% endif %},{{ 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].interface_type }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].ip_address is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].ip_address }}{% else %}N/A{% endif %},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].line_protocol }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].passive }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].retransmit_interval }}{% else %}N/A{% endif %},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].state }},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.link_scope_lsa_cksum_sum }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.link_scope_lsa_count }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.num_nbrs_adjacent }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.num_nbrs_flooding }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].statistics.total_neighbors }},{% else %}N/A,N/A,N/A,N/A,N/A,{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].transmit_delay }}{% else %}N/A{% endif %},{% if data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].wait_interval is defined %}{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].wait_interval }}{% else %}N/A{% endif %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf neighbors detail" %}VRF,Address Family,Instance,Area,Interface,Neighbor,Neighbor Address,Neighbor Events,DBD Options,Dead Timer,Hello Options,Last Non Hello Received,Last State Change,Neighbor Router ID,State
{%-     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 }},{{ address_family }},{{ 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].statistics.nbr_event_count }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dbd_options }},{{ 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].hello_options }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].last_non_hello_packet_received }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].last_state_change }},{{ 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 }}
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip ospf neighbors detail vrf all" %}VRF,Address Family,Instance,Area,Interface,Neighbor,Neighbor Address,Neighbor Events,DBD Options,Dead Timer,Hello Options,Last Non Hello Received,Last State Change,Neighbor Router ID,State
{%-     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 }},{{ address_family }},{{ 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].statistics.nbr_event_count }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].dbd_options }},{{ 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].hello_options }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].last_non_hello_packet_received }},{{ data_to_template['vrf'][vrf].address_family[address_family].instance[instance].areas[area].interfaces[interface].neighbors[neighbor].last_state_change }},{{ 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 }}
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip route" %}VRF,Address Family,Route,Active,Metric,Route Preference,Source Protocol,M Best,U Best,Next Hop Index,Next Hop,Best Unicast Nexthop,Metric,Route Preference,Source Protocol,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 %}
{%-                 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].mbest }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].ubest }},{{ 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].best_ucast_nexthop }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].metric }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].route_preference }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].source_protocol }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show ip route vrf all" %}VRF,Address Family,Route,Active,Metric,Route Preference,Source Protocol,M Best,U Best,Next Hop Index,Next Hop,Best Unicast Nexthop,Metric,Route Preference,Source Protocol,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 %}
{%-                 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].mbest }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].ubest }},{{ 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].best_ucast_nexthop }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].metric }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].route_preference }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].source_protocol }},{{ data_to_template['vrf'][vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show mac address-table" %}VLAN,MAC Address,Interface,Entry Type,Age
{%-     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].mac_type }},{{ data_to_template['mac_table'].vlans[vlan].mac_addresses[mac].interfaces[interface].age }}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if command == "show version" %}Bootflash,Chassis,CPU,Device Name,Memory,Model,Processor Board ID,RP,Slots,Kernel Uptime,Name,OS,Last Reload Reason,BIOS Compile Time,BIOS Version,Kickstart Compile Time,Kickstart Image,Kickstart Version,System Compile Time,System Image File,System Version
{{ data_to_template['platform'].hardware.bootflash }},{{ data_to_template['platform'].hardware.chassis }},{{ data_to_template['platform'].hardware.cpu }},{{ data_to_template['platform'].hardware.device_name }},{{ data_to_template['platform'].hardware.memory }},{{ data_to_template['platform'].hardware.model }},{{ data_to_template['platform'].hardware.processor_board_id }},{{ data_to_template['platform'].hardware.rp }},{{ data_to_template['platform'].hardware.slots }},{{ data_to_template['platform'].kernel_uptime.days }} {{ data_to_template['platform'].kernel_uptime.hours }} {{ data_to_template['platform'].kernel_uptime.minutes }} {{ data_to_template['platform'].kernel_uptime.seconds }},{{ data_to_template['platform'].name }},{{ data_to_template['platform'].os }},{{ data_to_template['platform'].reason }},{{ data_to_template['platform'].software.bios_compile_time }},{{ data_to_template['platform'].software.bios_version }},{{ data_to_template['platform'].software.kickstart_compile_time }},{{ data_to_template['platform'].software.kickstart_image_file }},{{ data_to_template['platform'].software.kickstart_version }},{{ data_to_template['platform'].software.system_compile_time }},{{ data_to_template['platform'].software.system_image_file }},{{ data_to_template['platform'].software.system_version }}
{%- else %}
{%- if command == "show vlan" %}VLAN,Interface,Name,State,Shutdown,Type,Mode
{%-     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].type }},{{ data_to_template['vlans'][vlan].mode }}
{%-         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 %}