2 * Copyright (c) 2015 CableLabs and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.unimgr.cli;
10 import org.apache.karaf.shell.commands.Argument;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.opendaylight.unimgr.api.IUnimgrConsoleProvider;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
16 @Command(name = "remove", scope = "uni", description = "Removes an Uni from the controller.")
17 public class UniRemoveShellCommand extends OsgiCommandSupport {
19 protected IUnimgrConsoleProvider provider;
21 @Argument(index = 0, name = "ip", description = "Uni ipAddress", required = true, multiValued = false)
24 public UniRemoveShellCommand(IUnimgrConsoleProvider provider) {
25 this.provider = provider;
29 protected Object doExecute() throws Exception {
30 IpAddress ipAddre = new IpAddress(ipAddress.toCharArray());
31 if (provider.removeUni(ipAddre)) {
32 return String.format("Uni successfully removed");
34 return String.format("Error removing Uni");