Hello All,
If someone could help point me in the right direction, would be amazing.
I created a script to pull interface information for the irb interfaces that are active on our QFXs.
I tried the using a custom table and view to pull the information and produce the output similar to
show interfaces irb terse (without the IP details)
>show interfaces irb terse
Interface Admin Link Proto Local Remote
irb up up
irb.x up up inet x.x.x.x/x
x.x.x.x/x
irb.x up up inet x.x.x.x/x
For my test I was mainly interested in the information below.
interface description
interface name
Interface admin status
Interface oper status
On running the script, I get the following output
Interface description
irb.xxx
NoneNoneInterface description
irb.xxx
NoneNone.
.
.
.
.
I can get the interface status from the main irb instance, but I want to get the operational and admin status information from all the sub interfaces.
There is a pre-configured table and view for the ethernet ports, but that will not work for the irbs interfaces.
Any suggestions?
Very new to scripting so I can expect I've mixed up a few things.
Thanks
R
---------------------
SCRIPT
-------------------
from jnpr.junos import Device
from jnpr.junos.factory.factory_loader import FactoryLoader
import yaml
from jnpr.junos.op.xcvr import XcvrTable
yml = """
---
IrbPortTable:
rpc: get-interface-information
args:
interface_name: '[irb]*'
args_key: interface_name
item: physical-interface/logical-interface
view: IrbPortView
IrbPortView:
groups:
flags: if-device-flags
fields:
oper: logical-interface/oper-status
admin: logical-interface/admin-status
description: description
fields_flags:
running: { ifdf-running: flag }
present: { ifdf-present: flag }
interfaceInformation:
rpc: get-interface-information
"""
globals().update(FactoryLoader().load(yaml.load(yml, Loader=yaml.FullLoader)))
with Device(host='device', port='22', user='uname',passwd='password') as dev:
Irb = IrbPortTable(dev)
Irb.get()
for item in Irb:
print (item.name)
print (item.oper)
print (item.admin)
print (item.description)
------------------------------
I have tried this script on two different models of qfx's and get the same output
Model: qfx5120
Junos: 20.2R3.9
Model: qfx5100
Junos: 14.1X53-D30.3