Create VLAN using bigsuds

Problem this snippet solves:

Add VLANs on BIGIP using bigsuds

How to use this snippet:

python .py <mgmt ip-addressof BIGIP>

Code :

#create Vlans

import sys
import paramiko
import bigsuds
import time                                                
print ("->Connecting to BIG-IP: "+sys.argv[1])
#you can use this instead:
#b= bigsuds.BIGIP(, 'admin', 'admin')

def createVLAN(username,password):
b = bigsuds.BIGIP(hostname=sys.argv[1],username=username,password=password)
b.Networking.VLAN.create_v2(vlans = ['external'], vlan_ids=[4094], members = [[{'member_name': '1.1', 'member_type': 'MEMBER_INTERFACE', 'tag_state': 'MEMBER_UNTAGGED'}]], failsafe_states = ['STATE_DISABLED'], timeouts = [100])
b.Networking.VLAN.create_v2(vlans = ['internal'], vlan_ids=[4093], members = [[{'member_name': '1.2', 'member_type': 'MEMBER_INTERFACE', 'tag_state': 'MEMBER_UNTAGGED'}]], failsafe_states = ['STATE_DISABLED'], timeouts = [100])


ssh = paramiko.SSHClient()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
ssh.connect(sys.argv[1], username="root", password="default")

Published Apr 25, 2019
Version 1.0

Was this article helpful?

No CommentsBe the first to comment