alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 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.mfwd.impl; |
| 17 | |
| 18 | import org.onlab.packet.IpPrefix; |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.intent.Key; |
| 21 | import org.onosproject.net.intent.SinglePointToMultiPointIntent; |
| 22 | |
| 23 | import 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 | */ |
| 29 | interface 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 Lawrence | 14c7318 | 2015-10-08 18:31:52 -0700 | [diff] [blame] | 60 | * 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 Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 75 | * Add the ingress ConnectPoint. |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 76 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 77 | * @param cpstr string representing a ConnectPoint |
| 78 | * @return whether ingress has been added, only add if ingressPoint is null |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 79 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 80 | public boolean addIngressPoint(String cpstr); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 81 | |
| 82 | /** |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 83 | * Add the ingress ConnectPoint. |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 84 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 85 | * @param cp the ConnectPoint of incoming traffic. |
| 86 | * @return whether ingress has been added, only add if ingressPoint is null |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 87 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 88 | public boolean addIngressPoint(ConnectPoint cp); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Get the ingress connect point. |
| 92 | * |
| 93 | * @return the ingress connect point |
| 94 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 95 | public McastConnectPoint getIngressPoint(); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
| 98 | * Add an egress connect point. |
| 99 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 100 | * @param cp the egress McastConnectPoint to be added |
| 101 | * @return return the McastConnectPoint |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 102 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 103 | public McastConnectPoint addEgressPoint(ConnectPoint cp); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * Add an egress connect point. |
| 107 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 108 | * @param connectPoint deviceId/portNum |
| 109 | * @return return the McastConnectPoint |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 110 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 111 | 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); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 130 | |
| 131 | /** |
| 132 | * Get the egress connect points. |
| 133 | * |
| 134 | * @return a set of egress connect points |
| 135 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 136 | 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 Eddy | c0e3fea | 2015-09-28 21:20:41 +0000 | [diff] [blame] | 148 | * @param cp ConnectPoint to search for |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 149 | * @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); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 161 | |
| 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 | } |