{%- if filetype_loop == 0 %}VRF,Address Family,Route,Active,Metric,Route Preference,Source Protocol,Source Protocol Code,Next Hop Number,Next Hop,Outgoing Interface,Updated
{%-     for vrf in to_parse_ip_route %}
{%-         for address_family in to_parse_ip_route[vrf].address_family %}
{%-             for route in to_parse_ip_route[vrf].address_family[address_family].routes %}
{%-                 if to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list is defined %}
{%-                     for next_hop in to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
{{ vrf }},{{ address_family }},{{ route }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }},{{ next_hop }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].outgoing_interface }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }}
{%-                     endfor %}
{%-                 else %}
{{ vrf }},{{ address_family }},{{ route }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }},{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }},{{ next_hop }},N/A,N/A,N/A
{%-                 endif %}
{%-             endfor %}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%-     if filetype_loop == 1 %}
# Show IP Route
| VRF | Address Family | Route | Active | Metric | Route Preference | Source Protocol | Source Protocol Code | Next Hop Number | Next Hop | Outgoing Interface | Updated |
| --- | -------------- | ----- | ------ | ------ | ---------------- | --------------- | -------------------- | --------------- | -------- | ------------------ | ------- |
{%-         for vrf in to_parse_ip_route %}
{%-             for address_family in to_parse_ip_route[vrf].address_family %}
{%-                 for route in to_parse_ip_route[vrf].address_family[address_family].routes %}
{%-                     if to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list is defined %}
{%-                         for next_hop in to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }} | {{ next_hop }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].outgoing_interface }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }} |
{%-                         endfor %}
{%-                     else %}
| {{ vrf }} | {{ address_family }} | {{ route }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }} | {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }} | {{ next_hop }} | N/A | N/A | N/A |
{%-                     endif %}
{%-                 endfor %}
{%-             endfor %}
{%-         endfor %}
{%-     else %}
{%-         if filetype_loop == 2 %}
<html><body>
<h1>Show IP Route</h1>
<table>
  <thead>
  <tr>
    <th>VRF</th>
    <th>Address Family</th>
    <th>Route</th>
    <th>Active</th>
    <th>Metric</th>
    <th>Route Preference</th>   
    <th>Source Protocol</th>
    <th>Source Protocol Code</th>
    <th>Next Hop Number</th>
    <th>Outgoing Interface</th>
    <th>Updated</th>
  </tr>
  </thead>
  <tbody>
{%-             for vrf in to_parse_ip_route %}
{%-                 for address_family in to_parse_ip_route[vrf].address_family %}
{%-                     for route in to_parse_ip_route[vrf].address_family[address_family].routes %}
{%-                         if to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list is defined %}
{%-                             for next_hop in to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
  <tr>
    <td>{{ vrf }}</td>
    <td>{{ address_family }}</td>
    <td>{{ route }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }}</td>   
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }}</td>
    <td>{{ next_hop }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].outgoing_interface }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }}</td>
  </tr>
{%-                             endfor %}
{%-                         else %}  
  <tr>
    <td>{{ vrf }}</td>
    <td>{{ address_family }}</td>
    <td>{{ route }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }}</td>   
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }}</td>
    <td>{{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }}</td>
    <td>{{ next_hop }}</td>
    <td>N/A</td>
    <td>N/A</td>
    <td>N/A</td>
  </tr>
{%-                         endif %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
  </tbody>
</table>
</body></html>
{%-         else %}
# Show IP Route
{%-             for vrf in to_parse_ip_route %}
{%-                 for address_family in to_parse_ip_route[vrf].address_family %}
## VRF: {{ vrf }} - {{ address_family }}
{%-                     for route in to_parse_ip_route[vrf].address_family[address_family].routes %}
### Route: {{ route }}
#### Active: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].active }}
#### Metric: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].metric }}
#### Preference: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].route_preference }}
#### Source
##### Protocol: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol }}
##### Code: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].source_protocol_codes }}
#### Next Hop
{%-                         for next_hop in to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list %}
##### {{ next_hop }}
###### Next Hop: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].next_hop }}
###### Outgoing Interface: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].outgoing_interface }}
###### Updated: {{ to_parse_ip_route[vrf].address_family[address_family].routes[route].next_hop.next_hop_list[next_hop].updated }}
{%-                         endfor %}
{%-                     endfor %}
{%-                 endfor %}
{%-             endfor %}
{%-         endif %}
{%-     endif %}
{%- endif %}