Permalink
Browse files

Use new PacketService to request ARP with duplication

Change-Id: Id005772b0a69629ad3fb532d16a398d170234d88
  • Loading branch information...
1 parent d832fc5 commit 2df0e8af5a90d4d7c24abbf9692d80714354a548 @rascov rascov committed with jonohart Jan 9, 2017
@@ -26,6 +26,7 @@
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.flowobjective.DefaultObjectiveContext;
import org.onosproject.net.flowobjective.ObjectiveContext;
+import org.onosproject.net.packet.PacketPriority;
import org.onosproject.segmentrouting.DefaultRoutingHandler.PortFilterInfo;
import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
import org.onosproject.segmentrouting.config.DeviceConfiguration;
@@ -51,6 +52,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
@@ -623,27 +625,16 @@ public void populateRouterIpPunts(DeviceId deviceId) {
deviceId);
return;
}
- ForwardingObjective.Builder puntIp = DefaultForwardingObjective.builder();
Set<Ip4Address> allIps = new HashSet<>(config.getPortIPs(deviceId));
allIps.add(routerIp);
for (Ip4Address ipaddr : allIps) {
- TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
- TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder();
- sbuilder.matchEthType(Ethernet.TYPE_IPV4);
- sbuilder.matchIPDst(IpPrefix.valueOf(ipaddr,
- IpPrefix.MAX_INET_MASK_LENGTH));
- tbuilder.setOutput(PortNumber.CONTROLLER);
- puntIp.withSelector(sbuilder.build());
- puntIp.withTreatment(tbuilder.build());
- puntIp.withFlag(Flag.VERSATILE)
- .withPriority(SegmentRoutingService.HIGHEST_PRIORITY)
- .makePermanent()
- .fromApp(srManager.appId);
- ObjectiveContext context = new DefaultObjectiveContext(
- (objective) -> log.debug("IP punt rule for {} populated", ipaddr),
- (objective, error) ->
- log.warn("Failed to populate IP punt rule for {}: {}", ipaddr, error));
- srManager.flowObjectiveService.forward(deviceId, puntIp.add(context));
+ TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder()
+ .matchEthType(Ethernet.TYPE_IPV4)
+ .matchIPDst(IpPrefix.valueOf(ipaddr, IpPrefix.MAX_INET_MASK_LENGTH));
+ Optional<DeviceId> optDeviceId = Optional.of(deviceId);
+
+ srManager.packetService.requestPackets(sbuilder.build(),
+ PacketPriority.CONTROL, srManager.appId, optDeviceId);
}
}
@@ -351,10 +351,13 @@ protected void activate() {
multicastRouteService.addListener(mcastListener);
cordConfigService.addListener(cordConfigListener);
- // Request ARP packet-in
+ /* Request ARP packet-in.
+ * Copy flag set to true since in cross-connect case we still want to
+ * forward ARP packet to the flood group.
+ */
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
selector.matchEthType(Ethernet.TYPE_ARP);
- packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId, Optional.empty());
+ packetService.requestPackets(selector.build(), PacketPriority.CONTROL, appId, true);
cfgListener.configureNetwork();
@@ -27,11 +27,6 @@
*/
public interface SegmentRoutingService {
/**
- * Highest flow priority.
- */
- int HIGHEST_PRIORITY = 0xffff;
-
- /**
* VLAN cross-connect priority.
*/
int XCONNECT_PRIORITY = 1000;
@@ -677,6 +677,9 @@ public void onError(FlowRuleOperations ops) {
log.warn("Cannot process instruction in versatile fwd {}", ins);
}
}
+ if (fwd.treatment().clearedDeferred()) {
+ ttBuilder.wipeDeferred();
+ }
}
if (fwd.nextId() != null) {
// overide case
@@ -762,6 +762,9 @@ public void onError(FlowRuleOperations ops) {
log.warn("Cannot process instruction in versatile fwd {}", ins);
}
}
+ if (fwd.treatment().clearedDeferred()) {
+ ttBuilder.wipeDeferred();
+ }
}
if (fwd.nextId() != null) {
// overide case

0 comments on commit 2df0e8a

Please sign in to comment.