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
2d38a7a7
Commit
2d38a7a7
authored
4 years ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
Develop gosdn cli t2
parent
a3876dd3
No related branches found
No related tags found
1 merge request
!18
Develop
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cliInterface/gosdnCLI.proto
+13
-0
13 additions, 0 deletions
cliInterface/gosdnCLI.proto
gosdn-cli/gosdn-cli.go
+7
-0
7 additions, 0 deletions
gosdn-cli/gosdn-cli.go
nucleus/nucleus-core.go
+10
-2
10 additions, 2 deletions
nucleus/nucleus-core.go
with
30 additions
and
2 deletions
cliInterface/gosdnCLI.proto
+
13
−
0
View file @
2d38a7a7
...
...
@@ -12,6 +12,8 @@ package cliInterface;
service
Greeter
{
// Sends a greeting
rpc
SayHello
(
HelloRequest
)
returns
(
HelloReply
)
{}
// Shutdown goSDN
rpc
Shutdown
(
ShutdownRequest
)
returns
(
ShutdownReply
)
{}
}
// The request message containing the user's name.
...
...
@@ -23,3 +25,14 @@ message HelloRequest {
message
HelloReply
{
string
message
=
1
;
}
// Request to shutdown goSDN
message
ShutdownRequest
{
string
name
=
1
;
}
// The response message containing some shutdown notes of goSDN
message
ShutdownReply
{
string
message
=
1
;
}
This diff is collapsed.
Click to expand it.
gosdn-cli/gosdn-cli.go
+
7
−
0
View file @
2d38a7a7
...
...
@@ -18,6 +18,7 @@ const (
func
main
()
{
// Set up a connection to the server.
address
:=
"localhost:55055"
conn
,
err
:=
grpc
.
Dial
(
address
,
grpc
.
WithInsecure
(),
grpc
.
WithBlock
())
if
err
!=
nil
{
log
.
Fatalf
(
"did not connect: %v"
,
err
)
...
...
@@ -37,4 +38,10 @@ func main() {
log
.
Fatalf
(
"could not greet: %v"
,
err
)
}
log
.
Printf
(
"Greeting: %s"
,
r
.
GetMessage
())
r2
,
err
:=
c
.
Shutdown
(
ctx
,
&
pb
.
ShutdownRequest
{
Name
:
name
})
if
err
!=
nil
{
log
.
Fatalf
(
"could not greet: %v"
,
err
)
}
log
.
Printf
(
"Greeting: %s"
,
r2
.
GetMessage
())
}
This diff is collapsed.
Click to expand it.
nucleus/nucleus-core.go
+
10
−
2
View file @
2d38a7a7
...
...
@@ -26,6 +26,13 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe
return
&
pb
.
HelloReply
{
Message
:
"Hello "
+
in
.
GetName
()},
nil
}
func
(
s
*
server
)
Shutdown
(
ctx
context
.
Context
,
in
*
pb
.
ShutdownRequest
)
(
*
pb
.
ShutdownReply
,
error
)
{
log
.
Printf
(
"Received: %v"
,
in
.
GetName
())
isRunning
=
false
return
&
pb
.
ShutdownReply
{
Message
:
"Shutdown "
+
in
.
GetName
()},
nil
}
func
getCLIGoing
()
{
log
.
Println
(
"Starting: GetCLIGoing"
)
// Boot-up the control interface for the cli
...
...
@@ -63,12 +70,13 @@ func StartUp() {
* nucleus.Run() is the "main loop" of the controller
*/
var
isRunning
=
true
func
Run
()
{
isRunning
:=
true
for
isRunning
{
time
.
Sleep
(
10
*
time
.
Second
)
isRunning
=
false
log
.
Println
((
"Still alive..."
))
}
log
.
Println
(
"Good bye....!"
)
...
...
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