cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
795
Views
1
Helpful
3
Replies

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

aligang1988
Level 4
Level 4

Hi !

I noticed pretty strange during combination of this topics:

- http://ydk.cisco.com/py/docs/guides/crud_guide.html#id1

- http://ydk.cisco.com/py/docs/api/services/netconf_service.html#ydk.services.NetconfService.edit_config

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)

  1. configuration = junos_configuration.Configuration()
  2. ge000 = configuration.interfaces.Interface()
  3. ge000.name = "ge-0/0/0"
  4. ge000.description = "test description"
  5. configuration.interfaces.interface.append(ge000)
  6. ge000unit0 = ge000.Unit()
  7. ge000unit0.name = "0"
  8. ge000.unit.append(ge000unit0)
  9. netconf = NetconfService()
  10. netconf.lock(provider, Datastore.candidate)
  11. ge000.yfilter = YFilter.merge
  12. netconf.edit_config(provider, Datastore.candidate, configuration)
  13. netconf.commit(provider)
  14. netconf.unlock(provider, Datastore.candidate)



When I try to change

  1. netconf.edit_config(provider, Datastore.candidate, configuration)

to

  1. 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

  1. ge000.yfilter = YFilter.merge
  2. netconf.edit_config(provider, Datastore.candidate, configuration)

to

  1. configuration.yfilter = YFilter.merge
  2. 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

  1. ge000.yfilter = YFilter.merge
  2. netconf.edit_config(provider, Datastore.candidate, configuration)

to

  1. configuration.yfilter = YFilter.merge
  2. 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 !

3 Replies 3

abhirame
Cisco Employee
Cisco Employee

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

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>


Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: