blob: fd8a3cb8acfc2f68db495f569438e9b6f6e97585 [file] [log] [blame]
Satish Kba1c9122017-04-05 15:27:23 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Satish Kba1c9122017-04-05 15:27:23 +05303 *
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.onosproject.pce.cli;
17
18import static org.slf4j.LoggerFactory.getLogger;
19
Ray Milkey86ad7bb2018-09-27 12:32:28 -070020import org.apache.karaf.shell.api.action.Argument;
21import org.apache.karaf.shell.api.action.Command;
Satish Kba1c9122017-04-05 15:27:23 +053022
Ray Milkey7a2dee52018-09-28 10:58:28 -070023import org.apache.karaf.shell.api.action.lifecycle.Service;
Satish Kba1c9122017-04-05 15:27:23 +053024import org.onosproject.cli.AbstractShellCommand;
25import org.onosproject.pce.pceservice.api.PceService;
26
27import org.slf4j.Logger;
28
29/**
30 * Supports deleting pce load balancing path.
31 */
Ray Milkey7a2dee52018-09-28 10:58:28 -070032@Service
Satish Kba1c9122017-04-05 15:27:23 +053033@Command(scope = "onos", name = "pce-delete-load-balancing-path",
34 description = "Supports deleting pce load balancing path.")
35public class PceDeleteLoadBalancingPathCommand extends AbstractShellCommand {
36 private final Logger log = getLogger(getClass());
37
38 @Argument(index = 0, name = "name", description = "load balancing path name", required = true,
39 multiValued = false)
40 String name = null;
41
42 @Override
Ray Milkey86ad7bb2018-09-27 12:32:28 -070043 protected void doExecute() {
Satish Kba1c9122017-04-05 15:27:23 +053044 log.info("executing pce-delete-load-balancing-path");
45
46 PceService service = get(PceService.class);
47
48 if (!service.releasePath(name)) {
49 error("Path deletion failed.");
50 return;
51 }
52 }
53}