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
e288ae6e
Commit
e288ae6e
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
lightweight Dockerfile.alpine
parent
853041c7
No related branches found
No related tags found
2 merge requests
!221
Thesis mk
,
!173
Process response overhaul
Pipeline
#76538
passed with warnings
4 years ago
Stage: test
Stage: .post
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile.alpine
+0
-1
0 additions, 1 deletion
Dockerfile.alpine
api/apiIntegration_test.go
+22
-80
22 additions, 80 deletions
api/apiIntegration_test.go
nucleus/device.go
+12
-0
12 additions, 0 deletions
nucleus/device.go
nucleus/principalNetworkDomain.go
+4
-9
4 additions, 9 deletions
nucleus/principalNetworkDomain.go
with
38 additions
and
90 deletions
Dockerfile.alpine
+
0
−
1
View file @
e288ae6e
...
@@ -6,7 +6,6 @@ WORKDIR /src/gosdn
...
@@ -6,7 +6,6 @@ WORKDIR /src/gosdn
COPY . .
COPY . .
RUN apk add --no-cache git
RUN apk add --no-cache git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
RUN go mod tidy
RUN GOOS=linux go build -o gosdn ./cmd/gosdn
RUN GOOS=linux go build -o gosdn ./cmd/gosdn
FROM alpine
FROM alpine
...
...
This diff is collapsed.
Click to expand it.
api/apiIntegration_test.go
+
22
−
80
View file @
e288ae6e
package
api
package
api
import
(
import
(
"os"
"testing"
"testing"
"code.fbi.h-da.de/cocsn/api/go/gosdn/pnd"
"code.fbi.h-da.de/cocsn/api/go/gosdn/pnd"
tpb
"code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
tpb
"code.fbi.h-da.de/cocsn/api/go/gosdn/transport"
"
code.fbi.h-da.de/cocsn/gosdn/nucleus/util/proto
"
"
github.com/google/uuid
"
guuid
"github.com/google/uuid"
guuid
"github.com/google/uuid"
gpb
"github.com/openconfig/gnmi/proto/gnmi"
log
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/spf13/viper"
pb
"google.golang.org/protobuf/proto"
)
)
const
unreachable
=
"203.0.113.10:6030"
const
testPath
=
"/system/config/hostname"
var
testAddress
=
"141.100.70.170:6030"
var
testAPIEndpoint
=
"gosdn-latest.apps.ocp.fbi.h-da.de"
var
testUsername
=
"admin"
var
testPassword
=
"arista"
var
opt
*
tpb
.
TransportOption
var
gnmiMessages
map
[
string
]
pb
.
Message
func
TestMain
(
m
*
testing
.
M
)
{
testSetupIntegration
()
os
.
Exit
(
m
.
Run
())
}
func
testSetupIntegration
()
{
if
os
.
Getenv
(
"GOSDN_LOG"
)
==
"nolog"
{
log
.
SetLevel
(
log
.
PanicLevel
)
}
addr
:=
os
.
Getenv
(
"GOSDN_TEST_ENDPOINT"
)
if
addr
!=
""
{
testAddress
=
addr
log
.
Infof
(
"GOSDN_TEST_ENDPOINT set to %v"
,
testAddress
)
}
api
:=
os
.
Getenv
(
"GOSDN_TEST_API_ENDPOINT"
)
if
api
!=
""
{
testAPIEndpoint
=
api
log
.
Infof
(
"GOSDN_TEST_API_ENDPOINT set to %v"
,
testAPIEndpoint
)
}
u
:=
os
.
Getenv
(
"GOSDN_TEST_USER"
)
if
u
!=
""
{
testUsername
=
u
log
.
Infof
(
"GOSDN_TEST_USER set to %v"
,
testUsername
)
}
p
:=
os
.
Getenv
(
"GOSDN_TEST_PASSWORD"
)
if
p
!=
""
{
testPassword
=
p
log
.
Infof
(
"GOSDN_TEST_PASSWORD set to %v"
,
testPassword
)
}
gnmiMessages
=
map
[
string
]
pb
.
Message
{
"../test/proto/cap-resp-arista-ceos"
:
&
gpb
.
CapabilityResponse
{},
"../test/proto/req-full-node"
:
&
gpb
.
GetRequest
{},
"../test/proto/req-full-node-arista-ceos"
:
&
gpb
.
GetRequest
{},
"../test/proto/req-interfaces-arista-ceos"
:
&
gpb
.
GetRequest
{},
"../test/proto/req-interfaces-interface-arista-ceos"
:
&
gpb
.
GetRequest
{},
"../test/proto/req-interfaces-wildcard"
:
&
gpb
.
GetRequest
{},
"../test/proto/resp-full-node"
:
&
gpb
.
GetResponse
{},
"../test/proto/resp-full-node-arista-ceos"
:
&
gpb
.
GetResponse
{},
"../test/proto/resp-interfaces-arista-ceos"
:
&
gpb
.
GetResponse
{},
"../test/proto/resp-interfaces-interface-arista-ceos"
:
&
gpb
.
GetResponse
{},
"../test/proto/resp-interfaces-wildcard"
:
&
gpb
.
GetResponse
{},
"../test/proto/resp-set-system-config-hostname"
:
&
gpb
.
SetResponse
{},
}
for
k
,
v
:=
range
gnmiMessages
{
if
err
:=
proto
.
Read
(
k
,
v
);
err
!=
nil
{
log
.
Fatalf
(
"error parsing %v: %v"
,
k
,
err
)
}
}
opt
=
&
tpb
.
TransportOption
{
Address
:
testAddress
,
Username
:
testUsername
,
Password
:
testPassword
,
}
}
func
TestApiIntegration
(
t
*
testing
.
T
)
{
func
TestApiIntegration
(
t
*
testing
.
T
)
{
// TDOO: Remove once openshift grpc support is available
// TDOO: Remove once openshift grpc support is available
t
.
Skip
(
"skipped due to openshift limitations"
)
t
.
Skip
(
"skipped due to openshift limitations"
)
...
@@ -111,24 +39,38 @@ func TestApiIntegration(t *testing.T) {
...
@@ -111,24 +39,38 @@ func TestApiIntegration(t *testing.T) {
cliPnd
:=
viper
.
GetString
(
"CLI_PND"
)
cliPnd
:=
viper
.
GetString
(
"CLI_PND"
)
cliSbi
:=
viper
.
GetString
(
"CLI_SBI"
)
cliSbi
:=
viper
.
GetString
(
"CLI_SBI"
)
suid
,
err
:=
uuid
.
Parse
(
cliSbi
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
puid
,
err
:=
uuid
.
Parse
(
cliPnd
)
if
err
!=
nil
{
t
.
Error
(
err
)
}
opt
:=
&
tpb
.
TransportOption
{
Address
:
testAddress
,
Username
:
testUsername
,
Password
:
testPassword
,
TransportOption
:
&
tpb
.
TransportOption_GnmiTransportOption
{
GnmiTransportOption
:
&
tpb
.
GnmiTransportOption
{},
},
}
if
_
,
err
:=
addDevice
(
if
_
,
err
:=
addDevice
(
testAPIEndpoint
,
testAPIEndpoint
,
testUsername
,
testPassword
,
cliSbi
,
cliPnd
,
testAddress
,
"test-device"
,
"test-device"
,
opt
,
suid
,
puid
,
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"gosdn cli add-device error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
t
.
Errorf
(
"gosdn cli add-device error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
return
return
}
}
did
:=
viper
.
GetString
(
"LAST_DEVICE_UUID"
)
did
:=
viper
.
GetString
(
"LAST_DEVICE_UUID"
)
_
,
err
:
=
getDevice
(
_
,
err
=
getDevice
(
testAPIEndpoint
,
testAPIEndpoint
,
cliPnd
,
cliPnd
,
testPath
,
did
,
did
,
)
)
if
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
(
err
!=
nil
)
!=
tt
.
wantErr
{
...
...
This diff is collapsed.
Click to expand it.
nucleus/device.go
+
12
−
0
View file @
e288ae6e
...
@@ -24,6 +24,18 @@ func NewDevice(name string, opt *tpb.TransportOption, sbi southbound.SouthboundI
...
@@ -24,6 +24,18 @@ func NewDevice(name string, opt *tpb.TransportOption, sbi southbound.SouthboundI
name
=
namesgenerator
.
GetRandomName
(
0
)
name
=
namesgenerator
.
GetRandomName
(
0
)
}
}
if
opt
.
Csbi
{
return
&
CsbiDevice
{
CommonDevice
:
CommonDevice
{
UUID
:
uuid
.
New
(),
GoStruct
:
sbi
.
Schema
()
.
Root
,
sbi
:
sbi
,
transport
:
t
,
name
:
name
,
},
},
nil
}
return
&
CommonDevice
{
return
&
CommonDevice
{
UUID
:
uuid
.
New
(),
UUID
:
uuid
.
New
(),
GoStruct
:
sbi
.
Schema
()
.
Root
,
GoStruct
:
sbi
.
Schema
()
.
Root
,
...
...
This diff is collapsed.
Click to expand it.
nucleus/principalNetworkDomain.go
+
4
−
9
View file @
e288ae6e
...
@@ -412,19 +412,14 @@ func (pnd *pndImplementation) createCsbiDevice(name string, d *cpb.Deployment, o
...
@@ -412,19 +412,14 @@ func (pnd *pndImplementation) createCsbiDevice(name string, d *cpb.Deployment, o
panic
(
err
)
panic
(
err
)
}
}
opt
.
Address
=
deviceDetails
.
Address
opt
.
Address
=
deviceDetails
.
Address
t
,
err
:=
NewTransport
(
opt
,
csbi
)
d
,
err
:=
NewDevice
(
name
,
opt
,
csbi
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
d
:=
&
CsbiDevice
{
d
.
(
*
CsbiDevice
)
.
UUID
=
id
CommonDevice
:
CommonDevice
{
name
:
name
,
UUID
:
id
,
transport
:
t
,
},
}
ch
<-
DeviceDetails
{
TransportOption
:
opt
}
ch
<-
DeviceDetails
{
TransportOption
:
opt
}
if
err
:=
pnd
.
devices
.
Add
(
d
,
d
.
n
ame
);
err
!=
nil
{
if
err
:=
pnd
.
devices
.
Add
(
d
,
d
.
N
ame
()
);
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
pnd
.
callback
(
id
,
nil
)
pnd
.
callback
(
id
,
nil
)
...
...
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