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

NewGnmiTarget initializes notification dispatcher

parent f7fb7da9
No related branches found
No related tags found
1 merge request!44NewGnmiTarget initializes notification dispatcher
Pipeline #184354 passed
...@@ -39,7 +39,6 @@ import ( ...@@ -39,7 +39,6 @@ import (
"code.fbi.h-da.de/danet/gnmi-target/examples/example01/handlers/system" "code.fbi.h-da.de/danet/gnmi-target/examples/example01/handlers/system"
gnmitargetygot "code.fbi.h-da.de/danet/gnmi-target/examples/example01/model" gnmitargetygot "code.fbi.h-da.de/danet/gnmi-target/examples/example01/model"
"code.fbi.h-da.de/danet/gnmi-target/handler" "code.fbi.h-da.de/danet/gnmi-target/handler"
not "code.fbi.h-da.de/danet/gnmi-target/internal/notifications"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
...@@ -84,8 +83,6 @@ var startCmd = &cobra.Command{ ...@@ -84,8 +83,6 @@ var startCmd = &cobra.Command{
logrus.Fatal(err) logrus.Fatal(err)
} }
changeDispatcher := not.NewDispatcher()
// The registered path handlers sorted by priority. If specific // The registered path handlers sorted by priority. If specific
// handlers should be able to process their workload before others, // handlers should be able to process their workload before others,
// then they should be placed in the front of the slice. // then they should be placed in the front of the slice.
...@@ -99,7 +96,7 @@ var startCmd = &cobra.Command{ ...@@ -99,7 +96,7 @@ var startCmd = &cobra.Command{
system.NewSystemHandler(), system.NewSystemHandler(),
} }
gnmitTarget := gnmitarget.NewGnmiTarget(schema, &gnmitargetygot.Gnmitarget{}, gnmitargetygot.ΓModelData, gnmitargetygot.Unmarshal, gnmitargetygot.ΛEnum, changeDispatcher, handlers...) gnmitTarget := gnmitarget.NewGnmiTarget(schema, &gnmitargetygot.Gnmitarget{}, gnmitargetygot.ΓModelData, gnmitargetygot.Unmarshal, gnmitargetygot.ΛEnum, handlers...)
if err := gnmitTarget.Start(viper.GetString("bindAddress"), viper.GetString("certFile"), viper.GetString("keyFile"), viper.GetString("caFile"), *insecure); err != nil { if err := gnmitTarget.Start(viper.GetString("bindAddress"), viper.GetString("certFile"), viper.GetString("keyFile"), viper.GetString("caFile"), *insecure); err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
......
...@@ -34,7 +34,6 @@ require ( ...@@ -34,7 +34,6 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ func (s *Server) Subscribe(stream gnmi.GNMI_SubscribeServer) error { ...@@ -42,7 +42,7 @@ func (s *Server) Subscribe(stream gnmi.GNMI_SubscribeServer) error {
} }
// Print the path a subscription is requested for. // Print the path a subscription is requested for.
log.Infof("Received subscribe for gnmi path %s", path.String()) log.Infof("Received subscribe for gnmi path %s with mode %s", path.String(), subscriptions.GetMode().String())
} }
subscribeMode = subscriptions.GetMode() subscribeMode = subscriptions.GetMode()
......
...@@ -43,7 +43,6 @@ func NewGnmiTarget( ...@@ -43,7 +43,6 @@ func NewGnmiTarget(
modeldata []*pbGNMI.ModelData, modeldata []*pbGNMI.ModelData,
unmarshalFn func(data []byte, destStruct ygot.GoStruct, opts ...ytypes.UnmarshalOpt) error, unmarshalFn func(data []byte, destStruct ygot.GoStruct, opts ...ytypes.UnmarshalOpt) error,
ΛEnum map[string]map[int64]ygot.EnumDefinition, ΛEnum map[string]map[int64]ygot.EnumDefinition,
changeDispatcher *not.Dispatcher,
yangHandlers ...handler.PathHandler, yangHandlers ...handler.PathHandler,
) *GnmiTarget { ) *GnmiTarget {
return &GnmiTarget{ return &GnmiTarget{
...@@ -52,7 +51,7 @@ func NewGnmiTarget( ...@@ -52,7 +51,7 @@ func NewGnmiTarget(
modeldata: modeldata, modeldata: modeldata,
unmarshalFn: unmarshalFn, unmarshalFn: unmarshalFn,
ΛEnum: ΛEnum, ΛEnum: ΛEnum,
YangModelChangeDispatcher: changeDispatcher, YangModelChangeDispatcher: not.NewDispatcher(),
yangHandlers: yangHandlers, yangHandlers: yangHandlers,
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment