[NETCONF-603] Attribute prefix binding warning encountered with RESTCONF Created: 16/Jan/19  Updated: 09/Jul/20  Resolved: 09/Jul/20

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: Neon
Fix Version/s: Aluminium, Magnesium SR2, Sodium SR4

Type: Bug Priority: Medium
Reporter: Robert Varga Assignee: Tomas Cere
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

With -YANGTOOLS-926- and -YANGTOOLS-801-, we are seeing this splat:

2019-01-16T21:30:02,785 | INFO  | qtp1726921883-106 | XMLStreamNormalizedNodeStreamWriter | 509 - org.opendaylight.yangtools.yang-data-codec-xml - 2.1.7 | Namespace urn:ietf:params:xml:ns:netconf:base:1.0 was not bound, please fix the caller
java.lang.Throwable: null
	at org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter.getPrefix(XMLStreamNormalizedNodeStreamWriter.java:139) [509:org.opendaylight.yangtools.yang-data-codec-xml:2.1.7]
	at org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter.writeAttributes(XMLStreamNormalizedNodeStreamWriter.java:118) [509:org.opendaylight.yangtools.yang-data-codec-xml:2.1.7]
	at org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter.startContainerNode(XMLStreamNormalizedNodeStreamWriter.java:297) [509:org.opendaylight.yangtools.yang-data-codec-xml:2.1.7]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.wasProcessedAsCompositeNode(NormalizedNodeWriter.java:190) [507:org.opendaylight.yangtools.yang-data-api:2.1.7]
	at org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter.write(NormalizedNodeWriter.java:97) [507:org.opendaylight.yangtools.yang-data-api:2.1.7]
	at org.opendaylight.netconf.util.NetconfUtil.writeNormalizedNode(NetconfUtil.java:68) [426:org.opendaylight.netconf.util:1.6.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.createEditConfigAnyxml(NetconfMessageTransformUtil.java:364) [420:org.opendaylight.netconf.sal-netconf-connector:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfRpcStructureTransformer.createEditConfigStructure(NetconfRpcStructureTransformer.java:41) [420:org.opendaylight.netconf.sal-netconf-connector:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps.createEditConfigStrcture(NetconfBaseOps.java:292) [420:org.opendaylight.netconf.sal-netconf-connector:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.connect.netconf.sal.tx.AbstractWriteTx.put(AbstractWriteTx.java:107) [420:org.opendaylight.netconf.sal-netconf-connector:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadWriteTx.put(ReadWriteTx.java:46) [420:org.opendaylight.netconf.sal-netconf-connector:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.BrokerFacade.simplePostPut(BrokerFacade.java:908) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.BrokerFacade.makeNormalPost(BrokerFacade.java:857) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.BrokerFacade.postData(BrokerFacade.java:676) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.BrokerFacade.postDataViaTransaction(BrokerFacade.java:658) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.BrokerFacade.commitConfigurationDataPost(BrokerFacade.java:455) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.RestconfImpl.createConfigurationData(RestconfImpl.java:967) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.RestconfImpl.createConfigurationData(RestconfImpl.java:915) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper.createConfigurationData(StatisticsRestconfServiceWrapper.java:157) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at org.opendaylight.netconf.sal.rest.impl.RestconfCompositeWrapper.createConfigurationData(RestconfCompositeWrapper.java:92) [417:org.opendaylight.netconf.restconf-nb-bierman02:1.9.0.SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [192:org.glassfish.jersey.core.jersey-server:2.25.1]

This points either to NETCONF or yangtools/woodstox not interoperating correctly.



 Comments   
Comment by Robert Varga [ 17/Jan/19 ]

I think this is a problem in netconf. The target element is netconf's "config" element, into which we are emitting the configuration. The config element is created with default namespace which is fine, but the XMLStreamWriter is not initialized to add the netconf URI to a prefix.

XMLStreamNormalizedNodeStreamWriter will emit the first configuration element, setting emitting its namespace as the default namespace and then we emit netconf attributes. Since we have overridden the default namespace, there is no bindining matching the netconf URI, which leads to this splat.

Comment by Robert Varga [ 17/Jan/19 ]

The correct approach would be to have the root preconstructed element carry the appropriate namespace declaration and calling XMLStreamWriter.setNamespaceContext() with mappings contained therein.

Except this won't work with JDK DOM writer, because it throws UnsupportedOperationException, so we need to dance around that, using setPrefix() if that is thrown. For giggles, Woodstox DOM writer will end up ignoring setPrefix() in that it will just store those values, but not return them.

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