Forum Discussion
dfo
Nimbostratus
Jun 06, 2018Python SDK: How to assign an interface to a VLAN on BIG-IP ?
I'm trying to attached an interface to a VLAN using the Python SDK but I get the following error => "Instance contains a string". Here is my code:
vlan = mgmt.tm.net.vlans.vlan.load(name='TEST_4001_TEST_DFO')
if not vlan.interfaces_s.interfaces.exists(name='1.2'):
interface = vlan.interfaces_s.interfaces.create(name='1.2', tagMode='none', tagged='True')
- JRahm
Admin
remove the
tagMode='none'
- dfo
Nimbostratus
I get the same result without
tagmode='none'
- JRahm
Admin
Ah...you are supplying the boolean as a string for the tagged state. Remove your quotes and it'll work fine:
v10 = b.tm.net.vlans.vlan.load(name='v10') v10.interfaces_s.get_collection() [] v10.interfaces_s.interfaces.exists(name='1.3') False if not v10.interfaces_s.interfaces.exists(name='1.3'): v10int = v10.interfaces_s.interfaces.create(name='1.3', untagged=True) v10.interfaces_s.interfaces.exists(name='1.3') True
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects