Networking.VLAN.create -- question

Hello,

I am trying to create a VLAN using iControl; I am using python as my scripting language. The code that I am using is as follows:

!/bin/env python

from optparse import OptionParser

import paramiko

import SOAPpy

import sys

import time

Funtion to pass values to variable at the time of executing the script

def parseargs():

“”"

“”"

parser = OptionParser(usage=“%prog [options]”)

parser.add_option(“-i”, “--dut-ip”, dest=‘host’,

help=“DUT IP address.”,

type=“string”, default=‘172.27.32.142’)

parser.add_option(“-p”, “--host-passwd”, dest=‘passwd’,

help=“Host password.”,

type=“string”, default=‘default’)

parser.add_option(“-U”, “--host-UI-username”, dest=‘uiUsername’,

help=“Host GUI username.”,

type=“string”, default=‘admin’)

parser.add_option(“-P”, “--host-UI-passwd”, dest=‘uiPasswd’,

help=“Host UI password.”,

type=“string”, default=‘admin’)

return parser

parser = parseargs()

(options, args) = parser.parse_args()

if not options.databaseip:

parser.error(“Missing Sleuth results database IP.”)

ICONTROL_URL = “https://%s:%s@%s/iControl/iControlPortal.cgi”%\

(options.uiUsername, options.uiPasswd, options.host)

ICONTROL_VLAN_NAMESPACE = “urn:iControl:Networking/VLAN”

ic_url = ICONTROL_URL

vlan_proxy = SOAPpy.SOAPProxy(ic_url, ICONTROL_VLAN_NAMESPACE)

print SOAPpy.Types.simplify(vlan_proxy.get_list())

creating a VLAN

import pdb;pdb.set_trace()

vlan_proxy.create( vlans=[“ictrlVLan”],

vlan_ids=[3001],

members=[{‘member_name’: ‘1.8’,

‘member_type’: ‘MEMBER_INTERFACE’,

‘tag_state’: ‘MEMBER_TAGGED’}],

failsafe_states=[‘STATE_DISABLED’],

timeouts=[90],

mac_masquerade_addreses=[‘none’])

Unfortunately, when I try to execute the script I run into following:

Traceback (most recent call last):

File “/HostShare/pythonScripts/bigip/./subcaseBgp-bpIctrlCreate.py”, line 75, in

mac_masquerade_addreses=[‘none’])

File “/usr/lib/python2.5/site-packages/SOAPpy/Client.py”, line 470, in __call__

return self.__r_call(*args, **kw)

File “/usr/lib/python2.5/site-packages/SOAPpy/Client.py”, line 492, in __r_call

self.__hd, self.__ma)

File “/usr/lib/python2.5/site-packages/SOAPpy/Client.py”, line 406, in __call

raise p

SOAPpy.Types.faultType:

The SDK was meant to be language neutral since we support so many toolkits out there with such different language semantics, it’s hard to write an SDK for a Web Service API that accommodates all the variants out there.

The biggest issue that Perl and Python developers face is that of the use of 2-d arrays in our APIs and how to code them. The strongly bound languages that have client proxy generation bypass this issue, but unfortunately the Perl and Python (and Php for that matter) will have to keep working at it until we get a better set of strongly bound client libraries for those languages.

I’m not a Python developer and the Python libraries for iControl were developed more as a community project so hopefully anything that you learn along the way, you would be willing to share it back with the community either as the form of a tech tip, forum post, or samples in the CodeShare.

-Joe

I do understand. I will post my code under code share and will also post my experience of tech tips.

Thanks,

K2

K2 - this thread shows a patch that will help Soappy make sense of nested arrays:

http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=7405

Hope this helps. PyControl handles this well too, so it may be worth looking at that.

-Matt

learning