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 | /** |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 60 | * Add the ingress ConnectPoint. |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 61 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 62 | * @param cpstr string representing a ConnectPoint |
| 63 | * @return whether ingress has been added, only add if ingressPoint is null |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 64 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 65 | public boolean addIngressPoint(String cpstr); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 68 | * Add the ingress ConnectPoint. |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 69 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 70 | * @param cp the ConnectPoint of incoming traffic. |
| 71 | * @return whether ingress has been added, only add if ingressPoint is null |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 72 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 73 | public boolean addIngressPoint(ConnectPoint cp); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
| 76 | * Get the ingress connect point. |
| 77 | * |
| 78 | * @return the ingress connect point |
| 79 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 80 | public McastConnectPoint getIngressPoint(); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Add an egress connect point. |
| 84 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 85 | * @param cp the egress McastConnectPoint to be added |
| 86 | * @return return the McastConnectPoint |
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 McastConnectPoint addEgressPoint(ConnectPoint cp); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Add an egress connect point. |
| 92 | * |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 93 | * @param connectPoint deviceId/portNum |
| 94 | * @return return the McastConnectPoint |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 95 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 96 | public McastConnectPoint addEgressPoint(String connectPoint); |
| 97 | |
| 98 | /** |
| 99 | * Add an egress connect point. |
| 100 | * |
| 101 | * @param cp the egress McastConnectPoint to be added |
| 102 | * @param interest the protocol that has shown interest in this route |
| 103 | * @return return the McastConnectPoint |
| 104 | */ |
| 105 | public McastConnectPoint addEgressPoint(ConnectPoint cp, McastConnectPoint.JoinSource interest); |
| 106 | |
| 107 | /** |
| 108 | * Add an egress connect point. |
| 109 | * |
| 110 | * @param connectPoint deviceId/portNum |
| 111 | * @param interest the protocol that has shown interest in this route |
| 112 | * @return return the McastConnectPoint |
| 113 | */ |
| 114 | public McastConnectPoint addEgressPoint(String connectPoint, McastConnectPoint.JoinSource interest); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Get the egress connect points. |
| 118 | * |
| 119 | * @return a set of egress connect points |
| 120 | */ |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 121 | public Set<McastConnectPoint> getEgressPoints(); |
| 122 | |
| 123 | /** |
| 124 | * Get the egress connect points. |
| 125 | * |
| 126 | * @return a set of egress connect points |
| 127 | */ |
| 128 | public Set<ConnectPoint> getEgressConnectPoints(); |
| 129 | |
| 130 | /** |
| 131 | * Find the egress connect point if it exists. |
| 132 | * |
Rusty Eddy | c0e3fea | 2015-09-28 21:20:41 +0000 | [diff] [blame^] | 133 | * @param cp ConnectPoint to search for |
Rusty Eddy | ddef893 | 2015-09-25 01:15:53 +0000 | [diff] [blame] | 134 | * @return the connect point when found, null otherwise. |
| 135 | */ |
| 136 | public McastConnectPoint findEgressConnectPoint(ConnectPoint cp); |
| 137 | |
| 138 | /** |
| 139 | * remove Interest from a McastConnectPoint. |
| 140 | * |
| 141 | * @param mcp connect point. |
| 142 | * @param interest the protocol interested in this multicast stream |
| 143 | * @return whether or not interest was removed |
| 144 | */ |
| 145 | public boolean removeInterest(McastConnectPoint mcp, McastConnectPoint.JoinSource interest); |
alshabib | eff0054 | 2015-09-23 13:22:33 -0700 | [diff] [blame] | 146 | |
| 147 | /** |
| 148 | * Increment the punt count. |
| 149 | */ |
| 150 | public void incrementPuntCount(); |
| 151 | |
| 152 | /** |
| 153 | * Get the punt count. |
| 154 | * |
| 155 | * @return the punt count |
| 156 | */ |
| 157 | public int getPuntCount(); |
| 158 | |
| 159 | /** |
| 160 | * Have the McastIntentManager create an intent, attempt to |
| 161 | * install the intent and then save the key. |
| 162 | */ |
| 163 | public void setIntent(); |
| 164 | |
| 165 | /** |
| 166 | * Set the Intent key. |
| 167 | * |
| 168 | * @param intent intent |
| 169 | */ |
| 170 | public void setIntent(SinglePointToMultiPointIntent intent); |
| 171 | |
| 172 | /** |
| 173 | * Withdraw the intent if it has been installed. |
| 174 | */ |
| 175 | public void withdrawIntent(); |
| 176 | |
| 177 | /** |
| 178 | * Get the intent key. |
| 179 | * |
| 180 | * @return the intentKey |
| 181 | */ |
| 182 | public Key getIntentKey(); |
| 183 | |
| 184 | /** |
| 185 | * Pretty print the the route. |
| 186 | * |
| 187 | * @return a pretty string |
| 188 | */ |
| 189 | public String toString(); |
| 190 | } |