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
9185dae6
Commit
9185dae6
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
change southbound interface
parent
71fe6871
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!173
Process response overhaul
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
interfaces/southbound/sbi.go
+1
-0
1 addition, 0 deletions
interfaces/southbound/sbi.go
nucleus/gnmi_transport.go
+3
-3
3 additions, 3 deletions
nucleus/gnmi_transport.go
nucleus/southbound.go
+8
-4
8 additions, 4 deletions
nucleus/southbound.go
with
12 additions
and
7 deletions
interfaces/southbound/sbi.go
+
1
−
0
View file @
9185dae6
...
...
@@ -22,4 +22,5 @@ type SouthboundInterface interface { // nolint
Schema
()
*
ytypes
.
Schema
ID
()
uuid
.
UUID
Type
()
spb
.
Type
Unmarshal
()
func
([]
byte
,
[]
string
,
interface
{},
...
ytypes
.
UnmarshalOpt
)
error
}
This diff is collapsed.
Click to expand it.
nucleus/gnmi_transport.go
+
3
−
3
View file @
9185dae6
...
...
@@ -68,6 +68,7 @@ func newGnmiTransport(opts *tpb.TransportOption, sbi southbound.SouthboundInterf
return
&
Gnmi
{
SetNode
:
sbi
.
SetNode
(),
RespChan
:
make
(
chan
*
gpb
.
SubscribeResponse
),
Unmarshal
:
sbi
.
Unmarshal
(),
Options
:
opts
,
client
:
c
,
config
:
gnmiConfig
,
...
...
@@ -231,11 +232,10 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch
for
_
,
msg
:=
range
rn
{
for
_
,
update
:=
range
msg
.
Update
{
path
:=
update
.
Path
fullPath
:=
path
val
,
ok
:=
update
.
Val
.
Value
.
(
*
gpb
.
TypedValue_JsonIetfVal
)
val
,
ok
:=
update
.
Val
.
Value
.
(
*
gpb
.
TypedValue_JsonVal
)
if
ok
{
opts
:=
[]
ytypes
.
UnmarshalOpt
{
&
ytypes
.
IgnoreExtraFields
{}}
return
g
.
Unmarshal
(
val
.
Json
Ietf
Val
,
pathutils
.
ToStrings
(
fullP
ath
),
root
,
opts
...
)
return
g
.
Unmarshal
(
val
.
JsonVal
,
pathutils
.
ToStrings
(
p
ath
),
root
,
opts
...
)
}
// TODO(mk): Evaluate hardcoded model key
schema
:=
models
[
"Device"
]
...
...
This diff is collapsed.
Click to expand it.
nucleus/southbound.go
+
8
−
4
View file @
9185dae6
...
...
@@ -58,8 +58,7 @@ func (oc *OpenConfig) Schema() *ytypes.Schema {
return
schema
}
// SetNode injects OpenConfig specific model
// representation to the transport.
// SetNode injects OpenConfig specific model representation to the transport.
// Needed for type assertion.
func
(
oc
*
OpenConfig
)
SetNode
()
func
(
schema
*
yang
.
Entry
,
root
interface
{},
path
*
gpb
.
Path
,
val
interface
{},
opts
...
ytypes
.
SetNodeOpt
)
error
{
return
func
(
schema
*
yang
.
Entry
,
root
interface
{},
path
*
gpb
.
Path
,
val
interface
{},
opts
...
ytypes
.
SetNodeOpt
)
error
{
...
...
@@ -67,8 +66,7 @@ func (oc *OpenConfig) SetNode() func(schema *yang.Entry, root interface{}, path
}
}
// Unmarshal injects OpenConfig specific model
// representation to the transport.
// Unmarshal injects OpenConfig specific model representation to the transport.
// Needed for type assertion.
func
(
oc
*
OpenConfig
)
Unmarshal
()
func
([]
byte
,
[]
string
,
interface
{},
...
ytypes
.
UnmarshalOpt
)
error
{
return
unmarshal
...
...
@@ -170,6 +168,12 @@ func (csbi *Csbi) SetNode() func(schema *yang.Entry, root interface{}, path *gpb
}
}
// Unmarshal injects OpenConfig specific model representation to the transport.
// Needed for type assertion.
func
(
csbi
*
Csbi
)
Unmarshal
()
func
([]
byte
,
[]
string
,
interface
{},
...
ytypes
.
UnmarshalOpt
)
error
{
return
unmarshal
}
// Schema is holding the default OpenConfig schema for minimal compatibility
// to gosdn interfaces
func
(
csbi
*
Csbi
)
Schema
()
*
ytypes
.
Schema
{
...
...
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