alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [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 | */ |
alshabib | 2ce0c73 | 2015-10-02 11:20:39 +0200 | [diff] [blame] | 16 | package org.onosproject.net.mcast; |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 17 | |
alshabib | 2ce0c73 | 2015-10-02 11:20:39 +0200 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 19 | import org.onosproject.event.AbstractEvent; |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 20 | |
alshabib | ed0951f | 2015-10-02 21:39:27 +0200 | [diff] [blame] | 21 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 22 | |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 23 | /** |
| 24 | * An entity representing a multicast event. Event either add or remove |
| 25 | * sinks or sources. |
| 26 | */ |
alshabib | 2ce0c73 | 2015-10-02 11:20:39 +0200 | [diff] [blame] | 27 | @Beta |
alshabib | 79e5287 | 2015-12-07 16:01:01 -0800 | [diff] [blame] | 28 | public class McastEvent extends AbstractEvent<McastEvent.Type, McastRouteInfo> { |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 29 | |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 30 | |
| 31 | public enum Type { |
| 32 | /** |
| 33 | * A new mcast route has been added. |
| 34 | */ |
| 35 | ROUTE_ADDED, |
| 36 | |
| 37 | /** |
| 38 | * A mcast route has been removed. |
| 39 | */ |
| 40 | ROUTE_REMOVED, |
| 41 | |
| 42 | /** |
| 43 | * A source for a mcast route (ie. the subject) has been added. |
| 44 | */ |
| 45 | SOURCE_ADDED, |
| 46 | |
| 47 | /** |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 48 | * A sink for a mcast route (ie. the subject) has been added. |
| 49 | */ |
| 50 | SINK_ADDED, |
| 51 | |
| 52 | /** |
| 53 | * A source for a mcast route (ie. the subject) has been removed. |
| 54 | */ |
| 55 | SINK_REMOVED |
| 56 | } |
| 57 | |
alshabib | 79e5287 | 2015-12-07 16:01:01 -0800 | [diff] [blame] | 58 | public McastEvent(McastEvent.Type type, McastRouteInfo subject) { |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 59 | super(type, subject); |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 60 | } |
| 61 | |
alshabib | ed0951f | 2015-10-02 21:39:27 +0200 | [diff] [blame] | 62 | |
| 63 | @Override |
| 64 | public String toString() { |
| 65 | return toStringHelper(this) |
| 66 | .add("type", type()) |
alshabib | 79e5287 | 2015-12-07 16:01:01 -0800 | [diff] [blame] | 67 | .add("info", subject()).toString(); |
alshabib | ed0951f | 2015-10-02 21:39:27 +0200 | [diff] [blame] | 68 | } |
alshabib | a9b2b5d | 2015-09-23 15:01:47 -0700 | [diff] [blame] | 69 | } |