Forum Discussion

Spidey_27_16399's avatar
Spidey_27_16399
Icon for Nimbostratus rankNimbostratus
Sep 18, 2014
Solved

Error creating an ltm monitor template on an F5 Loadbalancer BigIP 11.x device using the iControl Java API call: LocalLB__Monitor__create_template

Hi,

 

I'm trying to create an ltm monitor template on an F5 Loadbalancer BigIP 11.x device using the iControl Java API to make the create_template call as described here:

 

link text

 

I have a few questions as to how the IP Address is created. I have tried a number of combinations and none of them seem to work. Some will allow the creation of the template but the IP address information seems to be missing.

 

My understanding from the LocalLB__AddressType API is that the following is true:

 

MemberValueDescription ATYPE_UNSET0The address type is unknown. ATYPE_STAR_ADDRESS_STAR_PORT1For example, ":". ATYPE_STAR_ADDRESS_EXPLICIT_PORT2For example, ":80". ATYPE_EXPLICIT_ADDRESS_EXPLICIT_PORT3For example, "10.10.10.1:80". ATYPE_STAR_ADDRESS4For example, "". ATYPE_EXPLICIT_ADDRESS5For example, "10.10.10.1".

 

There may be errors with my assumption or the documentation though as my interpretation differs from the documentation for the following members: ATYPE_STAR_ADDRESS and ATYPE_EXPLICIT_ADDRESS

 

[link text](https://devcentral.f5.com/wiki/iControl.LocalLB__AddressType.ashx)

So the questions I have are:

Q1. Are my assumptions regarding the address members correct? (If so, I can edit the API).
Q2. As I have to specify an ip address and port number in the creation of the CommonIPPortDefinition:LocalLBMonitorIPPort (String, long), what ip address and port numbers are given for the following scenarios?
  • "*"[0.0.0.0, 0]?
  • ":"[0.0.0.0, 0]?
  • "10.10.10.10" [10.10.10.10, 0 if my assumption is correct for ATYPE_EXPLICIT_ADDRESS]?

I seem to be having problems with this part of the code.

 

Code
 // create inputCommonAttributes
CommonIPPortDefinition ipPort = new CommonIPPortDefinition("*:*", 0);
LocalLBMonitorIPPort monitorIPPort = new LocalLBMonitorIPPort(
LocalLBAddressType.ATYPE_STAR_ADDRESS_STAR_PORT, ipPort);

From the API, I understand that the call needs to be made in the following way after creating the LocalLBMonitorBindingStub:

 

Code
// inputs for create template
LocalLBMonitorMonitorTemplate[] inputTemplateArray = new LocalLBMonitorMonitorTemplate[1];
LocalLBMonitorCommonAttributes[] inputCommonAttributes = new LocalLBMonitorCommonAttributes[1];

// create template
LocalLBMonitorTemplateType templateType = LocalLBMonitorTemplateType.TTYPE_DIAMETER;
LocalLBMonitorMonitorTemplate monitorTemplate = new LocalLBMonitorMonitorTemplate("TestTemplate", templateType);

// add template to inputTemplateArray
inputTemplateArray[0] = monitorTemplate;

// create inputCommonAttributes
CommonIPPortDefinition ipPort = new CommonIPPortDefinition("*", 80);
LocalLBMonitorIPPort monitorIPPort = new LocalLBMonitorIPPort(
LocalLBAddressType.ATYPE_STAR_ADDRESS_EXPLICIT_PORT, ipPort);
LocalLBMonitorCommonAttributes commonAttributes = new LocalLBMonitorCommonAttributes("diameter", 10, 31, monitorIPPort, false, true);

// add common attributes to inputCommonAttributes array
inputCommonAttributes[0] = commonAttributes;

// make the call to the device
localLBMonitorBindingStub.create_template(inputTemplateArray,inputCommonAttributes);

Output of exception:

 

AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::create_template() Exception: Common::OperationFailed primary_error_code : 16908320 (0x01020020) secondary_error_code : 0 error_string : 01020020:3: The text string cannot be converted to an IP address. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::create_template() Exception: Common::OperationFailed primary_error_code : 16908320 (0x01020020) secondary_error_code : 0 error_string : 01020020:3: The text string cannot be converted to an IP address. at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.intelliden.drivers.f5.generated.LocalLBMonitorBindingStub.create_template(LocalLBMonitorBindingStub.java:1025) at com.intelliden.drivers.f5.F5TestMonitor.main(F5TestMonitor.java:70 {http://xml.apache.org/axis/}hostname:IBM988-R901C8N1

 

Any help would be greatly appreciated. Thanks in advance.

 

Kind regards, Don

 

  • Try setting the IP address to 0.0.0.0 instead of * when creating the CommonIPPortDefinition.

     

4 Replies

  • Try setting the IP address to 0.0.0.0 instead of * when creating the CommonIPPortDefinition.

     

    • Spidey_27_16399's avatar
      Spidey_27_16399
      Icon for Nimbostratus rankNimbostratus
      Hi Jonathan, I tried that already and I get the following error for these values: CommonIPPortDefinition ipPort = new CommonIPPortDefinition( "0.0.0.0", 0); LocalLBMonitorIPPort monitorIPPort = new LocalLBMonitorIPPort( LocalLBAddressType.ATYPE_STAR_ADDRESS, ipPort); AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::create_template() Exception: Common::OperationFailed primary_error_code : 17236023 (0x01070037) secondary_error_code : 0 error_string : 01070037:3: Monitor /Common/Test4 address type is incorrect for monitor type. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::create_template() Exception: Common::OperationFailed primary_error_code : 17236023 (0x01070037) secondary_error_code : 0 error_string : 01070037:3: Monitor /Common/Test4 address type is incorrect for monitor type. at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.intelliden.drivers.f5.generated.LocalLBMonitorBindingStub.create_template(LocalLBMonitorBindingStub.java:1025) at com.intelliden.drivers.f5.F5TestMonitor.main(F5TestMonitor.java:71)
  • Ok, I figured it out while learning a few things along the way.

     

    Firstly, to anyone else having this issue creating ltm monitors, please check out this great resource for information on each specific monitor template type and their various settings. It's exremely useful: big-ip ltm monitors reference

     

    So, what I figured out was that a) the XUI interface (https:///xui/) does some checking that the API does not, namely the com.f5.form.IPHostValidator! This does not allow one to modify the Host IP Address to something like ":" through the F5 device's XUI, however, the API does allow this.

     

    So why wasn't my code working? Well, the assumption I made was that the CommonIPPortDefinition was the same as the Host IP Address field for this Monitor. I was wrong. I am not sure why this sin't the case and if someone would like to enlighten me, then please do. (I suspect that it might be used for other monitor templates)

     

    So Jonathan, you are correct, I must set the ip portion to "0.0.0.0"...

     

    CommonIPPortDefinition ipPort = new CommonIPPortDefinition("0.0.0.0", 0);

    ...BUT then I must make an additional call to set_template_string_property method in the LocalLBMonitorBindingStub class to set the Host IP Address!

     

    public void set_template_string_property(java.lang.String[] template_names,
            LocalLBMonitorStringValue[] values) throws java.rmi.RemoteException

    For example (please excuse the messy code):

     

    LocalLBMonitorStringValue lbStringValue = new LocalLBMonitorStringValue(
    LocalLBMonitorStrPropertyType.STYPE_DIAMETER_HOST_IP_ADDRESS,"*:*");
    LocalLBMonitorStringValue[] lbStringValueArray = new LocalLBMonitorStringValue[1];
    lbStringValueArray[0] = lbStringValue;
    
    localLBMonitorBindingStub.set_template_string_property(template_names, lbStringValueArray);
    
    //template_names is a simple String[] array with the name of the template in it.

    More info here: LocalLB::Monitor::set_template_string_property

     

    Also, there are a number of calls that need to be made when making a monitor depending on whether you specify predefined strings, integer or user defined strings properties in the template e.g. set_template_string_property, set_template_integer_property or set_template_user_defined_property

     

    Thanks for your help.

     

    • Spidey_27_16399's avatar
      Spidey_27_16399
      Icon for Nimbostratus rankNimbostratus
      I also realised that the Host IP Address cannot be *:*, it makes no sense, you can't have one device with every IP address on every port. So this makes sense that the com.f5.form.IPHostValidator would reject it. :-/