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 = [
'//apps/routing/common:onos-apps-routing-common',
'//apps/routing/cpr:onos-apps-routing-cpr',
'//apps/routing-api:onos-apps-routing-api',
]

View File

@ -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

View File

@ -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.

View File

@ -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',
]