diff --git a/os_clients/ubuntu/ubuntu.go b/os_clients/ubuntu/ubuntu.go index 70ad2d8599d33eca475f15fe37beba03313fec89..b6dd682068c803cf9911332bdd96db121b194b36 100644 --- a/os_clients/ubuntu/ubuntu.go +++ b/os_clients/ubuntu/ubuntu.go @@ -9,6 +9,7 @@ import ( "time" "code.fbi.h-da.de/danet/gnmi-target/modeldata/gnmitargetygot" + osc "code.fbi.h-da.de/danet/gnmi-target/os_clients" "github.com/openconfig/gnmi/proto/gnmi" gnmiv "github.com/openconfig/gnmi/value" @@ -17,7 +18,7 @@ import ( "github.com/vishvananda/netlink" ) -var supportedPaths = map[string]PathFunc{ +var supportedPaths = map[string]osc.PathFunc{ "/system/config/hostname": func(path *gnmi.Path, val *gnmi.TypedValue) error { value, err := gnmiv.ToScalar(val) if err != nil { @@ -29,11 +30,14 @@ var supportedPaths = map[string]PathFunc{ } return nil }, + "/interfaces/interface/name": func(path *gnmi.Path, val *gnmi.TypedValue) error { + return nil + }, } type OsclientUbuntu struct { gt *gnmitargetygot.Gnmitarget - pm PathMap + pm osc.PathMap } func NewOsclientUbuntu() *OsclientUbuntu { @@ -51,19 +55,19 @@ func (ou OsclientUbuntu) UpdateConfig(config *ygot.ValidatedGoStruct) error { func (ou *OsclientUbuntu) GetConfig() *gnmitargetygot.Gnmitarget { ou.gt = &gnmitargetygot.Gnmitarget{} - // // Create Interfaces - // h, err := netlink.NewHandle() - // if err != nil { - // log.WithFields(log.Fields{}).Error(err) - // } - // //defer h.Delete() - // localIfaces, err := h.LinkList() - // if err != nil { - // log.WithFields(log.Fields{}).Error(err) - // } - // for _, localIface := range localIfaces { - // ou.createInterfaces(localIface, ou.gt) - // } + // Create Interfaces + h, err := netlink.NewHandle() + if err != nil { + log.WithFields(log.Fields{}).Error(err) + } + //defer h.Delete() + localIfaces, err := h.LinkList() + if err != nil { + log.WithFields(log.Fields{}).Error(err) + } + for _, localIface := range localIfaces { + ou.createInterfaces(localIface, ou.gt) + } ou.getSystem(ou.gt) diff --git a/os_clients/ubuntu/pathHandling.go b/os_clients/utils.go similarity index 96% rename from os_clients/ubuntu/pathHandling.go rename to os_clients/utils.go index 1f93774911f9ea7edf9b52532bf22cbdbdf8eee3..01beeec6600206259928a6ce77770e1819e7d64e 100644 --- a/os_clients/ubuntu/pathHandling.go +++ b/os_clients/utils.go @@ -1,4 +1,4 @@ -package ubuntu +package os_clients import ( "fmt"