Details
-
Bug
-
Status: Resolved (View Workflow)
-
Minor
-
Resolution: Fixed
-
26.1.0
-
None
-
Security Level: Default (Default Security Scheme)
-
Horizon 2021 - Feb 3 - Feb 17, Horizon 2021 - Feb 17 - Mar 3
Description
Our model does not allow create two services with the same name on an IP interface. The Web UI doesn't allow it but if you provision from a file it is possible we get the following error messages in provisiond.log
2020-06-02 17:09:20,856 WARN [importExecutor-2] o.h.u.JDBCExceptionReporter: SQL Error: 0, SQLState: 23505
2020-06-02 17:09:20,857 ERROR [importExecutor-2] o.h.u.JDBCExceptionReporter: ERROR: duplicate key value violates unique constraint "ifservices_ipinterfaceid_svc_unique"
Detail: Key (ipinterfaceid, serviceid)=(1, 3) already exists.
The behavior can be replicated with:
File: test-nodes.xml
<?xml version="1.0" encoding="UTF-8"?> <model-import xmlns="http://xmlns.opennms.org/xsd/config/model-import" date-stamp="2016-10-28T10:50:02.025Z" foreign-source="test-nodes" last-import="2016-10-28T10:51:29.354Z"> <node building="test-node-01" foreign-id="test-node-01" node-label="test-node-01"> <interface ip-addr="127.0.0.1" status="1" snmp-primary="P"> <monitored-service service-name="ICMP"/> <monitored-service service-name="ICMP"/> </interface> </node> </model-import>
curl -u admin:admin \ -X POST \ -H "Content-Type: application/xml" \ -H "Accept: application/xml" \ -d @test-nodes.xml \ http://localhost:8980/opennms/rest/requisitions
The request is accepted with HTTP/1.1 202 Accepted and should be rejected.