Deprecate potentially error prone constructor methods

Change-Id: I82d95c27dc7c4b1a6dcf5cc48a1c7583b5e30e2c
diff --git a/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java b/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
index 5a21de0..5b0b257 100644
--- a/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
+++ b/drivers/arista/src/main/java/org/onosproject/drivers/arista/DeviceDescriptionDiscoveryAristaImpl.java
@@ -128,9 +128,13 @@
                         .set(INTERFACE_TYPE, interfaceNode.path(INTERFACE_TYPE).asText())
                         .build();
 
-                PortDescription portDescription = new DefaultPortDescription(PortNumber
-                        .portNumber(getPortNumber(name)),
-                        true, Port.Type.FIBER, bandwidth, annotations);
+                PortDescription portDescription = DefaultPortDescription.builder()
+                        .withPortNumber(PortNumber.portNumber(getPortNumber(name)))
+                        .isEnabled(true)
+                        .type(Port.Type.FIBER)
+                        .portSpeed(bandwidth)
+                        .annotations(annotations)
+                        .build();
                 ports.add(portDescription);
 
             });
diff --git a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/TextBlockParserCisco.java b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/TextBlockParserCisco.java
index a4a68ec..1da7ad0 100644
--- a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/TextBlockParserCisco.java
+++ b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/TextBlockParserCisco.java
@@ -185,8 +185,13 @@
         long portSpeed = getPortSpeed(textStr);
         DefaultAnnotations.Builder annotations = DefaultAnnotations.builder()
                 .set(AnnotationKeys.PORT_NAME, firstWord);
-        return "-1".equals(port) ? null : new DefaultPortDescription(PortNumber.portNumber(port),
-                                                                     isEnabled, type, portSpeed, annotations.build());
+        return "-1".equals(port) ? null : DefaultPortDescription.builder()
+                .withPortNumber(PortNumber.portNumber(port))
+                .isEnabled(isEnabled)
+                .type(type)
+                .portSpeed(portSpeed)
+                .annotations(annotations.build())
+                .build();
     }
 
     /**
@@ -295,4 +300,4 @@
         return portSpeed;
     }
 
-}
\ No newline at end of file
+}
diff --git a/drivers/cisco/netconf/src/test/java/org/onosproject/drivers/cisco/TextBlockParserCiscoTest.java b/drivers/cisco/netconf/src/test/java/org/onosproject/drivers/cisco/TextBlockParserCiscoTest.java
index 39bd2e9..5b9bf92 100644
--- a/drivers/cisco/netconf/src/test/java/org/onosproject/drivers/cisco/TextBlockParserCiscoTest.java
+++ b/drivers/cisco/netconf/src/test/java/org/onosproject/drivers/cisco/TextBlockParserCiscoTest.java
@@ -118,18 +118,24 @@
                 .set(AnnotationKeys.PORT_NAME, INTF6_NAME);
 
         List<PortDescription> intfs = new ArrayList<>();
-        intfs.add(new DefaultPortDescription(INTF1_PORT, IS_ENABLED, COPPER, CONNECTION_SPEED_ETHERNET,
-                                             int1Annotations.build()));
-        intfs.add(new DefaultPortDescription(INTF2_PORT, IS_NOT_ENABLED, COPPER, CONNECTION_SPEED_ETHERNET,
-                                             int2Annotations.build()));
-        intfs.add(new DefaultPortDescription(INTF3_PORT, IS_NOT_ENABLED, COPPER, CONNECTION_SPEED_ETHERNET,
-                                             int3Annotations.build()));
-        intfs.add(new DefaultPortDescription(INTF4_PORT, IS_ENABLED, COPPER, CONNECTION_SPEED_SERIAL,
-                                             int4Annotations.build()));
-        intfs.add(new DefaultPortDescription(INTF5_PORT, IS_ENABLED, FIBER, CONNECTION_SPEED_POS,
-                                             int5Annotations.build()));
-        intfs.add(new DefaultPortDescription(INTF6_PORT, IS_ENABLED, FIBER, CONNECTION_SPEED_FDDI,
-                                             int6Annotations.build()));
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF1_PORT).isEnabled(IS_ENABLED)
+                .type(COPPER).portSpeed(CONNECTION_SPEED_ETHERNET)
+                .annotations(int1Annotations.build()).build());
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF2_PORT).isEnabled(IS_NOT_ENABLED)
+                .type(COPPER).portSpeed(CONNECTION_SPEED_ETHERNET)
+                .annotations(int2Annotations.build()).build());
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF3_PORT).isEnabled(IS_NOT_ENABLED)
+                .type(COPPER).portSpeed(CONNECTION_SPEED_ETHERNET)
+                .annotations(int3Annotations.build()).build());
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF4_PORT).isEnabled(IS_ENABLED)
+                .type(COPPER).portSpeed(CONNECTION_SPEED_SERIAL)
+                .annotations(int4Annotations.build()).build());
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF5_PORT).isEnabled(IS_ENABLED)
+                .type(FIBER).portSpeed(CONNECTION_SPEED_POS)
+                .annotations(int5Annotations.build()).build());
+        intfs.add(DefaultPortDescription.builder().withPortNumber(INTF6_PORT).isEnabled(IS_ENABLED)
+                .type(FIBER).portSpeed(CONNECTION_SPEED_FDDI)
+                .annotations(int6Annotations.build()).build());
         return intfs;
     }
 
diff --git a/drivers/cisco/rest/src/main/java/org/onosproject/drivers/cisco/rest/CiscoNxosDeviceDescription.java b/drivers/cisco/rest/src/main/java/org/onosproject/drivers/cisco/rest/CiscoNxosDeviceDescription.java
index 04a7132..63cd839 100644
--- a/drivers/cisco/rest/src/main/java/org/onosproject/drivers/cisco/rest/CiscoNxosDeviceDescription.java
+++ b/drivers/cisco/rest/src/main/java/org/onosproject/drivers/cisco/rest/CiscoNxosDeviceDescription.java
@@ -136,8 +136,11 @@
                         long portSpeed = itf.get(ETH_BW).asLong() / ONE_THOUSAND; //in Mbps
                         DefaultAnnotations.Builder annotations = DefaultAnnotations.builder()
                                 .set(AnnotationKeys.PORT_NAME, ifName);
-                        PortDescription desc = new DefaultPortDescription(PortNumber.portNumber(ifNum), state,
-                                Port.Type.FIBER, portSpeed, annotations.build());
+                        PortDescription desc = DefaultPortDescription.builder()
+                                .withPortNumber(PortNumber.portNumber(ifNum))
+                                .isEnabled(state)
+                                .type(Port.Type.FIBER).portSpeed(portSpeed).annotations(annotations.build())
+                                .build();
                         ports.add(desc);
                     }
                 });
diff --git a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
index eeaf2ab..93083c5 100644
--- a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
+++ b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
@@ -257,7 +257,7 @@
                 int number = Character.getNumericValue(portId.charAt(portId.length() - 1));
                 PortNumber portNumber = PortNumber.portNumber(number, portId);
                 ports.put(portId, DefaultPortDescription.builder()
-                        .withPortNumer(portNumber));
+                        .withPortNumber(portNumber));
             }
             if (name.equals("enabled")) {
                 DefaultPortDescription.Builder builder = ports.get(portId);
diff --git a/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiXmlParser.java b/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiXmlParser.java
index 111d1a9..fba0f75 100644
--- a/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiXmlParser.java
+++ b/drivers/huawei/src/main/java/org/onosproject/drivers/huawei/HuaweiXmlParser.java
@@ -182,9 +182,13 @@
 
             DefaultAnnotations annotations = DefaultAnnotations.builder()
                     .set(PORT_NAME, ifName).build();
-            ports.add(new DefaultPortDescription(portNumber(port), isEnabled,
-                                                 COPPER, portSpeed,
-                                                 annotations));
+            ports.add(DefaultPortDescription.builder()
+                      .withPortNumber(portNumber(port))
+                      .isEnabled(isEnabled)
+                      .type(COPPER)
+                      .portSpeed(portSpeed)
+                      .annotations(annotations)
+                      .build());
         }
     }
 
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
index d4c709e..4dae93b 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/JuniperUtils.java
@@ -347,11 +347,12 @@
 
         long portSpeed = toMbps(phyIntf.getString(SPEED));
 
-        portDescriptions.add(new DefaultPortDescription(portNumber,
-                                                        admUp && opUp,
-                                                        Type.COPPER,
-                                                        portSpeed,
-                                                        annotations.build()));
+        portDescriptions.add(DefaultPortDescription.builder()
+                .withPortNumber(portNumber)
+                .isEnabled(admUp && opUp)
+                .type(Type.COPPER)
+                .portSpeed(portSpeed)
+                .annotations(annotations.build()).build());
 
         // parse each logical Interface
         for (HierarchicalConfiguration logIntf : phyIntf.configurationsAt("logical-interface")) {
@@ -394,11 +395,12 @@
             // it seemed all logical loop-back interfaces were down
             boolean lEnabled = logIntf.getString("if-config-flags.iff-up") != null;
 
-            portDescriptions.add(new DefaultPortDescription(lPortNumber,
-                                                            admUp && opUp && lEnabled,
-                                                            Type.COPPER,
-                                                            portSpeed,
-                                                            lannotations.build()));
+            portDescriptions.add(DefaultPortDescription.builder()
+                    .withPortNumber(lPortNumber)
+                    .isEnabled(admUp && opUp && lEnabled)
+                    .type(Type.COPPER)
+                    .portSpeed(portSpeed).annotations(lannotations.build())
+                    .build());
         }
     }
 
diff --git a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/Ea1000DeviceDescription.java b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/Ea1000DeviceDescription.java
index faf2007..31a9480 100644
--- a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/Ea1000DeviceDescription.java
+++ b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/Ea1000DeviceDescription.java
@@ -134,13 +134,23 @@
 
         DefaultAnnotations annotationOptics = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "Optics")
                 .build();
-        PortDescription optics = new DefaultPortDescription(PortNumber.portNumber(0), true, Port.Type.FIBER, 1000,
-                annotationOptics);
+        PortDescription optics = DefaultPortDescription.builder()
+                .withPortNumber(PortNumber.portNumber(0))
+                .isEnabled(true)
+                .type(Port.Type.FIBER)
+                .portSpeed(1000)
+                .annotations(annotationOptics)
+                .build();
         ports.add(optics);
 
         DefaultAnnotations annotationHost = DefaultAnnotations.builder().set(AnnotationKeys.PORT_NAME, "Host").build();
-        PortDescription host = new DefaultPortDescription(PortNumber.portNumber(1), true, Port.Type.COPPER, 1000,
-                annotationHost);
+        PortDescription host = DefaultPortDescription.builder()
+                .withPortNumber(PortNumber.portNumber(1))
+                .isEnabled(true)
+                .type(Port.Type.COPPER)
+                .portSpeed(1000)
+                .annotations(annotationHost)
+                .build();
         ports.add(host);
 
         return ports;
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/config/ConfigOpticalDeviceDiscovery.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/config/ConfigOpticalDeviceDiscovery.java
index 5d09100..a38ea02 100644
--- a/drivers/optical/src/main/java/org/onosproject/driver/optical/config/ConfigOpticalDeviceDiscovery.java
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/config/ConfigOpticalDeviceDiscovery.java
@@ -198,7 +198,12 @@
             long portSpeed = port.flatMap(OpticalPortConfig::speed).orElse(speedFallback);
             Port.Type type = port.map(OpticalPortConfig::type).orElse(Port.Type.COPPER);
 
-            portDescs.add(new DefaultPortDescription(number, isEnabled, type, portSpeed));
+            portDescs.add(DefaultPortDescription.builder()
+                    .withPortNumber(number)
+                    .isEnabled(isEnabled)
+                    .type(type)
+                    .portSpeed(portSpeed)
+                    .build());
         }
 
         return portDescs;
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkHandshakerUtil.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkHandshakerUtil.java
index 2dd6edd..b0107e2 100644
--- a/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkHandshakerUtil.java
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkHandshakerUtil.java
@@ -139,8 +139,13 @@
                 // power value is actually signed-short value, down casting to recover sign bit.
                 builder.set(OpticalAnnotations.CURRENT_POWER, Short.toString((short) power.getPowerValue()));
             }
-            portDescs.add(new DefaultPortDescription(port.number(), port.isEnabled(),
-                    port.type(), port.portSpeed(), builder.build()));
+            portDescs.add(DefaultPortDescription.builder()
+                    .withPortNumber(port.number())
+                    .isEnabled(port.isEnabled())
+                    .type(port.type())
+                    .portSpeed(port.portSpeed())
+                    .annotations(builder.build())
+                    .build());
         }
         return portDescs;
     }
@@ -181,8 +186,13 @@
                 }
                 addLink(port.number(), neighbor);
             }
-            portDescs.add(new DefaultPortDescription(port.number(), port.isEnabled(),
-                                                     port.type(), port.portSpeed(), builder.build()));
+            portDescs.add(DefaultPortDescription.builder()
+                    .withPortNumber(port.number())
+                    .isEnabled(port.isEnabled())
+                    .type(port.type())
+                    .portSpeed(port.portSpeed())
+                    .annotations(builder.build())
+                    .build());
         }
         return portDescs;
     }
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkSwitchHandshaker.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkSwitchHandshaker.java
index 6e315cb..0a2a537 100644
--- a/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkSwitchHandshaker.java
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/handshaker/OplinkSwitchHandshaker.java
@@ -245,8 +245,13 @@
             } else {
                 builder.set(OUTPUT_PORT_STATUS, STATUS_OUT_SERVICE);
             }
-            portDescs.add(new DefaultPortDescription(port.number(), port.isEnabled(),
-                    port.type(), port.portSpeed(), builder.build()));
+            portDescs.add(DefaultPortDescription.builder()
+                    .withPortNumber(port.number())
+                    .isEnabled(port.isEnabled())
+                    .type(port.type())
+                    .portSpeed(port.portSpeed())
+                    .annotations(builder.build())
+                    .build());
         }
         return portDescs;
     }
diff --git a/drivers/ovsdb/src/main/java/org/onosproject/drivers/ovsdb/OvsdbBridgeConfig.java b/drivers/ovsdb/src/main/java/org/onosproject/drivers/ovsdb/OvsdbBridgeConfig.java
index 89eb22b..cba5c87 100644
--- a/drivers/ovsdb/src/main/java/org/onosproject/drivers/ovsdb/OvsdbBridgeConfig.java
+++ b/drivers/ovsdb/src/main/java/org/onosproject/drivers/ovsdb/OvsdbBridgeConfig.java
@@ -116,12 +116,12 @@
         Set<OvsdbPort> ports = client.getPorts();
 
         return ports.stream()
-                .map(x -> new DefaultPortDescription(
-                                PortNumber.portNumber(x.portNumber().value()),
-                                true,
-                                DefaultAnnotations.builder()
-                                        .set("portName", x.portName().value())
-                                        .build()))
+                .map(x -> DefaultPortDescription.builder()
+                        .withPortNumber(PortNumber.portNumber(x.portNumber().value()))
+                        .isEnabled(true)
+                        .annotations(DefaultAnnotations.builder()
+                                .set("portName", x.portName().value())
+                                .build()).build())
                 .collect(Collectors.toSet());
     }
 
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java b/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
index 694320d..8d08585 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
@@ -446,12 +446,13 @@
 
             // Create a port description and add it to the list
             portDescriptions.add(
-                new DefaultPortDescription(
-                    portNumber, nic.status(),
-                    nic.portType(), nic.speed(),
-                    annotations.build()
-                )
-            );
+                    DefaultPortDescription.builder()
+                            .withPortNumber(portNumber)
+                            .isEnabled(nic.status())
+                            .type(nic.portType())
+                            .portSpeed(nic.speed())
+                            .annotations(annotations.build())
+                            .build());
 
             log.info(
                 "Port discovery on device {}: NIC {} is {} at {} Mbps",