[VOL-5460] if the device is not in active state return error for getsinglevaluerequest

Change-Id: Idc8a286cf777e5cffd8363f3e66b9ac032dc740d
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
diff --git a/VERSION b/VERSION
index cd33751..74befd7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.15
+3.6.16
diff --git a/rw_core/core/device/extension_manager.go b/rw_core/core/device/extension_manager.go
index 23b814c..858656a 100644
--- a/rw_core/core/device/extension_manager.go
+++ b/rw_core/core/device/extension_manager.go
@@ -21,6 +21,7 @@
 
 	"github.com/opencord/voltha-lib-go/v7/pkg/log"
 	"github.com/opencord/voltha-protos/v5/go/extension"
+	"github.com/opencord/voltha-protos/v5/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
 )
@@ -49,6 +50,14 @@
 		if agent == nil {
 			return nil, status.Errorf(codes.NotFound, "target-id %s, parent-id %s", request.TargetId, parentId)
 		}
+		if agent.device.GetOperStatus() != voltha.OperStatus_ACTIVE {
+			logger.Errorw(ctx, "device-not-active",
+				log.Fields{
+					"device-id":        agent.deviceID,
+					"device-type":      agent.deviceType,
+					"adapter-endpoint": agent.adapterEndpoint})
+			return nil, status.Errorf(codes.FailedPrecondition, "device not active: %s", agent.deviceID)
+		}
 	default:
 		agent = e.DeviceManager.getDeviceAgent(ctx, request.TargetId)
 		if agent == nil {