[ONOS-5241] Add CLI to VPLS

Change-Id: I2d90a6370babea0538eb063b21ca29b49deb425f
diff --git a/apps/vpls/pom.xml b/apps/vpls/pom.xml
index 75b986d..937a739 100644
--- a/apps/vpls/pom.xml
+++ b/apps/vpls/pom.xml
@@ -73,5 +73,10 @@
             <artifactId>onlab-junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.karaf.shell</groupId>
+            <artifactId>org.apache.karaf.shell.console</artifactId>
+        </dependency>
+
     </dependencies>
 </project>
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java
new file mode 100644
index 0000000..ffeb81f
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddCommand.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.HashSet;
+
+/**
+ * CLI to create VPLSs.
+ */
+@Command(scope = "onos", name = "vpls-add", description = "Create a new VPLS")
+public class VplsAddCommand extends AbstractShellCommand {
+    private static final String VPLS_EXIST = "VPLS already exists: %s";
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
+            required = true, multiValued = false)
+    private String vplsName = null;
+
+    @Override
+    protected void execute() {
+
+        if (vplsConfigService.getAllVpls().contains(vplsName)) {
+            print(VPLS_EXIST, vplsName);
+            return;
+        }
+        vplsConfigService.addVpls(vplsName, new HashSet<>());
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java
new file mode 100644
index 0000000..5daaa9e
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsAddIfaceCommand.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.Map;
+
+/**
+ * CLI to add an interface to a VPLS.
+ */
+@Command(scope = "onos", name = "vpls-add-iface",
+        description = "Add an interface to an existing VPLS")
+public class VplsAddIfaceCommand extends AbstractShellCommand {
+
+    private static final String IFACE_ADD_FAIL = "Interface cannot be added.";
+    private static final String IFACE_EXIST =
+            "Interface %s already associated to network %s.";
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
+            required = true, multiValued = false)
+    private String vplsName = null;
+
+    @Argument(index = 1, name = "ifaceName", description = "Name of the interface" +
+            " to be added to the VPLS", required = true, multiValued = false)
+    private String ifaceName = null;
+
+    @Override
+    protected void execute() {
+        if (!vplsConfigService.getAllVpls().contains(vplsName)) {
+            print(IFACE_ADD_FAIL);
+            return;
+        }
+
+        if (vplsConfigService.getAllInterfaces()
+                .stream()
+                .anyMatch(e -> e.name().equals(ifaceName))) {
+            print(IFACE_EXIST, ifaceName, vplsConfigService.getVplsNetworks()
+                    .entries()
+                    .stream()
+                    .filter(e->e.getValue().name().equals(ifaceName))
+                    .map(Map.Entry::getKey)
+                    .findFirst()
+                    .get());
+            return;
+        }
+
+        vplsConfigService.addInterfaceToVpls(vplsName, ifaceName);
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java
new file mode 100644
index 0000000..6507d6b
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsCleanCommand.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+/**
+ * CLI to clean the VPLS app configuration.
+ */
+@Command(scope = "onos", name = "vpls-clean",
+        description = "Cleans the VPLS app configuration")
+public class VplsCleanCommand extends AbstractShellCommand {
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Override
+    protected void execute() {
+        vplsConfigService.cleanVpls();
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java
new file mode 100644
index 0000000..693ad97
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelCommand.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+/**
+ * CLI to remove VPLSs.
+ */
+@Command(scope = "onos", name = "vpls-del",
+        description = "Deletes a VPLS")
+public class VplsDelCommand extends AbstractShellCommand {
+
+    private static final String NETWORK_NOT_FOUND =
+            "VPLS %s not found";
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Argument(index = 0, name = "vplsName", description = "Name of the VPLS",
+            required = true, multiValued = false)
+    private String vplsName = null;
+
+    @Override
+    protected void execute() {
+
+        if (!vplsConfigService.getAllVpls().contains(vplsName)) {
+            print(NETWORK_NOT_FOUND, vplsName);
+            return;
+        }
+
+        vplsConfigService.removeVpls(vplsName);
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java
new file mode 100644
index 0000000..695e48f
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsDelIfaceCommand.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.intf.Interface;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.Set;
+
+/**
+ * CLI to remove an interface from an existing VPLS.
+ */
+@Command(scope = "onos", name = "vpls-del-iface",
+        description = "Removes an interface from an existing VPLS")
+public class VplsDelIfaceCommand extends AbstractShellCommand {
+
+    private static final String NO_CONFIGURATION = "Interface %s is not configured";
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Argument(index = 0, name = "IFACE_NAME", description = "Name of the interface" +
+            " to remove from the VPLS", required = true, multiValued = false)
+    private String ifaceName = null;
+
+    @Override
+    protected void execute() {
+        Set<Interface> ifaces = vplsConfigService.getAllInterfaces();
+
+        if (!ifaces.stream().map(Interface::name).anyMatch(ifaceName::equals)) {
+            print(NO_CONFIGURATION, ifaceName);
+        }
+
+        vplsConfigService.removeInterfaceFromVpls(ifaceName);
+    }
+
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java
new file mode 100644
index 0000000..bfbb054
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsListCommand.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+/**
+ * CLI to list VPLSs.
+ */
+@Command(scope = "onos", name = "vpls-list", description = "Lists the existing VPLSs")
+public class VplsListCommand extends AbstractShellCommand {
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Override
+    protected void execute() {
+        vplsConfigService.getAllVpls().forEach(vpls -> {
+            print("%s", vpls);
+        });
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java
new file mode 100644
index 0000000..550d122
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/VplsShowCommand.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli;
+
+import com.google.common.collect.SetMultimap;
+import com.google.common.collect.Sets;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.incubator.net.intf.Interface;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.Set;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+
+/**
+ * CLI to show VPLS details.
+ */
+@Command(scope = "onos", name = "vpls-show",
+        description = "Shows the details of an existing VPLS")
+public class VplsShowCommand extends AbstractShellCommand {
+
+    private static final String NAME_FORMAT = "%10s: interface=%s";
+    private static final String NETWORK_NOT_FOUND =
+            "VPLS with name \'%s\' not found";
+    private VplsConfigurationService vplsConfigService =
+            get(VplsConfigurationService.class);
+
+    @Argument(index = 0, name = "NETWORK_NAME", description = "Name of the VPLS",
+            required = false, multiValued = false)
+    private String vplsName = null;
+
+    @Override
+    protected void execute() {
+        Set<String> vplsNames = vplsConfigService.getAllVpls();
+        SetMultimap<String, Interface> vplsNetowrks = vplsConfigService.getVplsNetworks();
+        Set<String> ifaceNames = Sets.newHashSet();
+
+
+        if (!isNullOrEmpty(vplsName)) {
+
+            if (vplsNames.contains(vplsName)) {
+                vplsNetowrks.get(vplsName).stream()
+                        .map(Interface::name)
+                        .forEach(ifaceNames::add);
+                print(NAME_FORMAT, vplsName, ifaceNames);
+            } else {
+                print(NETWORK_NOT_FOUND, vplsName);
+            }
+        } else {
+            vplsNames.forEach(vplsName -> {
+                ifaceNames.clear();
+                vplsNetowrks.get(vplsName).stream()
+                        .map(Interface::name)
+                        .forEach(ifaceNames::add);
+                print(NAME_FORMAT, vplsName, ifaceNames);
+            });
+        }
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCmdCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCmdCompleter.java
new file mode 100644
index 0000000..9534635
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsAddIfaceCmdCompleter.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli.completer;
+
+import com.google.common.collect.Lists;
+import org.onosproject.cli.AbstractChoicesCompleter;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.List;
+import static org.onosproject.cli.AbstractShellCommand.get;
+
+/**
+ * Completer for "vpls-add-inf" command.
+ */
+public class VplsAddIfaceCmdCompleter extends AbstractChoicesCompleter {
+    @Override
+    protected List<String> choices() {
+        VplsConfigurationService vplsConfigService =
+                get(VplsConfigurationService.class);
+
+        return Lists.newArrayList(vplsConfigService.getAllVpls());
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java
new file mode 100644
index 0000000..9c6c061
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelCommandCompleter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli.completer;
+
+import com.google.common.collect.Lists;
+import org.onosproject.cli.AbstractChoicesCompleter;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.List;
+
+import static org.onosproject.cli.AbstractShellCommand.get;
+
+/**
+ * Completer for "vpls-del" command.
+ */
+public class VplsDelCommandCompleter extends AbstractChoicesCompleter {
+
+    @Override
+    protected List<String> choices() {
+        VplsConfigurationService vplsConfigService =
+                get(VplsConfigurationService.class);
+        return Lists.newArrayList(vplsConfigService.getAllVpls());
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java
new file mode 100644
index 0000000..81a1583
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsDelIfaceCommandCompleter.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli.completer;
+
+import org.onosproject.cli.AbstractChoicesCompleter;
+import org.onosproject.incubator.net.intf.Interface;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static org.onosproject.cli.AbstractShellCommand.get;
+
+/**
+ * Completer for vpls-del-iface command.
+ */
+public class VplsDelIfaceCommandCompleter extends AbstractChoicesCompleter {
+
+    @Override
+    protected List<String> choices() {
+        VplsConfigurationService vplsConfigService =
+                get(VplsConfigurationService.class);
+        Set<Interface> ifaces = vplsConfigService.getAllInterfaces();
+        return ifaces.stream().map(Interface::name).collect(Collectors.toList());
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java
new file mode 100644
index 0000000..75ce663
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/VplsShowCommandCompleter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.vpls.cli.completer;
+
+import com.google.common.collect.Lists;
+import org.onosproject.cli.AbstractChoicesCompleter;
+import org.onosproject.vpls.config.VplsConfigurationService;
+
+import java.util.List;
+
+import static org.onosproject.cli.AbstractShellCommand.get;
+
+/**
+ * Completer for vpls-show command.
+ */
+public class VplsShowCommandCompleter extends AbstractChoicesCompleter {
+
+    @Override
+    protected List<String> choices() {
+        VplsConfigurationService vplsConfigService =
+                get(VplsConfigurationService.class);
+        return Lists.newArrayList(vplsConfigService.getAllVpls());
+    }
+}
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/package-info.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/package-info.java
new file mode 100644
index 0000000..f58cd33
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/completer/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.
+ */
+
+/**
+ * Implementation completers for VPLS CLI.
+ */
+package org.onosproject.vpls.cli.completer;
\ No newline at end of file
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/cli/package-info.java b/apps/vpls/src/main/java/org/onosproject/vpls/cli/package-info.java
new file mode 100644
index 0000000..083baec
--- /dev/null
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.
+ */
+
+/**
+ * Implementation CLI for VPLS services.
+ */
+package org.onosproject.vpls.cli;
\ No newline at end of file
diff --git a/apps/vpls/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/vpls/src/main/resources/OSGI-INF/blueprint/shell-config.xml
new file mode 100644
index 0000000..5815ffd
--- /dev/null
+++ b/apps/vpls/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -0,0 +1,63 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ 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.
+  -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsAddCommand"/>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsAddIfaceCommand"/>
+      <completers>
+        <ref component-id="VplsAddIfaceCommandCompleter"/>
+        <null/>
+      </completers>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsDelCommand"/>
+      <completers>
+        <ref component-id="VplsDelCommandCompleter"/>
+        <null/>
+      </completers>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsDelIfaceCommand"/>
+      <completers>
+        <ref component-id="VplsDelIfaceCommandCompleter"/>
+        <null/>
+      </completers>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsListCommand"/>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsShowCommand"/>
+      <completers>
+        <ref component-id="VplsShowCommandCompleter"/>
+        <null/>
+      </completers>
+    </command>
+    <command>
+      <action class="org.onosproject.vpls.cli.VplsCleanCommand"/>
+    </command>
+  </command-bundle>
+
+  <bean id="VplsAddIfaceCommandCompleter" class="org.onosproject.vpls.cli.completer.VplsAddIfaceCmdCompleter"/>
+  <bean id="VplsDelCommandCompleter" class="org.onosproject.vpls.cli.completer.VplsDelCommandCompleter"/>
+  <bean id="VplsDelIfaceCommandCompleter" class="org.onosproject.vpls.cli.completer.VplsDelIfaceCommandCompleter"/>
+  <bean id="VplsShowCommandCompleter" class="org.onosproject.vpls.cli.completer.VplsShowCommandCompleter"/>
+</blueprint>