[VOL-1385] Remove parent's device flows after child deletion
This commit fixes the following:
1) Do not automatically raise an error when no routes can be
found when decomposing a flow. In some cases flows can still
be decomposed (e.g. some trap flows).
2) Delete flows from a parent device when receiving delete flow
instructions from the OF controller after a child device has
been deleted (previously was failing as no route could be
obtained).
Change-Id: I33dd45d52626146f0a6b4668048c979b5c931f9c
diff --git a/rw_core/route/device_route.go b/rw_core/route/device_route.go
index a36c841..292ef83 100644
--- a/rw_core/route/device_route.go
+++ b/rw_core/route/device_route.go
@@ -18,6 +18,7 @@
import (
"context"
+ "errors"
"fmt"
"github.com/opencord/voltha-lib-go/v3/pkg/log"
"github.com/opencord/voltha-protos/v3/go/voltha"
@@ -26,6 +27,8 @@
"sync"
)
+var ErrNoRoute = errors.New("no route")
+
// Hop represent a route hop
type Hop struct {
DeviceID string
@@ -95,7 +98,7 @@
}()
if len(lps) < 2 {
- return status.Error(codes.FailedPrecondition, "not-enough-logical-ports")
+ return fmt.Errorf("not enough logical port :%w", ErrNoRoute)
}
dr.reset()
@@ -112,8 +115,7 @@
}
}
if len(nniPorts) == 0 {
- err = status.Error(codes.FailedPrecondition, "no nni port")
- return err
+ return fmt.Errorf("no nni port :%w", ErrNoRoute)
}
var rootDevice *voltha.Device
var childDevice *voltha.Device