diff --git a/controller/nucleus/gnmi_transport.go b/controller/nucleus/gnmi_transport.go index eb1ea0e2409808f3a169a62b58ddd292d5b1c3ee..97d782f7577252aedf632030c22a6c0b3efc6101 100644 --- a/controller/nucleus/gnmi_transport.go +++ b/controller/nucleus/gnmi_transport.go @@ -130,23 +130,32 @@ func (g *Gnmi) applyDiff(ctx context.Context, payload change.Payload, path *gpb. return err } + setNodeOpts := []ytypes.SetNodeOpt{&ytypes.InitMissingElements{}, &ytypes.TolerateJSONInconsistencies{}} for _, u := range diff.Update { - opts := []ytypes.SetNodeOpt{&ytypes.InitMissingElements{}, &ytypes.TolerateJSONInconsistencies{}} - if err := g.SetNode(schema.RootSchema(), rootCopy, u.GetPath(), u.GetVal(), opts...); err != nil { + rootSchema := schema.RootSchema() + pathString, err := ygot.PathToString(u.GetPath()) + if err != nil { return err } + entry := rootSchema.Find(pathString) + if !entry.ReadOnly() { + if err := g.SetNode(rootSchema, rootCopy, u.GetPath(), u.GetVal(), setNodeOpts...); err != nil { + return err + } + } } ygot.PruneEmptyBranches(rootCopy) - opts := []ytypes.GetNodeOpt{ + getNodeOpts := []ytypes.GetNodeOpt{ &ytypes.GetHandleWildcards{}, } - nodes, err := ytypes.GetNode(schema.RootSchema(), rootCopy, path, opts...) + nodes, err := ytypes.GetNode(schema.RootSchema(), rootCopy, path, getNodeOpts...) if err != nil { return err } + // TODO: error handling if get nodes[0] returns a nil value if len(nodes) == 0 || err != nil || util.IsValueNil(nodes[0].Data) { return customerrs.PathNotFoundError{Path: path, Err: err} } diff --git a/controller/nucleus/principalNetworkDomain.go b/controller/nucleus/principalNetworkDomain.go index 0b6d8b999353f80ae6dddc29176ac7722117d8cd..f507e9b264174bf216a76aeca87196325c4ed55f 100644 --- a/controller/nucleus/principalNetworkDomain.go +++ b/controller/nucleus/principalNetworkDomain.go @@ -349,7 +349,7 @@ func (pnd *pndImplementation) addNetworkElement(mne networkelement.NetworkElemen } if mne.IsTransportValid() { - _, err = pnd.Request(mne.ID(), "/interfaces") + _, err = pnd.Request(mne.ID(), "/") if err != nil { return uuid.Nil, err }