A quick python script that will collect the VLANs configured on an individual port in VOSS.
import paramiko
import time
import re
# Configuration
HOST = “192.168.0.50”
USERNAME = “rwa”
PASSWORD = “rwa”
PORT = “1/9”
def extract_vlan_ids(output, port):
vlan_ids = []
for line in output.splitlines():
if port in line and “normal” in line:
words = line.split()
try:
normal_index = words.index(“normal”)
vlan_field = words[normal_index – 1]
vlan_ids = [int(v) for v in vlan_field.split(“,”) if v.isdigit()]
print(f”🔎 Extracted VLANs: {vlan_ids}”)
except (ValueError, IndexError):
print(“⚠️ Could not parse VLANs from line:”, line)
break
return vlan_ids
def remove_vlans_from_port(host, username, password, port):
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password, look_for_keys=False)
shell = ssh.invoke_shell()
time.sleep(1)
shell.send(“enable\n”)
time.sleep(0.5)
shell.send(“configure terminal\n”)
time.sleep(0.5)
# Show VLAN info for the port
shell.send(f”show interface gig vlan {port}\n”)
time.sleep(2)
output = shell.recv(5000).decode()
print(“📋 Raw Output:\n”, output)
vlan_ids = extract_vlan_ids(output, port)
if not vlan_ids:
print(f”⚠️ No VLANs found near ‘normal’ for port {port}.”)
else:
for vlan_id in vlan_ids:
cmd = f”vlan members remove {vlan_id} {port}\n”
shell.send(cmd)
time.sleep(0.2)
print(f”✅ Sent: {cmd.strip()}”)
shell.send(“exit\n”)
time.sleep(0.5)
ssh.close()
print(f”✅ Completed: Removed VLANs {vlan_ids} from port {port} on {host}”)
except Exception as e:
print(f”❌ Error: {e}”)
# Run it
remove_vlans_from_port(HOST, USERNAME, PASSWORD, PORT)
##
5520-24T-FabricEngine:1(config)#
🔎 Extracted VLANs: [44, 55]
✅ Sent: vlan members remove 44 1/9
✅ Sent: vlan members remove 55 1/9
✅ Completed: Removed VLANs [44, 55] from port 1/9 on 192.168.0.50
Note: Alternatively, use EDM to remove port from VLANs and Apply. Or prepare a list of VLAN IDs in Column A in an Excel sheet and concatenate into the command “vlan members remove <cell-A1> <port>” to create the complete command in the next column and then select the + sign of that cell and drag the cell down until reach the end and you can then copy a list of commands into the CLI which will remove each VLAN from the port.
Another idea is to remove tagging from the port, this will remove all the VLANs immediately. Can then make the port an untagged member of a single VLAN.