Forum Discussion

Laggin_53249's avatar
Laggin_53249
Icon for Nimbostratus rankNimbostratus
Sep 14, 2007

m_interface.initialize() always returns true, isValid() always returns false?

I can't believe I haven't run into this until now.

 

 

As long as I supply a valid ip address for the m_interface.initialize(Host . . .value, the return value is always true, regardless if the usename/password combination are invalid.

 

 

So I decided after m_interface.initialize(..) = true, I would try a m_interface.ConnectionInfo.isValid() call, assuming this would verify the credentials were valid. This always returned false, even if the credentials supplied are correct.

 

 

I know I'm missing something really simple here.

 

 

How can I validate a proper connection to an interface . . .validating username/password/rights/etc.?

1 Reply

  • Good points. The Initialize method basically validates that the inputs are correct format (address/port/etc) but does not actually connect to the BIG-IP to verify connectivity information (in hindsight maybe it should).

    The m_interface.ConnectionInfo.isValid() call verifies that the inputs for hostname, port, username, and password are non-zero length (meaning that the initialize call was made and succeeded). Not sure how this could be returning false. I'll have to test this out.

    With what you have, the easiest way to verify a connection is to put a try/catch loop around an iControl call after you make the initialize() call.

    ...
    m_interfaces.initialize(...)
    try
    {
      String sVersion = m_interfaces.SystemInfo.get_version();
    }
    catch (Exception)
    {
      // Invalid connection.
    }

    I'll look at adding the true connectivity to the assembly's intialize method but in the mean time, this should get you going. I'll also double check on the isValid() method returning false, it should not be in your case...

    -Joe