less than 1 minute read

Mature NETCONF client libraries exist for Python. For Go, the primary library is hosted at https://github.com/Juniper/go-netconf. Although hosted under the Juniper group, the contributors / maintainers are from a variety of companies. Some pull requests are accepted, but generally there does not seem to be dedicated governance for the project.

damianoneill/net is Golang management network Client library. It provides:

  • Client side support of the NETCONF Protocol defined in (rfc6241).
  • Client side support for NETCONF Notifications defined in (rc5277).
  • GetSchemas and GetSchema from NETCONF Monitoring defined in (rfc6022).
  • Client side support of the SNMP Protocol defined in (rfc3416).

An example client call is shown below.

	sshConfig := &ssh.ClientConfig{
		User:            testserver.TestUserName,
		Auth:            []ssh.AuthMethod{ssh.Password(testserver.TestPassword)},
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
	}

	serverAddress := fmt.Sprintf("localhost:%d", ts.Port())
	s, err := NewRPCSession(context.Background(), sshConfig, serverAddress)

	if err != nil {
		fmt.Printf("Failed to start session %s\n", err)
		return
	}

	r, err := s.Execute(common.Request("<get><expectResponse/></get>"))
	if err != nil {
		fmt.Printf("Failed to execute RPC:%s\n", err)
		return
	}
	fmt.Printf("%s\n", r.Data)