[VOL-4667] Implemented default ordering in voltctl for device, logicaldevice and flows list commands output
Change-Id: I0e4b3271a1e15d8f1ba065f244f0181140c4775d
diff --git a/VERSION b/VERSION
index 129309c..de28578 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.7.6-dev
+1.7.6
diff --git a/internal/pkg/commands/devices.go b/internal/pkg/commands/devices.go
index 448b900..7acac8c 100644
--- a/internal/pkg/commands/devices.go
+++ b/internal/pkg/commands/devices.go
@@ -33,6 +33,7 @@
const (
DEFAULT_DEVICE_FORMAT = "table{{ .Id }}\t{{.Type}}\t{{.Root}}\t{{.ParentId}}\t{{.SerialNumber}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.ConnectStatus}}\t{{.Reason}}"
+ DEFAULT_DEVICE_ORDER = "Type,Id"
DEFAULT_DEVICE_PORTS_FORMAT = "table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}\t{{.DeviceId}}\t{{.Peers}}"
DEFAULT_DEVICE_INSPECT_FORMAT = `ID: {{.Id}}
TYPE: {{.Type}}
@@ -704,7 +705,7 @@
orderBy := options.OrderBy
if orderBy == "" {
- orderBy = GetCommandOptionWithDefault("device-list", "order", "")
+ orderBy = GetCommandOptionWithDefault("device-list", "order", DEFAULT_DEVICE_ORDER)
}
// Make sure json output prints an empty list, not "null"
diff --git a/internal/pkg/commands/flows.go b/internal/pkg/commands/flows.go
index 378d01d..ee780e7 100644
--- a/internal/pkg/commands/flows.go
+++ b/internal/pkg/commands/flows.go
@@ -69,6 +69,7 @@
"ClearActions": 1020,
"MeterId": 1030,
}
+ DEFAULT_FLOWS_ORDER = "Id"
)
/*
@@ -157,7 +158,7 @@
orderBy := options.OrderBy
if orderBy == "" {
- orderBy = GetCommandOptionWithDefault(options.Method, "order", "")
+ orderBy = GetCommandOptionWithDefault(options.Method, "order", DEFAULT_FLOWS_ORDER)
}
result := CommandResult{
diff --git a/internal/pkg/commands/logicaldevices.go b/internal/pkg/commands/logicaldevices.go
index 69ead3b2..cb66ac8 100644
--- a/internal/pkg/commands/logicaldevices.go
+++ b/internal/pkg/commands/logicaldevices.go
@@ -28,6 +28,7 @@
const (
DEFAULT_LOGICAL_DEVICE_FORMAT = "table{{ .Id }}\t{{printf \"%016x\" .DatapathId}}\t{{.RootDeviceId}}\t{{.Desc.SerialNum}}\t{{.SwitchFeatures.NBuffers}}\t{{.SwitchFeatures.NTables}}\t{{printf \"0x%08x\" .SwitchFeatures.Capabilities}}"
+ DEFAULT_LOGICAL_DEVICE_ORDER = "Id"
DEFAULT_LOGICAL_DEVICE_PORT_FORMAT = "table{{.Id}}\t{{.DeviceId}}\t{{.DevicePortNo}}\t{{.RootPort}}\t{{.OfpPortStats.PortNo}}\t{{.OfpPort.HwAddr}}\t{{.OfpPort.Name}}\t{{printf \"0x%08x\" .OfpPort.State}}\t{{printf \"0x%08x\" .OfpPort.Curr}}\t{{.OfpPort.CurrSpeed}}"
DEFAULT_LOGICAL_DEVICE_INSPECT_FORMAT = `ID: {{.Id}}
DATAPATHID: {{.DatapathId}}
@@ -148,7 +149,7 @@
}
orderBy := options.OrderBy
if orderBy == "" {
- orderBy = GetCommandOptionWithDefault("local-device-list", "order", "")
+ orderBy = GetCommandOptionWithDefault("local-device-list", "order", DEFAULT_LOGICAL_DEVICE_ORDER)
}
result := CommandResult{