Deprecate potentially error prone constructor methods
Change-Id: I82d95c27dc7c4b1a6dcf5cc48a1c7583b5e30e2c
diff --git a/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java b/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
index 2354fce..57fdbe2 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DefaultPortDescription.java
@@ -44,7 +44,10 @@
* @param number port number
* @param isEnabled port enabled state
* @param annotations optional key/value annotations map
+ *
+ * @deprecated in 1.13.0 use {@link #builder()} instead
*/
+ @Deprecated
public DefaultPortDescription(PortNumber number, boolean isEnabled,
SparseAnnotations... annotations) {
this(number, isEnabled, Type.COPPER, DEFAULT_SPEED, annotations);
@@ -58,7 +61,9 @@
* @param type port type
* @param portSpeed port speed in Mbps
* @param annotations optional key/value annotations map
+ * @deprecated in 1.13.0 use {@link #builder()} instead
*/
+ @Deprecated
public DefaultPortDescription(PortNumber number, boolean isEnabled,
Type type, long portSpeed,
SparseAnnotations...annotations) {
@@ -74,7 +79,9 @@
* @param type port type
* @param portSpeed port speed in Mbps
* @param annotations optional key/value annotations map
+ * @deprecated in 1.13.0 use {@link #builder()} instead
*/
+ @Deprecated // to be made non-public
public DefaultPortDescription(PortNumber number, boolean isEnabled, boolean isRemoved,
Type type, long portSpeed,
SparseAnnotations...annotations) {
@@ -100,7 +107,10 @@
*
* @param base PortDescription to get basic information from
* @param annotations optional key/value annotations map
+ *
+ * @deprecated in 1.13.0 use {@link #builder(PortDescription)} instead.
*/
+ @Deprecated
public DefaultPortDescription(PortDescription base,
SparseAnnotations annotations) {
this(base.portNumber(), base.isEnabled(), base.isRemoved(), base.type(), base.portSpeed(),
@@ -114,10 +124,15 @@
* @param annotations to be used in the copied description.
* Note: Annotations on {@code base} will be ignored.
* @return copied port description
+ *
+ * @deprecated in 1.13.0 use {@link #builder(PortDescription)} instead.
*/
+ @Deprecated
public static DefaultPortDescription copyReplacingAnnotation(PortDescription base,
SparseAnnotations annotations) {
- return new DefaultPortDescription(base, annotations);
+ return DefaultPortDescription.builder(base)
+ .annotations(annotations)
+ .build();
}
@Override
@@ -222,8 +237,22 @@
*
* @param number to set
* @return self
+ *
+ * @deprecated in 1.13.0 use withPortNumber() instead.
*/
+
+ @Deprecated
public Builder withPortNumer(PortNumber number) {
+ return withPortNumber(number);
+ }
+
+ /**
+ * Sets mandatory field PortNumber.
+ *
+ * @param number to set
+ * @return self
+ */
+ public Builder withPortNumber(PortNumber number) {
this.number = checkNotNull(number);
return this;
}
diff --git a/core/api/src/test/java/org/onosproject/net/device/DefaultPortDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/device/DefaultPortDescriptionTest.java
index 1d15b20..9fa3893 100644
--- a/core/api/src/test/java/org/onosproject/net/device/DefaultPortDescriptionTest.java
+++ b/core/api/src/test/java/org/onosproject/net/device/DefaultPortDescriptionTest.java
@@ -33,15 +33,17 @@
private static PortNumber port1 = PortNumber.portNumber(1);
private static long portSpeed1 = 111L;
private static DefaultPortDescription portDescription1 =
- new DefaultPortDescription(port1, true, COPPER, portSpeed1);
+ DefaultPortDescription.builder().withPortNumber(port1).isEnabled(true)
+ .type(COPPER).portSpeed(portSpeed1).build();
private static DefaultPortDescription sameAsPortDescription1 =
- new DefaultPortDescription(portDescription1,
- portDescription1.annotations());
+ DefaultPortDescription.builder(portDescription1)
+ .annotations(portDescription1.annotations())
+ .build();
private static PortNumber port2 = PortNumber.portNumber(2);
private static DefaultPortDescription portDescription2 =
- new DefaultPortDescription(port2, true);
+ DefaultPortDescription.builder().withPortNumber(port2).isEnabled(true).build();
private static DefaultPortDescription portDescription3 =
new DefaultPortDescription();
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStore.java
index 5a41057..f4a7836 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStore.java
@@ -725,7 +725,9 @@
if (oldOne != null) {
SparseAnnotations merged = union(oldOne.annotations(),
newDesc.annotations());
- newOne = new DefaultPortDescription(newOne, merged);
+ newOne = DefaultPortDescription.builder(newOne)
+ .annotations(merged)
+ .build();
}
return portDescs.put(newOne.portNumber(), newOne);
}
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStoreTest.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStoreTest.java
index 595280a..719307f 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStoreTest.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleDeviceStoreTest.java
@@ -282,8 +282,8 @@
public final void testUpdatePorts() {
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
List<DeviceEvent> events = deviceStore.updatePorts(PID, DID1, pds);
@@ -300,9 +300,9 @@
List<PortDescription> pds2 = Arrays.asList(
- new DefaultPortDescription(P1, false),
- new DefaultPortDescription(P2, true),
- new DefaultPortDescription(P3, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P3).isEnabled(true).build()
);
events = deviceStore.updatePorts(PID, DID1, pds2);
@@ -325,8 +325,8 @@
}
List<PortDescription> pds3 = Arrays.asList(
- new DefaultPortDescription(P1, false),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
events = deviceStore.updatePorts(PID, DID1, pds3);
assertFalse("event should be triggered", events.isEmpty());
@@ -351,12 +351,12 @@
public final void testUpdatePortStatus() {
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds);
DeviceEvent event = deviceStore.updatePortStatus(PID, DID1,
- new DefaultPortDescription(P1, false));
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build());
assertEquals(PORT_UPDATED, event.type());
assertDevice(DID1, SW1, event.subject());
assertEquals(P1, event.port().number());
@@ -369,12 +369,12 @@
putDeviceAncillary(DID1, SW1);
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true, A1)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).annotations(A1).build()
);
deviceStore.updatePorts(PID, DID1, pds);
DeviceEvent event = deviceStore.updatePortStatus(PID, DID1,
- new DefaultPortDescription(P1, false, A1_2));
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).annotations(A1_2).build());
assertEquals(PORT_UPDATED, event.type());
assertDevice(DID1, SW1, event.subject());
assertEquals(P1, event.port().number());
@@ -382,12 +382,12 @@
assertFalse("Port is disabled", event.port().isEnabled());
DeviceEvent event2 = deviceStore.updatePortStatus(PIDA, DID1,
- new DefaultPortDescription(P1, true));
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build());
assertNull("Ancillary is ignored if primary exists", event2);
// but, Ancillary annotation update will be notified
DeviceEvent event3 = deviceStore.updatePortStatus(PIDA, DID1,
- new DefaultPortDescription(P1, true, A2));
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).annotations(A2).build());
assertEquals(PORT_UPDATED, event3.type());
assertDevice(DID1, SW1, event3.subject());
assertEquals(P1, event3.port().number());
@@ -396,7 +396,7 @@
// port only reported from Ancillary will be notified as down
DeviceEvent event4 = deviceStore.updatePortStatus(PIDA, DID1,
- new DefaultPortDescription(P2, true));
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build());
assertEquals(PORT_ADDED, event4.type());
assertDevice(DID1, SW1, event4.subject());
assertEquals(P2, event4.port().number());
@@ -410,8 +410,8 @@
putDevice(DID1, SW1);
putDevice(DID2, SW1);
List<PortDescription> pds = Arrays.<PortDescription>asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -433,8 +433,8 @@
putDevice(DID1, SW1);
putDevice(DID2, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, false)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(false).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -454,7 +454,7 @@
public final void testRemoveDevice() {
putDevice(DID1, SW1, A1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true, A2)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).annotations(A2).build()
);
deviceStore.updatePorts(PID, DID1, pds);
putDevice(DID2, SW1);
@@ -474,7 +474,7 @@
// putBack Device, Port w/o annotation
putDevice(DID1, SW1);
List<PortDescription> pds2 = Arrays.asList(
- new DefaultPortDescription(P1, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds2);
diff --git a/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java b/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
index 78b6c9e..5277075 100644
--- a/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
+++ b/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
@@ -189,7 +189,7 @@
// TODO inject port details if something like BasicPortConfig was created
PortNumber number = portNumber(i);
boolean isEnabled = true;
- portDescs.add(new DefaultPortDescription(number, isEnabled));
+ portDescs.add(DefaultPortDescription.builder().withPortNumber(number) .isEnabled(isEnabled).build());
}
providerService.updatePorts(did, portDescs);
}
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
index 37fc2cd..c82c1f5 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -716,12 +716,10 @@
log.trace("Device not found: {}", deviceId);
}
- PortDescription newPortDescription = new DefaultPortDescription(basePortDescription.portNumber(),
- basePortDescription.isEnabled(),
- true,
- basePortDescription.type(),
- basePortDescription.portSpeed(),
- basePortDescription.annotations());
+ PortDescription newPortDescription = DefaultPortDescription.builder(basePortDescription)
+ .isRemoved(true)
+ .build();
+
final DeviceEvent event = store.updatePortStatus(this.provider().id(),
deviceId,
newPortDescription);
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java b/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
index 2489f79..ac9ea84 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
@@ -71,7 +71,9 @@
builder.putAll(descr.annotations());
builder.putAll(annotations);
- return DefaultPortDescription.copyReplacingAnnotation(descr, builder.build());
+ return DefaultPortDescription.builder(descr)
+ .annotations(builder.build())
+ .build();
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/device/impl/DeviceManagerTest.java b/core/net/src/test/java/org/onosproject/net/device/impl/DeviceManagerTest.java
index 975c90a..601e6c3 100644
--- a/core/net/src/test/java/org/onosproject/net/device/impl/DeviceManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/device/impl/DeviceManagerTest.java
@@ -190,15 +190,15 @@
public void updatePorts() {
connectDevice(DID1, SW1);
List<PortDescription> pds = new ArrayList<>();
- pds.add(new DefaultPortDescription(P1, true));
- pds.add(new DefaultPortDescription(P2, true));
- pds.add(new DefaultPortDescription(P3, true));
+ pds.add(DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build());
+ pds.add(DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build());
+ pds.add(DefaultPortDescription.builder().withPortNumber(P3).isEnabled(true).build());
providerService.updatePorts(DID1, pds);
validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED, PORT_ADDED);
pds.clear();
- pds.add(new DefaultPortDescription(P1, false));
- pds.add(new DefaultPortDescription(P3, true));
+ pds.add(DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build());
+ pds.add(DefaultPortDescription.builder().withPortNumber(P3).isEnabled(true).build());
providerService.updatePorts(DID1, pds);
validateEvents(PORT_UPDATED, PORT_REMOVED);
}
@@ -207,14 +207,16 @@
public void updatePortStatus() {
connectDevice(DID1, SW1);
List<PortDescription> pds = new ArrayList<>();
- pds.add(new DefaultPortDescription(P1, true));
- pds.add(new DefaultPortDescription(P2, true));
+ pds.add(DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build());
+ pds.add(DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build());
providerService.updatePorts(DID1, pds);
validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED);
- providerService.portStatusChanged(DID1, new DefaultPortDescription(P1, false));
+ providerService.portStatusChanged(DID1, DefaultPortDescription.builder()
+ .withPortNumber(P1).isEnabled(false).build());
validateEvents(PORT_UPDATED);
- providerService.portStatusChanged(DID1, new DefaultPortDescription(P1, false));
+ providerService.portStatusChanged(DID1, DefaultPortDescription.builder()
+ .withPortNumber(P1).isEnabled(false).build());
assertTrue("no events expected", listener.events.isEmpty());
}
@@ -222,8 +224,8 @@
public void getPorts() {
connectDevice(DID1, SW1);
List<PortDescription> pds = new ArrayList<>();
- pds.add(new DefaultPortDescription(P1, true));
- pds.add(new DefaultPortDescription(P2, true));
+ pds.add(DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build());
+ pds.add(DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build());
providerService.updatePorts(DID1, pds);
validateEvents(DEVICE_ADDED, PORT_ADDED, PORT_ADDED);
assertEquals("wrong port count", 2, service.getPorts(DID1).size());
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/DeviceDescriptions.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/DeviceDescriptions.java
index 301767d..f14b062 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/DeviceDescriptions.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/DeviceDescriptions.java
@@ -97,7 +97,9 @@
SparseAnnotations merged = union(oldOne.value().annotations(),
newDesc.value().annotations());
newOne = new Timestamped<>(
- new DefaultPortDescription(newDesc.value(), merged),
+ DefaultPortDescription.builder(newDesc.value())
+ .annotations(merged)
+ .build(),
newDesc.timestamp());
}
portDescs.put(newOne.value().portNumber(), newOne);
diff --git a/core/store/dist/src/test/java/org/onosproject/store/device/impl/GossipDeviceStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/device/impl/GossipDeviceStoreTest.java
index 370c1d5..8a31446 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/device/impl/GossipDeviceStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/device/impl/GossipDeviceStoreTest.java
@@ -522,8 +522,8 @@
public final void testUpdatePorts() {
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
Capture<InternalDeviceEvent> message = new Capture<>();
Capture<MessageSubject> subject = new Capture<>();
@@ -547,9 +547,9 @@
List<PortDescription> pds2 = Arrays.asList(
- new DefaultPortDescription(P1, false),
- new DefaultPortDescription(P2, true),
- new DefaultPortDescription(P3, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P3).isEnabled(true).build()
);
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
@@ -577,8 +577,8 @@
}
List<PortDescription> pds3 = Arrays.asList(
- new DefaultPortDescription(P1, false),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
events = deviceStore.updatePorts(PID, DID1, pds3);
@@ -607,7 +607,7 @@
public final void testUpdatePortStatus() {
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -616,7 +616,8 @@
Capture<Function<InternalPortStatusEvent, byte[]>> encoder = new Capture<>();
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
- final DefaultPortDescription desc = new DefaultPortDescription(P1, false);
+ final DefaultPortDescription desc = DefaultPortDescription.builder().withPortNumber(P1)
+ .isEnabled(false).build();
DeviceEvent event = deviceStore.updatePortStatus(PID, DID1, desc);
assertEquals(PORT_UPDATED, event.type());
assertDevice(DID1, SW1, event.subject());
@@ -632,7 +633,7 @@
putDeviceAncillary(DID1, SW1);
putDevice(DID1, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true, A1)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).annotations(A1).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -643,7 +644,9 @@
// update port from primary
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
- final DefaultPortDescription desc1 = new DefaultPortDescription(P1, false, A1_2);
+ final DefaultPortDescription desc1 = DefaultPortDescription.builder().withPortNumber(P1).isEnabled(false)
+ .annotations(A1_2).build();
+
DeviceEvent event = deviceStore.updatePortStatus(PID, DID1, desc1);
assertEquals(PORT_UPDATED, event.type());
assertDevice(DID1, SW1, event.subject());
@@ -656,7 +659,8 @@
// update port from ancillary with no attributes
resetCommunicatorExpectingNoBroadcast(message, subject, encoder);
- final DefaultPortDescription desc2 = new DefaultPortDescription(P1, true);
+ final DefaultPortDescription desc2 = DefaultPortDescription.builder()
+ .withPortNumber(P1).isEnabled(true).build();
DeviceEvent event2 = deviceStore.updatePortStatus(PIDA, DID1, desc2);
assertNull("Ancillary is ignored if primary exists", event2);
verify(clusterCommunicator);
@@ -664,7 +668,8 @@
// but, Ancillary annotation update will be notified
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
- final DefaultPortDescription desc3 = new DefaultPortDescription(P1, true, A2);
+ final DefaultPortDescription desc3 = DefaultPortDescription.builder().withPortNumber(P1)
+ .isEnabled(true).annotations(A2).build();
DeviceEvent event3 = deviceStore.updatePortStatus(PIDA, DID1, desc3);
assertEquals(PORT_UPDATED, event3.type());
assertDevice(DID1, SW1, event3.subject());
@@ -677,7 +682,8 @@
// port only reported from Ancillary will be notified as down
resetCommunicatorExpectingSingleBroadcast(message, subject, encoder);
- final DefaultPortDescription desc4 = new DefaultPortDescription(P2, true);
+ final DefaultPortDescription desc4 = DefaultPortDescription.builder()
+ .withPortNumber(P2).isEnabled(true).build();
DeviceEvent event4 = deviceStore.updatePortStatus(PIDA, DID1, desc4);
assertEquals(PORT_ADDED, event4.type());
assertDevice(DID1, SW1, event4.subject());
@@ -757,8 +763,8 @@
putDevice(DID1, SW1);
putDevice(DID2, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -780,8 +786,8 @@
putDevice(DID1, SW1);
putDevice(DID2, SW1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true),
- new DefaultPortDescription(P2, false)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build(),
+ DefaultPortDescription.builder().withPortNumber(P2).isEnabled(false).build()
);
deviceStore.updatePorts(PID, DID1, pds);
@@ -801,7 +807,7 @@
public final void testRemoveDevice() {
putDevice(DID1, SW1, A1);
List<PortDescription> pds = Arrays.asList(
- new DefaultPortDescription(P1, true, A2)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).annotations(A2).build()
);
deviceStore.updatePorts(PID, DID1, pds);
putDevice(DID2, SW1);
@@ -830,7 +836,7 @@
// putBack Device, Port w/o annotation
putDevice(DID1, SW1);
List<PortDescription> pds2 = Arrays.asList(
- new DefaultPortDescription(P1, true)
+ DefaultPortDescription.builder().withPortNumber(P1).isEnabled(true).build()
);
deviceStore.updatePorts(PID, DID1, pds2);