Juniper / go-netconf

NETCONF implementation in Go.
Other
254 stars 110 forks source link

Namespace #25

Closed mislavn closed 6 years ago

mislavn commented 7 years ago

Hi,

I had some trouble with connecting go-netconf to the Netopeer2 server.

The following commits where needed to enable the communication to the Netopeer2 server, the changes are hard coded and they are:

1) add namespace to hello XML element. 2) add namespace to rpc XML element. Netopeer2 requires a namespace for the top XML element.

3) change the namespace of the default capability. 8.1. Capabilities Exchange Capabilities are advertised in messages sent by each peer during session establishment. When the NETCONF session is opened, each peer (both client and server) MUST send a element containing a list of that peer's capabilities. Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.0".

I tried to make a more general commit but I need input from you also I am not sure will this break something on someone else's setup.

Do you have any idea how to generalize inserting namespace's to the top XML element?

nemith commented 7 years ago

From https://golang.org/pkg/encoding/xml/#Unmarshal

If the XMLName field has an associated tag of the form "name" or "namespace-URL name", the XML element must have the given name (and, optionally, name space) or else Unmarshal returns an error.

I am afraid if the namespace is missing Go may barf on this. I need to do some more testing (or better we need unit tests for this)

change the namespace of the default capability. 8.1. Capabilities Exchange Capabilities are advertised in messages sent by each peer during session establishment. When the NETCONF session is opened, each peer (both client and server) MUST send a element containing a list of that peer's capabilities. Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.0".

Good catch.

Lets see if we can get some better testing on this with other devices and maybe add some message parsing unit tests in here as well.

nemith commented 6 years ago

This broke the unit tests. Can you rebase?