[VOL-4667] Implemented default ordering in voltctl for device, logicaldevice and flows list commands output
Change-Id: I0e4b3271a1e15d8f1ba065f244f0181140c4775d
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{