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
1416c8d8
Commit
1416c8d8
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Plain Diff
Merge branch 'lint-clean' into 'develop'
remove %v and simplify if-statement See merge request cocsn/gosdn!39
parents
c0ae8170
a5691c40
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!39
remove %v and simplify if-statement
,
!18
Develop
Pipeline
#52237
passed
4 years ago
Stage: compliance
Stage: build
Changes
2
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nucleus/cli-handling.go
+8
-8
8 additions, 8 deletions
nucleus/cli-handling.go
nucleus/controller.go
+1
-1
1 addition, 1 deletion
nucleus/controller.go
with
9 additions
and
9 deletions
nucleus/cli-handling.go
+
8
−
8
View file @
1416c8d8
...
@@ -9,10 +9,10 @@ package nucleus
...
@@ -9,10 +9,10 @@ package nucleus
import
(
import
(
pb
"code.fbi.h-da.de/cocsn/gosdn/cliInterface"
pb
"code.fbi.h-da.de/cocsn/gosdn/cliInterface"
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/restconf/client/ciena"
"code.fbi.h-da.de/cocsn/gosdn/restconf/client/ciena"
"context"
"context"
"google.golang.org/grpc"
"google.golang.org/grpc"
"code.fbi.h-da.de/cocsn/gosdn/log"
"net"
"net"
)
)
...
@@ -23,12 +23,12 @@ type server struct {
...
@@ -23,12 +23,12 @@ type server struct {
}
}
func
(
s
*
server
)
SayHello
(
ctx
context
.
Context
,
in
*
pb
.
HelloRequest
)
(
*
pb
.
HelloReply
,
error
)
{
func
(
s
*
server
)
SayHello
(
ctx
context
.
Context
,
in
*
pb
.
HelloRequest
)
(
*
pb
.
HelloReply
,
error
)
{
log
.
Info
(
"Received:
%v
"
,
in
.
GetName
())
log
.
Info
(
"Received: "
,
in
.
GetName
())
return
&
pb
.
HelloReply
{
Message
:
"Hello "
+
in
.
GetName
(),
GoSDNInfo
:
"goSDN in version: DEVELOP"
},
nil
return
&
pb
.
HelloReply
{
Message
:
"Hello "
+
in
.
GetName
(),
GoSDNInfo
:
"goSDN in version: DEVELOP"
},
nil
}
}
func
(
s
*
server
)
Shutdown
(
ctx
context
.
Context
,
in
*
pb
.
ShutdownRequest
)
(
*
pb
.
ShutdownReply
,
error
)
{
func
(
s
*
server
)
Shutdown
(
ctx
context
.
Context
,
in
*
pb
.
ShutdownRequest
)
(
*
pb
.
ShutdownReply
,
error
)
{
log
.
Info
(
"Shutdown Received:
%v
"
,
in
.
GetName
())
log
.
Info
(
"Shutdown Received: "
,
in
.
GetName
())
s
.
core
.
IsRunning
<-
false
s
.
core
.
IsRunning
<-
false
return
&
pb
.
ShutdownReply
{
Message
:
"Shutdown "
+
in
.
GetName
()},
nil
return
&
pb
.
ShutdownReply
{
Message
:
"Shutdown "
+
in
.
GetName
()},
nil
}
}
...
@@ -38,21 +38,21 @@ func getCLIGoing(core *Core) {
...
@@ -38,21 +38,21 @@ func getCLIGoing(core *Core) {
// Boot-up the control interface for the cli
// Boot-up the control interface for the cli
cliControlListener
,
err
:=
net
.
Listen
(
"tcp"
,
core
.
config
.
CliSocket
)
cliControlListener
,
err
:=
net
.
Listen
(
"tcp"
,
core
.
config
.
CliSocket
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
"failed to listen: %v"
,
err
)
log
.
Fatal
(
err
)
}
}
cliControlServer
:=
grpc
.
NewServer
()
cliControlServer
:=
grpc
.
NewServer
()
pb
.
RegisterGrpcCliServer
(
cliControlServer
,
&
server
{
core
:
core
})
pb
.
RegisterGrpcCliServer
(
cliControlServer
,
&
server
{
core
:
core
})
if
err
:=
cliControlServer
.
Serve
(
cliControlListener
);
err
!=
nil
{
if
err
:=
cliControlServer
.
Serve
(
cliControlListener
);
err
!=
nil
{
log
.
Fatal
(
"failed to serve: %v"
,
err
)
log
.
Fatal
(
err
)
}
}
log
.
Info
(
"Started: GetCLIGoing"
)
log
.
Info
(
"Started: GetCLIGoing"
)
}
}
// SBI specific calls, by now TAPI only
// SBI specific calls, by now TAPI only
func
(
s
*
server
)
TAPIGetEdge
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
func
(
s
*
server
)
TAPIGetEdge
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
log
.
Info
(
"Received:
%v
"
,
in
.
GetName
())
log
.
Info
(
"Received: "
,
in
.
GetName
())
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodes
();
err
!=
nil
{
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodes
();
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
...
@@ -61,7 +61,7 @@ func (s *server) TAPIGetEdge(ctx context.Context, in *pb.TAPIRequest) (*pb.TAPIR
...
@@ -61,7 +61,7 @@ func (s *server) TAPIGetEdge(ctx context.Context, in *pb.TAPIRequest) (*pb.TAPIR
}
}
func
(
s
*
server
)
TAPIGetEdgeNode
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
func
(
s
*
server
)
TAPIGetEdgeNode
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
log
.
Info
(
"Received:
%v
"
,
in
.
GetName
())
log
.
Info
(
"Received: "
,
in
.
GetName
())
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodeEdgePoints
();
err
!=
nil
{
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodeEdgePoints
();
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
...
@@ -70,7 +70,7 @@ func (s *server) TAPIGetEdgeNode(ctx context.Context, in *pb.TAPIRequest) (*pb.T
...
@@ -70,7 +70,7 @@ func (s *server) TAPIGetEdgeNode(ctx context.Context, in *pb.TAPIRequest) (*pb.T
}
}
func
(
s
*
server
)
TAPIGetLink
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
func
(
s
*
server
)
TAPIGetLink
(
ctx
context
.
Context
,
in
*
pb
.
TAPIRequest
)
(
*
pb
.
TAPIReply
,
error
)
{
log
.
Info
(
"Received:
%v
"
,
in
.
GetName
())
log
.
Info
(
"Received: "
,
in
.
GetName
())
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetLinks
();
err
!=
nil
{
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetLinks
();
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"TAPI error"
},
nil
...
...
This diff is collapsed.
Click to expand it.
nucleus/controller.go
+
1
−
1
View file @
1416c8d8
...
@@ -62,7 +62,7 @@ func (c *Core) AttachDatabase() {
...
@@ -62,7 +62,7 @@ func (c *Core) AttachDatabase() {
func
(
c
*
Core
)
Shutdown
()
{
func
(
c
*
Core
)
Shutdown
()
{
stopIt
:=
<-
c
.
IsRunning
stopIt
:=
<-
c
.
IsRunning
if
(
stopIt
==
false
)
{
if
!
stopIt
{
log
.
Debug
(
"Shutdown() received action to shutdown"
)
log
.
Debug
(
"Shutdown() received action to shutdown"
)
}
else
{
}
else
{
log
.
Debug
(
"Shutdown() received something else."
)
log
.
Debug
(
"Shutdown() received something else."
)
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in issue
#35 (closed)
·
4 years ago
mentioned in issue
#35 (closed)
mentioned in issue #35
Toggle commit list
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