<doc>
Template produces this dictionary:
{'huawei': {'switch_1': {'interfaces': {'SVI123': {'arp': [{'age': '-',
                                                               'ip': '10.123.111.1',
                                                               'mac': 'd094.6643.1111',
                                                               'type': 'ARPA'}],
                                                      'ip_addresses': [{'ip': '10.123.111.1',
                                                                        'netmask': '24',
                                                                        'network': '10.123.111.0/24'},
                                                                       {'ip': '10.123.222.1',
                                                                        'netmask': '24',
                                                                        'network': '10.123.222.0/24'}],
                                                      'port_description': 'Workstations Vlan',
                                                      'vrf': 'CORP'}}},
               'switch_2': {'interfaces': {'SVI11': {'ip_addresses': [{'ip': '10.11.11.1',
                                                                       'netmask': '24',
                                                                       'network': '10.11.11.0/24'}],
                                                     'port_description': 'Workstations Vlan'},
                                           'SVI22': {'arp': [{'age': '-',
                                                              'ip': '10.22.22.1',
                                                              'mac': 'd094.7890.1111',
                                                              'type': 'ARPA'},
                                                             {'age': '106',
                                                              'ip': '10.22.22.4',
                                                              'mac': 'd867.7890.1444',
                                                              'type': 'ARPA'}],
                                                     'ip_addresses': [{'ip': '10.22.22.1',
                                                                       'netmask': '24',
                                                                       'network': '10.22.22.0/24'}],
                                                     'port_description': 'Workstations Vlan'},
                                           'Te1/1/71': {'arp': [{'age': '5',
                                                                 'ip': '10.1.234.1',
                                                                 'mac': 'd867.d9b7.1111',
                                                                 'type': 'ARPA'}],
                                                        'fhrp': [{'hsrp_group': '1',
                                                                 'vip': '10.1.234.1.99',
                                                                 'type': 'hsrp'}],
                                                        'ip_addresses': [{'ip': '10.1.234.2',
                                                                          'netmask': '24',
                                                                          'network': '10.1.234.0/24'}],
                                                        'port_description': 'to SWITCH_2 shared '
                                                                            'subnet'}}}}}
</doc>

<template name="huawei" results="per_template">
<vars>local_hostname="gethostname"</vars>

<!-- Interfaces configuration group -->
<group name="{{ local_hostname }}.interfaces.{{ interface }}">
interface {{ interface | resuball("IfsNormalize") }}
 description {{ port_description | re(".+") }}
 ip binding vpn-instance {{ vrf }}
 <group name="ip_addresses*" chain="add_network()" method="table">
 ip address {{ ip | IP }} {{ netmask }}
 ip address {{ ip | IP }} {{ netmask }} sub
 ipv6 address {{ ip | IPV6 }}/{{ netmask }}
 ipv6 address {{ ip | IPV6 }}/{{ netmask }} sub
 </group>
 <group name="fhrp*" method="table">
 vrrp vrid {{ group | let("type", "VRRP") }} virtual-ip {{ ip | IP }}
 </group>
</group>

<!-- ARP cache group -->
<group name="{{ local_hostname }}.interfaces.{{ interface }}.arp*" method="table">
{{ ip | IP }}   {{ mac | MAC | mac_eui }}  {{ expire | re("\\d+") }}  {{ type | notdigit }}  {{ interface | resuball("IfsNormalize") }}   {{ vrf }}
{{ ip | IP }}   {{ mac | MAC | mac_eui }}                             {{ type | notdigit }}  {{ interface | resuball("IfsNormalize") }}   {{ vrf }}
{{ ip | IP }}   {{ mac | MAC | mac_eui }}  {{ expire | re("\\d+") }}  {{ type | notdigit }}  {{ interface | resuball("IfsNormalize") }}
{{ ip | IP }}   {{ mac | MAC | mac_eui }}                             {{ type | notdigit }}  {{ interface | resuball("IfsNormalize") }}
</group>

</template>