Skip to content
Snippets Groups Projects
Commit af732489 authored by S.H.'s avatar S.H.
Browse files

Change makefile to rename image to gnmi-target-local, add many debug print statements

parent 26fd529d
No related branches found
No related tags found
No related merge requests found
Pipeline #265242 failed
...@@ -40,7 +40,7 @@ generate-yang-models: install-tools ...@@ -40,7 +40,7 @@ generate-yang-models: install-tools
go generate go generate
container: build container: build
docker buildx build --rm -t gnmi-target --load -f ./examples/example01/target.Dockerfile . docker buildx build --rm -t gnmi-target-local --load -f ./examples/example01/target.Dockerfile .
container-debug: container-debug:
docker buildx build --rm -t gnmi-target-debug --load -f .examples/example01/Dockerfile.debug . docker buildx build --rm -t gnmi-target-debug --load -f .examples/example01/Dockerfile.debug .
......
...@@ -59,6 +59,7 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func ...@@ -59,6 +59,7 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
case update := <-interfaceChannel: case update := <-interfaceChannel:
//lock access for model //lock access for model
diff, err := yh.updateOrCreateInterface(update) diff, err := yh.updateOrCreateInterface(update)
fmt.Println("PublishToSubs with this diff:", diff)
if err != nil { if err != nil {
log.Errorf("Error within interface subscription goroutine; %v", err) log.Errorf("Error within interface subscription goroutine; %v", err)
// TODO: check again // TODO: check again
...@@ -70,12 +71,12 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func ...@@ -70,12 +71,12 @@ func (yh *InterfacesHandler) Init(config *handler.Config, publishToSubsFunc func
} }
} }
}() }()
return nil return nil
} }
func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Update) error { func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Update) error {
fmt.Println("Update request received for ", yh.GetName()) fmt.Println("Update request received for ", yh.GetName())
fmt.Println("To be updated:", updates)
config, ok := c.(*gnmitargetygot.Gnmitarget) config, ok := c.(*gnmitargetygot.Gnmitarget)
if !ok { if !ok {
return fmt.Errorf("failed type assertion for config %T", (*gnmitargetygot.Gnmitarget)(nil)) return fmt.Errorf("failed type assertion for config %T", (*gnmitargetygot.Gnmitarget)(nil))
...@@ -149,6 +150,7 @@ func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Up ...@@ -149,6 +150,7 @@ func (yh *InterfacesHandler) Update(c ygot.ValidatedGoStruct, updates []*gnmi.Up
} }
func (yh *InterfacesHandler) updateOrCreateInterface(localInterface *additions.Interface) ([]*gnmi.Notification, error) { func (yh *InterfacesHandler) updateOrCreateInterface(localInterface *additions.Interface) ([]*gnmi.Notification, error) {
fmt.Println("UpdateOrCreateInterface on interface", localInterface)
yh.Config.Lock() yh.Config.Lock()
defer yh.Config.Unlock() defer yh.Config.Unlock()
......
...@@ -144,6 +144,8 @@ func (s *Server) callback(newConfig ygot.ValidatedGoStruct, existingConf ygot.Va ...@@ -144,6 +144,8 @@ func (s *Server) callback(newConfig ygot.ValidatedGoStruct, existingConf ygot.Va
// TODO: This will be moved. // TODO: This will be moved.
func (s *Server) PublishNotificationsToSubscribers(notifications []*gnmi.Notification) error { func (s *Server) PublishNotificationsToSubscribers(notifications []*gnmi.Notification) error {
fmt.Println("In PublishNotificationsToSubscribers()")
fmt.Println("Notifications:", notifications)
for _, specificDiff := range notifications { for _, specificDiff := range notifications {
// First for gnmi Updates // First for gnmi Updates
updates := specificDiff.GetUpdate() updates := specificDiff.GetUpdate()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment