Introducing CE UNI/INNI/ENNI and BW profile builders

Change-Id: I1c8b47032946b2f68c3a19ebf070d44137ea7ef6
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
index 9dfe5f4..b9d9e74 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
@@ -18,10 +18,12 @@
 import org.onlab.util.Bandwidth;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * Bandwidth profile for a CE UNI.
  */
+// TODO: Methods to associate a CE BWP to a generic BWP and a Meter
 public class CarrierEthernetBandwidthProfile {
 
     public enum Type {
@@ -36,8 +38,13 @@
     protected long cbs;
     protected long ebs;
 
+    // TODO: Remove id from constructor - should be generated by some manager
+    // TODO: Make constructor private when SCA/NRP API apps are migrated
+    @Deprecated
     public CarrierEthernetBandwidthProfile(String id, String cfgId, Type type,
-                                           Bandwidth cir, Bandwidth eir, long cbs, long ebs) {
+                                            Bandwidth cir, Bandwidth eir,
+                                            long cbs, long ebs) {
+        checkNotNull(cir, "BW Profile must have an associated CIR");
         this.id = id;
         this.cfgId = cfgId;
         this.type = type;
@@ -148,4 +155,114 @@
                 .add("ebs", ebs).toString();
     }
 
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetBandwidthProfile entities.
+     */
+    public static final class Builder {
+
+        String id;
+        String cfgId;
+        Type type;
+        Bandwidth cir;
+        Bandwidth eir;
+        long cbs;
+        long ebs;
+
+        /**
+         * Sets the id of this builder.
+         *
+         * @param id the builder id to set
+         * @return this builder instance
+         */
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the type of this builder.
+         *
+         * @param type the builder type to set
+         * @return this builder instance
+         */
+        public Builder type(Type type) {
+            this.type = type;
+            return this;
+        }
+
+        /**
+         * Sets the cir of this builder.
+         *
+         * @param cir the builder cir to set
+         * @return this builder instance
+         */
+        public Builder cir(Bandwidth cir) {
+            this.cir = cir;
+            return this;
+        }
+
+        /**
+         * Sets the eir of this builder.
+         *
+         * @param eir the builder eir to set
+         * @return this builder instance
+         */
+        public Builder eir(Bandwidth eir) {
+            this.eir = eir;
+            return this;
+        }
+
+        /**
+         * Sets the cbs of this builder.
+         *
+         * @param cbs the builder cbs to set
+         * @return this builder instance
+         */
+        public Builder cbs(long cbs) {
+            this.cbs = cbs;
+            return this;
+        }
+
+        /**
+         * Sets the ebs of this builder.
+         *
+         * @param ebs the builder ebs to set
+         * @return this builder instance
+         */
+        public Builder ebs(long ebs) {
+            this.ebs = ebs;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetBandwidthProfile instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetBandwidthProfile instance
+         */
+        public CarrierEthernetBandwidthProfile build() {
+            return new CarrierEthernetBandwidthProfile(id, cfgId, type,
+                                                       cir, eir, cbs, ebs);
+        }
+    }
 }
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
index 696a0aa..dd002d0 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
@@ -61,10 +61,12 @@
     protected Set<VlanId> sVlanIdSet;
     String tpid;
 
-    public CarrierEthernetEnni(ConnectPoint connectPoint, String uniCfgId, Role role, VlanId sVlanId, String tpid,
-                               Bandwidth usedCapacity) {
-
-        super(connectPoint, Type.ENNI, uniCfgId);
+    // TODO: Make constructor private when SCA/NRP API apps are migrated
+    @Deprecated
+    public CarrierEthernetEnni(ConnectPoint cp, String uniCfgId,
+                                Role role, VlanId sVlanId, String tpid,
+                                Bandwidth usedCapacity) {
+        super(cp, Type.ENNI, uniCfgId);
         // TODO: Check for null
         this.role = role;
         this.sVlanIdSet = Sets.newConcurrentHashSet();
@@ -207,4 +209,102 @@
                 .add("usedCapacity", this.usedCapacity).toString();
     }
 
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetEnni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId sVlanId;
+        private String tpid;
+        private Bandwidth usedCapacity;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the sVlanId of this builder.
+         *
+         * @param sVlanId the builder sVlanId to set
+         * @return this builder instance
+         */
+        public Builder sVlanId(VlanId sVlanId) {
+            this.sVlanId = sVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the tpid of this builder.
+         *
+         * @param tpid the builder tpid to set
+         * @return this builder instance
+         */
+        public Builder tpid(String tpid) {
+            this.tpid = tpid;
+            return this;
+        }
+
+        /**
+         * Sets the usedCapacity of this builder.
+         *
+         * @param usedCapacity the builder usedCapacity to set
+         * @return this builder instance
+         */
+        public Builder usedCapacity(Bandwidth usedCapacity) {
+            this.usedCapacity = usedCapacity;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetEnni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetEnni instance
+         */
+        public CarrierEthernetEnni build() {
+            return new CarrierEthernetEnni(cp, cfgId, role,
+                                           sVlanId, tpid, usedCapacity);
+        }
+    }
 }
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetGenericNi.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetGenericNi.java
index 0795e01..d14fed7 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetGenericNi.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetGenericNi.java
@@ -15,18 +15,10 @@
  */
 package org.onosproject.ecord.carrierethernet.app;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
 import org.onlab.packet.VlanId;
-import org.onlab.util.Bandwidth;
 import org.onosproject.net.ConnectPoint;
-import org.slf4j.Logger;
-
 
 import static com.google.common.base.MoreObjects.toStringHelper;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Set;
 
 /**
  * Representation of a Generic Carrier Ethernet NI.
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
index f92abf4..bc0964a 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
@@ -62,9 +62,14 @@
 
     protected Role role;
     protected Set<VlanId> sVlanIdSet;
-    String tpid;
+    // TODO: Associate TPIDs with S-TAGs
+    protected String tpid;
 
-    public CarrierEthernetInni(ConnectPoint connectPoint, String uniCfgId, Role role, VlanId sVlanId, String tpid,
+    // TODO: Change sVlanId to Collection<VlanId>
+    // TODO: Make constructor private when SCA/NRP API apps are migrated
+    @Deprecated
+    public CarrierEthernetInni(ConnectPoint connectPoint, String uniCfgId,
+                               Role role, VlanId sVlanId, String tpid,
                                Bandwidth usedCapacity) {
 
         super(connectPoint, Type.INNI, uniCfgId);
@@ -212,4 +217,102 @@
                 .add("usedCapacity", this.usedCapacity).toString();
     }
 
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetInni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId sVlanId;
+        private String tpid;
+        private Bandwidth usedCapacity;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the sVlanId of this builder.
+         *
+         * @param sVlanId the builder sVlanId to set
+         * @return this builder instance
+         */
+        public Builder sVlanId(VlanId sVlanId) {
+            this.sVlanId = sVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the tpid of this builder.
+         *
+         * @param tpid the builder tpid to set
+         * @return this builder instance
+         */
+        public Builder tpid(String tpid) {
+            this.tpid = tpid;
+            return this;
+        }
+
+        /**
+         * Sets the usedCapacity of this builder.
+         *
+         * @param usedCapacity the builder usedCapacity to set
+         * @return this builder instance
+         */
+        public Builder usedCapacity(Bandwidth usedCapacity) {
+            this.usedCapacity = usedCapacity;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetInni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetInni instance
+         */
+        public CarrierEthernetInni build() {
+            return new CarrierEthernetInni(cp, cfgId, role,
+                                          sVlanId, tpid, usedCapacity);
+        }
+    }
 }
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetLogicalTerminationPoint.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetLogicalTerminationPoint.java
index ca2f54e..752eccb 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetLogicalTerminationPoint.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetLogicalTerminationPoint.java
@@ -83,13 +83,25 @@
         // FIXME: Provide appropriate mapping between LTP and NI roles (e.g. ROOT -> HUB, LEAF -> SPOKE)
         if (niType.equals(CarrierEthernetNetworkInterface.Type.UNI)) {
             CarrierEthernetUni.Role uniRole = (role == null) ? null : CarrierEthernetUni.Role.valueOf(role.name());
-            this.ni = new CarrierEthernetUni(cp, ltpId, uniRole, null, null);
+            this.ni = CarrierEthernetUni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(uniRole)
+                    .build();
         } else if (niType.equals(CarrierEthernetNetworkInterface.Type.INNI))  {
             CarrierEthernetInni.Role inniRole = (role == null) ? null : CarrierEthernetInni.Role.valueOf(role.name());
-            this.ni = new CarrierEthernetInni(cp, ltpId, inniRole, null, null, null);
+            this.ni = CarrierEthernetInni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(inniRole)
+                    .build();
         } else if (niType.equals(CarrierEthernetNetworkInterface.Type.ENNI)) {
             CarrierEthernetEnni.Role enniRole = (role == null) ? null : CarrierEthernetEnni.Role.valueOf(role.name());
-            this.ni = new CarrierEthernetEnni(cp, ltpId, enniRole, null, null, null);
+            this.ni = CarrierEthernetEnni.builder()
+                    .cp(cp)
+                    .cfgId(ltpId)
+                    .role(enniRole)
+                    .build();
         }
     }
 
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
index 6303108..0a4279d 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
@@ -60,16 +60,19 @@
     }
 
     protected Role role = null;
-    protected Set<VlanId> ceVlanIdSet = Sets.newConcurrentHashSet();;
+    protected Set<VlanId> ceVlanIdSet = Sets.newConcurrentHashSet();
 
     // Note: INTERFACE BWP map can only have up to one element
     protected final Map<CarrierEthernetBandwidthProfile.Type, Map<String, CarrierEthernetBandwidthProfile>> bwpMap =
             new HashMap<>();
 
     // TODO: May be needed to add refCount for CoS BWPs - only applicable to global UNIs
-
-    public CarrierEthernetUni(ConnectPoint cp, String uniCfgId, Role role, VlanId ceVlanId,
-                              CarrierEthernetBandwidthProfile bwp) {
+    // TODO: Change ceVlanId to Collection<VlanId>
+    // TODO: Make constructor private when SCA/NRP API apps are migrated
+    @Deprecated
+    public CarrierEthernetUni(ConnectPoint cp, String uniCfgId, Role role,
+                               VlanId ceVlanId,
+                               CarrierEthernetBandwidthProfile bwp) {
         super(cp, Type.UNI, uniCfgId);
 
         this.role = role;
@@ -302,4 +305,89 @@
                 .add("bandwidthProfiles", this.bwps()).toString();
     }
 
+    /**
+     * Returns a new builder.
+     *
+     * @return new builder
+     */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /**
+     * Builder of CarrierEthernetUni entities.
+     */
+    public static final class Builder {
+
+        private ConnectPoint cp;
+        private String cfgId;
+        private Role role;
+        private VlanId ceVlanId;
+        private CarrierEthernetBandwidthProfile bwp;
+
+        /**
+         * Sets the cp of this builder.
+         *
+         * @param cp the builder cp to set
+         * @return this builder instance
+         */
+        public Builder cp(ConnectPoint cp) {
+            this.cp = cp;
+            return this;
+        }
+
+        /**
+         * Sets the cfgId of this builder.
+         *
+         * @param cfgId the builder cfgId to set
+         * @return this builder instance
+         */
+        public Builder cfgId(String cfgId) {
+            this.cfgId = cfgId;
+            return this;
+        }
+
+        /**
+         * Sets the role of this builder.
+         *
+         * @param role the builder role to set
+         * @return this builder instance
+         */
+        public Builder role(Role role) {
+            this.role = role;
+            return this;
+        }
+
+        /**
+         * Sets the ceVlanId of this builder.
+         *
+         * @param ceVlanId the builder ceVlanId to set
+         * @return this builder instance
+         */
+        public Builder ceVlanId(VlanId ceVlanId) {
+            this.ceVlanId = ceVlanId;
+            return this;
+        }
+
+        /**
+         * Sets the bwp of this builder.
+         *
+         * @param bwp the builder bwp to set
+         * @return this builder instance
+         */
+        public Builder bwp(CarrierEthernetBandwidthProfile bwp) {
+            this.bwp = bwp;
+            return this;
+        }
+
+        /**
+         * Builds a new CarrierEthernetUni instance.
+         * based on this builder's parameters
+         *
+         * @return a new CarrierEthernetUni instance
+         */
+        public CarrierEthernetUni build() {
+            return new CarrierEthernetUni(cp, cfgId, role, ceVlanId, bwp);
+        }
+    }
 }
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
index 5e00b7d..3bbd6e72 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateEvcCommand.java
@@ -166,34 +166,39 @@
         CarrierEthernetVirtualConnection.Type evcType = generateEvcType();
 
         // We assume that first UNI supplied is always root
-        uniSet.add(new CarrierEthernetUni(ConnectPoint.deviceConnectPoint(argFirstUni), null,
-                CarrierEthernetUni.Role.ROOT, generateCeVlanId(),
-                new CarrierEthernetBandwidthProfile(
-                        generateBandwidthProfileId(argFirstUni),
-                        null,
-                        generateBandwidthProfileType(),
-                        Bandwidth.mbps(Double.parseDouble(argCir)),
-                        Bandwidth.mbps(Double.parseDouble(argEir)),
-                        Long.parseLong(argCbs),
-                        Long.parseLong(argEbs)
-                )));
+        uniSet.add(CarrierEthernetUni.builder()
+                           .cp(ConnectPoint.deviceConnectPoint(argFirstUni))
+                           .role(CarrierEthernetUni.Role.ROOT)
+                           .ceVlanId(generateCeVlanId())
+                           .bwp(CarrierEthernetBandwidthProfile.builder()
+                                        .id(generateBandwidthProfileId(argFirstUni))
+                                        .type(generateBandwidthProfileType())
+                                        .cir(Bandwidth.mbps(Double.parseDouble(argCir)))
+                                        .eir(Bandwidth.mbps(Double.parseDouble(argEir)))
+                                        .cbs(Long.parseLong(argCbs))
+                                        .ebs(Long.parseLong(argEbs))
+                                        .build())
+                           .build());
 
-        final CarrierEthernetUni.Role uniType;
+        final CarrierEthernetUni.Role role;
         // For E-Line and E-LAN all UNIs are roots. For E-Tree all UNIs are leafs except from one
-        uniType = ((evcType == CarrierEthernetVirtualConnection.Type.ROOT_MULTIPOINT) ?
+        role = ((evcType == CarrierEthernetVirtualConnection.Type.ROOT_MULTIPOINT) ?
                 CarrierEthernetUni.Role.LEAF : CarrierEthernetUni.Role.ROOT);
 
-        argUniList.forEach(argUni -> uniSet.add(new CarrierEthernetUni(ConnectPoint.deviceConnectPoint(argUni), null,
-                uniType, generateCeVlanId(),
-                new CarrierEthernetBandwidthProfile(
-                        generateBandwidthProfileId(argUni),
-                        null,
-                        generateBandwidthProfileType(),
-                        Bandwidth.mbps(Double.parseDouble(argCir)),
-                        Bandwidth.mbps(Double.parseDouble(argEir)),
-                        Long.parseLong(argCbs),
-                        Long.parseLong(argEbs)
-                ))));
+        argUniList.forEach(argUni -> uniSet.add(
+                CarrierEthernetUni.builder()
+                        .cp(ConnectPoint.deviceConnectPoint(argUni))
+                        .role(role)
+                        .ceVlanId(generateCeVlanId())
+                        .bwp(CarrierEthernetBandwidthProfile.builder()
+                                     .id(generateBandwidthProfileId(argUni))
+                                     .type(generateBandwidthProfileType())
+                                     .cir(Bandwidth.mbps(Double.parseDouble(argCir)))
+                                     .eir(Bandwidth.mbps(Double.parseDouble(argEir)))
+                                     .cbs(Long.parseLong(argCbs))
+                                     .ebs(Long.parseLong(argEbs))
+                                     .build())
+                        .build()));
 
         return uniSet;
     }
diff --git a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateFcCommand.java b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateFcCommand.java
index 9a9075d..67545f9 100644
--- a/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateFcCommand.java
+++ b/ecord/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/cli/commands/CarrierEthernetCreateFcCommand.java
@@ -164,25 +164,35 @@
         CarrierEthernetManager ceManager = get(CarrierEthernetManager.class);
 
         if(ceManager.ltpMap().get(ltpId).ni() instanceof CarrierEthernetUni) {
-            return new CarrierEthernetUni(ConnectPoint.deviceConnectPoint(ltpId), null,
-                    role, generateVlanId(argCeVlanId),
-                    new CarrierEthernetBandwidthProfile(
-                            generateBandwidthProfileId(ltpId),
-                            null,
-                            generateBandwidthProfileType(),
-                            Bandwidth.mbps(Double.parseDouble(argCir)),
-                            Bandwidth.mbps(Double.parseDouble(argEir)),
-                            Long.parseLong(argCbs),
-                            Long.parseLong(argEbs)
-                    ));
+            return CarrierEthernetUni.builder()
+                    .cp(ConnectPoint.deviceConnectPoint(ltpId))
+                    .role(role)
+                    .ceVlanId(generateVlanId(argCeVlanId))
+                    .bwp(CarrierEthernetBandwidthProfile.builder()
+                                 .id(ltpId)
+                                 .type(generateBandwidthProfileType())
+                                 .cir(Bandwidth.mbps(Double.parseDouble(argCir)))
+                                 .eir(Bandwidth.mbps(Double.parseDouble(argEir)))
+                                 .cbs(Long.parseLong(argCbs))
+                                 .ebs(Long.parseLong(argEbs))
+                                 .build())
+                    .build();
         } else if(ceManager.ltpMap().get(ltpId).ni() instanceof CarrierEthernetInni) {
             // FIXME: Use role properly
-            return new CarrierEthernetInni(ConnectPoint.deviceConnectPoint(ltpId), null,
-                    CarrierEthernetInni.Role.TRUNK, generateVlanId(argsTag), null, Bandwidth.bps((double) 0));
+            return CarrierEthernetInni.builder()
+                    .cp(ConnectPoint.deviceConnectPoint(ltpId))
+                    .role(CarrierEthernetInni.Role.TRUNK)
+                    .sVlanId(generateVlanId(argsTag))
+                    .usedCapacity(Bandwidth.bps((double) 0))
+                    .build();
         } else {
             // FIXME: Use role properly
-            return new CarrierEthernetEnni(ConnectPoint.deviceConnectPoint(ltpId), null,
-                    CarrierEthernetEnni.Role.HUB, generateVlanId(argsTag), null, Bandwidth.bps((double) 0));
+            return CarrierEthernetEnni.builder()
+                    .cp(ConnectPoint.deviceConnectPoint(ltpId))
+                    .role(CarrierEthernetEnni.Role.HUB)
+                    .sVlanId(generateVlanId(argsTag))
+                    .usedCapacity(Bandwidth.bps((double) 0))
+                    .build();
         }
     }