[VOL-2570]Make skew configurable for performance metrics

Change-Id: I6db3e32147e6c11b2d268d9cfb2808b4bbe10678
diff --git a/internal/pkg/commands/devices.go b/internal/pkg/commands/devices.go
index 4d93acf..dd0bfc8 100644
--- a/internal/pkg/commands/devices.go
+++ b/internal/pkg/commands/devices.go
@@ -196,6 +196,14 @@
 		Valueflag ValueFlag `positional-arg-name:"VALUE_FLAG" required:"yes"`
 	} `positional-args:"yes"`
 }
+
+type DevicePmConfigSetMaxSkew struct {
+	Args struct {
+		Id      DeviceId `positional-arg-name:"DEVICE_ID" required:"yes"`
+		MaxSkew uint32   `positional-arg-name:"MAX_SKEW" required:"yes"`
+	} `positional-args:"yes"`
+}
+
 type DeviceOpts struct {
 	List    DeviceList     `command:"list"`
 	Create  DeviceCreate   `command:"create"`
@@ -214,7 +222,10 @@
 		Get DeviceGetExtValue `command:"get"`
 	} `command:"value"`
 	PmConfig struct {
-		Get       DevicePmConfigsGet `command:"get"`
+		Get     DevicePmConfigsGet `command:"get"`
+		MaxSkew struct {
+			Set DevicePmConfigSetMaxSkew `command:"set"`
+		} `command:"maxskew"`
 		Frequency struct {
 			Set DevicePmConfigFrequencySet `command:"set"`
 		} `command:"frequency"`
@@ -781,6 +792,35 @@
 	return nil
 }
 
+func (options *DevicePmConfigSetMaxSkew) Execute(args []string) error {
+	conn, err := NewConnection()
+	if err != nil {
+		return err
+	}
+	defer conn.Close()
+
+	client := voltha.NewVolthaServiceClient(conn)
+
+	ctx, cancel := context.WithTimeout(context.Background(), GlobalConfig.Grpc.Timeout)
+	defer cancel()
+
+	id := voltha.ID{Id: string(options.Args.Id)}
+
+	pmConfigs, err := client.ListDevicePmConfigs(ctx, &id)
+	if err != nil {
+		return err
+	}
+
+	pmConfigs.MaxSkew = options.Args.MaxSkew
+
+	_, err = client.UpdateDevicePmConfigs(ctx, pmConfigs)
+	if err != nil {
+		return err
+	}
+
+	return nil
+}
+
 func (options *DevicePmConfigsGet) Execute(args []string) error {
 
 	conn, err := NewConnection()