Skip to content
Snippets Groups Projects
Commit f1afcd49 authored by Katharina Renk's avatar Katharina Renk
Browse files

added force-push func

parent 620d5808
No related branches found
No related tags found
2 merge requests!784Draft: Resolve "Integration test for Lab01",!757Draft: Resolve "Integration test for Lab01"
...@@ -170,16 +170,8 @@ func TestLab01(t *testing.T) { ...@@ -170,16 +170,8 @@ func TestLab01(t *testing.T) {
t.Error(err) t.Error(err)
} }
// Commit the change. // Force-push changes
commitChange := lab_utils.CommitOrConfirmChange(setResp.GetResponses()[0].GetId(), mnepb.Operation_OPERATION_COMMIT, pndID) err = lab_utils.ForcePush(setResp.GetResponses()[0].GetId(), pndID, mneService, ctx)
_, err = mneService.SetChangeList(ctx, commitChange)
if err != nil {
t.Error(err)
}
// Confirm the change.
confirmChange := lab_utils.CommitOrConfirmChange(setResp.GetResponses()[0].GetId(), mnepb.Operation_OPERATION_CONFIRM, pndID)
_, err = mneService.SetChangeList(ctx, confirmChange)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
...@@ -188,9 +180,7 @@ func TestLab01(t *testing.T) { ...@@ -188,9 +180,7 @@ func TestLab01(t *testing.T) {
} else if strings.Contains(mne.configEntries[i].leaf, "route") { } else if strings.Contains(mne.configEntries[i].leaf, "route") {
fmt.Println("to be continued") fmt.Println("to be continued")
} }
} }
} }
// Commit Confirm // Commit Confirm
...@@ -202,5 +192,4 @@ func TestLab01(t *testing.T) { ...@@ -202,5 +192,4 @@ func TestLab01(t *testing.T) {
// Check if the routing configuration has been changed // Check if the routing configuration has been changed
// Ping to check connection between both managed network elements. // Ping to check connection between both managed network elements.
} }
package lab_utils package lab_utils
import ( import (
"context"
"os" "os"
mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement"
...@@ -33,6 +34,24 @@ func CommitOrConfirmChange(cid string, operation mnepb.Operation, pndID string) ...@@ -33,6 +34,24 @@ func CommitOrConfirmChange(cid string, operation mnepb.Operation, pndID string)
return sclr return sclr
} }
func ForcePush(cid string, pndID string, mneService mnepb.NetworkElementServiceClient, ctx context.Context) error {
// Commit
commitChange := CommitOrConfirmChange(cid, mnepb.Operation_OPERATION_COMMIT, pndID)
_, err := mneService.SetChangeList(ctx, commitChange)
if err != nil {
return err
}
// Confirm
confirmChange := CommitOrConfirmChange(cid, mnepb.Operation_OPERATION_CONFIRM, pndID)
_, err = mneService.SetChangeList(ctx, confirmChange)
if err != nil {
return err
}
return nil
}
func SetHostnamePathListRequestSingleMne(mneId string, newHostname string, operation mnepb.ApiOperation) (*mnepb.SetPathListRequest, error) { func SetHostnamePathListRequestSingleMne(mneId string, newHostname string, operation mnepb.ApiOperation) (*mnepb.SetPathListRequest, error) {
hostnamePath, err := ygot.StringToStructuredPath("/system/config/hostname") hostnamePath, err := ygot.StringToStructuredPath("/system/config/hostname")
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment