Remove deprecated unfiltered connect point methods from multipoint to single point intents
Change-Id: I220a024568852d1f3168bac3f5cf47d0b3fd9d86
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodec.java
index 4216804..b465f57 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodec.java
@@ -20,6 +20,7 @@
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.intent.ConnectivityIntent;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -79,13 +80,13 @@
context.codec(ConnectPoint.class);
JsonNode connectPointsJson = json.get(INGRESS_POINT);
- Set<ConnectPoint> ingressCp = new HashSet<ConnectPoint>();
+ Set<FilteredConnectPoint> ingressCp = new HashSet<>();
if (connectPointsJson != null) {
for (int i = 0; i < connectPointsJson.size(); i++) {
- ingressCp.add(connectPointCodec.decode(get(connectPointsJson, i),
- context));
+ ingressCp.add(new FilteredConnectPoint(connectPointCodec.decode(get(connectPointsJson, i),
+ context)));
}
- builder.ingressPoints(ingressCp);
+ builder.filteredIngressPoints(ingressCp);
}
}
@@ -93,7 +94,7 @@
EGRESS_POINT + IntentCodec.MISSING_MEMBER_MESSAGE);
ConnectPoint egress = context.codec(ConnectPoint.class)
.decode(egressJson, context);
- builder.egressPoint(egress);
+ builder.filteredEgressPoint(new FilteredConnectPoint(egress));
return builder.build();
}
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodecTest.java
index c24da42..15c79d6 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/MultiPointToSinglePointIntentCodecTest.java
@@ -46,6 +46,8 @@
import static org.easymock.EasyMock.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
+import static org.onosproject.net.intent.ConnectivityIntentTest.FP2;
+import static org.onosproject.net.intent.ConnectivityIntentTest.FPS1;
/**
* Suite of tests of the multi-to-single point intent's codec for rest api.
@@ -91,8 +93,8 @@
.appId(APPID)
.selector(MATCH)
.treatment(NOP)
- .ingressPoints(PS1)
- .egressPoint(P2)
+ .filteredIngressPoints(FPS1)
+ .filteredEgressPoint(FP2)
.build();
assertThat(intent, notNullValue());
@@ -108,8 +110,20 @@
assertThat(result.get("id").textValue(), is("0x0"));
assertThat(result.get("appId").textValue(), is("foo"));
assertThat(result.get("priority").asInt(), is(100));
- assertThat(result.get("ingressPoint").get(0).get("port").textValue(), is("3"));
- assertThat(result.get("ingressPoint").get(1).get("port").textValue(), is("1"));
+
+ boolean found1 = false;
+ boolean found3 = false;
+ for (int i = 0; i < FPS1.size(); i++) {
+ String portString = result.get("ingressPoint").get(i).get("port").textValue();
+ if (portString.equals("1")) {
+ found1 = true;
+ } else if (portString.equals("3")) {
+ found3 = true;
+ }
+ }
+ assertThat("Port 1 was not found", found1, is(true));
+ assertThat("Port 3 was not found", found3, is(true));
+
assertThat(result.get("egressPoint").get("port").textValue(), is("2"));
assertThat(result.get("egressPoint").get("device").textValue(), is("222"));
}