Skip to content
Snippets Groups Projects
Verified Commit 440a4d7e authored by Malte Bauch's avatar Malte Bauch
Browse files

Update init for assignForwardingHandler

parent 68bc2a76
No related branches found
No related tags found
1 merge request!253Initialize AssignForwardingHandler and KeyStoreHandler
Checking pipeline status
This commit is part of merge request !253. Comments created here will be created in the context of that merge request.
...@@ -36,6 +36,28 @@ func (yh *AssignForwardingHandler) Init(config *handler.Config, publishToSubsFun ...@@ -36,6 +36,28 @@ func (yh *AssignForwardingHandler) Init(config *handler.Config, publishToSubsFun
yh.Config = config yh.Config = config
yh.PublishToSubs = publishToSubsFunc yh.PublishToSubs = publishToSubsFunc
yh.Config.Lock()
defer yh.Config.Unlock()
copyCurrentConfig, err := ygot.DeepCopy(yh.Config.Data)
if err != nil {
return err
}
newConfig, ok := copyCurrentConfig.(*gnmitargetygot.Gnmitarget)
if !ok {
return fmt.Errorf("Wrong type, exptected: %T, got: %T", (*gnmitargetygot.OpenconfigInterfaces_Interfaces)(nil), copyCurrentConfig)
}
newConfig.GetOrCreateAssignForwarding()
//validate struct
if err := newConfig.Validate(); err != nil {
return err
}
yh.Config.Data = newConfig
return nil return nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment