VOL-3608 Support of Get External OMCI Attribute values - GetOnuUniInfoResponse in golang OpenONU adapter

Change-Id: I2ebddd6b232887eb583a983a3a03f0e0c54b9ace
diff --git a/VERSION b/VERSION
index 347f583..9df886c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.4.1
+1.4.2
diff --git a/internal/pkg/commands/devices.go b/internal/pkg/commands/devices.go
index f04ab4e..b080733 100644
--- a/internal/pkg/commands/devices.go
+++ b/internal/pkg/commands/devices.go
@@ -60,6 +60,10 @@
   RXBCASTPACKETS:	{{.RxBcastPackets}}
   RXUCASTPACKETS:	{{.RxUcastPackets}}
   RXMCASTPACKETS:	{{.RxMcastPackets}}`
+	DEFAULT_DEVICE_GET_UNI_STATUS_FORMAT = `
+  ADMIN_STATE:          {{.AdmState}}
+  OPERATIONAL_STATE:    {{.OperState}}
+  CONFIG_IND:           {{.ConfigInd}}`
 )
 
 type DeviceList struct {
@@ -256,7 +260,13 @@
 		PortType string   `positional-arg-name:"PORT_TYPE" required:"yes"`
 	} `positional-args:"yes"`
 }
-
+type UniStatus struct {
+	ListOutputOptions
+	Args struct {
+		Id       DeviceId `positional-arg-name:"DEVICE_ID" required:"yes"`
+		UniIndex uint32   `positional-arg-name:"UNI_INDEX" required:"yes"`
+	} `positional-args:"yes"`
+}
 type DeviceOpts struct {
 	List    DeviceList     `command:"list"`
 	Create  DeviceCreate   `command:"create"`
@@ -302,7 +312,8 @@
 		Activate DeviceOnuActivateImageUpdate `command:"activate"`
 	} `command:"image"`
 	GetExtVal struct {
-		Stats DeviceGetPortStats `command:"portstats"`
+		Stats     DeviceGetPortStats `command:"portstats"`
+		UniStatus UniStatus          `command:"unistatus"`
 	} `command:"getextval"`
 }
 
@@ -1497,6 +1508,48 @@
 	return nil
 }
 
+func (options *UniStatus) Execute(args []string) error {
+	conn, err := NewConnection()
+	if err != nil {
+		return err
+	}
+	defer conn.Close()
+	client := extension.NewExtensionClient(conn)
+
+	singleGetValReq := extension.SingleGetValueRequest{
+		TargetId: string(options.Args.Id),
+		Request: &extension.GetValueRequest{
+			Request: &extension.GetValueRequest_UniInfo{
+				UniInfo: &extension.GetOnuUniInfoRequest{
+					UniIndex: options.Args.UniIndex,
+				},
+			},
+		},
+	}
+	ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.Grpc.Timeout)
+	defer cancel()
+	rv, err := client.GetExtValue(ctx, &singleGetValReq)
+	if err != nil {
+		Error.Printf("Error getting value on device Id %s,err=%s\n", options.Args.Id, ErrorToString(err))
+		return err
+	}
+	if rv.Response.Status != extension.GetValueResponse_OK {
+		return fmt.Errorf("failed to get uni status %v", rv.Response.ErrReason.String())
+	}
+	outputFormat := CharReplacer.Replace(options.Format)
+	if outputFormat == "" {
+		outputFormat = GetCommandOptionWithDefault("device-get-uni-status", "format", DEFAULT_DEVICE_GET_UNI_STATUS_FORMAT)
+	}
+	result := CommandResult{
+		Format:    format.Format(outputFormat),
+		OutputAs:  toOutputType(options.OutputAs),
+		NameLimit: options.NameLimit,
+		Data:      rv.GetResponse().GetUniInfo(),
+	}
+	GenerateOutput(&result)
+	return nil
+}
+
 /*Device  get Onu Distance */
 func (options *DeviceGetExtValue) Execute(args []string) error {
 	conn, err := NewConnection()