[VOL-2574]: code changes to support Child_device_lost API
Change-Id: Id296fde83f8f2f692d81cc638b98cc576ccfb024
diff --git a/VERSION b/VERSION
index 747457c..a909317 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0.9
+3.0.10
diff --git a/pkg/adapters/common/request_handler.go b/pkg/adapters/common/request_handler.go
index 78b8eb5..5b00887 100644
--- a/pkg/adapters/common/request_handler.go
+++ b/pkg/adapters/common/request_handler.go
@@ -658,3 +658,46 @@
}
return deviceId.Val, port, nil
}
+
+func (rhp *RequestHandlerProxy) Child_device_lost(args []*ic.Argument) error {
+ if len(args) < 4 {
+ logger.Warn("invalid-number-of-args", log.Fields{"args": args})
+ return errors.New("invalid-number-of-args")
+ }
+
+ pDeviceId := &ic.StrType{}
+ pPortNo := &ic.IntType{}
+ onuID := &ic.IntType{}
+ fromTopic := &ic.StrType{}
+ for _, arg := range args {
+ switch arg.Key {
+ case "pDeviceId":
+ if err := ptypes.UnmarshalAny(arg.Value, pDeviceId); err != nil {
+ logger.Warnw("cannot-unmarshal-parent-deviceId", log.Fields{"error": err})
+ return err
+ }
+ case "pPortNo":
+ if err := ptypes.UnmarshalAny(arg.Value, pPortNo); err != nil {
+ logger.Warnw("cannot-unmarshal-port", log.Fields{"error": err})
+ return err
+ }
+ case "onuID":
+ if err := ptypes.UnmarshalAny(arg.Value, onuID); err != nil {
+ logger.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
+ return err
+ }
+ case kafka.FromTopic:
+ if err := ptypes.UnmarshalAny(arg.Value, fromTopic); err != nil {
+ logger.Warnw("cannot-unmarshal-from-topic", log.Fields{"error": err})
+ return err
+ }
+ }
+ }
+ //Update the core reference for that device
+ rhp.coreProxy.UpdateCoreReference(pDeviceId.Val, fromTopic.Val)
+ //Invoke the Child_device_lost API on the adapter
+ if err := rhp.adapter.Child_device_lost(pDeviceId.Val, uint32(pPortNo.Val), uint32(onuID.Val)); err != nil {
+ return status.Errorf(codes.NotFound, "%s", err.Error())
+ }
+ return nil
+}
diff --git a/pkg/adapters/iAdapter.go b/pkg/adapters/iAdapter.go
index c0e44be..fc57247 100644
--- a/pkg/adapters/iAdapter.go
+++ b/pkg/adapters/iAdapter.go
@@ -51,4 +51,5 @@
Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error)
Enable_port(deviceId string, port *voltha.Port) error
Disable_port(deviceId string, port *voltha.Port) error
+ Child_device_lost(parentDeviceId string, parentPortNo uint32, onuID uint32) error
}