diff --git a/pkg/tools/heal/liveness_check.go b/pkg/tools/heal/liveness_check.go index 994035bc..44fd90bf 100644 --- a/pkg/tools/heal/liveness_check.go +++ b/pkg/tools/heal/liveness_check.go @@ -24,6 +24,7 @@ import ( "github.com/networkservicemesh/api/pkg/api/networkservice" "github.com/networkservicemesh/govpp/binapi/ip_types" "github.com/networkservicemesh/govpp/binapi/ping" + "github.com/networkservicemesh/sdk-vpp/pkg/tools/ifindex" "github.com/networkservicemesh/sdk/pkg/tools/log" "github.com/pkg/errors" "go.fd.io/govpp/api" @@ -62,16 +63,6 @@ func doPing( responseCh chan bool) { logger := log.FromContext(deadlineCtx).WithField("srcIP", srcIP.String()).WithField("dstIP", dstIP.String()) - if _, err := ping.NewServiceClient(vppConn).WantPingFinishedEvents(deadlineCtx, &ping.WantPingFinishedEvents{ - Address: dstIP, - Interval: interval, - Repeat: repeat, - }); err != nil { - logger.Error(errors.Wrap(err, "vppapi WantPingEvents returned error")) - responseCh <- true - return - } - watcher, err := vppConn.WatchEvent(deadlineCtx, &ping.PingFinishedEvent{}) if err != nil { logger.Error(errors.Wrap(err, "failed to watch ping.PingFinishedEvent").Error()) @@ -81,6 +72,23 @@ func doPing( defer func() { watcher.Close() }() + ifindex, ok := ifindex.Load(deadlineCtx, true) + if !ok { + logger.Errorf("failed to load ifindex") + responseCh <- true + return + } + if _, err := ping.NewServiceClient(vppConn).WantPingFinishedEvents(deadlineCtx, &ping.WantPingFinishedEvents{ + Address: dstIP, + SwIfIndex: ifindex, + Interval: interval, + Repeat: repeat, + }); err != nil { + logger.Error(errors.Wrap(err, "vppapi WantPingEvents returned error")) + responseCh <- true + return + } + select { case <-deadlineCtx.Done(): responseCh <- true