VlanTable:
rpc: get-vlan-information
key: l2ng-l2rtb-vlan-name
item: l2ng-l2ald-vlan-instance-group
view: VlanView
VlanView:
fields:
name: l2ng-l2rtb-vlan-name
tag: l2ng-l2rtb-vlan-tag
members: .//l2ng-l2rtb-vlan-member-interface
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/db1dd22f-79ce-4f63-bfd4-c34e4c2bd083%40googlegroups.com.
---
VlanTable:
rpc: get-vlan-information
item: vlan
view: VlanView
VlanView:
fields:
instance: vlan-instance
name: vlan-name
created: vlan-create-time
status: vlan-status
owner: vlan-owner
tag: vlan-tag
members: .//vlan-member-interface
And this is part of the config of the EX4200
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3R3/junos">
<vlan-information junos:style="terse">
<vlan-terse/>
<vlan>
<vlan-instance>0</vlan-instance>
<vlan-name>BC-Concourse</vlan-name>
<vlan-create-time>Thu Jun 13 21:02:38 2013
</vlan-create-time>
<vlan-status>Enabled</vlan-status>
<vlan-owner>static</vlan-owner>
<vlan-tag>183</vlan-tag>
<vlan-tag-string>183</vlan-tag-string>
<vlan-index>2</vlan-index>
<vlan-protocol-port>Port Mode</vlan-protocol-port>
<vlan-members-count>1</vlan-members-count>
<vlan-members-upcount>1</vlan-members-upcount>
<vlan-detail>
<vlan-member-list>
<vlan-member>
<vlan-member-interface>ae0.0*</vlan-member-interface>
</vlan-member>
</vlan-member-list>
</vlan-detail>
</vlan>
VlanTable:
rpc: get-vlan-information
item: vlan
key: vlan-name
view: VlanView
VlanView:
fields:
instance: vlan-instance
name: vlan-name
created: vlan-create-time
status: vlan-status
owner: vlan-owner
tag: vlan-tag
Hello Jose,
In your case vlan is the item that need to be iterable with respect to the View. Do change you yaml accordingly (marked in yellow).
from jnpr.junos import Device
from jnpr.junos.factory.factory_loader import FactoryLoader
import yaml
YamlTable = """
---
VlanTable:
rpc: get-vlan-information
item: vlan
key: vlan-name
view: VlanView
VlanView:
fields:
instance: vlan-instance
name: vlan-name
created: vlan-create-time
status: vlan-status
owner: vlan-owner
tag: vlan-tag
"""
globals().update(FactoryLoader().load(yaml.load(YamlTable)))
dev = Device(host=‘xxxx', user=‘xxx', password=‘xxx')
dev.open()
vlans = VlanTable(dev).get()
for vlan in vlans:
print 'instance: ', vlan.instance
print 'name: ', vlan.name
print 'created: ', vlan.name
print 'status: ', vlan.status
print 'owner: ', vlan.owner
print 'tag: ', vlan.tag
Print