Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namespace prefix nc is not supported in full #154

Closed
dima1308 opened this issue Nov 29, 2020 · 24 comments
Closed

namespace prefix nc is not supported in full #154

dima1308 opened this issue Nov 29, 2020 · 24 comments
Labels

Comments

@dima1308
Copy link

Hi @olofhagsand
It looks the #143 issue is not solved in full.
Please see attached two logs
good-no-ns.txt
bad-with-ns.txt
The good-no-ns.txt file shows the test result when a namespace is not allowed.
The bad-with-ns.txt file shows the test result when a namespace is allowed and we get a timeout.
Can you please compare both files? You will see that some netconf messages have ns namespace and some messages don't have it.

@olofhagsand
Copy link
Member

olofhagsand commented Nov 30, 2020

bad:

<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:3f90651b-25a7-4ebf-97bb-8c4af5f871bc"> <nc:edit-config><nc:target><nc:candidate/></nc:target><config>

config lacks prefix config -> nc:config
Or do has in good, use default prefix:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:03ad5f23-b03b-4a3c-927f-37f473ad92bc"><edit-config><target><candidate/></target><config>

@olofhagsand
Copy link
Member

I also see: "Could not find 'message-id' attribute in <rpc-reply>"

@dima1308
Copy link
Author

  1. In good, I configured the client not to use prefix at all.
  2. I think, the "Could not find 'message-id' attribute in <rpc-reply>" error caused by the previous bad-element error.

@olofhagsand
Copy link
Member

In good, I configured the client not to use prefix at all.

I am unsure what you mean?
(1) In "bad", ^the <config> tag lacks a namespace prefix. Is this something generated by clixon? I thought it was generated by the external tool and clixon reacts with an error message, that in turn (2) seem to get an error from the tool in that it does not have a message-id attribute.
I am looking at (2) adding message-id in errors - which I can confirm is an clixon issue.
But I dont know what to do about (1) - it seems generated outside of clixon. Please inform.

@dima1308
Copy link
Author

dima1308 commented Nov 30, 2020

<config> is coming from my sample code. Should it be changed to <nc:config>?

@olofhagsand
Copy link
Member

Yes, or set a default namespace as , in the current setup there is no default namespace, therefore namespace is void.

@dima1308
Copy link
Author

dima1308 commented Nov 30, 2020

I tried to use XML like this - it does not work with nc namespace... What I did wrong?

<nc:config>
   <ip xmlns="http://siklu.com/yang/tg/ip">
      <ipv4>
         <address>
            <ip>2.2.2.2</ip>
         </address>
      </ipv4>
   </ip>
</nc:config>

@olofhagsand
Copy link
Member

The "nc" prefix must be declared somewhere. ie as <nc:rpc xmlns:nc="..."
The base reference for all this is https://www.w3.org/TR/2009/REC-xml-names-20091208/

olofhagsand added a commit that referenced this issue Dec 1, 2020
  * See [namespace prefix nc is not supported in full #154](#154)
* Removed mandatory loading of clixon_restconf.yang
@olofhagsand
Copy link
Member

Added message-id:s in replies according to fix above.
@dima1308: is there anything remaining in the ticket, or can it be closed?

@dima1308
Copy link
Author

dima1308 commented Dec 1, 2020

@olofhagsand thanks for the fast response. Please let me time to test it with the latest master

@dima1308
Copy link
Author

dima1308 commented Dec 1, 2020

@olofhagsand I'm using the latest CLIXON master trying to send the following XML:

<nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
   <ip xmlns="http://siklu.com/yang/tg/ip">
      <ipv4>
         <address>
            <ip>2.2.2.2</ip>
         </address>
      </ipv4>
   </ip>
</nc:config>

I got an error - please see attached log.
new_try.txt
This is something I did wrong or it is a bug in CLIXON?

@olofhagsand
Copy link
Member

<?xml version="1.0" encoding="UTF-8"?><nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:44f66517-6f26-4d43-aa25-92838f700528"><nc:edit-config><nc:target><nc:candidate/></nc:target><nc:config>
   <ip xmlns="http://siklu.com/yang/tg/ip">
      <ipv4>
         <address>
            <ip>2.2.2.2</ip>
         </address>
      </ipv4>
   </ip>
</nc:config></nc:edit-config></nc:rpc>]]>]]>

The above seems ok, it may be a clixon problem, but I need to check.
Please try a default namespace, eg:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:44f66517-6f26-4d43-aa25-92838f700528"><edit-config><target><candidate/></target><config>
  ...

@dima1308
Copy link
Author

dima1308 commented Dec 1, 2020

Please see attached 2 additional tries I did
try1.txt
try2.txt

olofhagsand added a commit that referenced this issue Dec 2, 2020
  * edit-config "config" parameter did not work with prefix other than null
@olofhagsand
Copy link
Member

Added a patch to fix the problem of nc:config appearing with tag other than null/default.
Hope this fixes your issues.

@dima1308
Copy link
Author

dima1308 commented Dec 2, 2020

I tried the latest version. I can send XML with namespace, please see the example below

<nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
   <ip xmlns="http://siklu.com/yang/tg/ip">
      <ipv4>
         <address>
            <ip>2.2.2.2</ip>
         </address>
      </ipv4>
   </ip>
</nc:config>

If I remove the namespace from config, it does not work. Is it an expected result?

@olofhagsand
Copy link
Member

Yes, because there is no default namespace declared:
there is no xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" in that context.

@dima1308
Copy link
Author

dima1308 commented Dec 2, 2020

@olofhagsand thanks for the fast response. Tomorrow I plan to run more tests with the latest CLIXON master and will update you.

@dima1308
Copy link
Author

dima1308 commented Dec 2, 2020

I tried to use namespace urn:ietf:params:xml:ns:netconf:base:1.1 - it does not work.
See example XML and attached log
failure1.1.txt

<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.1">
   <ip xmlns="http://siklu.com/yang/tg/ip">
      <ipv4>
         <address>
            <ip>2.2.2.2</ip>
         </address>
      </ipv4>
   </ip>
</config>

Is it expected result?

@olofhagsand
Copy link
Member

I hope it works with :1.0? I dont recognize :1.1, where is that defined?

@dima1308
Copy link
Author

dima1308 commented Dec 3, 2020

yes, 1.0 is working well. The client I use support 1.1. So, I expect that the command will work. Am I missing something?

@olofhagsand
Copy link
Member

I have seen examples using urn:ietf:params:xml:ns:netconf:base:1.1
But I have seen no formal documents using it, therefore it is not supported in clixon.
You could help by finding a definition of urn:ietf:params:xml:ns:netconf:base:1.1.
I may have missed it.

@dima1308
Copy link
Author

dima1308 commented Dec 3, 2020

I can try to run netconf requests against the 1.1 device and see which commands are transmitted. Will it help?

@olofhagsand
Copy link
Member

Sure, to see differences from 1.0.
Maybe it would help even more if you could find some docs or references on 1.1

@dima1308
Copy link
Author

dima1308 commented Dec 3, 2020

OK, I will try. I will close this bug.
When I will have info about 1.1 - I will update you.

@dima1308 dima1308 closed this as completed Dec 3, 2020
s-bauer added a commit to s-bauer/clixon that referenced this issue Dec 13, 2020
The "filter" node was not detected when an a namespace was used. The fix is similar to clicon@d045e8a and related to bug clicon#154 clicon#143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants