Unexpected EOF using netconf-console

I’m trying to use the netconf-console to edit a super simple running config.

Here’s the yang:

module wibble {
	namespace "http://wibble.com/ns/link";
	prefix wib;

	container config {
		leaf name {
			type string;
			description "name of this device";
		}
	}
}

and here’s an xml file that successfully changes the name field

<edit-config>
	<target>
		<running/>
	</target>
	<config xmlns="http://wibble.com/ns/link">
		<config>
			<name>this-method-works</name>
		</config>
	</config>
</edit-config>

using this netconf-console command:

> netconf-console --user=admin --password=admin --rpc setName.xml

I want to add / remove items from a list which needs to use commands from the ietf netconf namespace but I kept getting an “unexpected EOF” message from the console. I can reproduce this problem for this super simple example.

Here’s the xml netconf - with the rpc wrapper because of the need to specify the xmlns:nc namespace.

<rpc message-id="100" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
		 xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
		 xmlns:yang="urn:ietf:params:xml:ns:yang:1">
	<edit-config>
		<target>
			<running/>
		</target>
		<config xmlns:rv="http://wibble.com/ns/link">
			<name>but this one reports unexpected EOF</name>
		</config>
	</edit-config>
</rpc>

that I send using this netconf-console command - note I didn’t use the --rpc option:

> netconf-console --user=admin --password=admin whyEOF.xml unexpected EOF in NETCONF transport

I tried adding the framing marker on the last line of whyEOF.xml like this:

`]]>]]>’

but it didn’t make any difference.

I’m sure it’s something stupid/obvious as I’m a newbie to netconf & yang, but I’d be grateful for your help.

update: set the --outputStyle=raw option and got this info back about /rpc being a bad element???

<!-- Error: bad element: /rpc (closing session) -->

I solved my own problem, but talking it thru with myself on this forum definitely helped :smile:

it turns out that the --rpc option must do more than just wrap around things. In the end my xml netconf command looked like this - i.e. say hello, do stuff, disconnect.

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
  </capabilities>
</hello>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="101"
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
       xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"
       xmlns:yang="urn:ietf:params:xml:ns:yang:1">
	<edit-config>
		<target>
			<running/>
		</target>
		<config xmlns:wib="http://wibble.com/ns/link">
			<wib:system>
				<wib:name>but this one reports unexpected EOF</wib:name>
			</wib:system>
		</config>
	</edit-config>
</rpc>
]]>]]>
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <close-session/>
</rpc>