[erlang-questions] ct_netconfc.erl: is this the expected behavior or is it a bug?

Alexander Poulikakos alexander.poulikakos@REDACTED
Tue Mar 11 11:15:49 CET 2014


Hi erlang users

I use the ct_netconfc client, from within Common Test.

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:
Config = {'ElementA',[],
                     [{elementAId,[],["1"]},
                      {elementB,[],
                                [{elementB,[],["1"]},
                                 {elementC,[{'xc:operation',"delete"}],
                                           [{elementCId,[],["6"]}]}]}]},
{ok, Client}=ct_netconfc:open([{ssh, "some-ip-address"}, {port, some-port}, {user, "some-username"},{password,"some-password"}]),
ct_netconfc:edit_config(Client, running, Config),

Which gives me the following error message:

{error,[{'error-type',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],
                      ["protocol"]},
        {'error-tag',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],
                     ["operation-failed"]},
        {'error-severity',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"}],
                          ["error"]},
        {'error-message',[{xmlns,"urn:ietf:params:xml:ns:netconf:base:1.0"},
                          {'xml:lang',"en"}],
                         ["Malformed XML!!!"]}]}


And the actual XML document (after processed by ct_netconfc) sent to my SUT looks as follow:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">
    <edit-config>
        <target>
            <running/>
        </target>
        <config>
            <ElementA>
                <elementAId>1</elementAId>
                <elementB>
                    <elementB>1</elementB>
                    <elementC xc:operation=\"delete\">
                        <elementCId>6</elementCId>
                    </elementC>
                </elementB>
            </ElementA>
        </config>
    </edit-config>
</rpc>




According to examples in RFC6241 [ http://tools.ietf.org/html/rfc6241  June 2011 page 41] the config element contains a namespace attribute xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0".

So if I add it to the xml document (as below) and manually send it to my SUT, then it works.


<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<rpc message-id=\"1\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">
    <edit-config>
        <target>
            <running/>
        </target>

        <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
            <ElementA>
                <elementAId>1</elementAId>
                <elementB>
                    <elementB>1</elementB>
                    <elementC xc:operation=\"delete\">
                        <elementCId>6</elementCId>
                    </elementC>
                </elementB>
            </ElementA>
        </config>
    </edit-config>
</rpc>

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?
Regards,
Alex (erlang newbie)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140311/282d2d6c/attachment.htm>


More information about the erlang-questions mailing list