Juniper/open-nti

New Parser show interface extensive

Opened this issue · 2 comments

Hi,

I am trying to adapt the show interface media to a new one show interface extensive parser in order to get information about queues in each interface.

It Works fine for traffic-statistics and input/output errors but is not working for queue counters. I guess is because xpath is 2 level Deep.

Here an example

parser:
regex-command: show\s+interfaces\s+extensive\s+|\s+display\s+xml
matches:
-
type: multi-value
method: xpath
xpath: //[local-name() = 'physical-interface']
loop:
key: ./
[local-name() = 'name']
sub-matches:
-
xpath: ./[local-name() = 'traffic-statistics']/[local-name() = 'input-bps']
variable-name: $host.interface.$key.input-bps
-
xpath: ./[local-name() = 'traffic-statistics']/[local-name() = 'input-pps']
variable-name: $host.interface.$key.input-pps
-
xpath: ./[local-name() = 'traffic-statistics']/[local-name() = 'output-bps']
variable-name: $host.interface.$key.output-bps
-
xpath: ./[local-name() = 'traffic-statistics']/[local-name() = 'output-pps']
variable-name: $host.interface.$key.output-pps
-
xpath: ./[local-name() = 'input-error-list']/[local-name() = 'input-errors']
variable-name: $host.interface.$key.input-errors
-
xpath: ./[local-name() = 'input-error-list']/[local-name() = 'input-drops']
variable-name: $host.interface.$key.input-drops
-
xpath: ./[local-name() = 'output-error-list']/[local-name() = 'output-errors']
variable-name: $host.interface.$key.output-errors
-
xpath: ./[local-name() = 'output-error-list']/[local-name() = 'output-drops']
variable-name: $host.interface.$key.output-drops
-
xpath: ./[local-name() = 'output-error-list']/[local-name() = 'output-drops']
variable-name: $host.interface.$key.output-drops
-
xpath: ./[local-name() = 'queue-counters']/[local-name() = 'queue-counters-queued-packets']
variable-name: $host.interface.$key.queue-counters-queued-packets

And the XML sample:



reth0
up
up
128
536
131
reth SecGW/CPN
Ethernet
1518
disabled
10Gbps
none
none
disabled
disabled

        <minimum-links-in-aggregate>1</minimum-links-in-aggregate>
        <minimum-bandwidth-in-aggregate>0</minimum-bandwidth-in-aggregate>
        <if-device-flags>
            <ifdf-present/>
            <ifdf-running/>
        </if-device-flags>
        <if-config-flags>
            <iff-snmp-traps/>
            <internal-flags>0x4000</internal-flags>
        </if-config-flags>
        <current-physical-address>00:10:db:ff:10:00</current-physical-address>
        <hardware-physical-address>00:10:db:ff:10:00</hardware-physical-address>
        <interface-flapped junos:seconds="21652480">2018-01-11 00:49:15 CET (35w5d 14:34 ago)</interface-flapped>
        <statistics-cleared>2018-09-17 21:59:58 CEST (18:23:57 ago)</statistics-cleared>
        <traffic-statistics junos:style="verbose">
            <input-bytes>10366164095177</input-bytes>
            <input-bps>1938269248</input-bps>
            <output-bytes>1271067057281</output-bytes>
            <output-bps>238333248</output-bps>
            <input-packets>9363622448</input-packets>
            <input-pps>215514</input-pps>
            <output-packets>5195882312</output-packets>
            <output-pps>121456</output-pps>
            <ipv6-transit-statistics>
                <input-bytes>0</input-bytes>
                <output-bytes>0</output-bytes>
                <input-packets>0</input-packets>
                <output-packets>0</output-packets>
            </ipv6-transit-statistics>
        </traffic-statistics>
        <stp-traffic-statistics junos:style="verbose">
            <stp-input-bytes-dropped>0</stp-input-bytes-dropped>
            <stp-output-bytes-dropped>0</stp-output-bytes-dropped>
            <stp-input-packets-dropped>0</stp-input-packets-dropped>
            <stp-output-packets-dropped>0</stp-output-packets-dropped>
        </stp-traffic-statistics>
        <input-error-list>
            <input-errors>0</input-errors>
            <input-drops>0</input-drops>
            <framing-errors>0</framing-errors>
            <input-runts>0</input-runts>
            <input-giants>0</input-giants>
            <input-discards>0</input-discards>
            <input-resource-errors>0</input-resource-errors>
        </input-error-list>
        <output-error-list>
            <carrier-transitions>0</carrier-transitions>
            <output-errors>0</output-errors>
            <output-drops>0</output-drops>
            <mtu-errors>0</mtu-errors>
            <output-resource-errors>0</output-resource-errors>
        </output-error-list>
        <queue-counters junos:style="brief">
            <interface-cos-short-summary>
                <intf-cos-queue-type>Egress queues</intf-cos-queue-type>
                <intf-cos-num-queues-supported>8</intf-cos-num-queues-supported>
                <intf-cos-num-queues-in-use>4</intf-cos-num-queues-in-use>
            </interface-cos-short-summary>
            <queue>
                <queue-number>0</queue-number>
                <forwarding-class-name>best-effort</forwarding-class-name>
                <queue-counters-queued-packets>5195048807</queue-counters-queued-packets>
                <queue-counters-trans-packets>5195048806</queue-counters-trans-packets>
                <queue-counters-total-drop-packets>0</queue-counters-total-drop-packets>
            </queue>
            <queue>
                <queue-number>1</queue-number>
                <forwarding-class-name>expedited-forwarding</forwarding-class-name>
                <queue-counters-queued-packets>0</queue-counters-queued-packets>
                <queue-counters-trans-packets>0</queue-counters-trans-packets>
                <queue-counters-total-drop-packets>0</queue-counters-total-drop-packets>
            </queue>
            <queue>
                <queue-number>2</queue-number>
                <forwarding-class-name>assured-forwarding</forwarding-class-name>
                <queue-counters-queued-packets>0</queue-counters-queued-packets>
                <queue-counters-trans-packets>0</queue-counters-trans-packets>
                <queue-counters-total-drop-packets>0</queue-counters-total-drop-packets>
            </queue>
            <queue>
                <queue-number>3</queue-number>
                <forwarding-class-name>network-control</forwarding-class-name>
                <queue-counters-queued-packets>826937</queue-counters-queued-packets>
                <queue-counters-trans-packets>826937</queue-counters-trans-packets>
                <queue-counters-total-drop-packets>0</queue-counters-total-drop-packets>
            </queue>
        </queue-counters>
        <queue-num-forwarding-class-name-map>
            <queue-number>0</queue-number>
            <forwarding-class-name>best-effort</forwarding-class-name>
        </queue-num-forwarding-class-name-map>
        <queue-num-forwarding-class-name-map>
            <queue-number>1</queue-number>
            <forwarding-class-name>expedited-forwarding</forwarding-class-name>
        </queue-num-forwarding-class-name-map>
        <queue-num-forwarding-class-name-map>
            <queue-number>2</queue-number>
            <forwarding-class-name>assured-forwarding</forwarding-class-name>
        </queue-num-forwarding-class-name-map>
        <queue-num-forwarding-class-name-map>
            <queue-number>3</queue-number>
            <forwarding-class-name>network-control</forwarding-class-name>
        </queue-num-forwarding-class-name-map>

Hi Albert,

It seems you need to modify your xpath, could you please try something like

./[local-name() = 'queue-counters']/[local-name() = 'queue'][queue-number='0']/[local-name() = 'queue-counters-queued-packets']

or a simplified version

./[local-name() = 'queue-counters']/queue[queue-number='0']/queue-counters-queued-packets

Then if it works you should repeat the same for each queue-number (0-3)

Regards

Hi,

Now I the parser doesn't fail. No log error in the log file.
But not able to record an value. Any problema with the variable?

        -
            xpath: ./*[local-name() = 'queue-counters']/*[local-name() = 'queue'][queue-number='0']/*[local-name() = 'queue-counters-qu

eued-packets']
variable-name: $host.interface.$key.queue.queue-number.0.queue-counters-queued-packets