Satish K | ba1c912 | 2017-04-05 15:27:23 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Satish K | ba1c912 | 2017-04-05 15:27:23 +0530 | [diff] [blame] | 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 | package org.onosproject.pce.cli; |
| 17 | |
| 18 | import static org.slf4j.LoggerFactory.getLogger; |
| 19 | |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame^] | 20 | import org.apache.karaf.shell.api.action.Argument; |
| 21 | import org.apache.karaf.shell.api.action.Command; |
Satish K | ba1c912 | 2017-04-05 15:27:23 +0530 | [diff] [blame] | 22 | |
| 23 | import org.onosproject.cli.AbstractShellCommand; |
| 24 | import org.onosproject.pce.pceservice.api.PceService; |
| 25 | |
| 26 | import org.slf4j.Logger; |
| 27 | |
| 28 | /** |
| 29 | * Supports deleting pce load balancing path. |
| 30 | */ |
| 31 | @Command(scope = "onos", name = "pce-delete-load-balancing-path", |
| 32 | description = "Supports deleting pce load balancing path.") |
| 33 | public class PceDeleteLoadBalancingPathCommand extends AbstractShellCommand { |
| 34 | private final Logger log = getLogger(getClass()); |
| 35 | |
| 36 | @Argument(index = 0, name = "name", description = "load balancing path name", required = true, |
| 37 | multiValued = false) |
| 38 | String name = null; |
| 39 | |
| 40 | @Override |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame^] | 41 | protected void doExecute() { |
Satish K | ba1c912 | 2017-04-05 15:27:23 +0530 | [diff] [blame] | 42 | log.info("executing pce-delete-load-balancing-path"); |
| 43 | |
| 44 | PceService service = get(PceService.class); |
| 45 | |
| 46 | if (!service.releasePath(name)) { |
| 47 | error("Path deletion failed."); |
| 48 | return; |
| 49 | } |
| 50 | } |
| 51 | } |