Configuring Cisco switchport for access point

When working with a multi-device environment, along with routers and switches we need to interact with other network gear(s) like wireless devices. This example will show how to configure a switch with specific ports to be connected to Access Point (AP) as trunk. 

In our test case, assuming the VLANs configured on AP are vlan 100 and vlan 200 for users, and the native VLAN is vlan 10, and the code is as follows:

from netmiko import ConnectHandlerimport timedef apvlanpush(routerip,switchport):    uname="cisco"    passwd="cisco"    device = ConnectHandler(device_type='cisco_ios', ip=routerip, username=uname, password=passwd)    cmds="interface "+switchport cmds=cmds+"\nswitchport mode trunk\nswitchport trunk ...

Get Python Network Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.