diff options
Diffstat (limited to 'framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli')
29 files changed, 0 insertions, 2065 deletions
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java deleted file mode 100644 index 00758dd2..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.floatingip; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.IpAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultFloatingIp; -import org.onosproject.vtnrsc.FloatingIpId; -import org.onosproject.vtnrsc.FloatingIp; -import org.onosproject.vtnrsc.FloatingIp.Status; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.floatingip.FloatingIpService; - -import com.google.common.collect.Sets; - -/** - * Supports for create a floating IP. - */ -@Command(scope = "onos", name = "floatingip-create", - description = "Supports for creating a floating IP") -public class FloatingIpCreateCommand extends AbstractShellCommand { - @Argument(index = 0, name = "id", description = "The floating IP identifier", - required = true, multiValued = false) - String id = null; - - @Argument(index = 1, name = "networkId", description = "The network identifier of floating IP", - required = true, multiValued = false) - String networkId = null; - - @Argument(index = 2, name = "tenantId", description = "The tenant identifier of floating IP", - required = true, multiValued = false) - String tenantId = null; - - @Argument(index = 3, name = "routerId", description = "The router identifier of floating IP", - required = true, multiValued = false) - String routerId = null; - - @Argument(index = 4, name = "fixedIp", description = "The fixed IP of floating IP", - required = true, multiValued = false) - String fixedIp = null; - - @Argument(index = 5, name = "floatingIp", description = "The floating IP of floating IP", - required = true, multiValued = false) - String floatingIp = null; - - @Option(name = "-p", aliases = "--portId", description = "The port identifier of floating IP", - required = false, multiValued = false) - String portId = null; - - @Option(name = "-s", aliases = "--status", description = "The status of floating IP", - required = false, multiValued = false) - String status = null; - - @Override - protected void execute() { - FloatingIpService service = get(FloatingIpService.class); - try { - FloatingIp floatingIpObj = new DefaultFloatingIp( - FloatingIpId.of(id), - TenantId.tenantId(tenantId), - TenantNetworkId.networkId(networkId), - VirtualPortId.portId(portId), - RouterId.valueOf(routerId), - floatingIp == null ? null : IpAddress.valueOf(floatingIp), - fixedIp == null ? null : IpAddress.valueOf(fixedIp), - status == null ? Status.ACTIVE - : Status.valueOf(status)); - Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj); - service.createFloatingIps(floatingIpSet); - } catch (Exception e) { - print(null, e.getMessage()); - } - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java deleted file mode 100644 index c441d535..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.floatingip; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.FloatingIpId; -import org.onosproject.vtnrsc.FloatingIp; -import org.onosproject.vtnrsc.floatingip.FloatingIpService; - -/** - * Supports for query a floating IP. - */ -@Command(scope = "onos", name = "floatingips", description = "Supports for querying a floating IP") -public class FloatingIpQueryCommand extends AbstractShellCommand { - @Option(name = "-I", aliases = "--id", description = "The floating IP identifier", - required = false, multiValued = false) - String id = null; - - @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP", - required = false, multiValued = false) - String fixedIp = null; - - @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP", - required = false, multiValued = false) - String floatingIp = null; - - private static final String FMT = "floatingIpId=%s, networkId=%s, tenantId=%s, portId=%s," - + "routerId=%s, fixedIp=%s, floatingIp=%s, status=%s"; - - @Override - protected void execute() { - FloatingIpService service = get(FloatingIpService.class); - if (id != null) { - FloatingIp floatingIp = service.getFloatingIp(FloatingIpId - .of(id)); - printFloatingIp(floatingIp); - } else if (fixedIp != null || floatingIp != null) { - Iterable<FloatingIp> floatingIps = service.getFloatingIps(); - if (floatingIps == null) { - return; - } - if (fixedIp != null) { - for (FloatingIp floatingIp : floatingIps) { - if (floatingIp.fixedIp().toString().equals(fixedIp)) { - printFloatingIp(floatingIp); - return; - } - } - print(null, "The fixedIp is not existed"); - } - if (floatingIp != null) { - for (FloatingIp floatingIpObj : floatingIps) { - if (floatingIpObj.fixedIp().toString().equals(floatingIp)) { - printFloatingIp(floatingIpObj); - return; - } - } - print(null, "The floatingIp is not existed"); - } - } else { - Iterable<FloatingIp> floatingIps = service.getFloatingIps(); - if (floatingIps == null) { - return; - } - for (FloatingIp floatingIp : floatingIps) { - printFloatingIp(floatingIp); - } - } - } - - private void printFloatingIp(FloatingIp floatingIp) { - print(FMT, floatingIp.id(), floatingIp.networkId(), - floatingIp.tenantId(), floatingIp.portId(), - floatingIp.routerId(), floatingIp.fixedIp(), - floatingIp.floatingIp(), floatingIp.status()); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java deleted file mode 100644 index a413503a..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.floatingip; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.FloatingIp; -import org.onosproject.vtnrsc.FloatingIpId; -import org.onosproject.vtnrsc.floatingip.FloatingIpService; - -import com.google.common.collect.Sets; - -/** - * Supports for remove a floating IP. - */ -@Command(scope = "onos", name = "floatingip-remove", description = "Supports for removing a floating IP") -public class FloatingIpRemoveCommand extends AbstractShellCommand { - @Option(name = "-I", aliases = "--id", description = "The floating IP identifier", - required = false, multiValued = false) - String id = null; - - @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP", - required = false, multiValued = false) - String fixedIp = null; - - @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP", - required = false, multiValued = false) - String floatingIp = null; - - @Override - protected void execute() { - FloatingIpService service = get(FloatingIpService.class); - if (id == null && fixedIp == null && floatingIp == null) { - print(null, "one of id, fixedIp, floatingIp should not be null"); - } - try { - Set<FloatingIpId> floatingIpSet = Sets.newHashSet(); - if (id != null) { - floatingIpSet.add(FloatingIpId.of(id)); - service.removeFloatingIps(floatingIpSet); - } else { - Iterable<FloatingIp> floatingIps = service.getFloatingIps(); - if (floatingIps == null) { - return; - } - if (fixedIp != null) { - for (FloatingIp floatingIp : floatingIps) { - if (floatingIp.fixedIp().toString().equals(fixedIp)) { - floatingIpSet.add(floatingIp.id()); - service.removeFloatingIps(floatingIpSet); - return; - } - } - print(null, "The fixedIp is not existed"); - return; - } - if (floatingIp != null) { - for (FloatingIp floatingIpObj : floatingIps) { - if (floatingIpObj.fixedIp().toString() - .equals(floatingIp)) { - floatingIpSet.add(floatingIpObj.id()); - service.removeFloatingIps(floatingIpSet); - return; - } - } - print(null, "The floatingIp is not existed"); - return; - } - } - } catch (Exception e) { - print(null, e.getMessage()); - } - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java deleted file mode 100644 index 413b3bdb..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.floatingip; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.IpAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultFloatingIp; -import org.onosproject.vtnrsc.FloatingIpId; -import org.onosproject.vtnrsc.FloatingIp; -import org.onosproject.vtnrsc.FloatingIp.Status; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.floatingip.FloatingIpService; - -import com.google.common.collect.Sets; - -/** - * Supports for update a floating IP. - */ -@Command(scope = "onos", name = "floatingip-update", - description = "Supports for updating a floating IP") -public class FloatingIpUpdateCommand extends AbstractShellCommand { - @Argument(index = 0, name = "id", description = "The floating IP identifier", - required = true, multiValued = false) - String id = null; - - @Option(name = "-n", aliases = "--networkId", description = "The network identifier of floating IP", - required = false, multiValued = false) - String networkId = null; - - @Option(name = "-t", aliases = "--tenantId", description = "The tenant identifier of floating IP", - required = false, multiValued = false) - String tenantId = null; - - @Option(name = "-r", aliases = "--routerId", description = "The router identifier of floating IP", - required = false, multiValued = false) - String routerId = null; - - @Option(name = "-p", aliases = "--portId", description = "The port identifier of floating IP", - required = false, multiValued = false) - String portId = null; - - @Option(name = "-s", aliases = "--status", description = "The status of floating IP", - required = false, multiValued = false) - String status = null; - - @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP", - required = false, multiValued = false) - String fixedIp = null; - - @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP", - required = false, multiValued = false) - String floatingIp = null; - - @Override - protected void execute() { - FloatingIpService service = get(FloatingIpService.class); - FloatingIpId floatingIpId = FloatingIpId.of(id); - FloatingIp floatingIpStore = get(FloatingIpService.class).getFloatingIp(floatingIpId); - try { - FloatingIp floatingIpObj = new DefaultFloatingIp( - floatingIpId, - tenantId == null ? floatingIpStore.tenantId() - : TenantId.tenantId(tenantId), - networkId == null ? floatingIpStore.networkId() - : TenantNetworkId.networkId(networkId), - portId == null ? floatingIpStore.portId() - : VirtualPortId.portId(portId), - routerId == null ? floatingIpStore.routerId() - : RouterId.valueOf(routerId), - floatingIp == null ? floatingIpStore.floatingIp() - : IpAddress.valueOf(floatingIp), - fixedIp == null ? floatingIpStore.fixedIp() - : IpAddress.valueOf(fixedIp), - status == null ? floatingIpStore.status() - : Status.valueOf(status)); - Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj); - service.updateFloatingIps(floatingIpSet); - } catch (Exception e) { - print(null, e.getMessage()); - } - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java deleted file mode 100644 index ac560771..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for floatingIP. - */ -package org.onosproject.vtnrsc.cli.floatingip; diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java deleted file mode 100644 index bcfdacfa..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.network; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultTenantNetwork; -import org.onosproject.vtnrsc.PhysicalNetwork; -import org.onosproject.vtnrsc.SegmentationId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetwork; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; - -import com.google.common.collect.Sets; - -/** - * Supports for creating a TenantNetwork. - */ -@Command(scope = "onos", name = "tenantnetwork-create", - description = "Supports for creating a TenantNetwork") -public class TenantNetworkCreateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "TenantNetwork network id", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "tenantID", description = "The tenant id of TenantNetwork", - required = true, multiValued = false) - String tenantID = null; - - @Argument(index = 2, name = "type", description = "The type of TenantNetwork", required = true, - multiValued = false) - String type = null; - - @Argument(index = 3, name = "segmentationID", description = "The segmentation id of TenantNetwork", - required = true, multiValued = false) - String segmentationID = ""; - - @Option(name = "-n", aliases = "--name", description = "TenantNetwork name", required = false, - multiValued = false) - String name = null; - - @Option(name = "-a", aliases = "--adminStateUp", description = "TenantNetwork adminStateUp is true or false", - required = false, multiValued = false) - boolean adminStateUp = false; - - @Option(name = "-s", aliases = "--state", description = "The state of TenantNetwork", - required = false, multiValued = false) - String state = null; - - @Option(name = "-d", aliases = "--shared", description = "TenantNetwork is shared or not", - required = false, multiValued = false) - boolean shared = false; - - @Option(name = "-r", aliases = "--routerExternal", - description = "TenantNetwork is routerExternal or not", required = false, - multiValued = false) - boolean routerExternal = false; - - @Option(name = "-p", aliases = "--physicalNetwork", description = "The physical network of Tenant", - required = false, multiValued = false) - String physicalNetwork = ""; - - @Override - protected void execute() { - TenantNetworkService service = get(TenantNetworkService.class); - TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name, - adminStateUp, - TenantNetwork.State.valueOf(state), - shared, TenantId.tenantId(tenantID), - routerExternal, - TenantNetwork.Type.valueOf(type), - PhysicalNetwork.physicalNetwork(physicalNetwork), - SegmentationId.segmentationId(segmentationID)); - - Set<TenantNetwork> networksSet = Sets.newHashSet(network); - service.createNetworks(networksSet); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java deleted file mode 100644 index 47ea83c2..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.network; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.TenantNetwork; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; - -/** - * Supports for querying TenantNetworks by network id. - */ -@Command(scope = "onos", name = "tenantnetworks", description = "Supports for querying" - + "tenantNetworks by networkid") -public class TenantNetworkQueryCommand extends AbstractShellCommand { - - @Option(name = "-i", aliases = "--id", description = "TenantNetwork id", required = false, - multiValued = false) - String id = null; - - private static final String FMT = "networkId=%s, networkName=%s, segmentationId=%s," - + "tenantId=%s, type=%s, adminStateUp=%s"; - - @Override - protected void execute() { - TenantNetworkService service = get(TenantNetworkService.class); - if (id != null) { - TenantNetwork network = service.getNetwork(TenantNetworkId.networkId(id)); - printNetwork(network); - } else { - Iterable<TenantNetwork> networks = service.getNetworks(); - for (TenantNetwork network : networks) { - printNetwork(network); - } - } - } - - private void printNetwork(TenantNetwork network) { - if (network == null) { - return; - } - print(FMT, network.id(), network.name(), network.segmentationId(), - network.tenantId(), network.type(), network.adminStateUp()); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java deleted file mode 100644 index 0ea22853..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.network; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; - -import com.google.common.collect.Sets; - -/** - * Supports for removing a TenantNetwork by network id. - */ -@Command(scope = "onos", name = "tenantnetwork-remove", description = "Supports for removing" - + " a tenantNetwork by tenantNetworkid") -public class TenantNetworkRemoveCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "TenantNetwork neutronNetwork Id", - required = true, multiValued = false) - String id = null; - - @Override - protected void execute() { - TenantNetworkService service = get(TenantNetworkService.class); - Set<TenantNetworkId> networkIds = Sets.newHashSet(TenantNetworkId.networkId(id)); - service.removeNetworks(networkIds); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java deleted file mode 100644 index 2a738f72..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.network; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultTenantNetwork; -import org.onosproject.vtnrsc.PhysicalNetwork; -import org.onosproject.vtnrsc.SegmentationId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetwork; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService; - -import com.google.common.collect.Sets; - -/** - * Supports for updating a TenantNetwork. - */ -@Command(scope = "onos", name = "tenantnetwork-update", - description = "Supports for updating a TenantNetwork") -public class TenantNetworkUpdateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "TenantNetwork network id", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "tenantID", description = "The tenant id of TenantNetwork", - required = true, multiValued = false) - String tenantID = null; - - @Argument(index = 2, name = "type", description = "The type of TenantNetwork", required = true, - multiValued = false) - String type = null; - - @Argument(index = 3, name = "segmentationID", description = "The segmentation id of TenantNetwork", - required = true, multiValued = false) - String segmentationID = ""; - - @Option(name = "-n", aliases = "--name", description = "TenantNetwork name", required = false, - multiValued = false) - String name = null; - - @Option(name = "-a", aliases = "--adminStateUp", description = "TenantNetwork adminStateUp is true or false", - required = false, multiValued = false) - boolean adminStateUp = false; - - @Option(name = "-s", aliases = "--state", description = "The state of TenantNetwork", - required = false, multiValued = false) - String state = null; - - @Option(name = "-d", aliases = "--shared", description = "TenantNetwork is shared or not", - required = false, multiValued = false) - boolean shared = false; - - @Option(name = "-r", aliases = "--routerExternal", - description = "TenantNetwork is routerExternal or not", required = false, - multiValued = false) - boolean routerExternal = false; - - @Option(name = "-p", aliases = "--physicalNetwork", description = "The physical network of Tenant", - required = false, multiValued = false) - String physicalNetwork = ""; - - @Override - protected void execute() { - TenantNetworkService service = get(TenantNetworkService.class); - TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name, - adminStateUp, - TenantNetwork.State.valueOf(state), - shared, TenantId.tenantId(tenantID), - routerExternal, - TenantNetwork.Type.valueOf(type), - PhysicalNetwork.physicalNetwork(physicalNetwork), - SegmentationId.segmentationId(segmentationID)); - - Set<TenantNetwork> networksSet = Sets.newHashSet(); - networksSet.add(network); - service.updateNetworks(networksSet); - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java deleted file mode 100644 index 1622c800..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for tenant networks. - */ -package org.onosproject.vtnrsc.cli.network; diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java deleted file mode 100644 index 3a736deb..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.router; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultRouter; -import org.onosproject.vtnrsc.Router; -import org.onosproject.vtnrsc.Router.Status; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.router.RouterService; - -import com.google.common.collect.Sets; - -/** - * Supports for create a router. - */ -@Command(scope = "onos", name = "router-create", - description = "Supports for creating a router") -public class RouterCreateCommand extends AbstractShellCommand { - @Argument(index = 0, name = "id", description = "The router identifier", - required = true, multiValued = false) - String id = null; - - @Argument(index = 1, name = "routerName", description = "The name of router", - required = true, multiValued = false) - String routerName = null; - - @Argument(index = 2, name = "tenantId", description = "The tenant identifier of router", - required = true, multiValued = false) - String tenantId = null; - - @Option(name = "-g", aliases = "--gatewayPortId", description = "The gatewayPort identifier of router", - required = false, multiValued = false) - String gatewayPortId = null; - - @Option(name = "-e", aliases = "--externalGatewayInfo", description = "The external gateway info of router", - required = false, multiValued = false) - String externalGatewayInfo = null; - - @Option(name = "-s", aliases = "--status", description = "The status of router", - required = false, multiValued = false) - String status = null; - - @Option(name = "-a", aliases = "--adminStateUp", description = "The boolean adminStateUp of router", - required = false, multiValued = false) - boolean adminStateUp = true; - - @Option(name = "-d", aliases = "--distributed", description = "The boolean distributed of router", - required = false, multiValued = false) - boolean distributed = false; - - @Override - protected void execute() { - RouterService service = get(RouterService.class); - try { - List<String> routes = new ArrayList<String>(); - Router router = new DefaultRouter( - RouterId.valueOf(id), - routerName, - adminStateUp, - status == null ? Status.ACTIVE - : Status.valueOf(status), - distributed, - null, - VirtualPortId.portId(gatewayPortId), - TenantId.tenantId(tenantId), - routes); - Set<Router> routerSet = Sets.newHashSet(router); - service.createRouters(routerSet); - } catch (Exception e) { - print(null, e.getMessage()); - } - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java deleted file mode 100644 index a8a4b585..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.router; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.Router; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.router.RouterService; - -/** - * Supports for query a list of router. - */ -@Command(scope = "onos", name = "routers", description = "Supports for creating a router") -public class RouterQueryCommand extends AbstractShellCommand { - @Option(name = "-i", aliases = "--id", description = "The router identifier", - required = false, multiValued = false) - String id = null; - - @Option(name = "-n", aliases = "--routerName", description = "The name of router", - required = false, multiValued = false) - String routerName = null; - - private static final String FMT = "routerId=%s, routerName=%s, tenantId=%s, gatewayPortId=%s," - + "externalGatewayInfo=%s, status=%s, adminStateUp=%s, distributed=%s, routers=%s"; - - @Override - protected void execute() { - RouterService service = get(RouterService.class); - if (id != null) { - Router router = service.getRouter(RouterId.valueOf(id)); - printFloatingIp(router); - } else if (routerName != null) { - Iterable<Router> routers = service.getRouters(); - if (routers == null) { - return; - } - for (Router router : routers) { - if (router.name().equals(routerName)) { - printFloatingIp(router); - return; - } - } - print(null, "The routerName is not existed"); - } else { - Iterable<Router> routers = service.getRouters(); - if (routers == null) { - return; - } - for (Router router : routers) { - printFloatingIp(router); - } - } - } - - private void printFloatingIp(Router router) { - print(FMT, router.id(), router.name(), router.tenantId(), - router.gatewayPortid(), router.externalGatewayInfo(), - router.status(), router.adminStateUp(), router.distributed(), - router.routes()); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java deleted file mode 100644 index b48434a1..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.router; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.Router; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.router.RouterService; - -import com.google.common.collect.Sets; - -/** - * Supports for remove a router. - */ -@Command(scope = "onos", name = "router-remove", description = "Supports for removing a router") -public class RouterRemoveCommand extends AbstractShellCommand { - @Option(name = "-i", aliases = "--id", description = "The router identifier", - required = false, multiValued = false) - String id = null; - - @Option(name = "-n", aliases = "--routerName", description = "The name of router", - required = false, multiValued = false) - String routerName = null; - - @Override - protected void execute() { - RouterService service = get(RouterService.class); - if (id == null && routerName == null) { - print(null, "one of id, routerName should not be null"); - } - try { - Set<RouterId> routerSet = Sets.newHashSet(); - if (id != null) { - routerSet.add(RouterId.valueOf(id)); - service.removeRouters(routerSet); - } else { - Iterable<Router> routers = service.getRouters(); - if (routers == null) { - return; - } - for (Router router : routers) { - if (router.name().equals(routerName)) { - routerSet.add(router.id()); - service.removeRouters(routerSet); - return; - } - } - } - } catch (Exception e) { - print(null, e.getMessage()); - } - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java deleted file mode 100644 index 699874b3..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.router; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.DefaultRouter; -import org.onosproject.vtnrsc.Router; -import org.onosproject.vtnrsc.Router.Status; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.router.RouterService; - -import com.google.common.collect.Sets; - -/** - * Supports for update a router. - */ -@Command(scope = "onos", name = "router-update", description = "Supports for updating a router") -public class RouterUpdateCommand extends AbstractShellCommand { - @Argument(index = 0, name = "id", description = "The router identifier", - required = true, multiValued = false) - String id = null; - - @Option(name = "-r", aliases = "--routerName", description = "The name of router", - required = false, multiValued = false) - String routerName = null; - - @Option(name = "-t", aliases = "--tenantId", description = "The tenant identifier of router", - required = false, multiValued = false) - String tenantId = null; - - @Option(name = "-g", aliases = "--gatewayPortId", description = "The gatewayPort identifier of router", - required = false, multiValued = false) - String gatewayPortId = null; - - @Option(name = "-e", aliases = "--externalGatewayInfo", description = "The externalGatewayInfo of router", - required = false, multiValued = false) - String externalGatewayInfo = null; - - @Option(name = "-s", aliases = "--status", description = "The status of router", - required = false, multiValued = false) - String status = null; - - @Option(name = "-a", aliases = "--adminStateUp", description = "The boolean adminStateUp of router", - required = false, multiValued = false) - boolean adminStateUp = true; - - @Option(name = "-d", aliases = "--distributed", description = "The boolean distributed of router", - required = false, multiValued = false) - boolean distributed = false; - - @Override - protected void execute() { - RouterService service = get(RouterService.class); - RouterId routerId = RouterId.valueOf(id); - Router router = get(RouterService.class).getRouter(routerId); - try { - List<String> routes = new ArrayList<String>(); - Router routerObj = new DefaultRouter( - RouterId.valueOf(id), - routerName == null ? router.name() : routerName, - adminStateUp, - status == null ? Status.ACTIVE - : Status.valueOf(status), - distributed, - null, - gatewayPortId == null ? router.gatewayPortid() - : VirtualPortId.portId(gatewayPortId), - tenantId == null ? router.tenantId() - : TenantId.tenantId(tenantId), - routes); - Set<Router> routerSet = Sets.newHashSet(routerObj); - service.createRouters(routerSet); - } catch (Exception e) { - print(null, e.getMessage()); - } - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java deleted file mode 100644 index 4f1768ac..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for router. - */ -package org.onosproject.vtnrsc.cli.router; diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java deleted file mode 100644 index a3a174c9..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.routerinterface; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.RouterInterface; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService; - -/** - * Supports for create a router interface. - */ -@Command(scope = "onos", name = "routerinterface-create", description = "Supports for creating a router interface") -public class RouterInterfaceCreateCommand extends AbstractShellCommand { - @Argument(index = 0, name = "routerId", description = "The router identifier of router interface", - required = true, multiValued = false) - String routerId = null; - - @Argument(index = 1, name = "tenantId", description = "The tenant identifier of router interface", - required = true, multiValued = false) - String tenantId = null; - - @Argument(index = 2, name = "portId", description = "The port identifier of router interface", - required = true, multiValued = false) - String portId = null; - - @Argument(index = 3, name = "subnetId", description = "The subnet identifier of router interface", - required = true, multiValued = false) - String subnetId = null; - - @Override - protected void execute() { - RouterInterfaceService service = get(RouterInterfaceService.class); - try { - RouterInterface routerInterface = RouterInterface.routerInterface( - SubnetId.subnetId(subnetId), - VirtualPortId.portId(portId), - RouterId.valueOf(routerId), - TenantId.tenantId(tenantId)); - service.addRouterInterface(routerInterface); - } catch (Exception e) { - print(null, e.getMessage()); - } - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java deleted file mode 100644 index 5de35aee..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.routerinterface; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.RouterInterface; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService; - -/** - * Supports for query a router interface. - */ -@Command(scope = "onos", name = "routerinterfaces", description = "Supports for querying a router interface") -public class RouterInterfaceQueryCommand extends AbstractShellCommand { - @Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface", - required = false, multiValued = false) - String subnetId = null; - - private static final String FMT = "subnetId=%s, tenantId=%s, portId=%s, routerId=%s"; - - @Override - protected void execute() { - RouterInterfaceService service = get(RouterInterfaceService.class); - if (subnetId != null) { - RouterInterface routerInterface = service - .getRouterInterface(SubnetId.subnetId(subnetId)); - printRouterInterface(routerInterface); - } else { - Iterable<RouterInterface> routerInterfaces = service - .getRouterInterfaces(); - for (RouterInterface routerInterface : routerInterfaces) { - printRouterInterface(routerInterface); - } - } - } - - private void printRouterInterface(RouterInterface routerInterface) { - print(FMT, routerInterface.subnetId(), routerInterface.tenantId(), - routerInterface.portId(), routerInterface.routerId()); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java deleted file mode 100644 index 4e838e26..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.routerinterface; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.RouterInterface; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService; - -/** - * Supports for remove a router interface. - */ -@Command(scope = "onos", name = "routerinterface-remove", description = "Supports for removing a router interface") -public class RouterInterfaceRemoveCommand extends AbstractShellCommand { - @Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface", - required = true, multiValued = false) - String subnetId = null; - - @Override - protected void execute() { - RouterInterfaceService service = get(RouterInterfaceService.class); - try { - RouterInterface routerInterface = service - .getRouterInterface(SubnetId.subnetId(subnetId)); - if (routerInterface == null) { - print(null, "subnet ID of interface doesn't exist"); - return; - } - service.removeRouterInterface(routerInterface); - } catch (Exception e) { - print(null, e.getMessage()); - } - - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java deleted file mode 100644 index 7b82004e..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for router interface. - */ -package org.onosproject.vtnrsc.cli.routerinterface; diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java deleted file mode 100644 index de8cfe53..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.subnet; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpAddress.Version; -import org.onlab.packet.IpPrefix; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.AllocationPool; -import org.onosproject.vtnrsc.DefaultSubnet; -import org.onosproject.vtnrsc.HostRoute; -import org.onosproject.vtnrsc.Subnet; -import org.onosproject.vtnrsc.Subnet.Mode; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.subnet.SubnetService; - -import com.google.common.collect.Sets; - -/** - * Supports for creating a subnet. - */ -@Command(scope = "onos", name = "subnet-create", description = "Supports for creating a subnet") -public class SubnetCreateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "Subnet Id", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "subnetName", description = "Subnet String name", required = true, - multiValued = false) - String subnetName = null; - - @Argument(index = 2, name = "networkId", description = "Subnet Network Id", required = true, - multiValued = false) - String networkId = null; - - @Argument(index = 3, name = "tenantId", description = "Subnet Tenant Id", required = true, - multiValued = false) - String tenantId = null; - - @Option(name = "-i", aliases = "--ipVersion", description = "Subnet Version ipVersion", - required = false, multiValued = false) - Version ipVersion = null; - - @Option(name = "-c", aliases = "--cidr", description = "Subnet IpPrefix cidr", - required = false, multiValued = false) - String cidr = "0.0.0.0/0"; - - @Option(name = "-g", aliases = "--gatewayIp", description = "Subnet IpAddress gatewayIp", - required = false, multiValued = false) - String gatewayIp = "0.0.0.0"; - - @Option(name = "-d", aliases = "--dhcpEnabled", description = "Subnet boolean dhcpEnabled", - required = false, multiValued = false) - boolean dhcpEnabled = false; - - @Option(name = "-s", aliases = "--shared", description = "Subnet boolean shared", - required = false, multiValued = false) - boolean shared = false; - - @Option(name = "-m", aliases = "--ipV6AddressMode", - description = "Subnet Mode ipV6AddressMode", required = false, multiValued = false) - String ipV6AddressMode = null; - - @Option(name = "-r", aliases = "--ipV6RaMode", description = "Subnet Mode ipV6RaMode", - required = false, multiValued = false) - String ipV6RaMode = null; - - @Option(name = "-h", aliases = "--hostRoutes", description = "Subnet jsonnode hostRoutes", - required = false, multiValued = false) - Set<HostRoute> hostRoutes = Sets.newHashSet(); - - @Option(name = "-a", aliases = "--allocationPools", - description = "Subnet jsonnode allocationPools", required = false, multiValued = false) - Set<AllocationPool> allocationPools = Sets.newHashSet(); - - @Override - protected void execute() { - SubnetService service = get(SubnetService.class); - if (id == null || networkId == null || tenantId == null) { - print("id,networkId,tenantId can not be null"); - return; - } - Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName, - TenantNetworkId.networkId(networkId), - TenantId.tenantId(tenantId), ipVersion, - cidr == null ? null : IpPrefix.valueOf(cidr), - gatewayIp == null ? null : IpAddress.valueOf(gatewayIp), - dhcpEnabled, shared, hostRoutes, - ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode), - ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode), - allocationPools); - - Set<Subnet> subnetsSet = Sets.newHashSet(subnet); - service.createSubnets(subnetsSet); - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java deleted file mode 100644 index f5a94f0f..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.subnet; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.Subnet; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.subnet.SubnetService; - -/** - * Supports for querying a subnet. - */ -@Command(scope = "onos", name = "subnets", description = "Supports for querying a subnet") -public class SubnetQueryCommand extends AbstractShellCommand { - - @Option(name = "-i", aliases = "--id", description = "Subnet id", required = false, - multiValued = false) - String id = null; - - private static final String FMT = "subnetId=%s, networkId=%s, subnetName=%s," - + "tenantId=%s, cidr=%s, dhcpEnabled=%s, gatewayIp=%s," + "ipVersion=%s"; - - @Override - protected void execute() { - SubnetService service = get(SubnetService.class); - if (id != null) { - Subnet subnet = service.getSubnet(SubnetId.subnetId(id)); - printSubnet(subnet); - } else { - Iterable<Subnet> subnets = service.getSubnets(); - if (subnets == null) { - return; - } - for (Subnet subnet : subnets) { - printSubnet(subnet); - } - } - } - - private void printSubnet(Subnet subnet) { - print(FMT, subnet.id(), subnet.networkId(), subnet.subnetName(), - subnet.tenantId(), subnet.cidr(), subnet.dhcpEnabled(), subnet - .gatewayIp(), subnet.ipVersion()); - - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java deleted file mode 100644 index 241af87e..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.subnet; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.subnet.SubnetService; - -import com.google.common.collect.Sets; - -/** - * Supports for removing a subnet. - */ -@Command(scope = "onos", name = "subnet-remove", description = "Supports for removing a subnet") -public class SubnetRemoveCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "Subnet SubnetId Id", required = true, - multiValued = false) - String id = null; - - @Override - protected void execute() { - SubnetService service = get(SubnetService.class); - Set<SubnetId> subnetsSet = Sets.newHashSet(); - subnetsSet.add(SubnetId.subnetId(id)); - service.removeSubnets(subnetsSet); - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java deleted file mode 100644 index c76ca5b2..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.subnet; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpAddress.Version; -import org.onlab.packet.IpPrefix; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.AllocationPool; -import org.onosproject.vtnrsc.DefaultSubnet; -import org.onosproject.vtnrsc.HostRoute; -import org.onosproject.vtnrsc.Subnet; -import org.onosproject.vtnrsc.Subnet.Mode; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.subnet.SubnetService; - -import com.google.common.collect.Sets; - -/** - * Supports for updating a subnet. - */ -@Command(scope = "onos", name = "subnet-update", description = "Supports for updating a subnet") -public class SubnetUpdateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "Subnet Id", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "subnetName", description = "Subnet String name", required = true, - multiValued = false) - String subnetName = null; - - @Argument(index = 2, name = "networkId", description = "Subnet Network Id", required = true, - multiValued = false) - String networkId = null; - - @Argument(index = 3, name = "tenantId", description = "Subnet Tenant Id", required = true, - multiValued = false) - String tenantId = null; - - @Option(name = "-i", aliases = "--ipVersion", description = "Subnet Version ipVersion", - required = false, multiValued = false) - Version ipVersion = null; - - @Option(name = "-c", aliases = "--cidr", description = "Subnet IpPrefix cidr", required = false, - multiValued = false) - String cidr = "0.0.0.0/0"; - - @Option(name = "-g", aliases = "--gatewayIp", description = "Subnet IpAddress gatewayIp", - required = false, multiValued = false) - String gatewayIp = "0.0.0.0"; - - @Option(name = "-d", aliases = "--dhcpEnabled", description = "Subnet boolean dhcpEnabled", - required = false, multiValued = false) - boolean dhcpEnabled = false; - - @Option(name = "-s", aliases = "--shared", description = "Subnet boolean shared", required = false, - multiValued = false) - boolean shared = false; - - @Option(name = "-m", aliases = "--ipV6AddressMode", description = "Subnet Mode ipV6AddressMode", - required = false, multiValued = false) - String ipV6AddressMode = null; - - @Option(name = "-r", aliases = "--ipV6RaMode", description = "Subnet Mode ipV6RaMode", - required = false, multiValued = false) - String ipV6RaMode = null; - - @Option(name = "-h", aliases = "--hostRoutes", description = "Subnet jsonnode hostRoutes", - required = false, multiValued = false) - Set<HostRoute> hostRoutes = Sets.newHashSet(); - - @Option(name = "-a", aliases = "--allocationPools", - description = "Subnet jsonnode allocationPools", required = false, multiValued = false) - Set<AllocationPool> allocationPools = Sets.newHashSet(); - - @Override - protected void execute() { - SubnetService service = get(SubnetService.class); - if (id == null || networkId == null || tenantId == null) { - print("id,networkId,tenantId can not be null"); - return; - } - Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName, - TenantNetworkId.networkId(networkId), - TenantId.tenantId(tenantId), ipVersion, - cidr == null ? null : IpPrefix.valueOf(cidr), - gatewayIp == null ? null : IpAddress.valueOf(gatewayIp), - dhcpEnabled, shared, hostRoutes, - ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode), - ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode), - allocationPools); - Set<Subnet> subnetsSet = Sets.newHashSet(); - subnetsSet.add(subnet); - service.updateSubnets(subnetsSet); - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java deleted file mode 100644 index b3a2ff51..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for subnets. - */ -package org.onosproject.vtnrsc.cli.subnet; diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java deleted file mode 100644 index 4c555e33..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.virtualport; - -import java.util.Map; -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.MacAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.net.DeviceId; -import org.onosproject.vtnrsc.AllowedAddressPair; -import org.onosproject.vtnrsc.BindingHostId; -import org.onosproject.vtnrsc.DefaultVirtualPort; -import org.onosproject.vtnrsc.FixedIp; -import org.onosproject.vtnrsc.SecurityGroup; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPort; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.virtualport.VirtualPortService; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -/** - * Supports for creating a virtualPort. - */ -@Command(scope = "onos", name = "virtualport-create", - description = "Supports for creating a virtualPort.") -public class VirtualPortCreateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "virtualPort id.", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "networkId", description = "network id.", required = true, - multiValued = false) - String networkId = null; - - @Argument(index = 2, name = "name", description = "virtualPort name.", required = true, - multiValued = false) - String name = null; - - @Argument(index = 3, name = "tenantId", description = "tenant id.", required = true, - multiValued = false) - String tenantId = null; - - @Argument(index = 4, name = "deviceId", description = "device id.", required = true, - multiValued = false) - String deviceId = null; - - @Option(name = "-a", aliases = "--adminStateUp", - description = "administrative status of the virtualPort which is true or false.", - required = false, multiValued = false) - Boolean adminStateUp = false; - - @Option(name = "-s", aliases = "--state", description = "virtualPort state.", required = false, - multiValued = false) - String state = null; - - @Option(name = "-m", aliases = "--macAddress", description = "MAC address.", required = false, - multiValued = false) - String macAddress = ""; - - @Option(name = "-d", aliases = "--deviceOwner", description = "ID of the entity that uses this " - + "virtualPort.", required = false, multiValued = false) - String deviceOwner = null; - - @Option(name = "-f", aliases = "--fixedIp", - description = "The IP address for the port,include the IP address " - + "and subnet identity.", required = false, multiValued = false) - FixedIp fixedIp = null; - - @Option(name = "-i", aliases = "--bindingHostId", description = "virtualPort bindingHostId.", - required = false, multiValued = false) - String bindingHostId = null; - - @Option(name = "-t", aliases = "--bindingvnicType", description = "virtualPort bindingvnicType.", - required = false, multiValued = false) - String bindingvnicType = null; - - @Option(name = "-v", aliases = "--bindingvifType", description = "virtualPort bindingvifType.", - required = false, multiValued = false) - String bindingvifType = null; - - @Option(name = "-b", aliases = "--bindingvnicDetails", - description = "virtualPort bindingvnicDetails.", required = false, multiValued = false) - String bindingvnicDetails = null; - - @Option(name = "-l", aliases = "--allowedAddress", description = "virtual allowedAddressPair.", - required = false, multiValued = false) - Set<AllowedAddressPair> allowedAddressPairs = Sets.newHashSet(); - - @Option(name = "-e", aliases = "--securityGroups", description = "virtualPort securityGroups.", - required = false, multiValued = false) - Set<SecurityGroup> securityGroups = Sets.newHashSet(); - - @Override - protected void execute() { - Map<String, String> strMap = Maps.newHashMap(); - strMap.putIfAbsent("name", name); - strMap.putIfAbsent("deviceOwner", deviceOwner); - strMap.putIfAbsent("bindingvnicType", bindingvnicType); - strMap.putIfAbsent("bindingvifType", bindingvifType); - strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails); - VirtualPortService service = get(VirtualPortService.class); - VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id), - TenantNetworkId.networkId(networkId), - false, strMap, VirtualPort.State.ACTIVE, - MacAddress.valueOf(macAddress), - TenantId.tenantId(tenantId), - DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp), - BindingHostId.bindingHostId(bindingHostId), - allowedAddressPairs, securityGroups); - Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort); - service.createPorts(virtualPorts); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java deleted file mode 100644 index 47126d1b..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.virtualport; - -import java.util.Collection; - -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.net.DeviceId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPort; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.virtualport.VirtualPortService; - -/** - * Supports for querying virtualPorts. - */ -@Command(scope = "onos", name = "virtualports", description = "Supports for querying virtualPorts.") -public class VirtualPortQueryCommand extends AbstractShellCommand { - - @Option(name = "-v", aliases = "--vPortId", description = "virtualPort ID.", required = false, - multiValued = false) - String vPortId; - - @Option(name = "-n", aliases = "--networkId", description = "network ID.", required = false, - multiValued = false) - String networkId; - - @Option(name = "-d", aliases = "--deviceId", description = "device ID.", required = false, - multiValued = false) - String deviceId; - - @Option(name = "-t", aliases = "--tenantId", description = "tenant ID.", required = false, - multiValued = false) - String tenantId; - - private static final String FMT = "virtualPortId=%s, networkId=%s, name=%s," - + " tenantId=%s, deviceId=%s, adminStateUp=%s, state=%s," - + " macAddress=%s, deviceOwner=%s, fixedIp=%s, bindingHostId=%s," - + " bindingvnicType=%s, bindingvifType=%s, bindingvnicDetails=%s," - + " allowedAddress=%s, securityGroups=%s"; - - @Override - protected void execute() { - VirtualPortService service = get(VirtualPortService.class); - if (vPortId != null && networkId == null && deviceId == null && tenantId == null) { - VirtualPort port = service.getPort(VirtualPortId.portId(vPortId)); - printPort(port); - } else if (vPortId == null && networkId != null && deviceId == null && tenantId == null) { - Collection<VirtualPort> ports = service.getPorts(TenantNetworkId.networkId(networkId)); - printPorts(ports); - } else if (vPortId == null && networkId == null && deviceId != null && tenantId == null) { - Collection<VirtualPort> ports = service.getPorts(DeviceId.deviceId(deviceId)); - printPorts(ports); - } else if (vPortId == null && networkId == null && deviceId == null && tenantId != null) { - Collection<VirtualPort> ports = service.getPorts(DeviceId.deviceId(tenantId)); - printPorts(ports); - } else if (vPortId == null && networkId == null && deviceId == null && tenantId == null) { - Collection<VirtualPort> ports = service.getPorts(); - printPorts(ports); - } else { - print("cannot input more than one parameter"); - } - - } - - private void printPorts(Collection<VirtualPort> ports) { - for (VirtualPort port : ports) { - printPort(port); - } - } - - private void printPort(VirtualPort port) { - print(FMT, port.portId(), port.networkId(), port.name(), port.tenantId(), port.deviceId(), - port.adminStateUp(), port.state(), port.macAddress(), port.deviceOwner(), port - .fixedIps(), port.bindingHostId(), port.bindingVnicType(), - port.bindingVifType(), port.bindingVifDetails(), port.allowedAddressPairs(), - port.securityGroups()); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java deleted file mode 100644 index 1a3cb4f0..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.virtualport; - -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.virtualport.VirtualPortService; - -import com.google.common.collect.Sets; - -/** - * Supports for removing a virtualPort. - */ -@Command(scope = "onos", name = "virtualport-remove", - description = "Supports for removing a virtualPort.") -public class VirtualPortRemoveCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "virtualPort id.", required = true, - multiValued = false) - String id = null; - - @Override - protected void execute() { - VirtualPortService service = get(VirtualPortService.class); - Set<VirtualPortId> virtualPorts = Sets.newHashSet(VirtualPortId.portId(id)); - service.removePorts(virtualPorts); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java deleted file mode 100644 index 6df4b23c..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2015 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.vtnrsc.cli.virtualport; - -import java.util.Map; -import java.util.Set; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.onlab.packet.MacAddress; -import org.onosproject.cli.AbstractShellCommand; -import org.onosproject.net.DeviceId; -import org.onosproject.vtnrsc.AllowedAddressPair; -import org.onosproject.vtnrsc.BindingHostId; -import org.onosproject.vtnrsc.DefaultVirtualPort; -import org.onosproject.vtnrsc.FixedIp; -import org.onosproject.vtnrsc.SecurityGroup; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPort; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.virtualport.VirtualPortService; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -/** - * Supports for updating a virtualPort. - */ -@Command(scope = "onos", name = "virtualport-update", - description = "Supports for updating a virtualPort.") -public class VirtualPortUpdateCommand extends AbstractShellCommand { - - @Argument(index = 0, name = "id", description = "virtualPort id.", required = true, - multiValued = false) - String id = null; - - @Argument(index = 1, name = "networkId", description = "network id.", required = true, - multiValued = false) - String networkId = null; - - @Argument(index = 2, name = "name", description = "virtualPort name.", required = true, - multiValued = false) - String name = null; - - @Argument(index = 3, name = "tenantId", description = "tenant id.", required = true, - multiValued = false) - String tenantId = null; - - @Argument(index = 4, name = "deviceId", description = "device id.", required = true, - multiValued = false) - String deviceId = null; - - @Option(name = "-a", aliases = "--adminStateUp", - description = "administrative status of the virtualPort which is true or false.", - required = false, multiValued = false) - Boolean adminStateUp = false; - - @Option(name = "-s", aliases = "--state", description = "virtualPort state.", required = false, - multiValued = false) - String state = null; - - @Option(name = "-m", aliases = "--macAddress", description = "MAC address.", required = false, - multiValued = false) - String macAddress = ""; - - @Option(name = "-d", aliases = "--deviceOwner", - description = "ID of the entity that uses this " + "virtualPort.", required = false, - multiValued = false) - String deviceOwner = null; - - @Option(name = "-f", aliases = "--fixedIp", - description = "The IP address for the port,include the IP address " - + "and subnet identity.", required = false, multiValued = false) - FixedIp fixedIp = null; - - @Option(name = "-i", aliases = "--bindingHostId", description = "virtualPort bindingHostId.", - required = false, multiValued = false) - String bindingHostId = ""; - - @Option(name = "-t", aliases = "--bindingvnicType", - description = "virtualPort bindingvnicType.", required = false, multiValued = false) - String bindingvnicType = null; - - @Option(name = "-v", aliases = "--bindingvifType", description = "virtualPort bindingvifType.", - required = false, multiValued = false) - String bindingvifType = null; - - @Option(name = "-b", aliases = "--bindingvnicDetails", - description = "virtualPort bindingvnicDetails.", required = false, multiValued = false) - String bindingvnicDetails = null; - - @Option(name = "-l", aliases = "--allowedAddress", description = "virtual allowedAddressPair.", - required = false, multiValued = false) - Set<AllowedAddressPair> allowedAddressPairs = Sets.newHashSet(); - - @Option(name = "-e", aliases = "--securityGroups", description = "virtualPort securityGroups.", - required = false, multiValued = false) - Set<SecurityGroup> securityGroups = Sets.newHashSet(); - - @Override - protected void execute() { - VirtualPortService service = get(VirtualPortService.class); - Map<String, String> strMap = Maps.newHashMap(); - strMap.putIfAbsent("name", name); - strMap.putIfAbsent("deviceOwner", deviceOwner); - strMap.putIfAbsent("bindingvnicType", bindingvnicType); - strMap.putIfAbsent("bindingvifType", bindingvifType); - strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails); - VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id), - TenantNetworkId.networkId(networkId), - false, strMap, VirtualPort.State.ACTIVE, - MacAddress.valueOf(macAddress), - TenantId.tenantId(tenantId), - DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp), - BindingHostId.bindingHostId(bindingHostId), - allowedAddressPairs, securityGroups); - Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort); - service.updatePorts(virtualPorts); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java deleted file mode 100644 index fac214a1..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Command line interface for virtual ports. - */ -package org.onosproject.vtnrsc.cli.virtualport; |