pyaoscx
pyaoscx copied to clipboard
Interface configuration fails when Interface is attached to an VRF other than default
Running the test on Ubuntu 20.04 and testing with virtual Aruba CX
Switch: sw01# sh ver
ArubaOS-CX (c) Copyright Hewlett Packard Enterprise Development LP
Version : Virtual.10.07.0010 Build Date : Build ID : ArubaOS-CX:Virtual.10.07.0010:c075dcdbb1f5:202106100007 Build SHA : c075dcdbb1f5c2d88d501045bc6386f1dfa49bbc Active Image :
Service OS Version : BIOS Version :
My virtual environment: (test) arne@linux:~/test$ pip list Package Version
certifi 2021.5.30 charset-normalizer 2.0.6 idna 3.2 netaddr 0.8.0 pip 20.0.2 pkg-resources 0.0.0 pyaoscx 2.0.1 PyYAML 5.4.1 requests 2.26.0 setuptools 44.0.0 urllib3 1.26.6
My testscript: (test) arne@linux:~/test$ cat sw01-int-down.py from pyaoscx.session import Session from pyaoscx.pyaoscx_factory import PyaoscxFactory #from pyaoscx.vlan import Vlan from pyaoscx.interface import Interface
There are two approaches to workflows, both using the session.
version = '10.04' switch_ip = 'sw01.ao-test.net' s = Session(switch_ip, version) s.open('admin', 'Pass0rd123!')
Try block is used so that session closes even on error.
try: #port_1_1_7 = Interface(s, '1/1/7') #port_1_1_7.get() #port_1_1_7.admin = 'down' # Apply changes #port_1_1_7.apply() port_1_1_8 = Interface(s, '1/1/8') port_1_1_8.get() port_1_1_8.admin = 'down' # Apply changes port_1_1_8.apply() #port_1_1_9 = Interface(s, '1/1/9') #port_1_1_9.get() #port_1_1_9.admin = 'down' # Apply changes #port_1_1_9.apply()
except Exception as error: print('Ran into exception: {}. Closing session.'.format(error))
finally: # At the end, the session MUST be closed s.close()
Error message when changing 1/1/7 or 1/1/8 Ran into exception: RESPONSE ERROR in maximum recursion depth exceeded while calling a Python object: GET. Closing session.
Interface config: interface 1/1/7 no shutdown vrf attach transport ip address 10.200.99.129/29 ip ospf 1 area 0.0.0.0 interface 1/1/8 no shutdown vrf attach transport ip address 10.200.99.145/29 ip ospf 1 area 0.0.0.0 interface 1/1/9 no shutdown no routing vlan trunk native 1 vlan trunk allowed all