Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-4749

Requisition REST Service allows duplicate nodes

    XMLWordPrintable

    Details

      Description

      As you can see on the attached image, you will see two sets of duplicated nodes:

      1. The node "my-test-router" has been added twice using REST Interface through the command:
      curl -v -H 'Content-Type: application/xml' -d @node.xml "http://admin:admin@localhost:8980/opennms/rest/requisitions/Test-01/nodes"

      where node.xml contains:
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <node xmlns="http://xmlns.opennms.org/xsd/config/model-import" node-label="my-test-router" foreign-id="20002" building="Test-01">
      <interface status="1" snmp-primary="P" ip-addr="11.1.0.254" descr="Fa0/1"/>
      <category name="Production"/>
      <category name="Routers"/>
      </node>

      2. The node "testsrv.local" has been added 3 times, by executing the following command:
      ./provision.pl --username admin --password admin node add Test-01 2003 testsrv.local

      This is expected because provision.pl uses the REST interface to manipulate requisitions.

      Final comment:
      Through WebUI, I can't modify the foreign-id. It always forces me to use the generated one.

      The curious thing is that I made a JUnit test to validate the correct implementation of the method "putNode" from Requisition.java, and it works as expected, so if you check the method "addOrReplaceNode" from RequisitionRestService.java, I think the problem could live on getActiveRequisition or m_pendingForeignSourceRepository.save() (but I'm not sure about that).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brozow Matt Brozowski
                Reporter:
                agalue Alejandro Galue
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: