diff --git a/apps/routing/cpr/BUCK b/apps/routing/cpr/BUCK index 89a499d91c..66a6f1e5fa 100644 --- a/apps/routing/cpr/BUCK +++ b/apps/routing/cpr/BUCK @@ -16,6 +16,7 @@ osgi_jar_with_tests ( ) BUNDLES = [ + '//apps/routing/common:onos-apps-routing-common', '//apps/routing/cpr:onos-apps-routing-cpr', '//apps/routing-api:onos-apps-routing-api', ] diff --git a/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java index 79c3b49156..d36607f8c4 100644 --- a/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java +++ b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java @@ -308,8 +308,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), - ip.ipAddress().toIpPrefix(), null, + ip.ipAddress().toIpPrefix(), NEIGHBOR_SOLICITATION, null ); @@ -319,8 +319,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), - Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), null, + Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), NEIGHBOR_SOLICITATION, null ); @@ -331,8 +331,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), - Ip6Address.valueOf(getSolicitNodeAddress(ip.ipAddress().toOctets())).toIpPrefix(), null, + Ip6Address.valueOf(getSolicitNodeAddress(ip.ipAddress().toOctets())).toIpPrefix(), NEIGHBOR_SOLICITATION, null ); @@ -343,10 +343,10 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), + null, Ip6Address.valueOf( getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes())) ).toIpPrefix(), - null, NEIGHBOR_SOLICITATION, null ); @@ -356,8 +356,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( controlPlanePort, intf.vlan(), - null, ip.ipAddress().toIpPrefix(), + null, NEIGHBOR_SOLICITATION, intf.mac() ); @@ -367,8 +367,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( controlPlanePort, intf.vlan(), - null, Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), + null, NEIGHBOR_SOLICITATION, intf.mac() ); @@ -378,8 +378,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), - ip.ipAddress().toIpPrefix(), null, + ip.ipAddress().toIpPrefix(), NEIGHBOR_ADVERTISEMENT, null ); @@ -389,8 +389,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), - Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), null, + Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), NEIGHBOR_ADVERTISEMENT, null ); @@ -400,8 +400,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( controlPlanePort, intf.vlan(), - null, ip.ipAddress().toIpPrefix(), + null, NEIGHBOR_ADVERTISEMENT, intf.mac() ); @@ -411,8 +411,8 @@ public class ControlPlaneRedirectManager { selector = buildNdpSelector( controlPlanePort, intf.vlan(), - null, Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), + null, NEIGHBOR_ADVERTISEMENT, intf.mac() ); @@ -447,7 +447,7 @@ public class ControlPlaneRedirectManager { // create nextObjectives for forwarding to the controlPlaneConnectPoint DeviceId deviceId = intf.connectPoint().deviceId(); - PortNumber controlPlanePort = intf.connectPoint().port(); + PortNumber controlPlanePort = controlPlaneConnectPoint.port(); int cpNextId; if (intf.vlan() == VlanId.NONE) { cpNextId = modifyNextObjective(deviceId, controlPlanePort, @@ -616,7 +616,7 @@ public class ControlPlaneRedirectManager { selector.matchIPv6Src(srcIp); } if (dstIp != null) { - selector.matchIPv6Dst(srcIp); + selector.matchIPv6Dst(dstIp); } if (srcMac != null) { selector.matchEthSrc(srcMac); @@ -688,11 +688,15 @@ public class ControlPlaneRedirectManager { return; } - // Generate L3 Unicast groups and store it in the map + // Generate L3 Unicast group for the traffic towards vRouter + // XXX This approach will change with the HA design int toRouterL3Unicast = createPeerGroup(peer.mac(), peerIntf.get().mac(), - peer.vlan(), peer.location().deviceId(), peerIntf.get().connectPoint().port()); + peer.vlan(), peer.location().deviceId(), controlPlaneConnectPoint.port()); + // Generate L3 Unicast group for the traffic towards the upStream + // XXX This approach will change with the HA design int toPeerL3Unicast = createPeerGroup(peerIntf.get().mac(), peer.mac(), peer.vlan(), peer.location().deviceId(), peer.location().port()); + // Store the next objectives in the map peerNextId.put(peer, ImmutableSortedSet.of(toRouterL3Unicast, toPeerL3Unicast)); // From peer to router diff --git a/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java b/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java index 212cc42a8e..d399fc39ff 100644 --- a/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java +++ b/apps/routing/cpr/src/test/java/org/onosproject/routing/cpr/ControlPlaneRedirectManagerTest.java @@ -320,8 +320,8 @@ public class ControlPlaneRedirectManagerTest { // Global unicast address toSelector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), - ip.ipAddress().toIpPrefix(), null, + ip.ipAddress().toIpPrefix(), NEIGHBOR_SOLICITATION, null); flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, @@ -331,49 +331,50 @@ public class ControlPlaneRedirectManagerTest { // Link local address toSelector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), + null, Ip6Address.valueOf( getLinkLocalAddress(intf.mac().toBytes()) ).toIpPrefix(), - null, NEIGHBOR_SOLICITATION, null); flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, - intfNextId, install, ACL_PRIORITY + 1)); + cpNextId, install, ACL_PRIORITY + 1)); expectLastCall().once(); // NDP solicitation to router // solicitated global unicast address toSelector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), + null, Ip6Address.valueOf( getSolicitNodeAddress(ip.ipAddress().toOctets()) ).toIpPrefix(), - null, NEIGHBOR_SOLICITATION, null); flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, - intfNextId, install, ACL_PRIORITY + 1)); + cpNextId, install, ACL_PRIORITY + 1)); + expectLastCall().once(); // NDP solicitation to router // solicitated link local address toSelector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), + null, Ip6Address.valueOf( getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes())) ).toIpPrefix(), - null, NEIGHBOR_SOLICITATION, null); flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, - intfNextId, install, ACL_PRIORITY + 1)); + cpNextId, install, ACL_PRIORITY + 1)); expectLastCall().once(); // NDP solicitation from router // Global unicast address fromSelector = buildNdpSelector(controlPlanePort, intf.vlan(), - null, ip.ipAddress().toIpPrefix(), + null, NEIGHBOR_SOLICITATION, intf.mac()); flowObjectiveService.forward(deviceId, @@ -384,10 +385,10 @@ public class ControlPlaneRedirectManagerTest { // Link local address fromSelector = buildNdpSelector(controlPlanePort, intf.vlan(), - null, Ip6Address.valueOf( getLinkLocalAddress(intf.mac().toBytes()) ).toIpPrefix(), + null, NEIGHBOR_SOLICITATION, intf.mac()); flowObjectiveService.forward(deviceId, @@ -399,19 +400,44 @@ public class ControlPlaneRedirectManagerTest { toSelector = buildNdpSelector( intf.connectPoint().port(), intf.vlan(), + null, + ip.ipAddress().toIpPrefix(), + NEIGHBOR_ADVERTISEMENT, + null + ); + flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, + cpNextId, install, ACL_PRIORITY + 1)); + expectLastCall().once(); + // NDP advertisement to router + // Link local address + toSelector = buildNdpSelector( + intf.connectPoint().port(), + intf.vlan(), + null, + Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), + NEIGHBOR_ADVERTISEMENT, + null + ); + flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, + cpNextId, install, ACL_PRIORITY + 1)); + expectLastCall().once(); + // NDP advertisement from the router + // Global unicast address + fromSelector = buildNdpSelector( + controlPlanePort, + intf.vlan(), ip.ipAddress().toIpPrefix(), null, NEIGHBOR_ADVERTISEMENT, null ); - - flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, - cpNextId, install, ACL_PRIORITY + 1)); + flowObjectiveService.forward(deviceId, buildForwardingObjective(fromSelector, puntTreatment, + intfNextId, install, ACL_PRIORITY + 1)); expectLastCall().once(); // NDP advertisement from router // Link local address fromSelector = buildNdpSelector( - intf.connectPoint().port(), + controlPlanePort, intf.vlan(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), null, @@ -422,32 +448,6 @@ public class ControlPlaneRedirectManagerTest { buildForwardingObjective(fromSelector, puntTreatment, intfNextId, install, ACL_PRIORITY + 1)); expectLastCall().once(); - // NDP advertisement to router - // Global unicast address - toSelector = buildNdpSelector(controlPlanePort, - intf.vlan(), - null, - ip.ipAddress().toIpPrefix(), - NEIGHBOR_ADVERTISEMENT, - intf.mac()); - flowObjectiveService.forward(deviceId, - buildForwardingObjective(toSelector, puntTreatment, - intfNextId, install, ACL_PRIORITY + 1)); - expectLastCall().once(); - // NDP advertisement to router - // Link local address - fromSelector = buildNdpSelector(controlPlanePort, - intf.vlan(), - null, - Ip6Address.valueOf( - getLinkLocalAddress(intf.mac().toBytes()) - ).toIpPrefix(), - NEIGHBOR_ADVERTISEMENT, - intf.mac()); - flowObjectiveService.forward(deviceId, - buildForwardingObjective(fromSelector, puntTreatment, - intfNextId, install, ACL_PRIORITY + 1)); - expectLastCall().once(); } } // setting expectations for ospf forwarding. diff --git a/apps/routing/fpm/BUCK b/apps/routing/fpm/BUCK index b221d0e6e9..d80d428128 100644 --- a/apps/routing/fpm/BUCK +++ b/apps/routing/fpm/BUCK @@ -16,6 +16,7 @@ osgi_jar_with_tests ( ) BUNDLES = [ + '//apps/routing/common:onos-apps-routing-common', '//apps/routing/fpm:onos-apps-routing-fpm', '//apps/routing-api:onos-apps-routing-api', ]