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
79048453
Commit
79048453
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
new logger, error handling, new GetLink() call
parent
be5abea2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!30
Gosdn cli features flow
,
!18
Develop
Pipeline
#52137
failed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nucleus/cli-handling.go
+19
-13
19 additions, 13 deletions
nucleus/cli-handling.go
restconf/client/ciena/client.go
+8
-0
8 additions, 0 deletions
restconf/client/ciena/client.go
with
27 additions
and
13 deletions
nucleus/cli-handling.go
+
19
−
13
View file @
79048453
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"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"
"log"
"
code.fbi.h-da.de/cocsn/gosdn/
log"
"net"
"net"
)
)
...
@@ -23,48 +23,54 @@ type server struct {
...
@@ -23,48 +23,54 @@ 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
.
Printf
(
"Received: %v"
,
in
.
GetName
())
log
.
Info
(
"Received: %v"
,
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
.
Printf
(
"Received: %v"
,
in
.
GetName
())
log
.
Info
(
"Received: %v"
,
in
.
GetName
())
isRunning
=
false
isRunning
=
false
return
&
pb
.
ShutdownReply
{
Message
:
"Shutdown "
+
in
.
GetName
()},
nil
return
&
pb
.
ShutdownReply
{
Message
:
"Shutdown "
+
in
.
GetName
()},
nil
}
}
func
getCLIGoing
(
core
*
Core
)
{
func
getCLIGoing
(
core
*
Core
)
{
log
.
Println
(
"Starting: GetCLIGoing"
)
log
.
Info
(
"Starting: GetCLIGoing"
)
// 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
f
(
"failed to listen: %v"
,
err
)
log
.
Fatal
(
"failed to listen: %v"
,
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
f
(
"failed to serve: %v"
,
err
)
log
.
Fatal
(
"failed to serve: %v"
,
err
)
}
}
log
.
Println
(
"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
.
Printf
(
"Received: %v"
,
in
.
GetName
())
log
.
Info
(
"Received: %v"
,
in
.
GetName
())
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodes
()
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodes
();
err
!=
nil
{
log
.
Error
(
err
)
}
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
}
}
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
.
Printf
(
"Received: %v"
,
in
.
GetName
())
log
.
Info
(
"Received: %v"
,
in
.
GetName
())
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodeEdgePoints
()
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetNodeEdgePoints
();
err
!=
nil
{
log
.
Error
(
err
)
}
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
}
}
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
.
Printf
(
"Received: %v"
,
in
.
GetName
())
log
.
Info
(
"Received: %v"
,
in
.
GetName
())
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetConnections
()
if
err
:=
s
.
core
.
clients
[
"ciena-mcp"
]
.
(
*
ciena
.
MCPClient
)
.
GetLinks
();
err
!=
nil
{
log
.
Error
(
err
)
}
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
return
&
pb
.
TAPIReply
{
Message
:
"Done"
},
nil
}
}
This diff is collapsed.
Click to expand it.
restconf/client/ciena/client.go
+
8
−
0
View file @
79048453
...
@@ -57,6 +57,14 @@ func (c *MCPClient) GetConnections() error {
...
@@ -57,6 +57,14 @@ func (c *MCPClient) GetConnections() error {
return
err
return
err
}
}
func
(
c
*
MCPClient
)
GetLinks
()
error
{
defer
c
.
buffer
.
Reset
()
_
,
err
:=
c
.
client
.
TapiTopologyCore
.
GetTapiCoreContextTopologyMcpBaseTopologyLink
(
nil
)
c
.
database
.
StoreConnections
(
c
.
buffer
.
String
())
log
.
Debug
(
c
.
buffer
.
Next
(
25
))
return
err
}
func
(
c
*
MCPClient
)
GetNodes
()
error
{
func
(
c
*
MCPClient
)
GetNodes
()
error
{
defer
c
.
buffer
.
Reset
()
defer
c
.
buffer
.
Reset
()
_
,
err
:=
c
.
client
.
TapiTopologyCore
.
GetTapiCoreContextTopologyMcpBaseTopologyNode
(
nil
)
_
,
err
:=
c
.
client
.
TapiTopologyCore
.
GetTapiCoreContextTopologyMcpBaseTopologyNode
(
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