[ONOS-7732] Automating switch workflow - workflow event map cli completer

Change-Id: I2fbabf4b42ab99fcf439e6b5864b5c1a53c1530f
diff --git a/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCommand.java b/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCommand.java
index 5240252..6315d44 100644
--- a/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCommand.java
+++ b/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCommand.java
@@ -20,6 +20,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.karaf.shell.api.action.Argument;
 import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.workflow.api.ContextEventMapStore;
@@ -32,7 +33,11 @@
 @Command(scope = "onos", name = "workflow-eventmap", description = "workflow event map cli")
 public class WorkFlowEventMapCommand extends AbstractShellCommand {
 
-    @Argument(index = 0, name = "cmd", description = "command(print)", required = true)
+    static final String PRINT = "print";
+
+    @Argument(index = 0, name = "cmd",
+            description = "command(" + PRINT + ")", required = true)
+    @Completion(WorkFlowEventMapCompleter.class)
     private String cmd = null;
 
     @Override
@@ -45,7 +50,7 @@
         ContextEventMapStore store = get(ContextEventMapStore.class);
         try {
             switch (cmd) {
-                case "print":
+                case PRINT:
                     JsonNode tree = store.asJsonTree();
                     ObjectMapper mapper = new ObjectMapper();
                     try {
diff --git a/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCompleter.java b/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCompleter.java
new file mode 100644
index 0000000..0977f01
--- /dev/null
+++ b/apps/workflow/app/src/main/java/org/onosproject/workflow/cli/WorkFlowEventMapCompleter.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.workflow.cli;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.onosproject.cli.AbstractChoicesCompleter;
+
+import java.util.List;
+
+import static org.onosproject.workflow.cli.WorkFlowEventMapCommand.PRINT;
+
+/**
+ * Workflow event map command completer.
+ */
+@Service
+public class WorkFlowEventMapCompleter extends AbstractChoicesCompleter {
+    @Override
+    protected List<String> choices() {
+        return ImmutableList.of(PRINT);    }
+}