nc operation tag is lost when provide list of instances(list of entities)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2018 05:19 AM
Hi !
I noticed pretty strange during combination of this topics:
- http://ydk.cisco.com/py/docs/guides/crud_guide.html#id1
When I try to execute this piece of code everything works fine, lets mention this snippet as reference one:
(exact code is in filter_in_middle.standalone_instance.py and respective log in filter_in_middle.standalone_instance.log)
- configuration = junos_configuration.Configuration()
- ge000 = configuration.interfaces.Interface()
- ge000.name = "ge-0/0/0"
- ge000.description = "test description"
- configuration.interfaces.interface.append(ge000)
- ge000unit0 = ge000.Unit()
- ge000unit0.name = "0"
- ge000.unit.append(ge000unit0)
- netconf = NetconfService()
- netconf.lock(provider, Datastore.candidate)
- ge000.yfilter = YFilter.merge
- netconf.edit_config(provider, Datastore.candidate, configuration)
- netconf.commit(provider)
- netconf.unlock(provider, Datastore.candidate)
When I try to change
- netconf.edit_config(provider, Datastore.candidate, configuration)
to
- netconf.edit_config(provider, Datastore.candidate, [ configuration ] )
It is still OK. I can see nc:operation tag over ge-0/0/0 xml block
(exact code is in filter_in_middle.instance_inside_list.py and respective log in filter_in_middle.instance_inside_list.log)
When change
- ge000.yfilter = YFilter.merge
- netconf.edit_config(provider, Datastore.candidate, configuration)
to
- configuration.yfilter = YFilter.merge
- netconf.edit_config(provider, Datastore.candidate, configuration)
nc:operation tag moved to to very top of configuration part payload, actually as expected
(exact code is in filter_on_top.standalone_instance.py and respective log in filter_on_top.standalone_instance.log)
However when configuration is changed from
- ge000.yfilter = YFilter.merge
- netconf.edit_config(provider, Datastore.candidate, configuration)
to
- configuration.yfilter = YFilter.merge
- netconf.edit_config(provider, Datastore.candidate, [ configuration ])
nc:operation tag disappeared
(exact code is in filter_on_top.instance_inside_list.py and respective log in filter_on_top.instance_inside_list.log)
Q: Is that expected behavior, that, when I put a tag to very topmost instance of configuration instance hierarchy, and provide that instance to netconf.service as part of list-type argument, a tag disappears ?
Thanks !
- Labels:
-
YANG Development Kit (YDK)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2018 10:00 AM
The YFilter object is only meant to be used on child elements of the <config> node. This corresponds to the edit-config operation attribute as specified in the RFC6241

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2018 12:37 PM
I agree , but I am afraid my question was not very clear
Let mt rephrase
Why this happens:
When I have such configuration string
netconf.edit_config(provider, Datastore.candidate, configuration)
nc operation tag is present under configuration node (which is child of config node)
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
<edit-config>
<target>
<candidate/>
</target>
<config>
<configuration xmlns="http://yang.juniper.net/yang/1.1/jc" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge"> ## nc:operation tag is here
<interfaces>
<interface>
<name>ge-0/0/0</name>
<unit>
<name>0</name>
</unit>
</interface>
</interfaces>
</configuration>
</config>
</edit-config>
</rpc>
But when I put entity (root configuration object) inside list
netconf.edit_config(provider, Datastore.candidate, [ configuration] )
nc operation tag is not present under configuration node (which is child of config node)
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
<edit-config>
<target>
<candidate/>
</target>
<config>
<configuration xmlns="http://yang.juniper.net/yang/1.1/jc" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" "> ## nc:operation tag is not here
<interfaces>
<interface>
<name>ge-0/0/0</name>
<unit>
<name>0</name>
</unit>
</interface>
</interfaces>
</configuration>
</config>
</edit-config>
</rpc>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 05:02 PM
