Remove deprecated unfiltered connect point methods from multipoint to single point intents
Change-Id: I220a024568852d1f3168bac3f5cf47d0b3fd9d86
diff --git a/apps/castor/src/main/java/org/onosproject/castor/ConnectivityManager.java b/apps/castor/src/main/java/org/onosproject/castor/ConnectivityManager.java
index 2d40f6d..a9a986ee 100644
--- a/apps/castor/src/main/java/org/onosproject/castor/ConnectivityManager.java
+++ b/apps/castor/src/main/java/org/onosproject/castor/ConnectivityManager.java
@@ -322,12 +322,12 @@
updateExistingL2Intents(peer);
}
- Set<ConnectPoint> ingressPorts = new HashSet<>();
+ Set<FilteredConnectPoint> ingressPorts = new HashSet<>();
ConnectPoint egressPort = ConnectPoint.deviceConnectPoint(peer.getPort());
for (Peer inPeer : castorStore.getAllPeers()) {
if (!inPeer.getName().equals(peer.getName())) {
- ingressPorts.add(ConnectPoint.deviceConnectPoint(inPeer.getPort()));
+ ingressPorts.add(new FilteredConnectPoint(ConnectPoint.deviceConnectPoint(inPeer.getPort())));
}
}
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
@@ -341,8 +341,8 @@
.key(key)
.selector(selector.build())
.treatment(treatment)
- .ingressPoints(ingressPorts)
- .egressPoint(egressPort)
+ .filteredIngressPoints(ingressPorts)
+ .filteredEgressPoint(new FilteredConnectPoint(egressPort))
.priority(FLOW_PRIORITY)
.build();
intentSynchronizer.submit(intent);
@@ -364,9 +364,9 @@
for (MultiPointToSinglePointIntent oldIntent : oldIntents) {
- Set<ConnectPoint> ingressPoints = oldIntent.ingressPoints();
+ Set<FilteredConnectPoint> ingressPoints = oldIntent.filteredIngressPoints();
ConnectPoint egressPoint = oldIntent.egressPoint();
- if (ingressPoints.add(ConnectPoint.deviceConnectPoint(peer.getPort()))) {
+ if (ingressPoints.add(new FilteredConnectPoint(ConnectPoint.deviceConnectPoint(peer.getPort())))) {
MultiPointToSinglePointIntent updatedMp2pIntent =
MultiPointToSinglePointIntent.builder()
@@ -374,8 +374,8 @@
.key(oldIntent.key())
.selector(oldIntent.selector())
.treatment(oldIntent.treatment())
- .ingressPoints(ingressPoints)
- .egressPoint(egressPoint)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(new FilteredConnectPoint(egressPoint))
.priority(oldIntent.priority())
.build();
@@ -453,9 +453,9 @@
for (MultiPointToSinglePointIntent oldIntent : oldIntents) {
- Set<ConnectPoint> ingressPoints = oldIntent.ingressPoints();
- ConnectPoint egressPoint = oldIntent.egressPoint();
- if (ingressPoints.remove(ConnectPoint.deviceConnectPoint(peer.getPort()))) {
+ Set<FilteredConnectPoint> ingressPoints = oldIntent.filteredIngressPoints();
+ FilteredConnectPoint egressPoint = oldIntent.filteredEgressPoint();
+ if (ingressPoints.remove(new FilteredConnectPoint(ConnectPoint.deviceConnectPoint(peer.getPort())))) {
MultiPointToSinglePointIntent updatedMp2pIntent =
MultiPointToSinglePointIntent.builder()
@@ -463,8 +463,8 @@
.key(oldIntent.key())
.selector(oldIntent.selector())
.treatment(oldIntent.treatment())
- .ingressPoints(ingressPoints)
- .egressPoint(egressPoint)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(egressPoint)
.priority(oldIntent.priority())
.build();
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
index 9c2b2b2..7e17b07 100644
--- a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
@@ -24,6 +24,7 @@
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.intf.Interface;
import org.onosproject.net.intf.InterfaceService;
import org.onosproject.intentsync.IntentSynchronizationService;
@@ -105,11 +106,11 @@
// Rewrite the destination MAC address
MacAddress hostMac = null;
- ConnectPoint egressPoint = null;
+ FilteredConnectPoint egressPoint = null;
for (Host host : hostService.getHostsByIp(hostIpAddress)) {
if (host.mac() != null) {
hostMac = host.mac();
- egressPoint = host.location();
+ egressPoint = new FilteredConnectPoint(host.location());
break;
}
}
@@ -133,11 +134,11 @@
return;
}
- Set<ConnectPoint> ingressPoints = new HashSet<>();
+ Set<FilteredConnectPoint> ingressPoints = new HashSet<>();
for (ConnectPoint connectPoint : interfaceConnectPoints) {
if (!connectPoint.equals(egressPoint)) {
- ingressPoints.add(connectPoint);
+ ingressPoints.add(new FilteredConnectPoint(connectPoint));
}
}
@@ -147,8 +148,8 @@
.key(key)
.selector(selector.build())
.treatment(treatment.build())
- .ingressPoints(ingressPoints)
- .egressPoint(egressPoint)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(egressPoint)
.priority(priority)
.constraints(CONSTRAINTS)
.build();
@@ -220,8 +221,8 @@
.key(key)
.selector(selector.build())
.treatment(treatment.build())
- .ingressPoints(Collections.singleton(ingressPoint))
- .egressPoint(egressPort)
+ .filteredIngressPoints(Collections.singleton(new FilteredConnectPoint(ingressPoint)))
+ .filteredEgressPoint(new FilteredConnectPoint(egressPort))
.priority(priority)
.constraints(CONSTRAINTS)
.build();
@@ -303,8 +304,8 @@
checkNotNull(dstMacAddress);
checkNotNull(srcConnectPoint);
- Set<ConnectPoint> ingressPoints = new HashSet<>();
- ingressPoints.add(srcConnectPoint);
+ Set<FilteredConnectPoint> ingressPoints = new HashSet<>();
+ ingressPoints.add(new FilteredConnectPoint(srcConnectPoint));
IpPrefix dstIpPrefix = dstIpAddress.toIpPrefix();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
@@ -329,8 +330,8 @@
.key(key)
.selector(selector.build())
.treatment(treatment.build())
- .ingressPoints(ingressPoints)
- .egressPoint(dstConnectPoint)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(new FilteredConnectPoint(dstConnectPoint))
.priority(priority)
.constraints(CONSTRAINTS)
.build();
@@ -348,17 +349,17 @@
MultiPointToSinglePointIntent existingIntent =
getExistingMp2pIntent(ipPrefix);
if (existingIntent != null) {
- Set<ConnectPoint> ingressPoints = existingIntent.ingressPoints();
+ Set<FilteredConnectPoint> ingressPoints = existingIntent.filteredIngressPoints();
// Add host connect point into ingressPoints of the existing intent
- if (ingressPoints.add(ingressConnectPoint)) {
+ if (ingressPoints.add(new FilteredConnectPoint(ingressConnectPoint))) {
MultiPointToSinglePointIntent updatedMp2pIntent =
MultiPointToSinglePointIntent.builder()
.appId(appId)
.key(existingIntent.key())
.selector(existingIntent.selector())
.treatment(existingIntent.treatment())
- .ingressPoints(ingressPoints)
- .egressPoint(existingIntent.egressPoint())
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(existingIntent.filteredEgressPoint())
.priority(existingIntent.priority())
.constraints(CONSTRAINTS)
.build();
diff --git a/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java b/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java
index 1a9d64f..e66d700 100644
--- a/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java
+++ b/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricReactiveRouting.java
@@ -37,6 +37,7 @@
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.intf.InterfaceService;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.EncapsulationType;
@@ -376,13 +377,13 @@
continue;
}
- Set<ConnectPoint> newIngressPoints = new HashSet<>();
+ Set<FilteredConnectPoint> newIngressPoints = new HashSet<>();
boolean ingressPointChanged = false;
- for (ConnectPoint cp : intent.ingressPoints()) {
- if (deviceService.isAvailable(cp.deviceId()) &&
- (simpleFabric.findL2Network(cp, VlanId.NONE) != null ||
+ for (FilteredConnectPoint cp : intent.filteredIngressPoints()) {
+ if (deviceService.isAvailable(cp.connectPoint().deviceId()) &&
+ (simpleFabric.findL2Network(cp.connectPoint(), VlanId.NONE) != null ||
(simpleFabric.REACTIVE_ALLOW_LINK_CP &&
- !linkService.getIngressLinks(cp).isEmpty()))) {
+ !linkService.getIngressLinks(cp.connectPoint()).isEmpty()))) {
newIngressPoints.add(cp);
} else {
log.info("refresh route ingress cp of "
@@ -405,8 +406,8 @@
.key(intent.key())
.selector(intent.selector())
.treatment(intent.treatment())
- .ingressPoints(newIngressPoints)
- .egressPoint(intent.egressPoint())
+ .filteredIngressPoints(newIngressPoints)
+ .filteredEgressPoint(intent.filteredEgressPoint())
.priority(intent.priority())
.constraints(intent.constraints())
.build();
@@ -810,11 +811,11 @@
}
// check and merge already existing ingress points
- Set<ConnectPoint> ingressPoints = new HashSet<>();
+ Set<FilteredConnectPoint> ingressPoints = new HashSet<>();
MultiPointToSinglePointIntent existingIntent = (MultiPointToSinglePointIntent) intentService.getIntent(key);
if (existingIntent != null) {
- ingressPoints.addAll(existingIntent.ingressPoints());
- if (!ingressPoints.add(srcCp) // alread exists and dst not changed
+ ingressPoints.addAll(existingIntent.filteredIngressPoints());
+ if (!ingressPoints.add(new FilteredConnectPoint(srcCp)) // alread exists and dst not changed
&& egressPoint.equals(existingIntent.egressPoint())
&& treatment.equals(existingIntent.treatment())) {
log.warn("srcCP is already in mp2p intent: srcPrefix={} dstPrefix={} srcCp={}",
@@ -826,7 +827,7 @@
} else {
log.info("create mp2p intent: srcPrefix={} dstPrefix={} srcCp={}",
srcPrefix, dstPrefix, srcCp);
- ingressPoints.add(srcCp);
+ ingressPoints.add(new FilteredConnectPoint(srcCp));
}
// priority for forwarding case
@@ -837,8 +838,8 @@
.appId(reactiveAppId)
.selector(selector.build())
.treatment(treatment)
- .ingressPoints(ingressPoints)
- .egressPoint(egressPoint)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(new FilteredConnectPoint(egressPoint))
.priority(priority)
.constraints(buildConstraints(reactiveConstraints, encap))
.build();
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
index 8a0639a..16250a3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
@@ -18,6 +18,7 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.intent.Constraint;
@@ -50,13 +51,13 @@
}
String egressDeviceString = deviceStrings[deviceStrings.length - 1];
- ConnectPoint egress = ConnectPoint.deviceConnectPoint(egressDeviceString);
+ FilteredConnectPoint egress = new FilteredConnectPoint(ConnectPoint.deviceConnectPoint(egressDeviceString));
- Set<ConnectPoint> ingressPoints = new HashSet<>();
+ Set<FilteredConnectPoint> ingressPoints = new HashSet<>();
for (int index = 0; index < deviceStrings.length - 1; index++) {
String ingressDeviceString = deviceStrings[index];
ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressDeviceString);
- ingressPoints.add(ingress);
+ ingressPoints.add(new FilteredConnectPoint(ingress));
}
TrafficSelector selector = buildTrafficSelector();
@@ -68,8 +69,8 @@
.key(key())
.selector(selector)
.treatment(treatment)
- .ingressPoints(ingressPoints)
- .egressPoint(egress)
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(egress)
.constraints(constraints)
.priority(priority())
.resourceGroup(resourceGroup())
diff --git a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
index 6d68798..8745ecb 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
@@ -176,42 +176,6 @@
}
/**
- * Sets the ingress point of the single point to multi point intent
- * that will be built.
- *
- * @param ingressPoints ingress connect points
- * @return this builder
- */
- @Deprecated
- public Builder ingressPoints(Set<ConnectPoint> ingressPoints) {
- if (this.ingressPoints != null) {
- log.warn("Ingress points are already set, " +
- "this will override original ingress points.");
- }
- this.ingressPoints = ingressPoints.stream()
- .map(FilteredConnectPoint::new)
- .collect(Collectors.toSet());
- return this;
- }
-
- /**
- * Sets the egress point of the multi point to single point intent
- * that will be built.
- *
- * @param egressPoint egress connect point
- * @return this builder
- */
- @Deprecated
- public Builder egressPoint(ConnectPoint egressPoint) {
- if (this.egressPoint != null) {
- log.warn("Egress point is already set, " +
- "this will override original egress point.");
- }
- this.egressPoint = new FilteredConnectPoint(egressPoint);
- return this;
- }
-
- /**
* Sets the filtered ingress point of the single point to multi point intent
* that will be built.
*
diff --git a/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java b/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
index 5603238..d4e3750 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/MultiPointToSinglePointIntentTest.java
@@ -91,8 +91,8 @@
.appId(APPID)
.selector(MATCH)
.treatment(NOP)
- .ingressPoints(PS1)
- .egressPoint(P2)
+ .filteredIngressPoints(FPS1)
+ .filteredEgressPoint(FP2)
.build();
}
@@ -102,8 +102,8 @@
.appId(APPID)
.selector(MATCH)
.treatment(NOP)
- .ingressPoints(PS2)
- .egressPoint(P1)
+ .filteredIngressPoints(FPS2)
+ .filteredEgressPoint(FP1)
.build();
}
@@ -112,8 +112,8 @@
.appId(APPID)
.selector(VLANMATCH1)
.treatment(NOP)
- .ingressPoints(PS1)
- .egressPoint(P2)
+ .filteredIngressPoints(FPS1)
+ .filteredEgressPoint(FP2)
.build();
}
@@ -122,8 +122,8 @@
.appId(APPID)
.selector(MATCH)
.treatment(NOP)
- .ingressPoints(PS1)
- .egressPoint(P2)
+ .filteredIngressPoints(FPS1)
+ .filteredEgressPoint(FP2)
.resourceGroup(RESOURCE_GROUP)
.build();
}
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"));
}
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
index a359964..f8be6a8 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
@@ -34,6 +34,7 @@
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.Host;
import org.onosproject.net.HostId;
import org.onosproject.net.HostLocation;
@@ -554,7 +555,7 @@
HostId dst = hostId(string(payload, DST));
Host dstHost = services.host().getHost(dst);
- Set<ConnectPoint> ingressPoints = getHostLocations(src);
+ Set<FilteredConnectPoint> ingressPoints = getHostLocations(src);
// FIXME: clearly, this is not enough
TrafficSelector selector = DefaultTrafficSelector.builder()
@@ -566,8 +567,8 @@
.appId(appId)
.selector(selector)
.treatment(treatment)
- .ingressPoints(ingressPoints)
- .egressPoint(dstHost.location())
+ .filteredIngressPoints(ingressPoints)
+ .filteredEgressPoint(new FilteredConnectPoint(dstHost.location()))
.build();
services.intent().submit(intent);
@@ -832,10 +833,10 @@
}
}
- private Set<ConnectPoint> getHostLocations(Set<HostId> hostIds) {
- Set<ConnectPoint> points = new HashSet<>();
+ private Set<FilteredConnectPoint> getHostLocations(Set<HostId> hostIds) {
+ Set<FilteredConnectPoint> points = new HashSet<>();
for (HostId hostId : hostIds) {
- points.add(getHostLocation(hostId));
+ points.add(new FilteredConnectPoint(getHostLocation(hostId)));
}
return points;
}