diff --git a/controller/interfaces/networkdomain/pnd.go b/controller/interfaces/networkdomain/pnd.go index 8aae436ef5c74fd0d52cede27b5d3dbc562f2b26..20abc1687b6609a1a7e185b0e79e114a59a2dc73 100644 --- a/controller/interfaces/networkdomain/pnd.go +++ b/controller/interfaces/networkdomain/pnd.go @@ -37,5 +37,4 @@ type NetworkDomain interface { Commit(uuid.UUID) error Confirm(uuid.UUID) error SubscribePath(uuid.UUID, *ppb.SubscriptionList) error - UpdateNetworkElementAfterSubscribeResponse(networkelement.NetworkElement) error } diff --git a/controller/nucleus/principalNetworkDomain.go b/controller/nucleus/principalNetworkDomain.go index 6bdc01daa331089d24f1a0ee1e063b0d66512504..b9ba3472bd1763c73fdab87e8f325b41e22b6fdb 100644 --- a/controller/nucleus/principalNetworkDomain.go +++ b/controller/nucleus/principalNetworkDomain.go @@ -310,6 +310,8 @@ func (pnd *pndImplementation) UpdateNetworkElement(networkElementID uuid.UUID, m return err } + //TODO: check if it could be worth to provide the method with a network + //element instead of an ID. err = pnd.ensureIntendedConfigurationIsAppliedOnNetworkElement(networkElementID) if err != nil { return err @@ -405,6 +407,8 @@ func (pnd *pndImplementation) MarshalNetworkElement(identifier string) (string, } // Request sends a get request to a specific network element. +// TODO: this method needs some heavy refactoring, especially in regards to the +// UpdateModel call func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) (proto.Message, error) { mne, err := pnd.networkElementService.Get(store.Query{ ID: uuid, @@ -433,8 +437,13 @@ func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) (proto.Messag return nil, err } + modelAsString, err := mne.GetModelAsString() + if err != nil { + return nil, err + } + // TODO(path): We probably have to remove this when we address path request handling. - err = pnd.networkElementService.Update(mne) + err = pnd.networkElementService.UpdateModel(uuid, modelAsString) if err != nil { return nil, err } @@ -950,12 +959,3 @@ func (pnd *pndImplementation) MarshalBSON() ([]byte, error) { Description: pnd.Description, }) } - -// UpdateMNEAfterSubscribeResponse takes a network element and forwards it to the network element service to handle the update. -func (pnd *pndImplementation) UpdateNetworkElementAfterSubscribeResponse(mne networkelement.NetworkElement) error { - if err := pnd.networkElementService.Update(mne); err != nil { - return err - } - - return nil -}