Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gNMI Target
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
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
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
gNMI Target
Commits
af732489
Commit
af732489
authored
2 months ago
by
S.H.
Browse files
Options
Downloads
Patches
Plain Diff
Change makefile to rename image to gnmi-target-local, add many debug print statements
parent
26fd529d
No related branches found
No related tags found
No related merge requests found
Pipeline
#265242
failed
2 months ago
Stage: build
Stage: analyze
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
examples/example01/handlers/interfaces/interfacesHandler.go
+3
-1
3 additions, 1 deletion
examples/example01/handlers/interfaces/interfacesHandler.go
internal/gnmiserver/server.go
+2
-0
2 additions, 0 deletions
internal/gnmiserver/server.go
with
6 additions
and
2 deletions
Makefile
+
1
−
1
View file @
af732489
...
@@ -40,7 +40,7 @@ generate-yang-models: install-tools
...
@@ -40,7 +40,7 @@ generate-yang-models: install-tools
go generate
go generate
container
:
build
container
:
build
docker buildx build
--rm
-t
gnmi-target
--load
-f
./examples/example01/target.Dockerfile .
docker buildx build
--rm
-t
gnmi-target
-local
--load
-f
./examples/example01/target.Dockerfile .
container-debug
:
container-debug
:
docker buildx build
--rm
-t
gnmi-target-debug
--load
-f
.examples/example01/Dockerfile.debug .
docker buildx build
--rm
-t
gnmi-target-debug
--load
-f
.examples/example01/Dockerfile.debug .
...
...
This diff is collapsed.
Click to expand it.
examples/example01/handlers/interfaces/interfacesHandler.go
+
3
−
1
View file @
af732489
...
@@ -59,6 +59,7 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
...
@@ -59,6 +59,7 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
case
update
:=
<-
interfaceChannel
:
case
update
:=
<-
interfaceChannel
:
//lock access for model
//lock access for model
diff
,
err
:=
yh
.
updateOrCreateInterface
(
update
)
diff
,
err
:=
yh
.
updateOrCreateInterface
(
update
)
fmt
.
Println
(
"PublishToSubs with this diff:"
,
diff
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"Error within interface subscription goroutine; %v"
,
err
)
log
.
Errorf
(
"Error within interface subscription goroutine; %v"
,
err
)
// TODO: check again
// TODO: check again
...
@@ -70,12 +71,12 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
...
@@ -70,12 +71,12 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
}
}
}
}
}()
}()
return
nil
return
nil
}
}
func
(
yh
*
InterfacesHandler
)
Update
(
c
ygot
.
ValidatedGoStruct
,
updates
[]
*
gnmi
.
Update
)
error
{
func
(
yh
*
InterfacesHandler
)
Update
(
c
ygot
.
ValidatedGoStruct
,
updates
[]
*
gnmi
.
Update
)
error
{
fmt
.
Println
(
"Update request received for "
,
yh
.
GetName
())
fmt
.
Println
(
"Update request received for "
,
yh
.
GetName
())
fmt
.
Println
(
"To be updated:"
,
updates
)
config
,
ok
:=
c
.
(
*
gnmitargetygot
.
Gnmitarget
)
config
,
ok
:=
c
.
(
*
gnmitargetygot
.
Gnmitarget
)
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"failed type assertion for config %T"
,
(
*
gnmitargetygot
.
Gnmitarget
)(
nil
))
return
fmt
.
Errorf
(
"failed type assertion for config %T"
,
(
*
gnmitargetygot
.
Gnmitarget
)(
nil
))
...
@@ -149,6 +150,7 @@ func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Up
...
@@ -149,6 +150,7 @@ func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Up
}
}
func
(
yh
*
InterfacesHandler
)
updateOrCreateInterface
(
localInterface
*
additions
.
Interface
)
([]
*
gnmi
.
Notification
,
error
)
{
func
(
yh
*
InterfacesHandler
)
updateOrCreateInterface
(
localInterface
*
additions
.
Interface
)
([]
*
gnmi
.
Notification
,
error
)
{
fmt
.
Println
(
"UpdateOrCreateInterface on interface"
,
localInterface
)
yh
.
Config
.
Lock
()
yh
.
Config
.
Lock
()
defer
yh
.
Config
.
Unlock
()
defer
yh
.
Config
.
Unlock
()
...
...
This diff is collapsed.
Click to expand it.
internal/gnmiserver/server.go
+
2
−
0
View file @
af732489
...
@@ -144,6 +144,8 @@ func (s *Server) callback(newConfig ygot.ValidatedGoStruct, existingConf ygot.Va
...
@@ -144,6 +144,8 @@ func (s *Server) callback(newConfig ygot.ValidatedGoStruct, existingConf ygot.Va
// TODO: This will be moved.
// TODO: This will be moved.
func
(
s
*
Server
)
PublishNotificationsToSubscribers
(
notifications
[]
*
gnmi
.
Notification
)
error
{
func
(
s
*
Server
)
PublishNotificationsToSubscribers
(
notifications
[]
*
gnmi
.
Notification
)
error
{
fmt
.
Println
(
"In PublishNotificationsToSubscribers()"
)
fmt
.
Println
(
"Notifications:"
,
notifications
)
for
_
,
specificDiff
:=
range
notifications
{
for
_
,
specificDiff
:=
range
notifications
{
// First for gnmi Updates
// First for gnmi Updates
updates
:=
specificDiff
.
GetUpdate
()
updates
:=
specificDiff
.
GetUpdate
()
...
...
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