blob: 611446d3e8d952bc9d88d2d435396b0c046aac27 [file] [log] [blame]
Ray Milkey140e4782015-04-24 11:25:13 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.xosintegration.cli;
17
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.xosintegration.VoltTenant;
22import org.onosproject.xosintegration.VoltTenantService;
23
24/**
25 * CLI command to create a new tenant.
26 */
27@Command(scope = "onos", name = "add-tenant",
28 description = "Lists the inventory of VOLT tenants and their contents")
29public class VoltTenantsCreateCommand extends AbstractShellCommand {
Ray Milkey140e4782015-04-24 11:25:13 -070030
Ray Milkeydea98172015-05-18 10:39:39 -070031 @Argument(index = 0, name = "service specific ID",
Ray Milkey140e4782015-04-24 11:25:13 -070032 description = "service specific ID",
33 required = true, multiValued = false)
34 String serviceSpecificId;
35
Ray Milkeydea98172015-05-18 10:39:39 -070036 @Argument(index = 1, name = "vlan ID",
Ray Milkey140e4782015-04-24 11:25:13 -070037 description = "vlan ID",
38 required = true, multiValued = false)
39 String vlanId;
40
41 @Override
42 protected void execute() {
43 VoltTenantService service = get(VoltTenantService.class);
44
45 VoltTenant newTenant = VoltTenant.builder()
Ray Milkey140e4782015-04-24 11:25:13 -070046 .withServiceSpecificId(serviceSpecificId)
47 .withVlanId(vlanId)
48 .build();
49 service.addTenant(newTenant);
50 }
51}