Small fixes to CPR and to CPR test
Change-Id: I03bbbdbb7a54458c1144c3a1191b7a617490a324
diff --git a/apps/routing/cpr/BUCK b/apps/routing/cpr/BUCK
index 89a499d..66a6f1e 100644
--- a/apps/routing/cpr/BUCK
+++ b/apps/routing/cpr/BUCK
@@ -16,6 +16,7 @@
)
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 79c3b49..d36607f 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 @@
selector = buildNdpSelector(
intf.connectPoint().port(),
intf.vlan(),
- ip.ipAddress().toIpPrefix(),
null,
+ ip.ipAddress().toIpPrefix(),
NEIGHBOR_SOLICITATION,
null
);
@@ -319,8 +319,8 @@
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 @@
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 @@
selector = buildNdpSelector(
intf.connectPoint().port(),
intf.vlan(),
+ null,
Ip6Address.valueOf(
getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes()))
).toIpPrefix(),
- null,
NEIGHBOR_SOLICITATION,
null
);
@@ -356,8 +356,8 @@
selector = buildNdpSelector(
controlPlanePort,
intf.vlan(),
- null,
ip.ipAddress().toIpPrefix(),
+ null,
NEIGHBOR_SOLICITATION,
intf.mac()
);
@@ -367,8 +367,8 @@
selector = buildNdpSelector(
controlPlanePort,
intf.vlan(),
- null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
+ null,
NEIGHBOR_SOLICITATION,
intf.mac()
);
@@ -378,8 +378,8 @@
selector = buildNdpSelector(
intf.connectPoint().port(),
intf.vlan(),
- ip.ipAddress().toIpPrefix(),
null,
+ ip.ipAddress().toIpPrefix(),
NEIGHBOR_ADVERTISEMENT,
null
);
@@ -389,8 +389,8 @@
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 @@
selector = buildNdpSelector(
controlPlanePort,
intf.vlan(),
- null,
ip.ipAddress().toIpPrefix(),
+ null,
NEIGHBOR_ADVERTISEMENT,
intf.mac()
);
@@ -411,8 +411,8 @@
selector = buildNdpSelector(
controlPlanePort,
intf.vlan(),
- null,
Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(),
+ null,
NEIGHBOR_ADVERTISEMENT,
intf.mac()
);
@@ -447,7 +447,7 @@
// 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 @@
selector.matchIPv6Src(srcIp);
}
if (dstIp != null) {
- selector.matchIPv6Dst(srcIp);
+ selector.matchIPv6Dst(dstIp);
}
if (srcMac != null) {
selector.matchEthSrc(srcMac);
@@ -688,11 +688,15 @@
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 212cc42..d399fc3 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 b221d0e..d80d428 100644
--- a/apps/routing/fpm/BUCK
+++ b/apps/routing/fpm/BUCK
@@ -16,6 +16,7 @@
)
BUNDLES = [
+ '//apps/routing/common:onos-apps-routing-common',
'//apps/routing/fpm:onos-apps-routing-fpm',
'//apps/routing-api:onos-apps-routing-api',
]