blob: 1d1f032e5bc414e74fe2cdf36a240915adcd9afc [file] [log] [blame]
Gamze Abaka1e5ccf52018-07-02 11:59:03 +00001/*
2 * Copyright 2017-present Open Networking Foundation
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.opencord.sadis.cli;
17
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.opencord.sadis.BandwidthProfileInformation;
22import org.opencord.sadis.BaseInformationService;
23import org.opencord.sadis.SadisService;
24
25/**
26 * Bandwidth profile information service CLI.
27 */
28@Command(scope = "onos", name = "bandwidthProfile", description = "Bandwidth profile information service CLI command")
29public class BandwidthProfileGetCommand extends AbstractShellCommand {
30
31 @Argument(index = 0, name = "ID", description = "bandwidthProfile ID", required = true, multiValued = false)
32 String id;
33
34 private SadisService sadisService = get(SadisService.class);
35 private BaseInformationService<BandwidthProfileInformation> service = sadisService.getBandwidthProfileService();
36
37 @Override
38 protected void execute() {
39 BandwidthProfileInformation info = service.get(id);
40 if (info != null) {
41 print(info.toString());
42 } else {
43 print("Bandwidth profile not found");
44 }
45 }
46}