Committed by
Gerrit Code Review
adding a multicast service to track multicast information.
This will be used by publishers to advertise multicast information and by consumers to realise it on the dataplane. This is currently an app but it may be moved to incubation. Change-Id: I6e350989207ce2207bf70da22ca15c8237b1d240
Showing
6 changed files
with
323 additions
and
0 deletions
apps/mcast/pom.xml
0 → 100644
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> |
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.mcast; | ||
17 | + | ||
18 | +import org.onosproject.event.AbstractEvent; | ||
19 | +import org.onosproject.net.ConnectPoint; | ||
20 | + | ||
21 | +import java.util.Optional; | ||
22 | + | ||
23 | +/** | ||
24 | + * An entity representing a multicast event. Event either add or remove | ||
25 | + * sinks or sources. | ||
26 | + */ | ||
27 | +public class McastEvent extends AbstractEvent<McastEvent.Type, McastRoute> { | ||
28 | + | ||
29 | + private final Optional<ConnectPoint> sink; | ||
30 | + private final Optional<ConnectPoint> source; | ||
31 | + | ||
32 | + public enum Type { | ||
33 | + /** | ||
34 | + * A new mcast route has been added. | ||
35 | + */ | ||
36 | + ROUTE_ADDED, | ||
37 | + | ||
38 | + /** | ||
39 | + * A mcast route has been removed. | ||
40 | + */ | ||
41 | + ROUTE_REMOVED, | ||
42 | + | ||
43 | + /** | ||
44 | + * A source for a mcast route (ie. the subject) has been added. | ||
45 | + */ | ||
46 | + SOURCE_ADDED, | ||
47 | + | ||
48 | + /** | ||
49 | + * A source for a mcast route (ie. the subject) has been removed. | ||
50 | + */ | ||
51 | + SOURCE_REMOVED, | ||
52 | + | ||
53 | + /** | ||
54 | + * A sink for a mcast route (ie. the subject) has been added. | ||
55 | + */ | ||
56 | + SINK_ADDED, | ||
57 | + | ||
58 | + /** | ||
59 | + * A source for a mcast route (ie. the subject) has been removed. | ||
60 | + */ | ||
61 | + SINK_REMOVED | ||
62 | + } | ||
63 | + | ||
64 | + private McastEvent(McastEvent.Type type, McastRoute subject) { | ||
65 | + super(type, subject); | ||
66 | + sink = Optional.empty(); | ||
67 | + source = Optional.empty(); | ||
68 | + } | ||
69 | + | ||
70 | + private McastEvent(McastEvent.Type type, McastRoute subject, long time) { | ||
71 | + super(type, subject, time); | ||
72 | + sink = Optional.empty(); | ||
73 | + source = Optional.empty(); | ||
74 | + } | ||
75 | + | ||
76 | + protected McastEvent(McastEvent.Type type, McastRoute subject, | ||
77 | + ConnectPoint sink, | ||
78 | + ConnectPoint source) { | ||
79 | + super(type, subject); | ||
80 | + this.sink = Optional.ofNullable(sink); | ||
81 | + this.source = Optional.ofNullable(source); | ||
82 | + } | ||
83 | + | ||
84 | + protected McastEvent(McastEvent.Type type, McastRoute subject, long time, | ||
85 | + ConnectPoint sink, | ||
86 | + ConnectPoint source) { | ||
87 | + super(type, subject, time); | ||
88 | + this.sink = Optional.ofNullable(sink); | ||
89 | + this.source = Optional.ofNullable(source); | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
93 | + * The sink which has been removed or added. The field may not be set | ||
94 | + * if the sink has not been detected yet or has been removed. | ||
95 | + * | ||
96 | + * @return an optional connect point | ||
97 | + */ | ||
98 | + public Optional<ConnectPoint> sink() { | ||
99 | + return sink; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * The source which has been removed or added. The field may not be set | ||
104 | + * if the source has not been detected yet or has been removed. | ||
105 | + | ||
106 | + * @return an optional connect point | ||
107 | + */ | ||
108 | + public Optional<ConnectPoint> source() { | ||
109 | + return source; | ||
110 | + } | ||
111 | +} |
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.mcast; | ||
17 | + | ||
18 | +import org.onosproject.event.EventListener; | ||
19 | + | ||
20 | +/** | ||
21 | + * A listener interface for multicast events. | ||
22 | + */ | ||
23 | +public interface McastListener extends EventListener<McastEvent> { | ||
24 | +} |
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.mcast; | ||
17 | + | ||
18 | +import org.onlab.packet.IpPrefix; | ||
19 | + | ||
20 | +/** | ||
21 | + * An entity representing a multicast route consisting of a source | ||
22 | + * and a multicast group address. | ||
23 | + */ | ||
24 | +public class McastRoute { | ||
25 | + | ||
26 | + public final IpPrefix source; | ||
27 | + public final IpPrefix group; | ||
28 | + | ||
29 | + public McastRoute(IpPrefix source, IpPrefix group) { | ||
30 | + this.source = source; | ||
31 | + this.group = group; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Fetches the source address of this route. | ||
36 | + * | ||
37 | + * @return an ip address | ||
38 | + */ | ||
39 | + public IpPrefix source() { | ||
40 | + return source; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Fetches the group address of this route. | ||
45 | + * | ||
46 | + * @return an ip address | ||
47 | + */ | ||
48 | + public IpPrefix group() { | ||
49 | + return group; | ||
50 | + } | ||
51 | + | ||
52 | +} |
1 | +/* | ||
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 | + */ | ||
16 | +package org.onosproject.mcast; | ||
17 | + | ||
18 | +import org.onosproject.net.ConnectPoint; | ||
19 | + | ||
20 | +import java.util.List; | ||
21 | + | ||
22 | +/** | ||
23 | + * A service interface for maintaining multicast information. | ||
24 | + */ | ||
25 | +public interface MulticastRouteTable { | ||
26 | + | ||
27 | + /** | ||
28 | + * Adds a route to the information base. | ||
29 | + * | ||
30 | + * @param route a multicast route | ||
31 | + */ | ||
32 | + void add(McastRoute route); | ||
33 | + | ||
34 | + /** | ||
35 | + * Removes a route from the information base. | ||
36 | + * | ||
37 | + * @param route a multicast route | ||
38 | + */ | ||
39 | + void remove(McastRoute route); | ||
40 | + | ||
41 | + /** | ||
42 | + * Adds a source connection to the route from where the | ||
43 | + * data stream is originating. | ||
44 | + * | ||
45 | + * @param route the multicast route | ||
46 | + * @param connectPoint a source connect point | ||
47 | + */ | ||
48 | + void addSource(McastRoute route, ConnectPoint connectPoint); | ||
49 | + | ||
50 | + /** | ||
51 | + * Adds a sink to the route to which a data stream should be | ||
52 | + * sent to. | ||
53 | + * | ||
54 | + * @param route a multicast route | ||
55 | + * @param connectPoint a sink connect point | ||
56 | + */ | ||
57 | + void addSink(McastRoute route, ConnectPoint connectPoint); | ||
58 | + | ||
59 | + /** | ||
60 | + * Removes a source connection from the route. | ||
61 | + * | ||
62 | + * @param route the multicast route | ||
63 | + * @param connectPoint a source connect point | ||
64 | + */ | ||
65 | + void removeSource(McastRoute route, ConnectPoint connectPoint); | ||
66 | + | ||
67 | + /** | ||
68 | + * Removes a sink from the route. | ||
69 | + * | ||
70 | + * @param route the multicast route | ||
71 | + * @param connectPoint a sink connect point | ||
72 | + */ | ||
73 | + void removeSink(McastRoute route, ConnectPoint connectPoint); | ||
74 | + | ||
75 | + /** | ||
76 | + * Find the data source association for this multicast route. | ||
77 | + * | ||
78 | + * @param route a multicast route | ||
79 | + * @return a connect point | ||
80 | + */ | ||
81 | + ConnectPoint fetchSource(McastRoute route); | ||
82 | + | ||
83 | + /** | ||
84 | + * Find the list of sinks for this route. | ||
85 | + * | ||
86 | + * @param route a multicast route | ||
87 | + * @return a list of connect points | ||
88 | + */ | ||
89 | + List<ConnectPoint> fetchSinks(McastRoute route); | ||
90 | +} |
-
Please register or login to post a comment