[YANGTOOLS-1362] Deserialization of instance-identifier doesn't seem to work Created: 12/Nov/21 Updated: 14/Nov/21 Resolved: 14/Nov/21 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | 7.0.9 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | Ravi Pendurty | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
ODL Release - Silicon-SR1 (0.14.1) Yangtools version - 6.0.6 MD-SAL version - 7.0.7 On receiving the following Netconf notification, the "target" field which is of type "instance-identifier" is not deserialized and hence the related data is missing in the deserialized object,
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <eventTime>2021-11-11T11:26:16Z</eventTime> <netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications"> <changed-by> <username>root</username> <session-id>3</session-id> </changed-by> <datastore>running</datastore> <edit> <target xmlns:hw="urn:ietf:params:xml:ns:yang:ietf-hardware">/hw:hardware/component[name='chassis-fan0']/alias</target> <operation>replace</operation> </edit> </netconf-config-change> </notification> Following is the Netconf TRACE, yangtools TRACE and some debugs from SDN-R while processing this notification -
2021-11-11T11:26:17,017 | TRACE | nioEventLoopGroupCloseable-3-4 | NetconfDeviceCommunicator | 358 - org.opendaylight.netconf.sal-netconf-connector - 1.13.2 | - | RemoteDevice{NTS_FUNCTION_TYPE_O_RAN_FH-0-830}: Notification received: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
<eventTime>2021-11-11T11:26:16Z</eventTime>
<netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications">
<changed-by>
<username>root</username>
<session-id>3</session-id>
</changed-by>
<datastore>running</datastore>
<edit>
<target xmlns:hw="urn:ietf:params:xml:ns:yang:ietf-hardware">/hw:hardware/hw:component[hw:name='chassis-fan0']/hw:alias</target>
<operation>replace</operation>
</edit>
</netconf-config-change>
</notification>
2021-11-11T11:26:17,018 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type BaseStringType{name=(urn:ietf:params:xml:ns:yang:1)string, status=CURRENT, patterns=[]} miss simple org.opendaylight.yangtools.yang.data.codec.xml.QuotedXmlCodec@45d9f6d3
2021-11-11T11:26:17,018 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type DerivedUint32Type{baseType=BaseUint32Type{name=(urn:ietf:params:xml:ns:yang:1)uint32, status=CURRENT, range=org.opendaylight.yangtools.yang.model.util.type.ResolvedRangeConstraint@d93dec}, description=NETCONF Session Id or Zero to indicate none, path=AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:netconf:base:1.0?revision=2013-09-29)session-id-or-zero-type]}, status=CURRENT} miss simple org.opendaylight.yangtools.yang.data.codec.xml.NumberXmlCodec@3e195c43
2021-11-11T11:26:17,018 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type DerivedEnumerationType{baseType=BaseEnumerationType{name=(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)enumeration, status=CURRENT, values=[EnumPairImpl{name=running, value=0}, EnumPairImpl{name=startup, value=1}]}, default=running, description=Indicates which configuration datastore has changed., path=AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)netconf-config-change, (urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)datastore]}, status=CURRENT} miss simple org.opendaylight.yangtools.yang.data.codec.xml.QuotedXmlCodec@5185e3d2
2021-11-11T11:26:17,018 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type BaseInstanceIdentifierType{name=(urn:ietf:params:xml:ns:yang:1)instance-identifier, status=CURRENT, requireInstance=false} miss simple org.opendaylight.yangtools.yang.data.codec.xml.XmlStringInstanceIdentifierCodec@64340942
2021-11-11T11:26:17,019 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type BaseStringType{name=(urn:ietf:params:xml:ns:yang:1)string, status=CURRENT, patterns=[]} hit simple org.opendaylight.yangtools.yang.data.codec.xml.QuotedXmlCodec@45d9f6d3
2021-11-11T11:26:17,019 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type DerivedEnumerationType{baseType=BaseEnumerationType{name=(urn:ietf:params:xml:ns:netconf:base:1.0?revision=2013-09-29)enumeration, status=CURRENT, values=[EnumPairImpl{name=merge, value=0}, EnumPairImpl{name=replace, value=1}, EnumPairImpl{name=create, value=2}, EnumPairImpl{name=delete, value=3}, EnumPairImpl{name=remove, value=4}]}, default=merge, description=NETCONF 'operation' attribute values, path=AbsoluteSchemaPath{path=[(urn:ietf:params:xml:ns:netconf:base:1.0?revision=2013-09-29)edit-operation-type]}, reference=RFC 6241, Section 7.2, status=CURRENT} miss simple org.opendaylight.yangtools.yang.data.codec.xml.QuotedXmlCodec@6ed10479
2021-11-11T11:26:17,019 | TRACE | nioEventLoopGroupCloseable-3-4 | LeafInterner | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Interned object ImmutableLeafNode{identifier=(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)datastore, value=running} to ImmutableLeafNode{identifier=(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)datastore, value=running}
2021-11-11T11:26:17,019 | TRACE | nioEventLoopGroupCloseable-3-4 | LeafInterner | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Interned object ImmutableLeafNode{identifier=(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)operation, value=replace} to ImmutableLeafNode{identifier=(urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?revision=2012-02-06)operation, value=replace}
2021-11-11T11:26:17,020 | DEBUG | nioEventLoopGroupCloseable-3-4 | NotificationHandler | 358 - org.opendaylight.netconf.sal-netconf-connector - 1.13.2 | - | RemoteDevice{NTS_FUNCTION_TYPE_O_RAN_FH-0-830}: Forwarding notification org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer$NetconfDeviceNotification@1adea6a4
2021-11-11T11:26:17,020 | INFO | nioEventLoopGroupCloseable-3-4 | ORanChangeNotificationListener | 219 - org.onap.ccsdk.features.sdnr.wt.sdnr-wt-devicemanager-o-ran-sc-oran-provider - 1.3.0.SNAPSHOT | - | onNetconfConfigChange (1) NetconfConfigChange{changedBy=ChangedBy{serverOrUser=ByUser{sessionId=SessionIdOrZeroType{_value=3}, username=root, augmentation=[]}, augmentation=[]}, datastore=Running, edit=[Edit{operation=Replace, augmentation=[]}], augmentation=[]}
2021-11-11T11:26:17,020 | INFO | nioEventLoopGroupCloseable-3-4 | ORanChangeNotificationListener | 219 - org.onap.ccsdk.features.sdnr.wt.sdnr-wt-devicemanager-o-ran-sc-oran-provider - 1.3.0.SNAPSHOT | - | Edit list size is 1
2021-11-11T11:26:17,020 | INFO | nioEventLoopGroupCloseable-3-4 | ORanChangeNotificationListener | 219 - org.onap.ccsdk.features.sdnr.wt.sdnr-wt-devicemanager-o-ran-sc-oran-provider - 1.3.0.SNAPSHOT | - | onNetconfConfigChange (2) Edit{operation=Replace, augmentation=[]}
In the case of "instance-identifier", the message reported is -
2021-11-11T11:26:17,018 | TRACE | nioEventLoopGroupCloseable-3-4 | AbstractCodecFactory | 394 - org.opendaylight.yangtools.yang-data-util - 6.0.6 | - | Type BaseInstanceIdentifierType{name=(urn:ietf:params:xml:ns:yang:1)instance-identifier, status=CURRENT, requireInstance=false} miss simple org.opendaylight.yangtools.yang.data.codec.xml.XmlStringInstanceIdentifierCodec@64340942
The last 3 lines are debug messages from the ORAN devicemanager where we do the following -
log.info("onNetconfConfigChange (1) {}", notification.toString()); StringBuffer sb = new StringBuffer(); List<Edit> editList = notification.nonnullEdit(); log.info("Edit list size is {}", editList.size()); for (Edit edit : editList) { if (sb.length() > 0) { sb.append(", "); } sb.append(edit); InstanceIdentifier<?> target = edit.getTarget(); if (target != null) { log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); for (PathArgument pa : target.getPathArguments()) { log.info("PathArgument {} Type {}", pa, pa.getType().getFields()); } // Write to database } } log.info("onNetconfConfigChange (2) {}", sb);
I am not certain if it is already resolved in the later versions. |
| Comments |
| Comment by Ravi Pendurty [ 12/Nov/21 ] |
|
highstreetherbert, FYI.. |
| Comment by Herbert Eiselt [ 12/Nov/21 ] |
|
Not clear if it is a netconf or yangtools problem .. could be a missing configuration of yangtools by netconf. The problem seems to be here: <target xmlns:hw="urn:ietf:params:xml:ns:yang:ietf-hardware">/hw:hardware/component[name='chassis-fan0']/alias</target>
For information: alex.stancu |
| Comment by Robert Varga [ 14/Nov/21 ] |
|
The instance identifier seems very much invalid as per https://datatracker.ietf.org/doc/html/rfc6020#section-9.13.5 – it is missing prefixes for component, name and alias – hence those would be resolved as part of ietf-netconf-notifications |
| Comment by Robert Varga [ 14/Nov/21 ] |
|
The problem is actually that you are trying to do this with Binding APIs: the instance identifier would refer (were it properly encoded) to a leaf, YangInstanceIdentifiers pointing to leaf nodes are not representable as InstanceIdentifer (what would be DataObject class?). Switch to DOM APIs and you will be fine. |
| Comment by Ravi Pendurty [ 14/Nov/21 ] |
|
As per - https://datatracker.ietf.org/doc/html/rfc7951#section-6.11 - the provided instance identifier seems to be OK. Are the 2 references (the one provided by you above and the one in this comment) contradictory? |
| Comment by Robert Varga [ 14/Nov/21 ] |
|
They are not contradictory at all. RFC6020/RFC7950 define the encoding in XML, RFC7951 defines the encoding in JSON. Since we are talking about NETCONF here, RFC7951 is simply irrelevant. |
| Comment by Ravi Pendurty [ 14/Nov/21 ] |
|
Thanks a lot Robert. Appreciate your inputs on this issue. |