Carmelo Cascone | 9e4972c | 2018-08-30 00:29:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-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.net.pi.service; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | import org.onosproject.event.ListenerService; |
| 21 | import org.onosproject.net.DeviceId; |
| 22 | import org.onosproject.net.pi.model.PiPipeconfId; |
| 23 | |
| 24 | /** |
| 25 | * Service that periodically probes pipeline programmable devices, to check that |
| 26 | * their pipeline is configured with the expected pipeconf. It emits events |
| 27 | * about pipeline status changes. |
| 28 | */ |
| 29 | @Beta |
| 30 | public interface PiPipeconfWatchdogService |
| 31 | extends ListenerService<PiPipeconfWatchdogEvent, PiPipeconfWatchdogListener> { |
| 32 | |
| 33 | /** |
| 34 | * Status of a device pipeline. |
| 35 | */ |
| 36 | enum PipelineStatus { |
| 37 | /** |
| 38 | * The device pipeline is ready to process packets. |
| 39 | */ |
| 40 | READY, |
| 41 | /** |
| 42 | * The status is unknown and the device might not be able to process |
| 43 | * packets yet. |
| 44 | */ |
| 45 | UNKNOWN, |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Asynchronously triggers a probe task that checks the device pipeline |
| 50 | * status and, if required, configures it with the pipeconf associated to |
| 51 | * this device (via {@link PiPipeconfService#bindToDevice(PiPipeconfId, |
| 52 | * DeviceId)}). |
| 53 | * |
| 54 | * @param deviceId device to probe |
| 55 | */ |
| 56 | void triggerProbe(DeviceId deviceId); |
| 57 | |
| 58 | /** |
| 59 | * Returns the last known pipeline status of the given device. |
| 60 | * |
| 61 | * @param deviceId device ID |
| 62 | * @return pipeline status |
| 63 | */ |
| 64 | PipelineStatus getStatus(DeviceId deviceId); |
| 65 | } |