alshabib
Committed by Gerrit Code Review

cleaning mcast route data type in preperation for the backing store

moving package to API with BETA tag

Change-Id: I62a611dcb67b6b4d3ee6f90ed2e963ea345b7d6e
1 -<?xml version="1.0" encoding="UTF-8"?>
2 -<!--
3 - ~ Copyright 2014 Open Networking Laboratory
4 - ~
5 - ~ Licensed under the Apache License, Version 2.0 (the "License");
6 - ~ you may not use this file except in compliance with the License.
7 - ~ You may obtain a copy of the License at
8 - ~
9 - ~ http://www.apache.org/licenses/LICENSE-2.0
10 - ~
11 - ~ Unless required by applicable law or agreed to in writing, software
12 - ~ distributed under the License is distributed on an "AS IS" BASIS,
13 - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - ~ See the License for the specific language governing permissions and
15 - ~ limitations under the License.
16 - -->
17 -<project xmlns="http://maven.apache.org/POM/4.0.0"
18 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
20 - <modelVersion>4.0.0</modelVersion>
21 -
22 - <parent>
23 - <groupId>org.onosproject</groupId>
24 - <artifactId>onos-apps</artifactId>
25 - <version>1.4.0-SNAPSHOT</version>
26 - <relativePath>../pom.xml</relativePath>
27 - </parent>
28 -
29 - <artifactId>onos-app-mcast</artifactId>
30 - <packaging>bundle</packaging>
31 -
32 - <description>Multicast RIB</description>
33 -
34 - <properties>
35 - <onos.app.name>org.onosproject.mcast</onos.app.name>
36 - </properties>
37 -
38 - <dependencies>
39 - <dependency>
40 - <groupId>org.osgi</groupId>
41 - <artifactId>org.osgi.compendium</artifactId>
42 - </dependency>
43 - </dependencies>
44 -
45 -</project>
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
61 <module>mfwd</module> 61 <module>mfwd</module>
62 <module>igmp</module> 62 <module>igmp</module>
63 <module>pim</module> 63 <module>pim</module>
64 - <module>mcast</module>
65 </modules> 64 </modules>
66 65
67 <properties> 66 <properties>
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.mcast; 16 +package org.onosproject.net.mcast;
17 17
18 +import com.google.common.annotations.Beta;
18 import org.onosproject.event.AbstractEvent; 19 import org.onosproject.event.AbstractEvent;
19 import org.onosproject.net.ConnectPoint; 20 import org.onosproject.net.ConnectPoint;
20 21
...@@ -24,6 +25,7 @@ import java.util.Optional; ...@@ -24,6 +25,7 @@ import java.util.Optional;
24 * An entity representing a multicast event. Event either add or remove 25 * An entity representing a multicast event. Event either add or remove
25 * sinks or sources. 26 * sinks or sources.
26 */ 27 */
28 +@Beta
27 public class McastEvent extends AbstractEvent<McastEvent.Type, McastRoute> { 29 public class McastEvent extends AbstractEvent<McastEvent.Type, McastRoute> {
28 30
29 private final Optional<ConnectPoint> sink; 31 private final Optional<ConnectPoint> sink;
......
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.mcast; 16 +package org.onosproject.net.mcast;
17 17
18 +import com.google.common.annotations.Beta;
18 import org.onosproject.event.EventListener; 19 import org.onosproject.event.EventListener;
19 20
20 /** 21 /**
21 * A listener interface for multicast events. 22 * A listener interface for multicast events.
22 */ 23 */
24 +@Beta
23 public interface McastListener extends EventListener<McastEvent> { 25 public interface McastListener extends EventListener<McastEvent> {
24 } 26 }
......
...@@ -13,22 +13,46 @@ ...@@ -13,22 +13,46 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.mcast; 16 +package org.onosproject.net.mcast;
17 17
18 +import com.google.common.annotations.Beta;
19 +import com.google.common.base.Objects;
18 import org.onlab.packet.IpPrefix; 20 import org.onlab.packet.IpPrefix;
19 21
22 +import static com.google.common.base.MoreObjects.toStringHelper;
23 +
20 /** 24 /**
21 * An entity representing a multicast route consisting of a source 25 * An entity representing a multicast route consisting of a source
22 * and a multicast group address. 26 * and a multicast group address.
23 */ 27 */
28 +@Beta
24 public class McastRoute { 29 public class McastRoute {
25 30
26 - public final IpPrefix source; 31 + public enum Type {
27 - public final IpPrefix group; 32 + /**
33 + * Route originates from PIM.
34 + */
35 + PIM,
36 +
37 + /**
38 + * Route originates from IGMP.
39 + */
40 + IGMP,
41 +
42 + /**
43 + * Route originates from other config (ie. REST, CLI).
44 + */
45 + STATIC
46 + }
47 +
48 + private final IpPrefix source;
49 + private final IpPrefix group;
50 + private final Type type;
28 51
29 - public McastRoute(IpPrefix source, IpPrefix group) { 52 + public McastRoute(IpPrefix source, IpPrefix group, Type type) {
30 this.source = source; 53 this.source = source;
31 this.group = group; 54 this.group = group;
55 + this.type = type;
32 } 56 }
33 57
34 /** 58 /**
...@@ -49,4 +73,41 @@ public class McastRoute { ...@@ -49,4 +73,41 @@ public class McastRoute {
49 return group; 73 return group;
50 } 74 }
51 75
76 + /**
77 + * Obtains how this route was created.
78 + * @return a type of route
79 +
80 + */
81 + public Type type() {
82 + return type;
83 + }
84 +
85 + @Override
86 + public String toString() {
87 + return toStringHelper(this)
88 + .add("source", source)
89 + .add("group", group)
90 + .add("origin", type)
91 + .toString();
92 + }
93 +
94 + @Override
95 + public boolean equals(Object o) {
96 + if (this == o) {
97 + return true;
98 + }
99 + if (o == null || getClass() != o.getClass()) {
100 + return false;
101 + }
102 + McastRoute that = (McastRoute) o;
103 + return Objects.equal(source, that.source) &&
104 + Objects.equal(group, that.group) &&
105 + Objects.equal(type, that.type);
106 + }
107 +
108 + @Override
109 + public int hashCode() {
110 + return Objects.hashCode(source, group, type);
111 + }
112 +
52 } 113 }
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.mcast; 16 +package org.onosproject.net.mcast;
17 17
18 +import com.google.common.annotations.Beta;
18 import org.onosproject.net.ConnectPoint; 19 import org.onosproject.net.ConnectPoint;
19 20
20 import java.util.List; 21 import java.util.List;
...@@ -22,6 +23,7 @@ import java.util.List; ...@@ -22,6 +23,7 @@ import java.util.List;
22 /** 23 /**
23 * A service interface for maintaining multicast information. 24 * A service interface for maintaining multicast information.
24 */ 25 */
26 +@Beta
25 public interface MulticastRouteTable { 27 public interface MulticastRouteTable {
26 28
27 /** 29 /**
......