IT Operations Management (ITOM)
cancel

How to Test NNMi Web Service APIs using SoapUI

How to Test NNMi Web Service APIs using SoapUI

JackYangHpe

Hewlett Packard Enterprise Network Node Manager i network monitoring software provides a rich set of Web Service based APIs which offer read/write capabilities on all basic NNMi object types, i.e., node, interface, incident, layer 2 connection, etc. Typically, customers develop their client code to interact with NNMi Web Service APIs programmatically.  In some scenarios, however, they may want to retrieve data at the XML layer without writing a line of code.  This blog demonstrates a step-by-step procedure on how to use a free tool, SoapUI, to test NNMi Web Service APIs without developing your own client code.

Try HPE Network Node Manager i for yourself to experience these capabilities.

Test Procedure

Step 1 - Download and Install SoapUI
SoapUI is an open-source web service testing application for service-oriented architectures (SOA) and representational state transfers (REST). The free version can be downloaded here.  At the time of this writing, the latest version is 5.2.1.

Launch the SoapUI installer and follow the onscreen instructions to complete the installation.

Step 2 - Create a new SoapUI Project associated with a Web Service WSDL
Launch the SoapUI. In the SoapUI Console, choose “File | New SOAP Project”:

p1.png

In the New SOAP Project pop up window, enter “MyNodeServiceProject” in the “Project Name” field, and the NodeService WSDL of your NNMi server in the “Initial WSDL” field, for example, “http://mynnmi.mycompant.com/NodeBeanService/NodeBean?wsdl”, as shown below:

p2.png

Please note, in this blog, I use NNMi NodeService as an example. NNMi offers a rich set of services for different object types, such as Interface, Incident, IPAddress, etc. The complete list of the services and the WSDL URLs are listed in the table below:

p3.png

You need to replace the <host> and <port> with the FQDN and port of your NNMi server.

Step 3 - Retrieve all the API Methods Provided by a Service
Once you have entered a valid Web Service WSDL URL, SoapUI connects to the URL, retrieves all the API methods and signatures, and presents them to you under your project. Below is an example showing all the available API methods supported by NodeService:

p4.png

Step 4 - Test Web Service APIs – Four Examples
Everyone loves examples. So, in this last section, I will show your four examples. But first, before you invoke a call to a method, i.e., make a request, you need to specify the user name and password to your NNMi server in the “Request Properties” table located at the lower-left corner of the SoapUI console as shown below:
p5.png

The user account must have the “NNMi Web Service Client” role.
You will need to enter user name and password for each request.

Example 1 - Retrieve all nodes, no filters used.

In this example, we will retrieve all the nodes with all the built-in attributes that were discovered by NNMi.
Expand the “getNodes” folder and click “request 1”:

p6.png

This will open the “Request 1” window, then click on the green Play button on the menu bar, the result data will be displayed on the right panel:

p7.png

Example 2 – Retrieve nodes using a simple filter (condition).

In this example, we will use a simple filter, i.e., retrieve all the nodes which are in “NORMAL” status.
The simple filter is an instance of “condition” object. You need to specify that the argument (<arg0> tag) is a condition, and it comes with “name”, “operator” and “value”. The XMP excerpt is shown below:

<arg0 xmlns:ns4="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:condition">
     <name>status</name>
     <operator>EQ</operator>
     <value>NORMAL</value>
</arg0>

You can cut the XML excerpt above and paste it under the <node:getNodes> tag, then click the green Play button, the result data will be displayed on the right panel:

p8.png

Example 3 – Retrieve nodes using a more advanced filter (expression).
In this example, we will use a more advanced filter, the “expression”. In an expression filter, you can combine multiple conditions using “AND” or “OR” operators. For example, retrieve a node with a custom attribute name = “ODB_ID” (condition 1), AND the value = “1fcef433504817ef0eae13cc3ada29cd” (condition 2).
You also specify the expression filter in the <arg0> tag:

<arg0 xmlns:ns4="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:expression">
     <operator>AND</operator>
     <subFilters xsi:type="ns4:condition">
         <name>customAttribute.name</name>
         <operator>EQ</operator>
         <value>ODB_ID</value>
     </subFilters>
     <subFilters xsi:type="ns4:condition">
         <name>customAttribute.value</name>
         <operator>EQ</operator>
         <value>1fcef433504817ef0eae13cc3ada29cd</value>
     </subFilters>
</arg0>

You can cut the XML excerpt above and paste it under the <node:getNodes> tag, then click the green Play button, the result data will be displayed on the right panel:

p9.png

Example 4 – Modify Node Object
In the last example, I will show you how to call the addCustomAttribute method of the NodeService to add a custome attribute “MyCustomAttribute” with the value “MyValue”.
From NNMi SDK document, the signature of addCustomAttribute method takes two parameters:

addCustomAttributes(String id, CustomAttribute[] customAttributes)

where the first parameter is the id of the node to be modified, and second parameter is an array of custom attributes (name/value pair). In this example, I am going to add only one custom attribute “MyCustomAttribute=MyValue”.

To invoke this method from SoapUI, you need to use the following XML excerpt:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:addCustomAttributes xmlns:ns2="http://node.sdk.nms.ov.hp.com/">
     <arg0>57018</arg0>
     <arg1>
         <item>
             <name>MyCustomAttribute</name>
             <value>MyValue</value>
         </item>
     </arg1>
</ns2:addCustomAttributes>
</S:Body>
</S:Envelope>

As you can see, I specified the id of the node (57018) to be modified in the first parameter <arg0> and the the custom attribute name/value pair in the 2nd parameter <arg1>.
You need to cut the XML excerpt above and paste it in “addCustomAttribute | request 1”, as shown below:

p10.png

You may need to change the node id and the custom attribute, then click the green play button. The response from the NNMi WebService will be displayed in the right panel.
You can verify in the NNMi UI console that the new custom attribute has been successfully added to the node:

p11.png

Summary
SoapUI is an efficient tool to test NNMi Web Service APIs without writing any client code. The tricky part is how to invoke the APIs in correct XML format. This blog demonstrated several commonly used usages. Experienced users should be able to use the NNMi SDK document and the Web Service WSDL to design correct XML formatted requests to retrieve any data supported by NNMi Web Service APIs.

Try HPE Network Node Manager i for yourself to experience these capabilities.

 

  • infrastructure management
About the Author

JackYangHpe