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
a14f90aa
Commit
a14f90aa
authored
3 years ago
by
Malte Bauch
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
395ed59e
No related branches found
No related tags found
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
os_clients/ubuntu/pathHandling.go
+30
-0
30 additions, 0 deletions
os_clients/ubuntu/pathHandling.go
os_clients/ubuntu/ubuntu.go
+5
-4
5 additions, 4 deletions
os_clients/ubuntu/ubuntu.go
with
35 additions
and
4 deletions
os_clients/ubuntu/pathHandling.go
0 → 100644
+
30
−
0
View file @
a14f90aa
package
ubuntu
import
(
"fmt"
"github.com/openconfig/gnmi/proto/gnmi"
)
type
PathFunc
func
(
path
*
gnmi
.
Path
,
val
*
gnmi
.
TypedValue
)
error
type
PathMap
map
[
string
]
PathFunc
func
(
pm
PathMap
)
Register
(
s
string
,
fn
PathFunc
)
error
{
if
_
,
found
:=
pm
[
s
];
found
{
return
fmt
.
Errorf
(
"a function is already registered for path: '%s'"
,
s
)
}
pm
[
s
]
=
fn
return
nil
}
func
(
pm
PathMap
)
Execute
(
s
string
)
error
{
return
execute
(
pm
,
s
)
}
func
execute
(
pm
PathMap
,
p
string
)
error
{
if
_
,
found
:=
pm
[
p
];
found
{
//return fn()
}
return
fmt
.
Errorf
(
"The given path: '%s' is not supported"
,
p
)
}
This diff is collapsed.
Click to expand it.
os_clients/ubuntu/ubuntu.go
+
5
−
4
View file @
a14f90aa
package
ubuntu
package
ubuntu
import
(
import
(
"fmt"
"net"
"net"
"os"
"os"
"os/exec"
"os/exec"
...
@@ -62,12 +63,12 @@ func (ou *OsclientUbuntu) callbackFunc(config ygot.ValidatedGoStruct) error {
...
@@ -62,12 +63,12 @@ func (ou *OsclientUbuntu) callbackFunc(config ygot.ValidatedGoStruct) error {
return
err
return
err
}
}
for
_
,
diff
:=
range
diffs
.
GetUpdate
()
{
for
_
,
diff
:=
range
diffs
.
GetUpdate
()
{
p
ath
,
err
:=
ygot
.
PathToS
tring
(
diff
.
GetPath
())
schemaP
ath
,
err
:=
ygot
.
PathToS
chemaPath
(
diff
.
GetPath
())
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
log
.
Info
(
p
ath
)
log
.
Info
(
schemaP
ath
)
switch
p
ath
{
switch
schemaP
ath
{
case
"/system/config/hostname"
:
case
"/system/config/hostname"
:
value
,
err
:=
gnmiv
.
ToScalar
(
diff
.
GetVal
())
value
,
err
:=
gnmiv
.
ToScalar
(
diff
.
GetVal
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -78,7 +79,7 @@ func (ou *OsclientUbuntu) callbackFunc(config ygot.ValidatedGoStruct) error {
...
@@ -78,7 +79,7 @@ func (ou *OsclientUbuntu) callbackFunc(config ygot.ValidatedGoStruct) error {
return
err
return
err
}
}
default
:
default
:
//INFO: currently this case is ignored
return
fmt
.
Errorf
(
"this path is not supported"
)
}
}
}
}
...
...
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