Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Commits
23be9eee
Commit
23be9eee
authored
1 year ago
by
Katharina Renk
Browse files
Options
Downloads
Patches
Plain Diff
func SetPathListRequestFromJsonImport can now process all paths
parent
b9328cf3
No related branches found
Tags
Tags containing commit
2 merge requests
!784
Draft: Resolve "Integration test for Lab01"
,
!757
Draft: Resolve "Integration test for Lab01"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
integration-tests/lab_tests/lab01/lab01_test.go
+17
-6
17 additions, 6 deletions
integration-tests/lab_tests/lab01/lab01_test.go
integration-tests/lab_tests/utils/labUtils.go
+3
-3
3 additions, 3 deletions
integration-tests/lab_tests/utils/labUtils.go
with
20 additions
and
9 deletions
integration-tests/lab_tests/lab01/lab01_test.go
+
17
−
6
View file @
23be9eee
...
@@ -29,6 +29,8 @@ const (
...
@@ -29,6 +29,8 @@ const (
targetBInterfacePathEth2
=
"switch1/s1-eth2.json"
targetBInterfacePathEth2
=
"switch1/s1-eth2.json"
targetBRoutePath
=
"switch1/s1-route.json"
targetBRoutePath
=
"switch1/s1-route.json"
relativePathToJSONSources
=
"../utils/json_sources/Lab01/"
relativePathToJSONSources
=
"../utils/json_sources/Lab01/"
pathToRouteConfig
=
"network-instances/network-instance"
pathToInterfaceConfig
=
"interfaces/interface"
)
)
// Represents the yang models stored in JSON files.
// Represents the yang models stored in JSON files.
...
@@ -161,7 +163,7 @@ func TestLab01(t *testing.T) {
...
@@ -161,7 +163,7 @@ func TestLab01(t *testing.T) {
for
i
:=
0
;
i
<
len
(
mne
.
configEntries
);
i
++
{
for
i
:=
0
;
i
<
len
(
mne
.
configEntries
);
i
++
{
// Interface change request
// Interface change request
if
strings
.
Contains
(
mne
.
configEntries
[
i
]
.
leaf
,
"eth"
)
{
if
strings
.
Contains
(
mne
.
configEntries
[
i
]
.
leaf
,
"eth"
)
{
interfacePathListRequest
,
err
:=
lab_utils
.
Set
Interface
PathListRequest
SingleMne
(
mne
.
configEntries
[
i
]
.
leaf
,
mne
.
id
,
mnepb
.
ApiOperation_API_OPERATION_UPDATE
,
mne
.
configEntries
[
i
]
.
value
,
pndID
)
interfacePathListRequest
,
err
:=
lab_utils
.
SetPathListRequest
FromJsonImport
(
pathToInterfaceConfig
,
mne
.
configEntries
[
i
]
.
leaf
,
mne
.
id
,
mnepb
.
ApiOperation_API_OPERATION_UPDATE
,
mne
.
configEntries
[
i
]
.
value
,
pndID
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
...
@@ -178,17 +180,26 @@ func TestLab01(t *testing.T) {
...
@@ -178,17 +180,26 @@ func TestLab01(t *testing.T) {
// Route change request
// Route change request
}
else
if
strings
.
Contains
(
mne
.
configEntries
[
i
]
.
leaf
,
"route"
)
{
}
else
if
strings
.
Contains
(
mne
.
configEntries
[
i
]
.
leaf
,
"route"
)
{
fmt
.
Println
(
"to be continued"
)
routePathListRequest
,
err
:=
lab_utils
.
SetPathListRequestFromJsonImport
(
pathToRouteConfig
,
mne
.
configEntries
[
i
]
.
leaf
,
mne
.
id
,
mnepb
.
ApiOperation_API_OPERATION_UPDATE
,
mne
.
configEntries
[
i
]
.
value
,
pndID
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
setResp
,
err
:=
mneService
.
SetPathList
(
ctx
,
routePathListRequest
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
// Force-push changes
err
=
lab_utils
.
ForcePush
(
setResp
.
GetResponses
()[
0
]
.
GetId
(),
pndID
,
mneService
,
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
}
}
}
}
}
}
// Commit Confirm
// Check if the network interface has been changed
// Check if the network interface has been changed
// Modify the routing configuration of both managed network elements.
// 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.
...
...
This diff is collapsed.
Click to expand it.
integration-tests/lab_tests/utils/labUtils.go
+
3
−
3
View file @
23be9eee
...
@@ -104,10 +104,10 @@ func CreateAddListRequestSingleMne(addr, name, id, username, password string, pn
...
@@ -104,10 +104,10 @@ func CreateAddListRequestSingleMne(addr, name, id, username, password string, pn
return
alr
return
alr
}
}
func
Set
Interface
PathListRequest
SingleMne
(
networkInterface
string
,
mneId
string
,
operation
mnepb
.
ApiOperation
,
newInterfaceConfig
[]
byte
,
pndID
string
)
(
*
mnepb
.
SetPathListRequest
,
error
)
{
func
SetPathListRequest
FromJsonImport
(
pathToLeaf
string
,
leaf
string
,
mneId
string
,
operation
mnepb
.
ApiOperation
,
newInterfaceConfig
[]
byte
,
pndID
string
)
(
*
mnepb
.
SetPathListRequest
,
error
)
{
// Extract network interface
// Extract network interface
interfacePathString
:=
"interfaces/interface[name="
+
networkInterface
+
"]"
completePathToLeaf
:=
pathToLeaf
+
"[name="
+
leaf
+
"]"
interfacePath
,
err
:=
ygot
.
StringToStructuredPath
(
interfacePathString
)
interfacePath
,
err
:=
ygot
.
StringToStructuredPath
(
completePathToLeaf
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment