Forum Discussion
mhite_60883
Apr 01, 2011Cirrocumulus
Setting VLAN on a virtual server
Pulling my hair out trying to enable a VLAN for a virtual server. This is what I'm doing -- "v" is the object reference to LocalLB.VirtualServer:
vlan_filter_list = v.typefactory.cr...
mhite_60883
Apr 01, 2011Cirrocumulus
Hi Matt,
Here is the output:
cowboy:vip_provision mhite$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import vip_provision
>>> import pycontrol.pycontrol as pc
>>> b = pc.BIGIP(hostname="s0-bigip-lb2", username="tuna", password="slurpee", wsdls=['LocalLB.VirtualServer'], fromurl=True, debug=True)
>>> v = b.LocalLB.VirtualServer
>>> vip_provision.set_active_partition("s0-bigip-lb2", "tuna", "slurpee", "tuna")
DEBUG:suds.client:sending to (https://s0-bigip-lb2/iControl/iControlPortal.cgi)
message:
tuna
DEBUG:suds.client:headers = {'SOAPAction': u'"urn:iControl:Management/Partition"', 'Content-Type': 'text/xml'}
DEBUG:suds.client:http succeeded:
>>> v.get_vlan(["tuna-devasdfsao2o-tcp-80-s0-bigip-lb2-vs"])
DEBUG:suds.client:sending to (https://s0-bigip-lb2/iControl/iControlPortal.cgi)
message:
tuna-devasdfsao2o-tcp-80-s0-bigip-lb2-vs
DEBUG:suds.client:headers = {'SOAPAction': u'"urn:iControl:LocalLB/VirtualServer"', 'Content-Type': 'text/xml'}
DEBUG:suds.client:http succeeded:
STATE_DISABLED
[(Common.VLANFilterList){
state = "STATE_DISABLED"
vlans[] =
}]
>>> vlan_filter_list = v.typefactory.create('Common.VLANFilterList')
>>> enabled_state = v.typefactory.create('Common.EnabledState')
>>> vlan_filter_list.vlans = ["external"]
>>> vlan_filter_list.state = enabled_state.STATE_ENABLED
>>> v.set_vlan(virtual_servers = ["tuna-devasdfsao2o-tcp-80-s0-bigip-lb2-vs"], vlans = [vlan_filter_list])
DEBUG:suds.client:sending to (https://s0-bigip-lb2/iControl/iControlPortal.cgi)
message:
tuna-devasdfsao2o-tcp-80-s0-bigip-lb2-vs
STATE_ENABLED
external
DEBUG:suds.client:headers = {'SOAPAction': u'"urn:iControl:LocalLB/VirtualServer"', 'Content-Type': 'text/xml'}
ERROR:suds.client:
tuna-devasdfsao2o-tcp-80-s0-bigip-lb2-vs
STATE_ENABLED
external
DEBUG:suds.client:http failed:
500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator,
support@f5.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.
Apache Server at s0-bigip-lb2 Port 443
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.6/site-packages/suds/client.py", line 539, in __call__
return client.invoke(args, kwargs)
File "/Library/Python/2.6/site-packages/suds/client.py", line 598, in invoke
result = self.send(msg)
File "/Library/Python/2.6/site-packages/suds/client.py", line 633, in send
result = self.failed(binding, e)
File "/Library/Python/2.6/site-packages/suds/client.py", line 684, in failed
r, p = binding.get_fault(reply)
File "/Library/Python/2.6/site-packages/suds/bindings/binding.py", line 231, in get_fault
faultroot = sax.parse(string=reply)
File "/Library/Python/2.6/site-packages/suds/sax/parser.py", line 136, in parse
sax.parse(source)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/expatreader.py", line 211, in feed
self._err_handler.fatalError(exc)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/handler.py", line 38, in fatalError
raise exception
xml.sax._exceptions.SAXParseException: :1:49: syntax error
>>>
And just for clarification, here is the set_active_partition function I am calling from vip_provision.py:
def set_active_partition(ltm, user, pw, partition):
"""Switch a user's management context to a specific partition.
Uses the F5 API to switch a user's management context to a specific
partition.
Args:
ltm: IP address or hostname or BIG-IP; for example, 10.10.10.5.
user: Username used to authenticate to the BIG-IP device.
pw: Password credentials used to authenticate to the BIG-IP device.
partition: Management context for user's subsequent API calls.
Returns:
n/a
Raises:
n/a
"""
p = pc.BIGIP(hostname=ltm, username=user, password=pw,
wsdls=['Management.Partition'], fromurl=True)
p.Management.Partition.set_active_partition(partition)
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