04-08-2019 05:25 AM
Here is code snippet on what i am trying
>>> from ydk.path import NetconfSession
>>> from ydk.path import Codec
>>> from ydk.types import EncodingFormat
>>> session = NetconfSession('10.64.86.95', 'lab', 'lab')
>>> root = session.get_root_schema()
>>> voice = root.create_datanode("Cisco-IOS-XE-native:native" , "")
>>> gw = voice.create_datanode("ios-voice:voice/vrf", "1") -----> ios-voice is prefix of another module which is augumented in native. The container voice and it leaf vrf are a grouping in module Cisco-IOS-XE-voice (prefix:ios-voice).
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: YClientError: Could not send payload
whenever i want to create node of leafs or container which are augumented from another module it reports "RuntimeError: YClientError: Could not send payload"
while if i create node of leaf from the same module native , then it gets created .
>>> gw = voice.create_datanode("user-name/name", "test")
Is there anything i am need to take care to create nodes of leafs which are from another module.
Solved! Go to Solution.
04-08-2019 10:07 AM
Thanks Abhirame for looking into this,
here is log with debug level enable
>>> gw = voice.create_datanode("ios-voice:voice/vrf", "1")
2019-04-08 16:57:23,578 - ydk - DEBUG - Populating schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,578 - ydk - DEBUG - Populating schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,612 - ydk - DEBUG - Looking to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,612 - ydk - DEBUG - Looking to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Ready to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Ready to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules from 'ios-voice:voice/vrf'
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules from 'ios-voice:voice/vrf'
2019-04-08 16:57:23,615 - ydk - DEBUG - Loading module 'ios-voice', revision ''
2019-04-08 16:57:23,615 - ydk - DEBUG - Loading module 'ios-voice', revision ''
2019-04-08 16:57:23,616 - ydk - DEBUG - Getting module 'ios-voice' submodule 'none'
2019-04-08 16:57:23,616 - ydk - DEBUG - Getting module 'ios-voice' submodule 'none'
2019-04-08 16:57:23,616 - ydk - DEBUG - Looking for file in folder: /root/.ydk/10.64.86.95_830
2019-04-08 16:57:23,616 - ydk - DEBUG - Looking for file in folder: /root/.ydk/10.64.86.95_830
2019-04-08 16:57:23,617 - ydk - DEBUG - Opening file '/root/.ydk/10.64.86.95_830/ios-voice.yang'
2019-04-08 16:57:23,617 - ydk - DEBUG - Opening file '/root/.ydk/10.64.86.95_830/ios-voice.yang'
2019-04-08 16:57:23,618 - ydk - DEBUG - Path found with rev: false. Path without rev: false
2019-04-08 16:57:23,618 - ydk - DEBUG - Path found with rev: false. Path without rev: false
2019-04-08 16:57:23,619 - ydk - DEBUG - Getting module 'ios-voice' using get-schema
2019-04-08 16:57:23,619 - ydk - DEBUG - Getting module 'ios-voice' using get-schema
2019-04-08 16:57:23,622 - ydk - DEBUG - Trace: Missing message-id in rpc.
2019-04-08 16:57:23,622 - ydk - DEBUG - Trace: Missing message-id in rpc.
2019-04-08 16:57:23,624 - ydk - DEBUG - Netconf SSH Client: sending rpc
2019-04-08 16:57:23,624 - ydk - DEBUG - Netconf SSH Client: sending rpc
2019-04-08 16:57:23,624 - ydk - ERROR - Connection error occurred: Invalid session to send <rpc>.
2019-04-08 16:57:23,624 - ydk - ERROR - Connection error occurred: Invalid session to send <rpc>.
2019-04-08 16:57:23,625 - ydk - ERROR - Could not send payload <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ios-voice</identifier><format>yang</format></get-schema></rpc>
2019-04-08 16:57:23,625 - ydk - ERROR - Could not send payload <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ios-voice</identifier><format>yang</format></get-schema></rpc>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: YClientError: Could not send payload
I found the issue as it is checking for Module name and i was using module prefix . Once i changed ios-voice to module name which is 'Cisco-IOS-XE-voice:voice/vrf ' it is able to create the node.
Thanks for the pointer .
regards
jayaseelan
04-08-2019 08:55 AM
Can you please enable logging (see this) and post the logs?
04-08-2019 10:07 AM
Thanks Abhirame for looking into this,
here is log with debug level enable
>>> gw = voice.create_datanode("ios-voice:voice/vrf", "1")
2019-04-08 16:57:23,578 - ydk - DEBUG - Populating schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,578 - ydk - DEBUG - Populating schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,612 - ydk - DEBUG - Looking to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,612 - ydk - DEBUG - Looking to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Ready to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Ready to populate schemas for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules for ios-voice:voice/vrf
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules from 'ios-voice:voice/vrf'
2019-04-08 16:57:23,613 - ydk - DEBUG - Getting new modules from 'ios-voice:voice/vrf'
2019-04-08 16:57:23,615 - ydk - DEBUG - Loading module 'ios-voice', revision ''
2019-04-08 16:57:23,615 - ydk - DEBUG - Loading module 'ios-voice', revision ''
2019-04-08 16:57:23,616 - ydk - DEBUG - Getting module 'ios-voice' submodule 'none'
2019-04-08 16:57:23,616 - ydk - DEBUG - Getting module 'ios-voice' submodule 'none'
2019-04-08 16:57:23,616 - ydk - DEBUG - Looking for file in folder: /root/.ydk/10.64.86.95_830
2019-04-08 16:57:23,616 - ydk - DEBUG - Looking for file in folder: /root/.ydk/10.64.86.95_830
2019-04-08 16:57:23,617 - ydk - DEBUG - Opening file '/root/.ydk/10.64.86.95_830/ios-voice.yang'
2019-04-08 16:57:23,617 - ydk - DEBUG - Opening file '/root/.ydk/10.64.86.95_830/ios-voice.yang'
2019-04-08 16:57:23,618 - ydk - DEBUG - Path found with rev: false. Path without rev: false
2019-04-08 16:57:23,618 - ydk - DEBUG - Path found with rev: false. Path without rev: false
2019-04-08 16:57:23,619 - ydk - DEBUG - Getting module 'ios-voice' using get-schema
2019-04-08 16:57:23,619 - ydk - DEBUG - Getting module 'ios-voice' using get-schema
2019-04-08 16:57:23,622 - ydk - DEBUG - Trace: Missing message-id in rpc.
2019-04-08 16:57:23,622 - ydk - DEBUG - Trace: Missing message-id in rpc.
2019-04-08 16:57:23,624 - ydk - DEBUG - Netconf SSH Client: sending rpc
2019-04-08 16:57:23,624 - ydk - DEBUG - Netconf SSH Client: sending rpc
2019-04-08 16:57:23,624 - ydk - ERROR - Connection error occurred: Invalid session to send <rpc>.
2019-04-08 16:57:23,624 - ydk - ERROR - Connection error occurred: Invalid session to send <rpc>.
2019-04-08 16:57:23,625 - ydk - ERROR - Could not send payload <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ios-voice</identifier><format>yang</format></get-schema></rpc>
2019-04-08 16:57:23,625 - ydk - ERROR - Could not send payload <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ios-voice</identifier><format>yang</format></get-schema></rpc>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: YClientError: Could not send payload
I found the issue as it is checking for Module name and i was using module prefix . Once i changed ios-voice to module name which is 'Cisco-IOS-XE-voice:voice/vrf ' it is able to create the node.
Thanks for the pointer .
regards
jayaseelan
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide