blob: 4fcc2712e6497d6eed6ecebaffbe610d4a672494 [file] [log] [blame]
Brian O'Connor7cbbbb72016-04-09 02:13:23 -07001/*
2 * Copyright 2016-present 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 */
Saurav Das24431192016-03-07 19:13:00 -080016package org.onosproject.cli.net;
17
18import java.util.List;
19
20//import org.apache.karaf.shell.commands.Argument;
21import org.apache.karaf.shell.commands.Command;
22import org.onosproject.cli.AbstractShellCommand;
23import org.onosproject.net.flowobjective.FlowObjectiveService;
24
25/**
26 * Returns a mapping of FlowObjective next-ids to the groups that get created
27 * by a device driver.
28 */
29@Command(scope = "onos", name = "next-ids",
30 description = "flow-objective next-ids to group-ids mapping")
31public class FlowObjectiveNextListCommand extends AbstractShellCommand {
32
33 /*@Argument(index = 1, name = "uri", description = "Device ID",
34 required = false, multiValued = false)
35 String uri = null;
36 */
37 private static final String FORMAT_MAPPING =
38 " %s";
39 @Override
40 protected void execute() {
41 FlowObjectiveService service = get(FlowObjectiveService.class);
42 printNexts(service.getNextMappings());
43 }
44
45 private void printNexts(List<String> nextGroupMappings) {
46 nextGroupMappings.forEach(str -> print(FORMAT_MAPPING, str));
47 }
48}