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
5e187d37
Commit
5e187d37
authored
4 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
adapted the testcase blueprints
parent
be368991
No related branches found
No related tags found
3 merge requests
!97
Resolve "PND handling via CLI and database"
,
!91
"Overhaul Architecture"
,
!90
Develop
Pipeline
#63815
passed with warnings
4 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
nucleus/device_test.go
+2
-2
2 additions, 2 deletions
nucleus/device_test.go
nucleus/principalNetworkDomain_test.go
+79
-35
79 additions, 35 deletions
nucleus/principalNetworkDomain_test.go
nucleus/southbound_test.go
+2
-2
2 additions, 2 deletions
nucleus/southbound_test.go
with
83 additions
and
39 deletions
nucleus/device_test.go
+
2
−
2
View file @
5e187d37
...
...
@@ -8,7 +8,7 @@ import (
func
TestDevice_Add
(
t
*
testing
.
T
)
{
type
fields
struct
{
Device
ygot
.
GoStruct
ygot
.
GoStruct
SBI
SouthboundInterface
Config
DeviceConfig
Transport
Transport
...
...
@@ -26,7 +26,7 @@ func TestDevice_Add(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
d
:=
Device
{
Device
:
tt
.
fields
.
Device
,
GoStruct
:
tt
.
fields
.
SBI
.
Schema
()
.
Root
,
SBI
:
tt
.
fields
.
SBI
,
Config
:
tt
.
fields
.
Config
,
Transport
:
tt
.
fields
.
Transport
,
...
...
This diff is collapsed.
Click to expand it.
nucleus/principalNetworkDomain_test.go
+
79
−
35
View file @
5e187d37
...
...
@@ -9,6 +9,7 @@ import (
func
TestNewPND
(
t
*
testing
.
T
)
{
type
args
struct
{
name
string
desc
string
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
...
...
@@ -20,7 +21,7 @@ func TestNewPND(t *testing.T) {
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
got
:=
NewPND
(
tt
.
args
.
name
,
tt
.
args
.
sbi
);
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
if
got
:=
NewPND
(
tt
.
args
.
name
,
tt
.
args
.
desc
,
tt
.
args
.
sbi
);
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"NewPND() = %v, want %v"
,
got
,
tt
.
want
)
}
})
...
...
@@ -28,15 +29,32 @@ func TestNewPND(t *testing.T) {
}
func
Test_addSbi
(
t
*
testing
.
T
)
{
type
fields
struct
{
name
string
desc
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
name
string
fields
fields
args
args
wantErr
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
err
:=
addSbi
();
(
err
!=
nil
)
!=
tt
.
wantErr
{
pnd
:=
&
pndImplementation
{
name
:
tt
.
fields
.
name
,
description
:
tt
.
fields
.
desc
,
sbi
:
tt
.
fields
.
sbi
,
devices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
addSbi
(
tt
.
args
.
sbi
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"addSbi() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
@@ -62,8 +80,9 @@ func Test_destroy(t *testing.T) {
func
Test_pndImplementation_AddDevice
(
t
*
testing
.
T
)
{
type
fields
struct
{
name
string
desc
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
device
Device
...
...
@@ -79,11 +98,12 @@ func Test_pndImplementation_AddDevice(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
Name
:
tt
.
fields
.
name
,
Sbi
:
tt
.
fields
.
sbi
,
Devices
:
tt
.
fields
.
devices
,
name
:
tt
.
fields
.
name
,
description
:
tt
.
fields
.
desc
,
sbi
:
tt
.
fields
.
sbi
,
devices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
AddDevice
(
tt
.
args
.
device
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
err
:=
pnd
.
AddDevice
(
&
tt
.
args
.
device
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"AddDevice() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
@@ -94,11 +114,15 @@ func Test_pndImplementation_AddSbi(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
name
string
fields
fields
args
args
wantErr
bool
}{
// TODO: Add test cases.
...
...
@@ -106,11 +130,11 @@ func Test_pndImplementation_AddSbi(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
AddSbi
();
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
err
:=
pnd
.
AddSbi
(
tt
.
args
.
sbi
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"AddSbi() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
@@ -121,7 +145,7 @@ func Test_pndImplementation_Destroy(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
tests
:=
[]
struct
{
name
string
...
...
@@ -133,9 +157,9 @@ func Test_pndImplementation_Destroy(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
Destroy
();
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"Destroy() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
...
...
@@ -148,7 +172,7 @@ func Test_pndImplementation_RemoveDevice(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
uuid
uuid
.
UUID
...
...
@@ -164,9 +188,9 @@ func Test_pndImplementation_RemoveDevice(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
RemoveDevice
(
tt
.
args
.
uuid
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"RemoveDevice() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
...
...
@@ -179,11 +203,15 @@ func Test_pndImplementation_RemoveSbi(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
name
string
fields
fields
args
args
wantErr
bool
}{
// TODO: Add test cases.
...
...
@@ -191,11 +219,11 @@ func Test_pndImplementation_RemoveSbi(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
RemoveSbi
();
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
err
:=
pnd
.
RemoveSbi
(
tt
.
args
.
sbi
.
SbiIdentifier
()
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"RemoveSbi() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
@@ -206,7 +234,7 @@ func Test_pndImplementation_addDevice(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
device
Device
...
...
@@ -222,11 +250,11 @@ func Test_pndImplementation_addDevice(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
addDevice
(
tt
.
args
.
device
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
err
:=
pnd
.
addDevice
(
&
tt
.
args
.
device
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"addDevice() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
@@ -237,7 +265,7 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
Device
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
uuid
uuid
.
UUID
...
...
@@ -253,9 +281,9 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
pnd
:=
&
pndImplementation
{
N
ame
:
tt
.
fields
.
name
,
S
bi
:
tt
.
fields
.
sbi
,
D
evices
:
tt
.
fields
.
devices
,
n
ame
:
tt
.
fields
.
name
,
s
bi
:
tt
.
fields
.
sbi
,
d
evices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
removeDevice
(
tt
.
args
.
uuid
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"removeDevice() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
...
...
@@ -265,15 +293,31 @@ func Test_pndImplementation_removeDevice(t *testing.T) {
}
func
Test_removeSbi
(
t
*
testing
.
T
)
{
type
fields
struct
{
name
string
sbi
map
[
string
]
SouthboundInterface
devices
map
[
uuid
.
UUID
]
*
Device
}
type
args
struct
{
uuid
uuid
.
UUID
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
name
string
fields
fields
args
args
wantErr
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
err
:=
removeSbi
();
(
err
!=
nil
)
!=
tt
.
wantErr
{
pnd
:=
&
pndImplementation
{
name
:
tt
.
fields
.
name
,
sbi
:
tt
.
fields
.
sbi
,
devices
:
tt
.
fields
.
devices
,
}
if
err
:=
pnd
.
removeSbi
(
tt
.
args
.
sbi
.
SbiIdentifier
());
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"removeSbi() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
...
...
This diff is collapsed.
Click to expand it.
nucleus/southbound_test.go
+
2
−
2
View file @
5e187d37
...
...
@@ -16,7 +16,7 @@ func TestOpenConfig_SbiIdentifier(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
OpenConfig
{
T
ransport
:
tt
.
fields
.
transport
,
t
ransport
:
tt
.
fields
.
transport
,
}
if
got
:=
oc
.
SbiIdentifier
();
got
!=
tt
.
want
{
t
.
Errorf
(
"SbiIdentifier() = %v, want %v"
,
got
,
tt
.
want
)
...
...
@@ -42,7 +42,7 @@ func TestOpenConfig_OpenconfigInterfaces(t *testing.T) {
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
OpenConfig
{
T
ransport
:
tt
.
fields
.
transport
,
t
ransport
:
tt
.
fields
.
transport
,
}
oc
.
OpenconfigInterfaces
(
tt
.
args
.
device
)
})
...
...
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