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
890f7094
Commit
890f7094
authored
4 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
gofmt
parent
c53dc06f
No related branches found
No related tags found
2 merge requests
!120
Resolve "Code Quality"
,
!90
Develop
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
cli/get.go
+2
-2
2 additions, 2 deletions
cli/get.go
cli/integration_test.go
+1
-1
1 addition, 1 deletion
cli/integration_test.go
cmd/get.go
+1
-1
1 addition, 1 deletion
cmd/get.go
nucleus/controller.go
+6
-6
6 additions, 6 deletions
nucleus/controller.go
with
10 additions
and
10 deletions
cli/get.go
+
2
−
2
View file @
890f7094
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
)
)
// Get sends a gNMI Get request to the specified target and prints the response to stdout
// Get sends a gNMI Get request to the specified target and prints the response to stdout
func
Get
(
a
,
u
,
p
string
,
args
...
string
)
(
*
gpb
.
GetResponse
,
error
)
{
func
Get
(
a
,
u
,
p
string
,
args
...
string
)
(
*
gpb
.
GetResponse
,
error
)
{
sbi
:=
&
nucleus
.
OpenConfig
{}
sbi
:=
&
nucleus
.
OpenConfig
{}
opts
:=
&
nucleus
.
GnmiTransportOptions
{
opts
:=
&
nucleus
.
GnmiTransportOptions
{
Config
:
gnmi
.
Config
{
Config
:
gnmi
.
Config
{
...
@@ -22,7 +22,7 @@ func Get(a, u, p string, args ...string) (*gpb.GetResponse,error) {
...
@@ -22,7 +22,7 @@ func Get(a, u, p string, args ...string) (*gpb.GetResponse,error) {
}
}
t
,
err
:=
nucleus
.
NewGnmiTransport
(
opts
)
t
,
err
:=
nucleus
.
NewGnmiTransport
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
resp
,
err
:=
t
.
Get
(
context
.
Background
(),
args
...
)
resp
,
err
:=
t
.
Get
(
context
.
Background
(),
args
...
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
cli/integration_test.go
+
1
−
1
View file @
890f7094
...
@@ -109,7 +109,7 @@ func TestGet(t *testing.T) {
...
@@ -109,7 +109,7 @@ func TestGet(t *testing.T) {
}
}
for
_
,
tt
:=
range
tests
{
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
_
,
err
:=
Get
(
tt
.
args
.
a
,
tt
.
args
.
u
,
tt
.
args
.
p
,
tt
.
args
.
args
...
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
if
_
,
err
:=
Get
(
tt
.
args
.
a
,
tt
.
args
.
u
,
tt
.
args
.
p
,
tt
.
args
.
args
...
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"Get() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
t
.
Errorf
(
"Get() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
cmd/get.go
+
1
−
1
View file @
890f7094
...
@@ -42,7 +42,7 @@ var getCmd = &cobra.Command{
...
@@ -42,7 +42,7 @@ var getCmd = &cobra.Command{
Short
:
"get request"
,
Short
:
"get request"
,
Long
:
`Sends a gNMI Get request to the specified target and prints the response to stdout`
,
Long
:
`Sends a gNMI Get request to the specified target and prints the response to stdout`
,
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
RunE
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
_
,
err
:=
cli
.
Get
(
address
,
username
,
password
,
args
...
)
_
,
err
:=
cli
.
Get
(
address
,
username
,
password
,
args
...
)
return
err
return
err
},
},
}
}
...
...
This diff is collapsed.
Click to expand it.
nucleus/controller.go
+
6
−
6
View file @
890f7094
...
@@ -26,10 +26,10 @@ var c *Core
...
@@ -26,10 +26,10 @@ var c *Core
func
init
()
{
func
init
()
{
c
=
&
Core
{
c
=
&
Core
{
database
:
database
.
Database
{},
database
:
database
.
Database
{},
pndc
:
pndStore
{},
pndc
:
pndStore
{},
sbic
:
sbiStore
{},
sbic
:
sbiStore
{},
stopChan
:
make
(
chan
os
.
Signal
,
1
),
stopChan
:
make
(
chan
os
.
Signal
,
1
),
}
}
// Setting up signal capturing
// Setting up signal capturing
...
@@ -106,7 +106,7 @@ func Run(ctx context.Context) error {
...
@@ -106,7 +106,7 @@ func Run(ctx context.Context) error {
}
}
}
}
func
shutdown
()
error
{
func
shutdown
()
error
{
log
.
Info
(
"shutting down controller"
)
log
.
Info
(
"shutting down controller"
)
return
stopHttpServer
()
return
stopHttpServer
()
}
}
\ No newline at end of file
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