Showing
2 changed files
with
25 additions
and
8 deletions
... | @@ -133,6 +133,10 @@ public class Router implements RouteListener { | ... | @@ -133,6 +133,10 @@ public class Router implements RouteListener { |
133 | */ | 133 | */ |
134 | public void start() { | 134 | public void start() { |
135 | 135 | ||
136 | + // TODO hack to enable SDN-IP now for testing | ||
137 | + isElectedLeader = true; | ||
138 | + isActivatedLeader = true; | ||
139 | + | ||
136 | bgpUpdatesExecutor.execute(new Runnable() { | 140 | bgpUpdatesExecutor.execute(new Runnable() { |
137 | @Override | 141 | @Override |
138 | public void run() { | 142 | public void run() { | ... | ... |
... | @@ -35,6 +35,7 @@ import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyAct | ... | @@ -35,6 +35,7 @@ import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyAct |
35 | import org.projectfloodlight.openflow.protocol.match.Match; | 35 | import org.projectfloodlight.openflow.protocol.match.Match; |
36 | import org.projectfloodlight.openflow.protocol.match.MatchField; | 36 | import org.projectfloodlight.openflow.protocol.match.MatchField; |
37 | import org.projectfloodlight.openflow.types.IPv4Address; | 37 | import org.projectfloodlight.openflow.types.IPv4Address; |
38 | +import org.projectfloodlight.openflow.types.Masked; | ||
38 | import org.slf4j.Logger; | 39 | import org.slf4j.Logger; |
39 | 40 | ||
40 | import com.google.common.collect.Lists; | 41 | import com.google.common.collect.Lists; |
... | @@ -218,23 +219,35 @@ public class FlowEntryBuilder { | ... | @@ -218,23 +219,35 @@ public class FlowEntryBuilder { |
218 | builder.matchEthType((short) ethType); | 219 | builder.matchEthType((short) ethType); |
219 | break; | 220 | break; |
220 | case IPV4_DST: | 221 | case IPV4_DST: |
221 | - IPv4Address di = match.get(MatchField.IPV4_DST); | ||
222 | IpPrefix dip; | 222 | IpPrefix dip; |
223 | - if (di.isCidrMask()) { | 223 | + if (match.isPartiallyMasked(MatchField.IPV4_DST)) { |
224 | - dip = IpPrefix.valueOf(di.getInt(), di.asCidrMaskLength()); | 224 | + Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST); |
225 | + | ||
226 | + dip = IpPrefix.valueOf( | ||
227 | + maskedIp.getValue().getInt(), | ||
228 | + maskedIp.getMask().asCidrMaskLength()); | ||
225 | } else { | 229 | } else { |
226 | - dip = IpPrefix.valueOf(di.getInt(), IpPrefix.MAX_INET_MASK); | 230 | + dip = IpPrefix.valueOf( |
231 | + match.get(MatchField.IPV4_DST).getInt(), | ||
232 | + IpPrefix.MAX_INET_MASK); | ||
227 | } | 233 | } |
234 | + | ||
228 | builder.matchIPDst(dip); | 235 | builder.matchIPDst(dip); |
229 | break; | 236 | break; |
230 | case IPV4_SRC: | 237 | case IPV4_SRC: |
231 | - IPv4Address si = match.get(MatchField.IPV4_SRC); | ||
232 | IpPrefix sip; | 238 | IpPrefix sip; |
233 | - if (si.isCidrMask()) { | 239 | + if (match.isPartiallyMasked(MatchField.IPV4_SRC)) { |
234 | - sip = IpPrefix.valueOf(si.getInt(), si.asCidrMaskLength()); | 240 | + Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC); |
241 | + | ||
242 | + sip = IpPrefix.valueOf( | ||
243 | + maskedIp.getValue().getInt(), | ||
244 | + maskedIp.getMask().asCidrMaskLength()); | ||
235 | } else { | 245 | } else { |
236 | - sip = IpPrefix.valueOf(si.getInt(), IpPrefix.MAX_INET_MASK); | 246 | + sip = IpPrefix.valueOf( |
247 | + match.get(MatchField.IPV4_SRC).getInt(), | ||
248 | + IpPrefix.MAX_INET_MASK); | ||
237 | } | 249 | } |
250 | + | ||
238 | builder.matchIPSrc(sip); | 251 | builder.matchIPSrc(sip); |
239 | break; | 252 | break; |
240 | case IP_PROTO: | 253 | case IP_PROTO: | ... | ... |
-
Please register or login to post a comment