Create-subscription throws framing_error

In response to create-subscription, confd is throwing framing_error. I understood that this error is thrown whenever the message is not framed as per the standards. But, I do not find any issue with the create-subscription message I am sending. What is wrong with the message?

The tail of Confd logs is listed below.

#172
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
    <create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <stream>interface</stream>
    </create-subscription>
</rpc>
==> netconf.log <==
<INFO> 12-Sep-2023::18:21:50.476 vm-alarm confd[42925]: netconf id=14 framing_error

==> netconf.trace <==

**< sess:14 session closed

==> audit.log <==
<INFO> 12-Sep-2023::18:21:50.480 vm-alarm confd[42925]: audit user: admin/14 terminated session (reason: dropped)

I have isolated the issue to the wrong xmlns being sent with create-subscription.

Problematic Message:

#172
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1947">
    <create-subscription xmlns="urn:ietf:params:netconf:capability:notification:1.0">
    	<stream>interface</stream>
    </create-subscription>
</rpc>

Correct Message:

#263
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1947">
  <create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <stream>interface</stream>
  </create-subscription>
</rpc>

Related query: when do we need to send the xmlns? I see some of the Netconf operation such as get, get-config do not need xmlns. Whereas, operation like create-subscription need xmlns.

You were getting “framing error” because your framing is, well, erroneous. As you probably figured out, the number in the text “#263” indicates number of octets in the following message chunk, see the RFC 6242 for details about the chunked framing mechanism. But unless you decided to do that as an excercise, maybe you should use one of already existing NETCONF client libraries, chances are they are available for your environment too.

Regarding namespace declarations - the principle is that a NETCONF message must be a valid XML document and its elements must belong to correct namespaces. By

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1947">

you are saying that the element rpc belongs to the NETCONF namespace and all descendant elements belong to that namespace too, unless they are prefixed or unless you declare another default namespace. But again - even if you decide to write your own NETCONF client, you should leave all the XML stuff to a dedicated library, there simply must be one for your environment, no matter how exotic it is.

1 Like

Thank you, Martin, I am developing a Netconf client using Erlang, as it is unavailable.