blob: ec45a8ba99fbe7ffdd684d3d24bf100197dca09d [file] [log] [blame]
alshabiba9b2b5d2015-09-23 15:01:47 -07001/*
2 * Copyright 2015 Open Networking Laboratory
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 */
alshabib2ce0c732015-10-02 11:20:39 +020016package org.onosproject.net.mcast;
alshabiba9b2b5d2015-09-23 15:01:47 -070017
alshabib2ce0c732015-10-02 11:20:39 +020018import com.google.common.annotations.Beta;
alshabiba9b2b5d2015-09-23 15:01:47 -070019import org.onosproject.event.AbstractEvent;
alshabiba9b2b5d2015-09-23 15:01:47 -070020
alshabibed0951f2015-10-02 21:39:27 +020021import static com.google.common.base.MoreObjects.toStringHelper;
22
alshabiba9b2b5d2015-09-23 15:01:47 -070023/**
24 * An entity representing a multicast event. Event either add or remove
25 * sinks or sources.
26 */
alshabib2ce0c732015-10-02 11:20:39 +020027@Beta
alshabib79e52872015-12-07 16:01:01 -080028public class McastEvent extends AbstractEvent<McastEvent.Type, McastRouteInfo> {
alshabiba9b2b5d2015-09-23 15:01:47 -070029
alshabiba9b2b5d2015-09-23 15:01:47 -070030
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 /**
alshabiba9b2b5d2015-09-23 15:01:47 -070048 * 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
alshabib79e52872015-12-07 16:01:01 -080058 public McastEvent(McastEvent.Type type, McastRouteInfo subject) {
alshabiba9b2b5d2015-09-23 15:01:47 -070059 super(type, subject);
alshabiba9b2b5d2015-09-23 15:01:47 -070060 }
61
alshabibed0951f2015-10-02 21:39:27 +020062
63 @Override
64 public String toString() {
65 return toStringHelper(this)
66 .add("type", type())
alshabib79e52872015-12-07 16:01:01 -080067 .add("info", subject()).toString();
alshabibed0951f2015-10-02 21:39:27 +020068 }
alshabiba9b2b5d2015-09-23 15:01:47 -070069}