Commit 02510811 authored by Jean Rebiffe's avatar Jean Rebiffe
Browse files

Update scripts/inventory/INV_HW_01/INV_HW_01_script.txt,...

Update scripts/inventory/INV_HW_01/INV_HW_01_script.txt, scripts/inventory/INV_HW_01/hardware_filter.xml, scripts/inventory/INV_HW_01/hardware_transform.xsl, scripts/inventory/INV_HW_01/README.md
parent e625ed36
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
set feedback_to_output true
ne load ne.yaml
# set logging_config logging_config.yaml

# Retreive data from NEs
connect
netconf --filter-file hardware_filter.xml
netconf close-session

# Formating data
table from_xml --xsl-transform hardware_transform.xsl
table concat
table to_excel hardware.xlsx
+9 −0
Original line number Diff line number Diff line
# INV_HW_01

The _INV_HW_01_script.txt_ script should product the inventory for hardware components of ietf-hardware module ([RFC8348](https://datatracker.ietf.org/doc/html/rfc8348)).

```console
$ python3 lncc.py "run_script INV_HW_01_script.txt"
```

+3 −0
Original line number Diff line number Diff line
<hardware xmlns="urn:ietf:params:xml:ns:yang:ietf-hardware-state">
    <component />
</hardware>
+34 −0
Original line number Diff line number Diff line
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <hardware>
            <xsl:for-each select="nc:data/hw:hardware/hw:component"
                        xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
                        xmlns:hw="urn:ietf:params:xml:ns:yang:ietf-hardware">
                <component>
                    <xsl:copy-of select="hw:name" />
                    <xsl:copy-of select="hw:class" />
                    <xsl:copy-of select="hw:physical-index" />
                    <xsl:copy-of select="hw:description" />
                    <xsl:copy-of select="hw:parent" />
                    <xsl:copy-of select="hw:parent-rel-pos" />
                    <!-- contains-child -->
                    <xsl:copy-of select="hw:hardware-rev" />
                    <xsl:copy-of select="hw:firmware-rev" />
                    <xsl:copy-of select="hw:software-rev" />
                    <xsl:copy-of select="hw:serial-num" />
                    <xsl:copy-of select="hw:mfg-name" />
                    <xsl:copy-of select="hw:model-name" />
                    <xsl:copy-of select="hw:alias" />
                    <xsl:copy-of select="hw:asset-id" />
                    <xsl:copy-of select="hw:is-fru" />
                    <xsl:copy-of select="hw:mfg-date" />
                    <!-- uri -->
                    <xsl:copy-of select="hw:uuid" />
                    <!-- state -->
                    <!-- sensor-data -->
                </component>
            </xsl:for-each>
        </hardware>
    </xsl:template>
</xsl:stylesheet>