Small fixes to CPR and to CPR test

Change-Id: I03bbbdbb7a54458c1144c3a1191b7a617490a324
This commit is contained in:
Pier Luigi 2017-02-03 13:35:23 -08:00 committed by Jonathan Hart
parent f31019ae11
commit 9f765dc5df
4 changed files with 59 additions and 53 deletions

View File

@ -16,6 +16,7 @@ osgi_jar_with_tests (
) )
BUNDLES = [ BUNDLES = [
'//apps/routing/common:onos-apps-routing-common',
'//apps/routing/cpr:onos-apps-routing-cpr', '//apps/routing/cpr:onos-apps-routing-cpr',
'//apps/routing-api:onos-apps-routing-api', '//apps/routing-api:onos-apps-routing-api',
] ]

View File

@ -308,8 +308,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
ip.ipAddress().toIpPrefix(),
null, null,
ip.ipAddress().toIpPrefix(),
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null null
); );
@ -319,8 +319,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
null, null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null null
); );
@ -331,8 +331,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
Ip6Address.valueOf(getSolicitNodeAddress(ip.ipAddress().toOctets())).toIpPrefix(),
null, null,
Ip6Address.valueOf(getSolicitNodeAddress(ip.ipAddress().toOctets())).toIpPrefix(),
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null null
); );
@ -343,10 +343,10 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf( Ip6Address.valueOf(
getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes())) getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes()))
).toIpPrefix(), ).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null null
); );
@ -356,8 +356,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
controlPlanePort, controlPlanePort,
intf.vlan(), intf.vlan(),
null,
ip.ipAddress().toIpPrefix(), ip.ipAddress().toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
intf.mac() intf.mac()
); );
@ -367,8 +367,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
controlPlanePort, controlPlanePort,
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
intf.mac() intf.mac()
); );
@ -378,8 +378,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
ip.ipAddress().toIpPrefix(),
null, null,
ip.ipAddress().toIpPrefix(),
NEIGHBOR_ADVERTISEMENT, NEIGHBOR_ADVERTISEMENT,
null null
); );
@ -389,8 +389,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
null, null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
NEIGHBOR_ADVERTISEMENT, NEIGHBOR_ADVERTISEMENT,
null null
); );
@ -400,8 +400,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
controlPlanePort, controlPlanePort,
intf.vlan(), intf.vlan(),
null,
ip.ipAddress().toIpPrefix(), ip.ipAddress().toIpPrefix(),
null,
NEIGHBOR_ADVERTISEMENT, NEIGHBOR_ADVERTISEMENT,
intf.mac() intf.mac()
); );
@ -411,8 +411,8 @@ public class ControlPlaneRedirectManager {
selector = buildNdpSelector( selector = buildNdpSelector(
controlPlanePort, controlPlanePort,
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
null,
NEIGHBOR_ADVERTISEMENT, NEIGHBOR_ADVERTISEMENT,
intf.mac() intf.mac()
); );
@ -447,7 +447,7 @@ public class ControlPlaneRedirectManager {
// create nextObjectives for forwarding to the controlPlaneConnectPoint // create nextObjectives for forwarding to the controlPlaneConnectPoint
DeviceId deviceId = intf.connectPoint().deviceId(); DeviceId deviceId = intf.connectPoint().deviceId();
PortNumber controlPlanePort = intf.connectPoint().port(); PortNumber controlPlanePort = controlPlaneConnectPoint.port();
int cpNextId; int cpNextId;
if (intf.vlan() == VlanId.NONE) { if (intf.vlan() == VlanId.NONE) {
cpNextId = modifyNextObjective(deviceId, controlPlanePort, cpNextId = modifyNextObjective(deviceId, controlPlanePort,
@ -616,7 +616,7 @@ public class ControlPlaneRedirectManager {
selector.matchIPv6Src(srcIp); selector.matchIPv6Src(srcIp);
} }
if (dstIp != null) { if (dstIp != null) {
selector.matchIPv6Dst(srcIp); selector.matchIPv6Dst(dstIp);
} }
if (srcMac != null) { if (srcMac != null) {
selector.matchEthSrc(srcMac); selector.matchEthSrc(srcMac);
@ -688,11 +688,15 @@ public class ControlPlaneRedirectManager {
return; 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(), 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(), int toPeerL3Unicast = createPeerGroup(peerIntf.get().mac(), peer.mac(),
peer.vlan(), peer.location().deviceId(), peer.location().port()); peer.vlan(), peer.location().deviceId(), peer.location().port());
// Store the next objectives in the map
peerNextId.put(peer, ImmutableSortedSet.of(toRouterL3Unicast, toPeerL3Unicast)); peerNextId.put(peer, ImmutableSortedSet.of(toRouterL3Unicast, toPeerL3Unicast));
// From peer to router // From peer to router

View File

@ -320,8 +320,8 @@ public class ControlPlaneRedirectManagerTest {
// Global unicast address // Global unicast address
toSelector = buildNdpSelector(intf.connectPoint().port(), toSelector = buildNdpSelector(intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
ip.ipAddress().toIpPrefix(),
null, null,
ip.ipAddress().toIpPrefix(),
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null); null);
flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment,
@ -331,49 +331,50 @@ public class ControlPlaneRedirectManagerTest {
// Link local address // Link local address
toSelector = buildNdpSelector(intf.connectPoint().port(), toSelector = buildNdpSelector(intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf( Ip6Address.valueOf(
getLinkLocalAddress(intf.mac().toBytes()) getLinkLocalAddress(intf.mac().toBytes())
).toIpPrefix(), ).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null); null);
flowObjectiveService.forward(deviceId, flowObjectiveService.forward(deviceId,
buildForwardingObjective(toSelector, puntTreatment, buildForwardingObjective(toSelector, puntTreatment,
intfNextId, install, ACL_PRIORITY + 1)); cpNextId, install, ACL_PRIORITY + 1));
expectLastCall().once(); expectLastCall().once();
// NDP solicitation to router // NDP solicitation to router
// solicitated global unicast address // solicitated global unicast address
toSelector = buildNdpSelector(intf.connectPoint().port(), toSelector = buildNdpSelector(intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf( Ip6Address.valueOf(
getSolicitNodeAddress(ip.ipAddress().toOctets()) getSolicitNodeAddress(ip.ipAddress().toOctets())
).toIpPrefix(), ).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null); null);
flowObjectiveService.forward(deviceId, flowObjectiveService.forward(deviceId,
buildForwardingObjective(toSelector, puntTreatment, buildForwardingObjective(toSelector, puntTreatment,
intfNextId, install, ACL_PRIORITY + 1)); cpNextId, install, ACL_PRIORITY + 1));
expectLastCall().once();
// NDP solicitation to router // NDP solicitation to router
// solicitated link local address // solicitated link local address
toSelector = buildNdpSelector(intf.connectPoint().port(), toSelector = buildNdpSelector(intf.connectPoint().port(),
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf( Ip6Address.valueOf(
getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes())) getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes()))
).toIpPrefix(), ).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
null); null);
flowObjectiveService.forward(deviceId, flowObjectiveService.forward(deviceId,
buildForwardingObjective(toSelector, puntTreatment, buildForwardingObjective(toSelector, puntTreatment,
intfNextId, install, ACL_PRIORITY + 1)); cpNextId, install, ACL_PRIORITY + 1));
expectLastCall().once(); expectLastCall().once();
// NDP solicitation from router // NDP solicitation from router
// Global unicast address // Global unicast address
fromSelector = buildNdpSelector(controlPlanePort, fromSelector = buildNdpSelector(controlPlanePort,
intf.vlan(), intf.vlan(),
null,
ip.ipAddress().toIpPrefix(), ip.ipAddress().toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
intf.mac()); intf.mac());
flowObjectiveService.forward(deviceId, flowObjectiveService.forward(deviceId,
@ -384,10 +385,10 @@ public class ControlPlaneRedirectManagerTest {
// Link local address // Link local address
fromSelector = buildNdpSelector(controlPlanePort, fromSelector = buildNdpSelector(controlPlanePort,
intf.vlan(), intf.vlan(),
null,
Ip6Address.valueOf( Ip6Address.valueOf(
getLinkLocalAddress(intf.mac().toBytes()) getLinkLocalAddress(intf.mac().toBytes())
).toIpPrefix(), ).toIpPrefix(),
null,
NEIGHBOR_SOLICITATION, NEIGHBOR_SOLICITATION,
intf.mac()); intf.mac());
flowObjectiveService.forward(deviceId, flowObjectiveService.forward(deviceId,
@ -399,19 +400,44 @@ public class ControlPlaneRedirectManagerTest {
toSelector = buildNdpSelector( toSelector = buildNdpSelector(
intf.connectPoint().port(), intf.connectPoint().port(),
intf.vlan(), 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(), ip.ipAddress().toIpPrefix(),
null, null,
NEIGHBOR_ADVERTISEMENT, NEIGHBOR_ADVERTISEMENT,
null null
); );
flowObjectiveService.forward(deviceId, buildForwardingObjective(fromSelector, puntTreatment,
flowObjectiveService.forward(deviceId, buildForwardingObjective(toSelector, puntTreatment, intfNextId, install, ACL_PRIORITY + 1));
cpNextId, install, ACL_PRIORITY + 1));
expectLastCall().once(); expectLastCall().once();
// NDP advertisement from router // NDP advertisement from router
// Link local address // Link local address
fromSelector = buildNdpSelector( fromSelector = buildNdpSelector(
intf.connectPoint().port(), controlPlanePort,
intf.vlan(), intf.vlan(),
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
null, null,
@ -422,32 +448,6 @@ public class ControlPlaneRedirectManagerTest {
buildForwardingObjective(fromSelector, puntTreatment, buildForwardingObjective(fromSelector, puntTreatment,
intfNextId, install, ACL_PRIORITY + 1)); intfNextId, install, ACL_PRIORITY + 1));
expectLastCall().once(); 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. // setting expectations for ospf forwarding.

View File

@ -16,6 +16,7 @@ osgi_jar_with_tests (
) )
BUNDLES = [ BUNDLES = [
'//apps/routing/common:onos-apps-routing-common',
'//apps/routing/fpm:onos-apps-routing-fpm', '//apps/routing/fpm:onos-apps-routing-fpm',
'//apps/routing-api:onos-apps-routing-api', '//apps/routing-api:onos-apps-routing-api',
] ]