Skip to content
Snippets Groups Projects
Commit a0a3477e authored by Malte Bauch's avatar Malte Bauch
Browse files

Change pnd.Request to use UpdateModel method

parent 81af1518
No related branches found
No related tags found
1 merge request!410Some basic house keeping
Pipeline #125975 failed
......@@ -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
}
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment