blob: 87db21e05fd313c49b77d8deed6298f0c8e792fa [file] [log] [blame]
Kyuhwi Choi70537882016-06-24 17:24:12 +09001/*
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.scalablegateway.cli;
18
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.scalablegateway.api.ScalableGatewayService;
22
23/**
24 * Lists all gateway node information of scalablegateway.
25 */
26
27@Command(scope = "onos", name = "gateways",
28 description = "Lists gateway node information")
29public class ScalableGatewayListCommand extends AbstractShellCommand {
30
31 private static final String FORMAT = "GatewayNode Id[%s]: DataPlane Ip[%s], External Interface names[%s]";
32 @Override
33 protected void execute() {
34 ScalableGatewayService service = get(ScalableGatewayService.class);
35 service.getGatewayNodes().forEach(node -> print(FORMAT,
36 node.getGatewayDeviceId().toString(),
37 node.getDataIpAddress().toString(),
Kyuhwi Choi176c83d2016-07-14 11:39:37 +090038 node.getGatewayExternalInterfaceName().toString()));
Kyuhwi Choi70537882016-06-24 17:24:12 +090039 }
40}