python - How to use Junos PyEZ configuration table to extract all interface units? -
i trying use pyez interfacetable extract interface configuration. problem can see 1 unit per interface while there more 1 configured on interfaces.
the script
from jnpr.junos import device jnpr.junos.resources.interface import interfacetable device(host=host_test, user='lab', passwd='lab123') dev: tabl = interfacetable(dev) tabl.get() print(tabl.keys()) print(tabl['ge-0/0/4'].unit_name)
in case have 2 units on ge-0/0/4 interface
lab@srx# show interfaces ge-0/0/4 vlan-tagging; unit 108 { vlan-id 108; family inet { address 172.20.108.1/24; } } unit 109 { vlan-id 109; family inet { address 172.20.109.1/24; } }
but result giving me 1 unit (in 2nd line of output):
['ge-0/0/0', 'ge-0/0/1', 'ge-0/0/2', 'ge-0/0/3', 'ge-0/0/4', 'lo0'] 108
ideally, work units , confuguration options under each unit (such family , address).
please refer "user defined tables" example @ https://github.com/vnitinv/pyez-examples/blob/master/9_user_defined_table.py
Comments
Post a Comment