mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
793 stars 220 forks source link

ciscoconfparse.models_cisco needs an explicit MAX_VLAN constant #133

Closed mpenning closed 5 years ago

mpenning commented 5 years ago

Not all platforms support vlans to the IEEE max VLAN ID of 4094. Make this maximum vlan configurable.

mpenning commented 5 years ago

This has been implemented in version 1.3.31.

The syntax follows:

from ciscoconfparse import CiscoConfParse
import ciscoconfparse

config = """!
interface GigabitEthernet0/1
 switchport mode trunk
!""".splitlines()

## Set the max vlan value
ciscoconfparse.models_cisco.MAX_VLAN = 3974

parse = CiscoConfParse(config, factory=True, syntax='ios')
obj = parse.find_objects('^interface')[0]
print obj.trunk_vlans_allowed  # This prints <CiscoRange 1-3974>