Skip to content
Snippets Groups Projects
Commit a734cd6f authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Documentation

parent 450cf188
No related branches found
No related tags found
3 merge requests!98Resolve "gNMI proto encoding",!91"Overhaul Architecture",!90Develop
Pipeline #63535 passed with warnings
This commit is part of merge request !91. Comments created here will be created in the context of that merge request.
...@@ -12,9 +12,12 @@ import ( ...@@ -12,9 +12,12 @@ import (
// SouthboundInterface provides an // SouthboundInterface provides an
// interface for SBI implementations // interface for SBI implementations
type SouthboundInterface interface { type SouthboundInterface interface {
// Deprecated // deprecated
SbiIdentifier() string SbiIdentifier() string
// SetNode injects SBI specific model
// representation to the transport.
// Needed for type assertion.
SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error
Schema() *ytypes.Schema Schema() *ytypes.Schema
} }
...@@ -22,11 +25,19 @@ type SouthboundInterface interface { ...@@ -22,11 +25,19 @@ type SouthboundInterface interface {
type Tapi struct { type Tapi struct {
} }
// OpenConfig is the implementation of an OpenConfig SBI.
// The struct holds the YANG schema and a function that
// returns an SBI specific SetNode function.
type OpenConfig struct { type OpenConfig struct {
// deprecated
transport Transport transport Transport
schema *ytypes.Schema
schema *ytypes.Schema
} }
// SbiIdentifier returns the string representation of
// the SBI
// deprecated
func (oc *OpenConfig) SbiIdentifier() string { func (oc *OpenConfig) SbiIdentifier() string {
return "openconfig" return "openconfig"
} }
...@@ -39,7 +50,10 @@ func (oc *OpenConfig) Schema() *ytypes.Schema { ...@@ -39,7 +50,10 @@ func (oc *OpenConfig) Schema() *ytypes.Schema {
return schema return schema
} }
func (oc *OpenConfig)SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error { // 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 { return func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error {
if err := ytypes.SetNode(schema, root.(*openconfig.Device), path, val, opts...); err != nil { if err := ytypes.SetNode(schema, root.(*openconfig.Device), path, val, opts...); err != nil {
return err return err
...@@ -48,9 +62,14 @@ func (oc *OpenConfig)SetNode() func(schema *yang.Entry, root interface{}, path * ...@@ -48,9 +62,14 @@ func (oc *OpenConfig)SetNode() func(schema *yang.Entry, root interface{}, path *
} }
} }
// deprecated
// Use for prototyping only.
// Use OpenConfig instead
type AristaOC struct { type AristaOC struct {
// deprecated
transport Transport transport Transport
schema *ytypes.Schema
schema *ytypes.Schema
} }
func (oc *AristaOC) SbiIdentifier() string { func (oc *AristaOC) SbiIdentifier() string {
...@@ -65,7 +84,10 @@ func (oc *AristaOC) Schema() *ytypes.Schema { ...@@ -65,7 +84,10 @@ func (oc *AristaOC) Schema() *ytypes.Schema {
return schema return schema
} }
func (oc *AristaOC)SetNode() func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error { // SetNode injects AristaOC specific model
// representation to the transport.
// Needed for type assertion.
func (oc *AristaOC) 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 { return func(schema *yang.Entry, root interface{}, path *gpb.Path, val interface{}, opts ...ytypes.SetNodeOpt) error {
if err := ytypes.SetNode(schema, root.(*arista.Device), path, val, opts...); err != nil { if err := ytypes.SetNode(schema, root.(*arista.Device), path, val, opts...); err != nil {
return err return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment