<div dir="ltr">Would this also work ?<div><br></div><div><div><?xml version=\"1.0\" encoding=\"UTF-8\"?></div><div><rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"></div>

<div>    <edit-config></div><div>        <target></div><div>            <running/></div><div>        </target></div><div>        <config></div><div>            <ElementA></div><div>                <elementAId>1</elementAId></div>

<div>                <elementB></div><div>                    <elementB>1</elementB></div><div>                    <elementC operation=\"delete\"></div><div>                        <elementCId>6</elementCId></div>

<div>                    </elementC></div><div>                </elementB></div><div>            </ElementA></div><div>        </config></div><div>    </edit-config></div><div></rpc></div>

<div> </div></div><div><br></div><div> i.e. without the 'xc' prefix (the netconf base namespace is the default anyway). It's probably up to your netconf server if it can handle that or not.</div><div><br></div>
<div>Ideally it should be something like:</div><div><br></div>
<div><div><?xml version=\"1.0\" encoding=\"UTF-8\"?></div><div><rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"></div><div>    <edit-config></div>

<div>        <target></div><div>            <running/></div><div>        </target></div><div>        <config></div><div>            <ElementA xmlns=\"mynamespace\" xmlns:xc=\"urn:ietf:params:xml:ns:netconf:base:1.0\"></div>

<div>                <elementAId>1</elementAId></div><div>                <elementB></div><div>                    <elementB>1</elementB></div><div>                    <elementC xc:operation=\"delete\"></div>

<div>                        <elementCId>6</elementCId></div><div>                    </elementC></div><div>                </elementB></div><div>            </ElementA></div><div>        </config></div>

<div>    </edit-config></div><div></rpc></div></div><div><br></div><div>where "mynamespace" defines your own config data. This can be expressed in the erlang term like this:</div><div><br></div><div>
<div>Config = {'ElementA',[{xmlns,"mynamespace"},{'xmlns:xc',"urn:ietf:params:xml:ns:netconf:base:1.0"}],</div><div>                     [{elementAId,[],["1"]},</div><div>                      {elementB,[],</div>
<div>                                [{elementB,[],["1"]},</div><div>                                 {elementC,[{'xc:operation',"delete"}],</div><div>                                           [{elementCId,[],["6"]}]}]}]},</div>
</div><div><br></div><div>(but you can probably skip the whole "mynamespace" business and just add the {'xmlns:xc',..} part.</div><div><br></div><div>/siri</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2014-03-11 11:15 GMT+01:00 Alexander Poulikakos <span dir="ltr"><<a href="mailto:alexander.poulikakos@ericsson.com" target="_blank">alexander.poulikakos@ericsson.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="color:#1f497d">Hi erlang users<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">I use the ct_netconfc client, from within Common Test.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">I’m communicating with a System Under Test (SUT), with the NETCONF protocol and I want to send a “delete” operation to delete some object. Example of my code:<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">Config = {'ElementA',[],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                     [{elementAId,[],["1"]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                      {elementB,[],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                                [{elementB,[],["1"]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                                 {elementC,[{'xc:operation',"delete"}],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                                           [{elementCId,[],["6"]}]}]}]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">{ok, Client}=ct_netconfc:open([{ssh, "some-ip-address"}, {port, some-port}, {user, "some-username"},{password,"some-password"}]),<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">ct_netconfc:edit_config(Client, running, Config),<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">Which gives me the following error message:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">{error,[{'error-type',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                      ["protocol"]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        {'error-tag',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                     ["operation-failed"]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        {'error-severity',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                          ["error"]},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        {'error-message',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"},<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                          {'xml:lang',"en"}],<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                         ["Malformed XML!!!"]}]}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">And the actual XML document (after processed by ct_netconfc) sent to my SUT looks as follow:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><?xml version=\"1.0\" encoding=\"UTF-8\"?><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    <edit-config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        <target><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            <running/><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        </target><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        <config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            <ElementA><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                <elementAId>1</elementAId><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                <elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    <elementB>1</elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    <elementC xc:operation=\"delete\"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                        <elementCId>6</elementCId><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    </elementC><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                </elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            </ElementA><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        </config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    </edit-config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""></rpc><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><u></u> <u></u></span></p>
<pre><u></u> <u></u></pre>
<pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">According to examples in RFC6241 [ <a href="http://tools.ietf.org/html/rfc6241" target="_blank">http://tools.ietf.org/html/rfc6241</a></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <span style="color:#1f497d"> June 2011 page 41] the config element contains a namespace attribute</span></span><span style="color:#1f497d"> </span><span style>xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0".</span><span style="font-size:12.0pt"><u></u><u></u></span></pre>

<pre><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So if I add it to the xml document (as below) and manually send it to my SUT, then it works.</span><span style="font-size:9.0pt"><u></u><u></u></span></pre>

<pre><span style="font-size:12.0pt"><u></u> <u></u></span></pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><?xml version=\"1.0\" encoding=\"UTF-8\"?><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    <edit-config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        <target><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            <running/><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        </target><u></u><u></u></span></p>
<pre>        <config <span style>xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"</span>><span style><u></u><u></u></span></pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            <ElementA><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                <elementAId>1</elementAId><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                <elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    <elementB>1</elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    <elementC xc:operation=\"delete\"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                        <elementCId>6</elementCId><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                    </elementC><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">                </elementB><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">            </ElementA><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">        </config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    </edit-config><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""></rpc><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="color:#1f497d">So question is, how do I add the namespace attribute using ct_netconfc:edit_config/3? Or is there any other way of doing it?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d">Alex (erlang newbie)<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>