Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [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.net.pi.service; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | import org.onosproject.event.AbstractEvent; |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 21 | import org.onosproject.net.pi.runtime.PiEntity; |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Signals an event related to the translation of a protocol-dependent (PD) |
| 25 | * entity to a protocol-independent (PI) one. |
| 26 | */ |
| 27 | @Beta |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 28 | public final class PiTranslationEvent<T extends PiTranslatable, E extends PiEntity> |
| 29 | extends AbstractEvent<PiTranslationEvent.Type, PiTranslatedEntity<T, E>> { |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Type of event. |
| 33 | */ |
| 34 | public enum Type { |
| 35 | /** |
| 36 | * Signals that A PD entity has been translated to a PI one, and the |
| 37 | * mapping between the two entities has been learned by the system. |
| 38 | */ |
| 39 | LEARNED, |
| 40 | |
| 41 | /** |
| 42 | * Signals that a previously learned mapping between a PD entity and its |
| 43 | * PI counterpart has been removed. |
| 44 | */ |
| 45 | FORGOT, |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Creates a new translation event. |
| 50 | * |
| 51 | * @param type type of event |
| 52 | * @param subject subject of event |
| 53 | */ |
Carmelo Cascone | 326ad2d | 2017-11-28 18:09:13 -0800 | [diff] [blame] | 54 | public PiTranslationEvent(Type type, PiTranslatedEntity<T, E> subject) { |
Carmelo Cascone | 1a7e4f9 | 2017-11-20 23:04:02 -0800 | [diff] [blame] | 55 | super(type, subject); |
| 56 | } |
| 57 | } |