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
No related branches found
No related tags found
3 merge requests!95path traversal library,!91"Overhaul Architecture",!90Develop
Pipeline #61084 passed with warnings
...@@ -52,4 +52,4 @@ func (c *Core) Shutdown() { ...@@ -52,4 +52,4 @@ func (c *Core) Shutdown() {
} }
log.Info("Shutdown complete") log.Info("Shutdown complete")
os.Exit(0) os.Exit(0)
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ type Device struct { ...@@ -19,7 +19,7 @@ type Device struct {
// use better naming in further develop // use better naming in further develop
// Also all that Interface Call specific logic belongs to SBI! // Also all that Interface Call specific logic belongs to SBI!
func (d Device) Add(resp interface{}) error { func (d Device) Add(resp interface{}) error {
s, err := openconfig.Schema() s, err := d.SBI.Schema()
if err != nil { if err != nil {
return err return err
} }
......
...@@ -34,4 +34,4 @@ func TestDevice_Add(t *testing.T) { ...@@ -34,4 +34,4 @@ func TestDevice_Add(t *testing.T) {
log.Debug(d.SBI.SbiIdentifier()) log.Debug(d.SBI.SbiIdentifier())
}) })
} }
} }
\ No newline at end of file
package nucleus 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 // SouthboundInterface provides an
// interface for SBI implementations // interface for SBI implementations
type SouthboundInterface interface { type SouthboundInterface interface {
// Deprecated
SbiIdentifier() string SbiIdentifier() string
Schema() (*ytypes.Schema, error)
} }
type Tapi struct { type Tapi struct {
...@@ -11,12 +20,17 @@ type Tapi struct { ...@@ -11,12 +20,17 @@ type Tapi struct {
type OpenConfig struct { type OpenConfig struct {
transport Transport transport Transport
schema *ytypes.Schema
} }
func (oc *OpenConfig) SbiIdentifier() string { func (oc *OpenConfig) SbiIdentifier() string {
return "openconfig" return "openconfig"
} }
func (oc *OpenConfig) Schema() (*ytypes.Schema, error) {
return openconfig.Schema()
}
func (oc *OpenConfig) OpenconfigInterfaces(device Device) { func (oc *OpenConfig) OpenconfigInterfaces(device Device) {
resp, err := oc.transport.Get(nil, nil...) resp, err := oc.transport.Get(nil, nil...)
if err != nil { if err != nil {
...@@ -24,3 +38,10 @@ func (oc *OpenConfig) OpenconfigInterfaces(device Device) { ...@@ -24,3 +38,10 @@ func (oc *OpenConfig) OpenconfigInterfaces(device Device) {
} }
device.Add(resp) 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) { ...@@ -47,4 +47,4 @@ func TestOpenConfig_OpenconfigInterfaces(t *testing.T) {
oc.OpenconfigInterfaces(tt.args.device) 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