Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Add allowed VLAN to Virtual Server - Python F5-SDK

I'm trying to set the allowed vlan on a virtual server using the Python SDK.

Here's my code

newvs = vs.virtual.create(name='myvs', destination='10.0.0.1:80')
newvs.mask = '255.255.255.255'
newvs.pool = 'mypool'
newvs.vlansDisabled = False
newvs.vlansEnabled = True
newvs.vlan = 'myvlan'
newvs.update()

The script runs successfully but the vlan is not added to the allowed vlan list.

If I add the vlan manually via the config utility and browse the API I noticed the vlan option uses square brackets [].

vlans: [ "/Common/myvlan" ]

Please advise. :)

0
Rate this Question
Comments on this Question
Comment made 31-May-2017 by Joel Breton 213

I would advise against using an absolute update on a BIG-IP object as this activates the custom checkbox for every setting - unless this is your intent

Instead of

newvs = vs.virtual.create(name='myvs', destination='10.0.0.1:80')
newvs.mask = '255.255.255.255'
newvs.update()

Use this approach

newvs = vs.virtual.create(name='myvs', destination='10.0.0.1:80')
newvs.update(mask='255.255.255.255')
0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

After a few hours of troubleshooting I found the solution.

newvs.vlans = ['myvlan']
0