Kyuhwi Choi | 7053788 | 2016-06-24 17:24:12 +0900 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.scalablegateway.cli; |
| 18 | |
| 19 | import org.apache.karaf.shell.commands.Command; |
| 20 | import org.onosproject.cli.AbstractShellCommand; |
| 21 | import 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") |
| 29 | public 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 Choi | 176c83d | 2016-07-14 11:39:37 +0900 | [diff] [blame^] | 38 | node.getGatewayExternalInterfaceName().toString())); |
Kyuhwi Choi | 7053788 | 2016-06-24 17:24:12 +0900 | [diff] [blame] | 39 | } |
| 40 | } |