Forum Discussion

Tim_18689's avatar
Tim_18689
Icon for Cirrus rankCirrus
Jan 05, 2013

Trying to setup basic networking with bigsuds

I am trying write a script to setup basic networking using bigsuds. I am having trouble creating a vlan. I am novice at scripting so I must be making an error.

 

 

Here is the simple script to create a vlan:

 

 

!/usr/bin/python

 

 

netconfig.py

 

attempt to do basic network setup with icontrol

 

 

import bigsuds

 

 

b = bigsuds.BIGIP(

 

hostname = '10.3.213.66',

 

username = 'admin',

 

password = 'admin',

 

)

 

 

b.networking.VLAN.create_v2(

 

vlans, 'ext-esnet',

 

vlan_ids, 1101,

 

members, 1.1,

 

)

 

 

 

Here is the error I get when I try to run it:

 

 

$ ./netconfig.py

 

Traceback (most recent call last):

 

File "./netconfig.py", line 14, in

 

b.networking.VLAN.create_v2(

 

File "/usr/local/lib/python2.7/dist-packages/bigsuds-1.0-py2.7.egg/bigsuds.py", line 258, in __getattr__

 

client = self._client_creator('%s.%s' % (self._name, attr))

 

File "/usr/local/lib/python2.7/dist-packages/bigsuds-1.0-py2.7.egg/bigsuds.py", line 134, in _create_client

 

'namespace?' % (e, wsdl_name))

 

bigsuds.ParseError: :12:2: mismatched tag

 

Failed to parse wsdl. Is "networking.VLAN" a valid namespace?

 

 

 

 

Tim T

 

  • I was able t get this working. My idea of how it would work was much too simple. It took me a lot of trial an error becuase of my lack of understanding of how this works. I would like to have listed all the param names that I gave values for ( vlan_ids, failsafe_states, fail_safe_time_outs), but I could not figure out the syntax. If anyone can show me this it would be great.

     

     

    Here is the script working to make a vlan:

     

     

     

    !/usr/bin/python

     

     

    netconfig.py

     

    attempt to do basic network setup with icontrol

     

     

    import bigsuds

     

     

    b = bigsuds.BIGIP(

     

    hostname = '10.3.213.85',

     

    username = 'admin',

     

    password = 'admin',

     

    )

     

     

    b.Networking.VLAN.create_v2(

     

    ['test1'],

     

    [1102],

     

    [[{'tag_state': 'MEMBER_UNTAGGED', 'member_type': 'MEMBER_INTERFACE', 'member_name': '1.2'}]],

     

    ['STATE_DISABLED'],

     

    [90],

     

    )

     

     

     

     

    Next, self IPs...

     

  • Here is an improved syntax:

     

     

     

    !/usr/bin/python

     

     

    set target system and supply login info

     

    b = bigsuds.BIGIP(

     

    hostname = '10.3.214.70',

     

    username = 'admin',

     

    password = 'admin',

     

    )

     

     

    create a vlan

     

    b.Networking.VLAN.create_v2(

     

    vlans = ['ext-esnet'],

     

    vlan_ids = [1101],

     

    members = [[{'member_name': '1.1', 'member_type': 'MEMBER_INTERFACE', 'tag_state': 'MEMBER_UNTAGGED'}]],

     

    failsafe_states = ['STATE_DISABLED'],

     

    timeouts = [90]

     

    )

     

     

    • JerryMac_150114's avatar
      JerryMac_150114
      Historic F5 Account
      Thank you for providing your example. So many times people post "got it working" but fail to show how they did it.
  • JerryMac_150114's avatar
    JerryMac_150114
    Historic F5 Account

    Creating a VLAN with more then one interface added.

    Platform.Networking.VLAN.create_v2(
            vlans = ['testVLAN01'],
            vlan_ids = [1001],
            members = [[{'member_name': '1.1', 'member_type': 'MEMBER_INTERFACE', 'tag_state': 'MEMBER_UNTAGGED'},
                        {'member_name': '1.2', 'member_type': 'MEMBER_INTERFACE', 'tag_state': 'MEMBER_UNTAGGED'}]],
            failsafe_states = ['STATE_DISABLED'],
            timeouts = [90]
            )