diff --git a/netconf/rpc.go b/netconf/rpc.go
index 7d38995..508c35c 100644
--- a/netconf/rpc.go
+++ b/netconf/rpc.go
@@ -49,7 +49,7 @@ type RPCReply struct {
XMLName xml.Name `xml:"rpc-reply"`
Errors []RPCError `xml:"rpc-error,omitempty"`
Data string `xml:",innerxml"`
- Ok bool `xml:",omitempty"`
+ Ok RPCReplyOk `xml:"ok,omitempty"`
RawReply string `xml:"-"`
}
@@ -72,6 +72,17 @@ func newRPCReply(rawXML []byte, ErrOnWarning bool) (*RPCReply, error) {
return reply, nil
}
+type RPCReplyOk struct {
+ bool
+}
+
+func (c *RPCReplyOk) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
+ var v string
+ d.DecodeElement(&v, &start)
+ *c = RPCReplyOk{true}
+ return nil
+}
+
// RPCError defines an error reply to a RPC request
type RPCError struct {
Type string `xml:"error-type"`
diff --git a/netconf/rpc_test.go b/netconf/rpc_test.go
index 3c80905..b048f7d 100644
--- a/netconf/rpc_test.go
+++ b/netconf/rpc_test.go
@@ -149,7 +149,7 @@ func TestUUIDChar(t *testing.T) {
var RPCReplytests = []struct {
rawXML string
- replyOk bool
+ replyOk RPCReplyOk
}{
{
`
@@ -158,7 +158,7 @@ var RPCReplytests = []struct {
`,
- false,
+ RPCReplyOk{true},
},
{
`
@@ -184,7 +184,7 @@ configuration check-out failed: (missing mandatory statements)
`,
- false,
+ RPCReplyOk{false},
},
{
`
@@ -213,7 +213,7 @@ configuration check-out failed: (missing mandatory statements)
`,
- false,
+ RPCReplyOk{true},
},
}
@@ -226,5 +226,8 @@ func TestNewRPCReply(t *testing.T) {
if reply.RawReply != tc.rawXML {
t.Errorf("newRPCReply(%q) did not set RawReply to input, got %q", tc.rawXML, reply.RawReply)
}
+ if reply.Ok != tc.replyOk {
+ t.Errorf("newRPCReply(%q).Ok == %v, want %v", tc.rawXML, reply.Ok, tc.replyOk)
+ }
}
}