Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

Making an Operational Table and View - having problems

‎02-11-2019 08:25 AM

I'm trying to extend the default InterfaceStatisticsTable and View and I'm having trouble understanding how to add a new table/view. Specifically, I would like to show the CoS queue statistics:

 

 

            <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>be-class</forwarding-class-name>
                    <queue-counters-queued-packets>12057545</queue-counters-queued-packets>
                    <queue-counters-trans-packets>12057545</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>ef-class</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>af-class</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>nc-class</forwarding-class-name>
                    <queue-counters-queued-packets>3405261</queue-counters-queued-packets>
                    <queue-counters-trans-packets>3405261</queue-counters-trans-packets>
                    <queue-counters-total-drop-packets>0</queue-counters-total-drop-packets>
                </queue>
            </queue-counters>

I am essentially copying the InterfaceStatisticsTable, but adding a sub-view:

 

 


InterfaceTroubleshootTable:
rpc: get-interface-information
args:
extensive: True
interface_name: '[efgx][et]-*'
args_key: interface_name
item: physical-interface
view: InterfaceTroubleshootView

InterfaceTroubleshootView:
fields:
oper : oper-status
admin : admin-status
description: description
mtu: { mtu : int }
link_mode: link-mode
speed: speed
macaddr: current-physical-address
flapped: interface-flapped

groups: ts: traffic-statistics qs: _queueCountersTable rxerrs: input-error-list txerrs: output-error-list

_queueCountersTable:
item: queue
key: queue-number
view: _queueCountersView

_queueCountersView:
fields:

So the _queueCountersView fields is where I am getting stuck. There are four queues and I want to see stats for each one. Should they be listed with an expression to show each one? I tried looking at some other default tables for an idea, but nothing I found was close enough for me to figure out. Can someone point me in the right direction?