Python Forum

Full Version: Get trunk port
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I am creating a code to creat vlan and find the trunk port on a Avaya switch.
So i am wondering how do i get only the trunk ports and adds to get members vlan.

show autotopology nmm-table
LSlot RSlot
LPort IP Addr Seg ID MAC Addr Chassis Type BT LS CS RPort
----- --------------- -------- ------------ ---------------- -- --- ---- -----
0/ 0 XXXXXXXXXX XXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XX XXX HTBT XX
1/49 XXXXXXXXXX XXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XX XXX HTBT XX
1/50 XXXXXXXXXX XXXXXXXXX XXXXXXXXXXX XXXXXXXXXXX XX XXX HTBT XX

I want to save 1/49 and 1/50 to Trunk-port value

import getpass
import sys
import telnetlib

tn.write("conf t\n")
Trunk-port = tn.write("autotopology nmm-table\n")
tn.write("vlan create 1234 name TEST-VLAN type port\n")
tn.write("vlan members add 1234" + Trunk-port + "\n")
tn.write("save config\n")
tn.write("end\n")