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

schema is attached to sbi

parent 3bccf682
Branches
Tags
3 merge requests!95path traversal library,!91"Overhaul Architecture",!90Develop
Pipeline #61084 passed with warnings
......@@ -52,4 +52,4 @@ func (c *Core) Shutdown() {
}
log.Info("Shutdown complete")
os.Exit(0)
}
\ No newline at end of file
}
......@@ -19,7 +19,7 @@ type Device struct {
// use better naming in further develop
// Also all that Interface Call specific logic belongs to SBI!
func (d Device) Add(resp interface{}) error {
s, err := openconfig.Schema()
s, err := d.SBI.Schema()
if err != nil {
return err
}
......
......@@ -34,4 +34,4 @@ func TestDevice_Add(t *testing.T) {
log.Debug(d.SBI.SbiIdentifier())
})
}
}
\ No newline at end of file
}
package nucleus
import (
"code.fbi.h-da.de/cocsn/gosdn/nucleus/util"
"code.fbi.h-da.de/cocsn/yang-models/generated/openconfig"
"github.com/openconfig/ygot/ytypes"
)
// SouthboundInterface provides an
// interface for SBI implementations
type SouthboundInterface interface {
// Deprecated
SbiIdentifier() string
Schema() (*ytypes.Schema, error)
}
type Tapi struct {
......@@ -11,12 +20,17 @@ type Tapi struct {
type OpenConfig struct {
transport Transport
schema *ytypes.Schema
}
func (oc *OpenConfig) SbiIdentifier() string {
return "openconfig"
}
func (oc *OpenConfig) Schema() (*ytypes.Schema, error) {
return openconfig.Schema()
}
func (oc *OpenConfig) OpenconfigInterfaces(device Device) {
resp, err := oc.transport.Get(nil, nil...)
if err != nil {
......@@ -24,3 +38,10 @@ func (oc *OpenConfig) OpenconfigInterfaces(device Device) {
}
device.Add(resp)
}
func (oc *OpenConfig) GetFullDeviceInfo(device Device) error {
paths := util.NewPaths()
paths.ParseSchema(oc.schema, "device")
return nil
}
......@@ -47,4 +47,4 @@ func TestOpenConfig_OpenconfigInterfaces(t *testing.T) {
oc.OpenconfigInterfaces(tt.args.device)
})
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment