blob: e027d119e73a415e99bb294801b6ceaa74bd7bb9 [file] [log] [blame]
Pier Luigi Ventre0a023f42016-04-30 11:03:15 +02001/*
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 */
16
17package org.onosproject.sdxl2.cli;
18
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.sdxl2.SdxL2Service;
22
23import java.util.Set;
24
25/**
26 * CLI to list sdxl2.
27 */
28@Command(scope = "sdxl2", name = "sdxl2-list", description = "Lists the sdxl2s")
29public class SdxL2ListCommand extends AbstractShellCommand {
30
31 private static final String HEADER = "\n\u001B[1;37mSDXL2\u001B[0m";
32 private static final String SEPARATOR = "\u001B[1;37m--------------\u001B[0m";
33 private static final String FORMAT_SDXL2 = "\u001B[1;37m%s\u001B[0m";
34
35 @Override
36 protected void execute() {
37 SdxL2Service sdxl2Service = get(SdxL2Service.class);
38 Set<String> sdxl2s = sdxl2Service.getSdxL2s();
39 if (sdxl2s.size() > 0) {
40 print(HEADER);
41 print(SEPARATOR);
42 for (String sdxl2 : sdxl2s) {
43 print(FORMAT_SDXL2, sdxl2);
44 }
45 print("");
46 }
47 }
48}