Refactor: split api from SONA simple fabric

Change-Id: Icbdb10b730af29057097b14df8ddc377f4107853
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java
new file mode 100644
index 0000000..75db695
--- /dev/null
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/SimpleFabricCommand.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017-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.simplefabric;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.simplefabric.api.SimpleFabricService;
+
+/**
+ * CLI to interact with the SIMPLE_FABRIC application.
+ */
+@Command(scope = "onos", name = "simpleFabric",
+         description = "Manages the SimpleFabric application")
+public class SimpleFabricCommand extends AbstractShellCommand {
+
+    @Argument(index = 0, name = "command",
+              description = "Command: show|intents|reactive-intents|refresh|flush",
+              required = true, multiValued = false)
+    String command = null;
+
+    @Override
+    protected void execute() {
+
+        SimpleFabricService simpleFabric = get(SimpleFabricService.class);
+
+        if (command == null) {
+            print("command not found", command);
+            return;
+        }
+        switch (command) {
+        case "show":
+            simpleFabric.dumpToStream("show", System.out);
+            break;
+        case "intents":
+            simpleFabric.dumpToStream("intents", System.out);
+            break;
+        case "reactive-intents":
+            simpleFabric.dumpToStream("reactive-intents", System.out);
+            break;
+        case "refresh":
+            simpleFabric.triggerRefresh();
+            System.out.println("simple fabric refresh triggered");
+            break;
+        case "flush":
+            simpleFabric.triggerFlush();
+            System.out.println("simple fabric flush triggered");
+            break;
+        default:
+            System.out.println("unknown command: " + command);
+            break;
+        }
+    }
+
+}
+