blob: a67725d70fcd4f0a04773fdb33512cc4f2ddcebd [file] [log] [blame]
alshabibeff00542015-09-23 13:22:33 -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 */
16package org.onosproject.mfwd.impl;
17
18import org.onlab.packet.IpPrefix;
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.intent.Key;
21import org.onosproject.net.intent.SinglePointToMultiPointIntent;
22
23import java.util.Set;
24
25/**
26 * This McastRouteBase interface is implemented by the McastRouteBase class which
27 * in turn acts as the base class for both the McastRouteGroup and McastRouteSource.
28 */
29interface McastRoute {
30
31 /**
32 * Gets the group addresses.
33 *
34 * @return group address
35 */
36 public IpPrefix getGaddr();
37
38 /**
39 * Gets the source address.
40 *
41 * @return the source address
42 */
43 public IpPrefix getSaddr();
44
45 /**
46 * Determines if this is an IPv4 multicast route.
47 *
48 * @return true if it is an IPv4 route
49 */
50 public boolean isIp4();
51
52 /**
53 * Determines if this is an IPv6 multicast route.
54 *
55 * @return true if it is an IPv6 route
56 */
57 public boolean isIp6();
58
59 /**
Julian Lawrence14c73182015-10-08 18:31:52 -070060 * Get the dirty state.
61 *
62 * @return whether this route is dirty or not.
63 */
64 public boolean getDirty();
65
66 /**
67 * Set the dirty state to indicate that something changed.
68 * This may require an update to the flow tables (intents).
69 *
70 * @param dirty set the dirty bit
71 */
72 public void setDirty(boolean dirty);
73
74 /**
Rusty Eddyddef8932015-09-25 01:15:53 +000075 * Add the ingress ConnectPoint.
alshabibeff00542015-09-23 13:22:33 -070076 *
Rusty Eddyddef8932015-09-25 01:15:53 +000077 * @param cpstr string representing a ConnectPoint
78 * @return whether ingress has been added, only add if ingressPoint is null
alshabibeff00542015-09-23 13:22:33 -070079 */
Rusty Eddyddef8932015-09-25 01:15:53 +000080 public boolean addIngressPoint(String cpstr);
alshabibeff00542015-09-23 13:22:33 -070081
82 /**
Rusty Eddyddef8932015-09-25 01:15:53 +000083 * Add the ingress ConnectPoint.
alshabibeff00542015-09-23 13:22:33 -070084 *
Rusty Eddyddef8932015-09-25 01:15:53 +000085 * @param cp the ConnectPoint of incoming traffic.
86 * @return whether ingress has been added, only add if ingressPoint is null
alshabibeff00542015-09-23 13:22:33 -070087 */
Rusty Eddyddef8932015-09-25 01:15:53 +000088 public boolean addIngressPoint(ConnectPoint cp);
alshabibeff00542015-09-23 13:22:33 -070089
90 /**
91 * Get the ingress connect point.
92 *
93 * @return the ingress connect point
94 */
Rusty Eddyddef8932015-09-25 01:15:53 +000095 public McastConnectPoint getIngressPoint();
alshabibeff00542015-09-23 13:22:33 -070096
97 /**
98 * Add an egress connect point.
99 *
Rusty Eddyddef8932015-09-25 01:15:53 +0000100 * @param cp the egress McastConnectPoint to be added
101 * @return return the McastConnectPoint
alshabibeff00542015-09-23 13:22:33 -0700102 */
Rusty Eddyddef8932015-09-25 01:15:53 +0000103 public McastConnectPoint addEgressPoint(ConnectPoint cp);
alshabibeff00542015-09-23 13:22:33 -0700104
105 /**
106 * Add an egress connect point.
107 *
Rusty Eddyddef8932015-09-25 01:15:53 +0000108 * @param connectPoint deviceId/portNum
109 * @return return the McastConnectPoint
alshabibeff00542015-09-23 13:22:33 -0700110 */
Rusty Eddyddef8932015-09-25 01:15:53 +0000111 public McastConnectPoint addEgressPoint(String connectPoint);
112
113 /**
114 * Add an egress connect point.
115 *
116 * @param cp the egress McastConnectPoint to be added
117 * @param interest the protocol that has shown interest in this route
118 * @return return the McastConnectPoint
119 */
120 public McastConnectPoint addEgressPoint(ConnectPoint cp, McastConnectPoint.JoinSource interest);
121
122 /**
123 * Add an egress connect point.
124 *
125 * @param connectPoint deviceId/portNum
126 * @param interest the protocol that has shown interest in this route
127 * @return return the McastConnectPoint
128 */
129 public McastConnectPoint addEgressPoint(String connectPoint, McastConnectPoint.JoinSource interest);
alshabibeff00542015-09-23 13:22:33 -0700130
131 /**
132 * Get the egress connect points.
133 *
134 * @return a set of egress connect points
135 */
Rusty Eddyddef8932015-09-25 01:15:53 +0000136 public Set<McastConnectPoint> getEgressPoints();
137
138 /**
139 * Get the egress connect points.
140 *
141 * @return a set of egress connect points
142 */
143 public Set<ConnectPoint> getEgressConnectPoints();
144
145 /**
146 * Find the egress connect point if it exists.
147 *
Rusty Eddyc0e3fea2015-09-28 21:20:41 +0000148 * @param cp ConnectPoint to search for
Rusty Eddyddef8932015-09-25 01:15:53 +0000149 * @return the connect point when found, null otherwise.
150 */
151 public McastConnectPoint findEgressConnectPoint(ConnectPoint cp);
152
153 /**
154 * remove Interest from a McastConnectPoint.
155 *
156 * @param mcp connect point.
157 * @param interest the protocol interested in this multicast stream
158 * @return whether or not interest was removed
159 */
160 public boolean removeInterest(McastConnectPoint mcp, McastConnectPoint.JoinSource interest);
alshabibeff00542015-09-23 13:22:33 -0700161
162 /**
163 * Increment the punt count.
164 */
165 public void incrementPuntCount();
166
167 /**
168 * Get the punt count.
169 *
170 * @return the punt count
171 */
172 public int getPuntCount();
173
174 /**
175 * Have the McastIntentManager create an intent, attempt to
176 * install the intent and then save the key.
177 */
178 public void setIntent();
179
180 /**
181 * Set the Intent key.
182 *
183 * @param intent intent
184 */
185 public void setIntent(SinglePointToMultiPointIntent intent);
186
187 /**
188 * Withdraw the intent if it has been installed.
189 */
190 public void withdrawIntent();
191
192 /**
193 * Get the intent key.
194 *
195 * @return the intentKey
196 */
197 public Key getIntentKey();
198
199 /**
200 * Pretty print the the route.
201 *
202 * @return a pretty string
203 */
204 public String toString();
205}