[sysrepo-devel] not able to edit-config a choice object
Lukas Macko -X (lmacko - PANTHEON TECHNOLOGIES at Cisco)
lmacko at cisco.com
Mon Oct 10 14:14:34 UTC 2016
Hi Joan,
the choice element is redundant in the edit-config request. It should be like:
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="43"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<target>
<candidate/>
</target>
<config> <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
<sys:location>Florida</sys:location>
<system-config xmlns="http://www.abc.com/ns/abc-sysrem" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
<unit-name>one</unit-name>
<mep-id>43</mep-id>
</system-config>
</sys:system>
</config>
</edit-config>
</rpc>
Regards,
Lukas
> -----Original Message-----
> From: sysrepo-devel [mailto:sysrepo-devel-bounces at sysrepo.org] On Behalf Of
> Joan Landry
> Sent: Monday, October 10, 2016 2:55 PM
> To: sysrepo-devel at sysrepo.org
> Subject: [sysrepo-devel] not able to edit-config a choice object
>
> Is the choice option supported?
>
> I get an error when I try to edit-config an element that is defined as a choice.
> Any info on this would be greatly appreciated.
>
> This is a sample yang model with a choice element defined:
> grouping target-address-group {
> choice address-type {
> case mac-address {
> leaf mac-address {
> type yang:mac-address;
> }
> }
> case mep-id {
> leaf mep-id {
> type uint16;
> }
> }
> }
> }
>
> augment "/sys:system" {
> container system-config {
> leaf unit-name {
> type string;
> }
> uses target-address-group;
> }
> }
> }
>
> This is the debug from Netopeer:
>
> netopeer2-server[22758]: Session 1: received message:
> <?xml version="1.0" encoding="UTF-8"?>
> <rpc message-id="43"
> xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> <edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> <target>
> <candidate/>
> </target>
> <config> <sys:system xmlns:sys="urn:ietf:params:xml:ns:yang:ietf-system"
> xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
> <sys:location>Florida</sys:location>
> <system-config xmlns="http://www.abc.com/ns/abc-sysrem"
> xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="merge">
> <unit-name>one</unit-name>
> <address-type>
> <mep-id>43</mep-id>
> </address-type>
> </system-config>
> </sys:system>
> </config>
> </edit-config>
> </rpc>
>
> netopeer2-server[22758]: XPATH: eval_node_test parsed NameTest[1]
> netopeer2-server[22758]: XPATH: eval_relative_location_path parsed
> Operator(Path)[25]
> netopeer2-server[22758]: DICT: inserting (refcount) "config"
> netopeer2-server[22758]: XPATH: eval_node_test parsed NameTest[26]
> netopeer2-server[22758]: Unknown element "address-type". (/ietf-
> system:system/abc-system:system-config)
> netopeer2-server[22758]: DICT: inserting "/ietf-system:system/abc-
> system:system-config" with collision
> netopeer2-server[22758]: DICT: inserting (refcount) "An unexpected element is
> present."
> netopeer2-server[22758]: DICT: inserting "en" with collision
> netopeer2-server[22758]: DICT: inserting "Unknown element "address-type"."
> with collision
> netopeer2-server[22758]: DICT: inserting "en" with collision
> netopeer2-server[22758]: Session 1: sending message:
>
> #391
>
> [2016/10/10 08:52:04.520148, 3] ssh_socket_unbuffered_write: Enabling
> POLLOUT for socket
> [2016/10/10 08:52:04.520374, 3] packet_send2: packet: wrote
> [len=28,padding=12,comp=15,payload=15]
> [2016/10/10 08:52:04.520529, 3] channel_write_common: channel_write
> wrote 6 bytes
> netopeer2-server[22758]: Session 1: sending message:
> <rpc-reply message-id="43"
> xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><rpc-error><error-
> type>protocol</error-type><error-tag>unknown-element</error-tag><error-
> severity>error</error-severity><error-message xml:lang="en">Unknown
> element "address-type".</error-message><error-info><bad-element>/ietf-
> system:system/abc-system:system-config</bad-element></error-info></rpc-
> error></rpc-reply>
> _______________________________________________
> sysrepo-devel mailing list
> sysrepo-devel at sysrepo.org
> http://lists.sysrepo.org/listinfo/sysrepo-devel
More information about the sysrepo-devel
mailing list