From e1b84b3b46c26e251b7e3272a69010f6cffa4c23 Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@extern.h-da.de> Date: Thu, 19 May 2022 17:58:07 +0200 Subject: [PATCH] WIP --- Dockerfile | 1 - Makefile | 3 +++ os_clients/freebsd/freebsd.go | 9 +++++++++ os_clients/os_clients.go | 3 ++- os_clients/ubuntu/ubuntu.go | 10 ++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 13ae8fb..5a081c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ ARG GOLANG_VERSION=1.18 FROM golang:$GOLANG_VERSION-buster AS installer - WORKDIR /gnmi-target/ COPY go.* ./ RUN go mod download diff --git a/Makefile b/Makefile index ba6548f..f818a9d 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ generate-yang-models: install-tools container: build docker build -t gnmi-target -f ./Dockerfile . +container-debug: + docker build -t gnmi-target-debug -f ./Dockerfile.debug . + # other targets cross: go build -o ${OUTPUT} diff --git a/os_clients/freebsd/freebsd.go b/os_clients/freebsd/freebsd.go index 0a92a5a..b66c5a9 100644 --- a/os_clients/freebsd/freebsd.go +++ b/os_clients/freebsd/freebsd.go @@ -43,6 +43,15 @@ func (of *OsclientFreebsd) GetConfig() *gnmitargetygot.Gnmitarget { return of.gt } +func (ou *OsclientFreebsd) GetCallbackFunc() func(ygot.ValidatedGoStruct) error { + return callbackFunc +} + +func callbackFunc(config ygot.ValidatedGoStruct) error { + + return nil +} + // ExampleAnnotation is used to demonstrate the ygot.Annotation interface, // and the ability for ygot to add annotations to generated structs. type ExampleAnnotation struct { diff --git a/os_clients/os_clients.go b/os_clients/os_clients.go index 66da6ef..675bf89 100644 --- a/os_clients/os_clients.go +++ b/os_clients/os_clients.go @@ -1,11 +1,12 @@ package os_clients import ( - "github.com/openconfig/ygot/ygot" "code.fbi.h-da.de/danet/gnmi-target/modeldata/gnmitargetygot" + "github.com/openconfig/ygot/ygot" ) type Osclient interface { UpdateConfig(config *ygot.ValidatedGoStruct) error GetConfig() *gnmitargetygot.Gnmitarget + GetCallbackFunc() func(ygot.ValidatedGoStruct) error } diff --git a/os_clients/ubuntu/ubuntu.go b/os_clients/ubuntu/ubuntu.go index aeb51a9..1227139 100644 --- a/os_clients/ubuntu/ubuntu.go +++ b/os_clients/ubuntu/ubuntu.go @@ -1,6 +1,7 @@ package ubuntu import ( + "fmt" "net" "os" "os/exec" @@ -50,6 +51,15 @@ func (ou *OsclientUbuntu) GetConfig() *gnmitargetygot.Gnmitarget { return ou.gt } +func (ou *OsclientUbuntu) GetCallbackFunc() func(ygot.ValidatedGoStruct) error { + return callbackFunc +} + +func callbackFunc(config ygot.ValidatedGoStruct) error { + fmt.Printf("config: %v\n", config) + return nil +} + func (ou OsclientUbuntu) createInterfaces(localIface netlink.Link, gt *gnmitargetygot.Gnmitarget) { //experiment with the ygot struct //populate with data HERE -- GitLab