Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | |
| 17 | package org.onosproject.dhcprelay.cli; |
| 18 | |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 19 | import org.apache.karaf.shell.api.action.Command; |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 20 | import org.apache.karaf.shell.api.action.lifecycle.Service; |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 21 | import org.onosproject.cli.AbstractShellCommand; |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 22 | import org.apache.karaf.shell.api.action.Argument; |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 23 | import org.onlab.packet.IpPrefix; |
| 24 | import org.onosproject.dhcprelay.api.DhcpRelayService; |
| 25 | |
| 26 | /** |
| 27 | * Prints Dhcp FPM Routes information. |
| 28 | */ |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 29 | @Service |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 30 | @Command(scope = "onos", name = "dhcp-fpm-delete", |
| 31 | description = "delete DHCP FPM prefix in dhcp-fpm-store") |
| 32 | public class DhcpFpmDeleteCommand extends AbstractShellCommand { |
| 33 | |
| 34 | private static final DhcpRelayService DHCP_RELAY_SERVICE = get(DhcpRelayService.class); |
| 35 | |
| 36 | @Argument(index = 0, name = "prefix", |
| 37 | description = "prefix", |
| 38 | required = true, multiValued = false) |
| 39 | String prefixString = null; |
| 40 | |
| 41 | @Override |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 42 | protected void doExecute() { |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 43 | IpPrefix prefix = IpPrefix.valueOf(prefixString); |
| 44 | |
| 45 | DHCP_RELAY_SERVICE.removeFpmRecord(prefix); |
| 46 | } |
| 47 | } |