Forum Discussion

JoshBecigneul's avatar
Nov 13, 2013

iControl EM Proxy Issues

Hi All,

Trying to use the ruby f5-icontrol library to interact with Enterprise Manager's iControl proxy capability. So far I have had little luck. I have the following script, and it is functional in returning info from EM, except for when I attempt to run the get_context_id method.

require 'f5-icontrol'
require 'pp'
wsdls = ['Management.EM']
b = F5::IControl.new('myem', 'admin', 'thepassword', wsdls).get_interfaces
l = {}
l['devices'] = b['Management.EM'].get_devices()
l['context'] = b['Management.EM'].get_context_id()
pp l

This results in the following error:

/usr/share/ruby/rexml/parsers/baseparser.rb:411:in `block in pull_event': Undefined prefix E found (REXML::UndefinedNamespaceException)
    from /usr/share/ruby/set.rb:232:in `each_key'
    from /usr/share/ruby/set.rb:232:in `each'
    from /usr/share/ruby/rexml/parsers/baseparser.rb:409:in `pull_event'
    from /usr/share/ruby/rexml/parsers/baseparser.rb:183:in `pull'
    from /usr/share/ruby/rexml/parsers/streamparser.rb:16:in `parse'
    from /usr/share/ruby/rexml/document.rb:243:in `parse_stream'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/xsd/xmlparser/rexmlparser.rb:27:in `do_parse'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/parser.rb:102:in `parse'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/processor.rb:39:in `unmarshal'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/rpc/proxy.rb:291:in `unmarshal'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/rpc/proxy.rb:190:in `route'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/rpc/proxy.rb:149:in `call'
    from /usr/local/share/gems/gems/soap2r-1.5.8/lib/soap/rpc/driver.rb:151:in `call'
    from (eval):6:in `get_context_id'
    from em2.rb:11:in `'

I'm running ruby 2.0.0p247, EM 3.1.1 (40.7), and have tried f5-icontrol gems for v11.3.0 and v11.4.1.

Any ideas?

Thanks.

  • Julian_Balog_34's avatar
    Julian_Balog_34
    Historic F5 Account

    Are you able to retrieve the list of devices, through the get_devices() API? Or it's just the get_context_id() API that is failing?

     

    Can you please try to call individually both of these APIs, just to make sure? (From the stack trace it looks like the failure could be with retrieving the array list corresponding to the devices, but I could be wrong).

     

    Can you also make sure the f5-icontrol gem that you're using has the required APIs (in the Management.EM namespace) built-in?

     

    If you inspect your f5-icontrol gem zip file, look for:

     

    data.tar.gz -> lib -> wsdl -> Management.EM.wsdl -> get_context_id() metadata.gz -> metadata -> lib/wsdl/Management.EM.wsdl

     

    The f5-icontrol gem that should have the required APIs can be downloaded at: https://devcentral.f5.com/labs/Ruby/f5-icontrol-11.3-gem.zip

     

    The next I can think of could be an issue related to the SOAP serializer library that you're using (soap2r) and the way it serializes and names the SOAP data types involved (e.g. SOAP-ENC:xxx, xsd:string, etc.). I wonder if one of these types could not be properly resolved (as a valid namespace) by the ruby SOAP serializer.

     

    It would be useful if you could enable a verbose trace to see the actual SOAP request/response vehiculated on the wire, between the ruby client and the EM/iControl Proxy. (Even a raw HTTP/tcpdump on the client side would help).

     

    I would probably lean to my second assumption: SOAP serialization/deserialization issue, and probably with the get_devices() API, since it's returning a [complex] SOAP-ENC::arrayType.