[NETCONF-658] RFC 8040 "fields" query fails if requested subelement missing Created: 04/Mar/20  Updated: 06/Mar/20  Resolved: 06/Mar/20

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

Type: Bug Priority: High
Reporter: Allan Clarke Assignee: Allan Clarke
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 1 day, 6 hours
Original Estimate: Not Specified

Attachments: File NETCONF-658.postman_collection.json     Zip Archive netconf-658b.zip    

 Description   

The RFC8040 implementation is too brittle to support real-word filtering situations. In this case, we're trying to retrieve the active alarm list from a set of components (logical-termination-points - LTPs).
The subelement that contains the alarm list does not exist in all LTPs, and if it is missing from any of the LTPs the entire query fails with error:
{
"errors": {
"error": [

{ "error-message": "Child ethernet-container-pac node missing in logical-termination-point", "error-tag": "invalid-value", "error-type": "protocol" }

]
}
}

Query:
[http://controller:8181/rests/data/
about:blank]network-topology:network-topology/topology=topology-netconf/node=siae_alcplus2e_12969/yang-ext:mount/
core-model-1-4:control-construct?content=nonconfig
&fields=logical-termination-point(local-id;layer-protocol(administrative-state);ethernet-container-2-0:ethernet-container-pac(ethernet-container-current-problems))
Partial tree model:
module: ethernet-container-2-0
augment /core-model:control-construct/core-model:logical-termination-point/core-model:layer-protocol:
+--rw ethernet-container-pac
.
.
.
+--ro ethernet-container-current-problems

+--ro current-problem-list* [sequence-number]
+--ro problem-name? string
+--ro sequence-number int16
+--ro timestamp? yang:date-and-time
+--ro problem-severity? severity-type
.
.
.

Expected behavior:
If a particular subelement doesn’t exist, simply don’t return it.



 Comments   
Comment by Allan Clarke [ 04/Mar/20 ]

https://jira.opendaylight.org/browse/NETCONF-657 (useful resources and links in the comments)

Comment by Allan Clarke [ 04/Mar/20 ]

Workflow...

  1. Create YANG models suitable for reproduction and confirm with reporter (DONE)
  2. Confirm buggy behavior (IN-PROGRESS)
  3. Review NETCONF code around defect
  4. Propose change/design
  5. Implement unit test showing defect
  6. Implement code change
  7. Get QA sign off on feature coverage
  8. Get 3rd party acceptance of implementation (see original reporter, Frank Sandoval @ Lumina)
  9. PR and review process
Comment by Allan Clarke [ 04/Mar/20 ]

Resources...
https://tools.ietf.org/html/rfc8040#section-1.1.6 (RESTCONF)
https://tools.ietf.org/html/draft-ietf-netconf-yang-patch-14 (Yang Patch)
https://docs.opendaylight.org/en/latest/developer-guide/yang-tools.html (YangTools)
https://tools.ietf.org/html/rfc7950 (Yang)

Comment by Allan Clarke [ 04/Mar/20 ]


karaf> feature:install odl-restconf odl-netconf-topology odl-restconf-nb-rfc8040 odl-netconf-connector-all

Comment by Allan Clarke [ 06/Mar/20 ]

Ran testtool loaded with directory of attached Yang models...

echo "Starting testtool (port=17830,cred=admin/admin) using extra schemas..."
java -jar ./netconf/tools/netconf-testtool/target/netconf-testtool-*-SNAPSHOT-executable.jar  --device-count 1  --schemas-dir ./extra_schemas/netconf-658b --md-sal true
Comment by Allan Clarke [ 06/Mar/20 ]

Use the attached Postman collection to mount testtool as device, create content, apply query

Comment by Allan Clarke [ 06/Mar/20 ]

So I got the back haul model 3 Yang files loaded into testtool (acting as a device).

I made minor modifications by commenting out some of the model so my payloads were simpler.

I created an instance in the device and the read gave this, which looks fine to me:

<control-construct xmlns="urn:onf:yang:core-model-1-4">

<logical-termination-point>

<uuid>xyz</uuid>

<layer-protocol>

<local-id>foobar</local-id>

<ethernet-container-pac xmlns="urn:onf:yang:ethernet-container-2-0">

<ethernet-container-current-problems>

<current-problem-list>

<sequence-number>3</sequence-number>

<problem-severity>SEVERITY_TYPE_MINOR</problem-severity>

<timestamp>2020-03-06T11:00:02Z</timestamp>

</current-problem-list>

<current-problem-list>

<sequence-number>2</sequence-number>

<timestamp>2020-03-06T11:00:01Z</timestamp>

<problem-name>bar</problem-name>

</current-problem-list>

<current-problem-list>

<sequence-number>1</sequence-number>

<problem-severity>SEVERITY_TYPE_CRITICAL</problem-severity>

<timestamp>2020-03-06T11:00:00Z</timestamp>

<problem-name>foo</problem-name>

</current-problem-list>

</ethernet-container-current-problems>

</ethernet-container-pac>

</layer-protocol>

</logical-termination-point>

</control-construct>

I ran the original query URL (ignore the missing content type) from the JIRA issue, shown below:

http://127.0.0.1:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=testtool/yang-ext:mount/core-model-1-4:control-construct?fields=logical-termination-point(local-id;layer-protocol(administrative-state);ethernet-container-2-0:ethernet-container-pac(ethernet-container-current-problems))

It resulted in the following error:

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">

<error>

<error-message>Child ethernet-container-pac node missing in logical-termination-point</error-message>

<error-tag>invalid-value</error-tag>

<error-type>protocol</error-type>

</error>

</errors>

I think that URL is not compatible with the Yang model. I changed the query URL to be:

http://127.0.0.1:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=testtool/yang-ext:mount/core-model-1-4:control-construct?fields=logical-termination-point(local-id;layer-protocol(administrative-state;ethernet-container-2-0:ethernet-container-pac(ethernet-container-current-problems)))

So this resulted in a successful query, yielding:

<control-construct xmlns="urn:onf:yang:core-model-1-4">

<logical-termination-point>

<layer-protocol>

<ethernet-container-pac xmlns="urn:onf:yang:ethernet-container-2-0">

<ethernet-container-current-problems>

<current-problem-list>

<sequence-number>3</sequence-number>

<problem-severity>SEVERITY_TYPE_MINOR</problem-severity>

<timestamp>2020-03-06T11:00:02Z</timestamp>

</current-problem-list>

<current-problem-list>

<sequence-number>2</sequence-number>

<timestamp>2020-03-06T11:00:01Z</timestamp>

<problem-name>bar</problem-name>

</current-problem-list>

<current-problem-list>

<sequence-number>1</sequence-number>

<problem-severity>SEVERITY_TYPE_CRITICAL</problem-severity>

<timestamp>2020-03-06T11:00:00Z</timestamp>

<problem-name>foo</problem-name>

</current-problem-list>

</ethernet-container-current-problems>

</ethernet-container-pac>

</layer-protocol>

</logical-termination-point>

</control-construct>

So the original URL shows an error that is really more of a “typo” in the query.

Comment by Allan Clarke [ 06/Mar/20 ]

Not a bug. User error.

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