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                                                
username='admin'
password='admin'
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])

print(b.Networking.VLAN.get_list())



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")

createVLAN(username,password)
Published Apr 25, 2019
Version 1.0
No CommentsBe the first to comment