Skip to content

Unable to respond with customized error for edit-config #2243

@marchest

Description

@marchest

Describe the bug
Unable to respond with customized error from netconf server since Lighty overrides our custom error. However , I can see the following logs in lighty which seems correct but it's responding different than its logging.

2025-07-01 10:56:51 WARN  [NetconfDeviceCommunicator] (odl-netconf-client-2) [{}] RemoteDeviceId[name=1, address=host.docker.internal/172.17.0.1:2022]: Error reply from remote device, request: <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-50">
    <edit-config>
        <target>
            <candidate/>
        </target>
        <error-option>rollback-on-error</error-option>
        <config>
            <dhcp-kea xmlns="http://nsp-dhcp.siemens.com/ns/nsp-dhcp">
                <subnetscon>
                    <subnets xmlns:op="urn:ietf:params:xml:ns:netconf:base:1.0" op:operation="create">
                        <uuid>39b29f21-de8c-4fa8-9fd7-6951607128c9</uuid>
                        <net>192.168.28.0/24</net>
                    </subnets>
                </subnetscon>
            </dhcp-kea>
        </config>
    </edit-config>
</rpc>
, response: <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-50">
    <rpc-error>
        <error-type>application</error-type>
        <error-tag>operation-failed</error-tag>
        <error-severity>error</error-severity>
        <error-app-tag>data-not-unique</error-app-tag>
       <error-message xml:lang="en">&lt;&lt;&lt;labelSubnetworkDataNotUnique&gt;&gt;&gt;</error-message>
        <error-info xmlns:dhcpd-kea="http://nsp-dhcp.siemens.com/ns/nsp-dhcp" xmlns:yang="urn:ietf:params:xml:ns:yang:1">
            <yang:non-unique>/dhcpd-kea:dhcp-kea/dhcpd-kea:subnetscon/dhcpd-kea:subnets[dhcpd-kea:uuid='39b29f21-de8c-4fa8-9fd7-6951607128c9']/dhcpd-kea:net</yang:non-unique>
            <yang:non-unique>/dhcpd-kea:dhcp-kea/dhcpd-kea:subnetscon/dhcpd-kea:subnets[dhcpd-kea:uuid='87794c3c-4e8e-4ab8-8732-3255fa0a1401']/dhcpd-kea:net</yang:non-unique>
        </error-info>
    </rpc-error>
</rpc-reply>

2025-07-01 10:56:51 WARN  [NetconfRpcFutureCallback] (odl-netconf-client-2) [{}] RemoteDeviceId[name=1, address=host.docker.internal/172.17.0.1:2022]:
 Edit candidate invoked unsuccessfully: [RpcError [message=<<<labelSubnetworkDataNotUnique>>>, severity=ERROR, errorType=APPLICATION, tag=operation-failed, 
 applicationTag=null, info=<yang:non-unique>/dhcpd-kea:dhcp-kea/dhcpd-kea:subnetscon/dhcpd-kea:subnets[dhcpd-kea:uuid='87794c3c-4e8e-4ab8-8732-3255fa0a1401']/dhcpd-kea:net</yang:non-unique>, cause=null]]

HTTP 500 Response

Image

Branch
lighty.io branch [20.3.0 release or 21.2.0]

To Reproduce
Steps to reproduce the behavior:

  1. git checkout lighty- 20.3.0
  2. Use any yang file and try to return custom error for the edit config.

Expected behavior
We would like to respond edit-config with a customized error due to invalid input but with the 20.3.0 release lighty overriding our response. We were using 17.3.0 version but due to EOL of that version we upgraded to 20.3.0. We were getting following response with the 17.3.0 which was fine.

{
  "errors": {
    "error": [
      {
        "error-tag": "operation-failed",
        "error-info": "<bad-element>host-specific-file-op</bad-element>",
        "error-message": "{\"status\" : {\"code\": -4, \"message\": \"<<<labelSubnetworkDataNotUnique>>>Input is wrong\"}}",
        "error-type": "application"
      }
    ]
  }
}

Environment:

  • OS: [ubuntu 24.04]
  • Java Version [java 17]

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions