[NETCONF-316] Netconf MD-SAL connector is treating prefixed XML as invalid Created: 14/Nov/16  Updated: 15/Mar/19  Resolved: 13/Oct/17

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Richard Kosegi Assignee: Alexis de Talhouët
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 7176

 Description   

Logic in EditConfig is imposing requirements not defined by RFC (or at least I can't find such restriction).
It is required for rpc element (or its children) to NOT have XML prefix.

There are tools (eg. python ncclient) and devices (eg. https://www.juniper.net/documentation/en_US/junos15.1/topics/concept/netconf-session-rfc-compliant.html#jd0e89) which allows to use prefixed rpc elements and thus rendering connector-netconf-mdsal incompatible with them.

This is message as received by ODL:
<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:2fd6f8c7-b266-429c-97cb-3887c8cab01e">
<nc:edit-config>
<nc:target>
<nc:candidate/>
</nc:target>
<nc:default-operation>merge</nc:default-operation>
<config>
<network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
<topology>
<topology-id>11</topology-id>
</topology>
</network-topology>
</config>
</nc:edit-config>
</nc:rpc>

Note "nc" prefix on root element.

This is error :

Error occurred while processing message
NetconfDocumentedException{message=Missing target element, errorType=rpc, errorTag=missing_attribute, errorSeverity=error, errorInfo={}}
at org.opendaylight.netconf.mdsal.connector.ops.EditConfig.extractTargetParameter(EditConfig.java:196)[291:org.opendaylight.netconf.mdsal-netconf-connector:1.1.1.Boron-SR1]
at org.opendaylight.netconf.mdsal.connector.ops.EditConfig.handleWithNoSubsequentOperations(EditConfig.java:67)[291:org.opendaylight.netconf.mdsal-netconf-connector:1.1.1.Boron-SR1]
at org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation.handle(AbstractSingletonNetconfOperation.java:26)[149:org.opendaylight.netconf.util:1.1.1.Boron-SR1]
at org.opendaylight.netconf.util.mapping.AbstractNetconfOperation.handle(AbstractNetconfOperation.java:101)[149:org.opendaylight.netconf.util:1.1.1.Boron-SR1]
at org.opendaylight.netconf.impl.osgi.NetconfOperationRouterImpl$NetconfOperationExecution.execute(NetconfOperationRouterImpl.java:182)[155:org.opendaylight.netconf.impl:1.1.1.Boron-SR1]

I think problem is here:
https://github.com/opendaylight/netconf/blob/stable/boron/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java#L193

Element#getElementsByTagName() returns empty NodeList, because "target" element is in non-empty namespace.



 Comments   
Comment by Alexis de Talhouët [ 18/Nov/16 ]

Proposed fix: https://git.opendaylight.org/gerrit/#/c/48483/

Generated at Wed Feb 07 20:14:42 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.