<template name="cisco_xr_inventory" results="per_template">
<doc>
Template to parse Cisco IOS XR inventory.

This template requires output of 'show inventory' command.
</doc>

<input>
commands = [
    "show inventory"
]
platform = [
    "cisco_xr", # netmiko
    "iosxr", # napalm
    "cisco_iosxr", # scrapli
]
</input>

<macro>
def transform_inventory_to_records(payload):
    from ttp_templates.utils.cisco_xr_process_show_inventory import (
        transform_inventory,
    )

    return transform_inventory(payload)
</macro>

<group>
 Name: {{ slot | ORPHRASE }}  Descr: {{ description | ORPHRASE }}
 PID: {{ module | strip(",") }}{{ ignore(".+") }}SN: {{ serial }}
</group>

<group>
Name: {{ slot | ORPHRASE }}  Descr: {{ description | ORPHRASE }}
PID: {{ module | strip(",") }}{{ ignore(".+") }}SN: {{ serial }}
</group>

<group>
NAME: "{{ slot | ORPHRASE }}", DESCR: "{{ description | ORPHRASE }}"
PID: {{ module | strip(",") }}{{ ignore(".+") }}SN: {{ serial }}
PID: {{ module | strip(",") | let("serial", "") }}{{ ignore(".+") }}SN:
</group>

<output macro="transform_inventory_to_records"/>

</template>
