Fix IPv6-related bug in SDN-IP.
- Use the correct API to set an IPv6 prefix in the matching condition
Change-Id: I7911a7e886024bff5442821816e4481570ec8172
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
index 7677b07..c10df94 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
@@ -317,10 +317,11 @@
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
if (prefix.version() == Ip4Address.VERSION) {
selector.matchEthType(Ethernet.TYPE_IPV4);
+ selector.matchIPDst(prefix);
} else {
selector.matchEthType(Ethernet.TYPE_IPV6);
+ selector.matchIPv6Dst(prefix);
}
- selector.matchIPDst(prefix);
// Rewrite the destination MAC address
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
index 91754c5..c613007 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
@@ -574,10 +574,11 @@
DefaultTrafficSelector.builder();
if (ipPrefix.version() == Ip4Address.VERSION) {
selectorBuilder.matchEthType(Ethernet.TYPE_IPV4); // IPv4
+ selectorBuilder.matchIPDst(ipPrefix);
} else {
selectorBuilder.matchEthType(Ethernet.TYPE_IPV6); // IPv6
+ selectorBuilder.matchIPv6Dst(ipPrefix);
}
- selectorBuilder.matchIPDst(ipPrefix);
TrafficTreatment.Builder treatmentBuilder =
DefaultTrafficTreatment.builder();