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
c9df869a
Commit
c9df869a
authored
2 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
Added callback function to gnmitarget
parent
4802f603
Branches
Branches containing commit
Tags
Tags containing commit
4 merge requests
!17
Build basic ci
,
!10
Add simple modem support on linux through modemmanager
,
!8
General refactoring
,
!5
Draft: Add basic set support for ip/routing via gnmi
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gnmitarget/callback.go
+32
-0
32 additions, 0 deletions
gnmitarget/callback.go
gnmitarget/target.go
+1
-6
1 addition, 6 deletions
gnmitarget/target.go
with
33 additions
and
6 deletions
gnmitarget/callback.go
0 → 100644
+
32
−
0
View file @
c9df869a
package
gnmitarget
import
(
"fmt"
"code.fbi.h-da.de/danet/gnmi-target/modeldata/gnmitargetygot"
"github.com/openconfig/ygot/ygot"
)
func
callbackFunc
(
config
ygot
.
ValidatedGoStruct
)
error
{
conf
,
ok
:=
config
.
(
*
gnmitargetygot
.
Gnmitarget
)
if
!
ok
{
return
fmt
.
Errorf
(
"failed type assertion for %T"
,
(
*
gnmitargetygot
.
Gnmitarget
)(
nil
))
}
walkThroughSystem
(
conf
.
GetSystem
())
walkThroughInterfaces
(
conf
.
GetInterfaces
())
walkThroughNetworkInstances
(
conf
.
GetNetworkInstances
())
return
nil
}
func
walkThroughSystem
(
system
*
gnmitargetygot
.
OpenconfigSystem_System
)
error
{
return
nil
}
func
walkThroughInterfaces
(
interfaces
*
gnmitargetygot
.
OpenconfigInterfaces_Interfaces
)
error
{
return
nil
}
func
walkThroughNetworkInstances
(
system
*
gnmitargetygot
.
OpenconfigNetworkInstance_NetworkInstances
)
error
{
return
nil
}
This diff is collapsed.
Click to expand it.
gnmitarget/target.go
+
1
−
6
View file @
c9df869a
...
...
@@ -18,7 +18,6 @@ import (
"code.fbi.h-da.de/danet/gnmi-target/modeldata/gnmitargetygot"
pbGNMI
"github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ygot/ygot"
log
"github.com/sirupsen/logrus"
)
...
...
@@ -80,7 +79,7 @@ func (gt *GnmiTarget) Start(bindAddress string) error {
}
}
gnmiServer
,
err
:=
gnmiserver
.
NewServer
(
gnmiModel
,
gt
.
os
.
GetConfig
(),
gt
.
callbackFunc
)
gnmiServer
,
err
:=
gnmiserver
.
NewServer
(
gnmiModel
,
gt
.
os
.
GetConfig
(),
callbackFunc
)
if
err
!=
nil
{
log
.
Fatalf
(
"error in creating GNMI target: %v"
,
err
)
}
...
...
@@ -107,7 +106,3 @@ func (gt *GnmiTarget) Start(bindAddress string) error {
return
nil
}
func
(
gt
GnmiTarget
)
callbackFunc
(
config
ygot
.
ValidatedGoStruct
)
error
{
return
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