Skip to Main Content
Python Network Programming
book

Python Network Programming

by Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
January 2019
Beginner to intermediate content levelBeginner to intermediate
776 pages
19h 58m
English
Packt Publishing
Content preview from Python Network Programming

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Network Programming for Network Engineers (Python 3)

Python Network Programming for Network Engineers (Python 3)

David Bombal

Publisher Resources

ISBN: 9781788835466Supplemental Content