Closed mrmouro closed 7 years ago
Hi,
I have tested it and looks fine except what I mentioned before, which function should I use in netopeer-cli for getting the reply? If I always use nc_reply_get_data_custom()
then it generally works, but it adds the top-level element <data>
into standard RPC data replies. You are free to solve this however you want, but my idea is to modify nc_reply_get_data()
so that when it sees this top-level element <data>
in the namespace urn:ietf:params:xml:ns:netconf:base:1.0
then it skips it. This way all the original functionality of the function will remain and there won't even be any changes in the netopeer-cli required.
Regards, Michal
Hi, I've removed completely the nc_reply_get_data_custom() method. Now nc_reply_get_data() should handle both data and custom replies (node or list elements). The only problem i foresee, is if the user-defined rpc has a data element defined as an element of the rpc output. In this case nc_reply_get_data will return a subset of the correct result:
rpc activate-software-image {
input {
leaf image-name {
type string;
}
}
output {
container status {
leaf data {
type string;
}
}
}
}
result:
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data> The image acmefw-2.3 is being installed.</data>
</rpc-reply>
instead of
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<status>
<data>The image acmefw-2.3 is being installed.</data>
</status>
</rpc-reply>
Yes, perhaps I should check the namespace of the data element. If it is not BASE:1 then it is a custom reply. I'll have a look at this.
Hi again, hope this is all good now.
best regards Joao
Hi Joao, now it all seems fine, thanks.
Regards, Michal
Following up on #220.
Added nc_reply_get_data_custom method to retrieve the stringified content of a rpc-reply with custom data.