Use builders when available. Harmonized CE packet node service API.
Change-Id: Ibf5e7de179eed122397ede63789d749520112926
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/api/CarrierEthernetPacketNodeService.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/api/CarrierEthernetPacketNodeService.java
index f36a6c5..73438c0 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/api/CarrierEthernetPacketNodeService.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/api/CarrierEthernetPacketNodeService.java
@@ -57,10 +57,10 @@
/**
* Removes the meters associated with a specific UNI of an FC.
*
- * @param fcId the forwarding construct id
+ * @param fc the forwarding construct
* @param uni the user to network interface
*/
- void removeBandwidthProfileResources(String fcId, CarrierEthernetUni uni);
+ void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni);
/**
* Removes all installed flow objectives associated with a specific FC.
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
index b9d9e74..d234ea7 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetBandwidthProfile.java
@@ -24,7 +24,7 @@
* Bandwidth profile for a CE UNI.
*/
// TODO: Methods to associate a CE BWP to a generic BWP and a Meter
-public class CarrierEthernetBandwidthProfile {
+public final class CarrierEthernetBandwidthProfile {
public enum Type {
INTERFACE, EVC, COS
@@ -39,9 +39,7 @@
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,
+ private CarrierEthernetBandwidthProfile(String id, String cfgId, Type type,
Bandwidth cir, Bandwidth eir,
long cbs, long ebs) {
checkNotNull(cir, "BW Profile must have an associated CIR");
@@ -255,14 +253,12 @@
}
/**
- * Builds a new CarrierEthernetBandwidthProfile instance.
- * based on this builder's parameters
+ * 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);
+ return new CarrierEthernetBandwidthProfile(id, cfgId, type, cir, eir, cbs, ebs);
}
}
}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
index 8ffd3dd..0857918 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetEnni.java
@@ -21,19 +21,18 @@
import org.onosproject.net.ConnectPoint;
import org.slf4j.Logger;
+import java.util.Set;
import static com.google.common.base.MoreObjects.toStringHelper;
import static org.slf4j.LoggerFactory.getLogger;
-import java.util.Set;
-
/**
* Representation of a Carrier Ethernet ENNI.
* Class can be used in different two ways:
* 1. As a global ENNI descriptor containing one or more S-VLAN tags
* 2. As a service-specific ENNI descriptor containing a single S-VLAN tag and including a role (e.g. hub, spoke)
*/
-public class CarrierEthernetEnni extends CarrierEthernetNetworkInterface<CarrierEthernetEnni> {
+public final class CarrierEthernetEnni extends CarrierEthernetNetworkInterface<CarrierEthernetEnni> {
private final Logger log = getLogger(getClass());
@@ -61,9 +60,7 @@
protected Set<VlanId> sVlanIdSet;
String tpid;
- // TODO: Make constructor private when SCA/NRP API apps are migrated
- @Deprecated
- public CarrierEthernetEnni(ConnectPoint cp, String uniCfgId,
+ private CarrierEthernetEnni(ConnectPoint cp, String uniCfgId,
Role role, VlanId sVlanId, String tpid,
Bandwidth usedCapacity) {
super(cp, Type.ENNI, uniCfgId);
@@ -307,8 +304,7 @@
* @return a new CarrierEthernetEnni instance
*/
public CarrierEthernetEnni build() {
- return new CarrierEthernetEnni(cp, cfgId, role,
- sVlanId, tpid, usedCapacity);
+ return new CarrierEthernetEnni(cp, cfgId, role, sVlanId, tpid, usedCapacity);
}
}
}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetForwardingConstruct.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetForwardingConstruct.java
index 6b20e4b..863bde2 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetForwardingConstruct.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetForwardingConstruct.java
@@ -32,7 +32,7 @@
/**
* Representation of a CE Forwarding Construct.
*/
-public class CarrierEthernetForwardingConstruct extends CarrierEthernetConnection {
+public final class CarrierEthernetForwardingConstruct extends CarrierEthernetConnection {
private Set<CarrierEthernetLogicalTerminationPoint> ltpSet;
private VlanId vlanId;
@@ -42,9 +42,7 @@
// TODO: Remove id from constructor - currently used only when updating FC
// TODO: Add congruentPaths flag to constructor and Builder
- // TODO: Make constructor private when SCA/NRP API apps are migrated
- @Deprecated
- public CarrierEthernetForwardingConstruct(String id, String cfgId, Type type,
+ private CarrierEthernetForwardingConstruct(String id, String cfgId, Type type,
Set<CarrierEthernetLogicalTerminationPoint> ltpSet,
Duration maxLatency) {
super(id, cfgId, type, maxLatency);
@@ -179,7 +177,6 @@
private Type type;
private Duration maxLatency;
private Set<CarrierEthernetLogicalTerminationPoint> ltpSet;
- private boolean congruentPaths;
/**
* Sets the id of this builder.
@@ -246,8 +243,8 @@
checkNotNull(type, "FC must have a type");
checkArgument(ltpSet != null && ltpSet.size() > 1,
"FC must include at least two LTPs");
- return new CarrierEthernetForwardingConstruct(id, cfgId, type,
- ltpSet, maxLatency);
+
+ return new CarrierEthernetForwardingConstruct(id, cfgId, type, ltpSet, maxLatency);
}
}
}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
index efcbfb0..bcf9e6b 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetInni.java
@@ -22,19 +22,18 @@
import org.onosproject.net.ConnectPoint;
import org.slf4j.Logger;
+import java.util.Set;
import static com.google.common.base.MoreObjects.toStringHelper;
import static org.slf4j.LoggerFactory.getLogger;
-import java.util.Set;
-
/**
* Representation of a Carrier Ethernet INNI.
* Class can be used in different two ways:
* 1. As a global INNI descriptor containing one or more S-VLAN tags
* 2. As a service-specific INNI descriptor containing a single S-VLAN tag and including a role (e.g. hub, spoke)
*/
-public class CarrierEthernetInni extends CarrierEthernetNetworkInterface<CarrierEthernetInni> {
+public final class CarrierEthernetInni extends CarrierEthernetNetworkInterface<CarrierEthernetInni> {
private final Logger log = getLogger(getClass());
@@ -66,9 +65,7 @@
protected 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,
+ private CarrierEthernetInni(ConnectPoint connectPoint, String uniCfgId,
Role role, VlanId sVlanId, String tpid,
Bandwidth usedCapacity) {
@@ -313,8 +310,7 @@
* @return a new CarrierEthernetInni instance
*/
public CarrierEthernetInni build() {
- return new CarrierEthernetInni(cp, cfgId, role,
- sVlanId, tpid, usedCapacity);
+ return new CarrierEthernetInni(cp, cfgId, role, sVlanId, tpid, usedCapacity);
}
}
}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetManager.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetManager.java
index 9ce9fb2..bae654a 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetManager.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetManager.java
@@ -992,7 +992,10 @@
return null;
}
- return new CarrierEthernetUni(cp, uniId);
+ return CarrierEthernetUni.builder()
+ .cp(cp)
+ .cfgId(uniId)
+ .build();
}
@Override
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
index c76e819..fd5bd42 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetPacketNodeManager.java
@@ -413,19 +413,19 @@
}
@Override
- public void removeBandwidthProfileResources(String fcId, CarrierEthernetUni uni) {
- removeMeters(fcId, uni);
+ public void removeBandwidthProfileResources(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
+ removeMeters(fc, uni);
}
/**
* Removes the meters associated with a specific UNI of an FC.
*
- * @param fcId the EVC ID
+ * @param fc the forwarding construct
* @param uni the UNI descriptor
* */
- private void removeMeters(String fcId, CarrierEthernetUni uni) {
+ private void removeMeters(CarrierEthernetForwardingConstruct fc, CarrierEthernetUni uni) {
- Set<DeviceMeterId> newDeviceMeterIdSet = deviceMeterIdMap.get(fcId);
+ Set<DeviceMeterId> newDeviceMeterIdSet = deviceMeterIdMap.get(fc.id());
DeviceMeterId tmpDeviceMeterId;
Collection<Meter> meters = meterService.getMeters(uni.cp().deviceId());
@@ -435,7 +435,7 @@
Meter meter = it.next();
tmpDeviceMeterId = new DeviceMeterId(uni.cp().deviceId(), meter.id());
if (meter.appId().equals(appId) &&
- deviceMeterIdMap.get(fcId).contains(tmpDeviceMeterId)) {
+ deviceMeterIdMap.get(fc.id()).contains(tmpDeviceMeterId)) {
MeterRequest.Builder mBuilder;
mBuilder = DefaultMeterRequest.builder()
.fromApp(meter.appId())
@@ -450,7 +450,7 @@
}
}
- deviceMeterIdMap.put(fcId, newDeviceMeterIdSet);
+ deviceMeterIdMap.put(fc.id(), newDeviceMeterIdSet);
}
@Override
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetProvisioner.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetProvisioner.java
index a4d887a..57423b0 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetProvisioner.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetProvisioner.java
@@ -53,8 +53,11 @@
import static org.slf4j.LoggerFactory.getLogger;
+/**
+ * Carrier Ethernet provisioner of connectivity for forwarding constructs and bandwidth profiles.
+ */
@Component(immediate = true)
-@Service ()
+@Service
public class CarrierEthernetProvisioner implements CarrierEthernetProvisionerService {
private final Logger log = getLogger(getClass());
@@ -350,7 +353,7 @@
// TODO: Select node manager depending on device protocol
fc.ltpSet().forEach((ltp -> {
if (ltp.ni().type().equals(CarrierEthernetNetworkInterface.Type.UNI)) {
- cePktNodeService.removeBandwidthProfileResources(fc.id(), (CarrierEthernetUni) ltp.ni());
+ cePktNodeService.removeBandwidthProfileResources(fc, (CarrierEthernetUni) ltp.ni());
}
}));
}
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
index 11b2beb..a7beec9 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetUni.java
@@ -22,23 +22,22 @@
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.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Representation of a Carrier Ethernet UNI.
* Class can be used in different two ways:
* 1. As a global UNI descriptor containing one or more BW profiles
* 2. As a service-specific UNI descriptor containing a single BW profile and including a type (root, leaf)
*/
-public class CarrierEthernetUni extends CarrierEthernetNetworkInterface<CarrierEthernetUni> {
+public final class CarrierEthernetUni extends CarrierEthernetNetworkInterface<CarrierEthernetUni> {
private final Logger log = getLogger(getClass());
@@ -68,9 +67,7 @@
// TODO: May be needed to add refCount for CoS BWPs - only applicable to global UNIs
// 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,
+ private CarrierEthernetUni(ConnectPoint cp, String uniCfgId, Role role,
VlanId ceVlanId,
CarrierEthernetBandwidthProfile bwp) {
super(cp, Type.UNI, uniCfgId);
@@ -104,14 +101,6 @@
}
}
- public CarrierEthernetUni(ConnectPoint cp, String uniCfgId) {
- super(cp, Type.UNI, uniCfgId);
- this.scope = Scope.GLOBAL;
- for (CarrierEthernetBandwidthProfile.Type bwpType : CarrierEthernetBandwidthProfile.Type.values()) {
- this.bwpMap.put(bwpType, new HashMap<>());
- }
- }
-
/**
* Adds a BW profile to a UNI.
*
diff --git a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetVirtualConnection.java b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetVirtualConnection.java
index 61722da..4203714 100644
--- a/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetVirtualConnection.java
+++ b/carrierethernet/src/main/java/org/onosproject/ecord/carrierethernet/app/CarrierEthernetVirtualConnection.java
@@ -28,7 +28,7 @@
/**
* Representation of a Carrier Ethernet EVC.
*/
-public class CarrierEthernetVirtualConnection extends CarrierEthernetConnection {
+public final class CarrierEthernetVirtualConnection extends CarrierEthernetConnection {
private Short shortId;
private Set<CarrierEthernetUni> uniSet;
@@ -40,9 +40,7 @@
public static final Integer MAX_NUM_UNI = 1000;
// TODO: Remove id from constructor - currently used only when updating EVC
- // TODO: Make constructor private when SCA/NRP API apps are migrated
- @Deprecated
- public CarrierEthernetVirtualConnection(String id, String cfgId, Type type,
+ private CarrierEthernetVirtualConnection(String id, String cfgId, Type type,
Integer maxNumUni,
Set<CarrierEthernetUni> uniSet,
Duration maxLatency) {
@@ -245,9 +243,7 @@
checkNotNull(type, "EVC must have a type");
checkArgument(uniSet != null && uniSet.size() > 1,
"EVC must include at least two UNIs");
- return new CarrierEthernetVirtualConnection(id, cfgId, type,
- maxNumUni, uniSet,
- maxLatency);
+ return new CarrierEthernetVirtualConnection(id, cfgId, type, maxNumUni, uniSet, maxLatency);
}
}
}
diff --git a/mef-nrp-api/src/main/java/org/onosproject/mefnrpapi/translate/NrpApiTranslator.java b/mef-nrp-api/src/main/java/org/onosproject/mefnrpapi/translate/NrpApiTranslator.java
index 317a016..00ddb4c 100644
--- a/mef-nrp-api/src/main/java/org/onosproject/mefnrpapi/translate/NrpApiTranslator.java
+++ b/mef-nrp-api/src/main/java/org/onosproject/mefnrpapi/translate/NrpApiTranslator.java
@@ -15,15 +15,7 @@
*/
package org.onosproject.mefnrpapi.translate;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.annotations.Beta;
import org.onlab.packet.VlanId;
import org.onlab.util.Bandwidth;
import org.onosproject.cli.AbstractShellCommand;
@@ -65,7 +57,14 @@
import org.onosproject.net.device.DeviceService;
import org.slf4j.Logger;
-import com.google.common.annotations.Beta;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
/**
* Methods for translating between NRP swagger-generated Java classes and corresponding ONOS Java classes.
@@ -162,7 +161,13 @@
ceLtpSet.add(ceLtp);
});
- return new CarrierEthernetForwardingConstruct(fcId, null, fcType, ceLtpSet, null);
+ return CarrierEthernetForwardingConstruct.builder()
+ .id(fcId)
+ .cfgId(null)
+ .type(fcType)
+ .ltpSet(ceLtpSet)
+ .maxLatency(null)
+ .build();
}
public static LogicalTerminationPoint fromCarrierEthernetLtp(CarrierEthernetLogicalTerminationPoint ceLtp) {
@@ -319,7 +324,13 @@
// Create a global UNI and then for each CE-VLAN ID add a new one to it
// TODO: What to do with the BW profiles?
- CarrierEthernetUni ceGlobalUni = new CarrierEthernetUni(ceLtpCp, ceLtpCfgId, null, null, null);
+ CarrierEthernetUni ceGlobalUni = CarrierEthernetUni.builder()
+ .cp(ceLtpCp)
+ .cfgId(ceLtpCfgId)
+ .role(null)
+ .ceVlanId(null)
+ .bwp(null)
+ .build();
// Get info from TerminationSpec
// TODO: What exactly should we get?
@@ -353,8 +364,13 @@
.valueOf(nrpEndPointRole.getRole().name());
// Create service UNI
- CarrierEthernetUni ceServiceUni = new CarrierEthernetUni(ceLtpCp, ceLtpCfgId,
- ceUniRole, ceVlanId, null);
+ CarrierEthernetUni ceServiceUni = CarrierEthernetUni.builder()
+ .cp(ceLtpCp)
+ .cfgId(ceLtpCfgId)
+ .role(ceUniRole)
+ .ceVlanId(ceVlanId)
+ .bwp(null)
+ .build();
// Add service UNI to globalUni
ceGlobalUni.addEcNi(ceServiceUni);
@@ -384,7 +400,14 @@
} else if (nrpTerminationSpec.getNrpInniTerminationSpec() != null) {
// Create a global INNI and then for each S-TAG add a new one to it
- CarrierEthernetInni ceGlobalInni = new CarrierEthernetInni(ceLtpCp, ceLtpCfgId, null, null, null, null);
+ CarrierEthernetInni ceGlobalInni = CarrierEthernetInni.builder()
+ .cp(ceLtpCp)
+ .cfgId(ceLtpCfgId)
+ .role(null)
+ .sVlanId(null)
+ .tpid(null)
+ .usedCapacity(null)
+ .build();
// Get info from TerminationSpec
// TODO: What exactly should we get?
@@ -416,9 +439,14 @@
.valueOf(nrpEndPointRole.getRole().name());
// Create service INNI
- CarrierEthernetInni ceServiceInni =
- new CarrierEthernetInni(ceLtpCp, ceLtpCfgId, ceInniRole,
- VlanId.vlanId(sVlanId), tpid, Bandwidth.bps((double) 0));
+ CarrierEthernetInni ceServiceInni = CarrierEthernetInni.builder()
+ .cp(ceLtpCp)
+ .cfgId(ceLtpCfgId)
+ .role(ceInniRole)
+ .sVlanId(VlanId.vlanId(sVlanId))
+ .tpid(tpid)
+ .usedCapacity(Bandwidth.bps((double) 0))
+ .build();
// Add service INNI to global INNI
ceGlobalInni.addEcNi(ceServiceInni);
@@ -468,13 +496,20 @@
}
ceBwpCfgId = ingressBwpPerEvc.getBwpCfgIdentifier();
ceBwpType = CarrierEthernetBandwidthProfile.Type.EVC;
- return new CarrierEthernetBandwidthProfile(ceBwpId, ceBwpCfgId, ceBwpType,
- ((ingressBwpPerEvc.getBwpCfgCir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerEvc.getBwpCfgCir())),
- ((ingressBwpPerEvc.getBwpCfgEir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerEvc.getBwpCfgEir())),
- ((ingressBwpPerEvc.getBwpCfgCbs() == null) ? 0L : (long) ingressBwpPerEvc.getBwpCfgCbs()),
- ((ingressBwpPerEvc.getBwpCfgEbs() == null) ? 0L : (long) ingressBwpPerEvc.getBwpCfgEbs()));
+
+ return CarrierEthernetBandwidthProfile.builder()
+ .id(ceBwpId)
+ .cfgId(ceBwpCfgId)
+ .type(ceBwpType)
+ .cir((ingressBwpPerEvc.getBwpCfgCir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerEvc.getBwpCfgCir()))
+ .eir((ingressBwpPerEvc.getBwpCfgEir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerEvc.getBwpCfgEir()))
+ .cbs((ingressBwpPerEvc.getBwpCfgCbs() == null) ?
+ 0L : (long) ingressBwpPerEvc.getBwpCfgCbs())
+ .ebs((ingressBwpPerEvc.getBwpCfgEbs() == null) ?
+ 0L : (long) ingressBwpPerEvc.getBwpCfgEbs())
+ .build();
} else if (interfaceIngressBwp != null) {
if (ingressBwpPerCos != null) {
log.error("Only one BW profile can be set per UNI");
@@ -485,13 +520,20 @@
nrpLtp.getPhysicalPortReference().getPort();
ceBwpCfgId = interfaceIngressBwp.getBwpCfgIdentifier();
ceBwpType = CarrierEthernetBandwidthProfile.Type.INTERFACE;
- return new CarrierEthernetBandwidthProfile(ceBwpId, ceBwpCfgId, ceBwpType,
- ((interfaceIngressBwp.getBwpCfgCir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(interfaceIngressBwp.getBwpCfgCir())),
- ((interfaceIngressBwp.getBwpCfgEir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(interfaceIngressBwp.getBwpCfgEir())),
- ((interfaceIngressBwp.getBwpCfgCbs() == null) ? 0L : (long) interfaceIngressBwp.getBwpCfgCbs()),
- ((interfaceIngressBwp.getBwpCfgEbs() == null) ? 0L : (long) interfaceIngressBwp.getBwpCfgEbs()));
+
+ return CarrierEthernetBandwidthProfile.builder()
+ .id(ceBwpId)
+ .cfgId(ceBwpCfgId)
+ .type(ceBwpType)
+ .cir((interfaceIngressBwp.getBwpCfgCir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(interfaceIngressBwp.getBwpCfgCir()))
+ .eir((interfaceIngressBwp.getBwpCfgEir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(interfaceIngressBwp.getBwpCfgEir()))
+ .cbs((interfaceIngressBwp.getBwpCfgCbs() == null) ?
+ 0L : (long) interfaceIngressBwp.getBwpCfgCbs())
+ .ebs((interfaceIngressBwp.getBwpCfgEbs() == null) ?
+ 0L : (long) interfaceIngressBwp.getBwpCfgEbs())
+ .build();
} else if (ingressBwpPerCos != null) {
ceBwpId = ingressBwpPerCos.getNrpCosName();
if (ceBwpId == null) {
@@ -501,13 +543,20 @@
ceBwpCfgId = ingressBwpPerCos.getNrpCosName();
ceBwpType = CarrierEthernetBandwidthProfile.Type.COS;
NRPBwpFlow ingressBwpPerCosBwp = ingressBwpPerCos.getNrpBwpflow();
- return new CarrierEthernetBandwidthProfile(ceBwpId, ceBwpCfgId, ceBwpType,
- ((ingressBwpPerCosBwp.getBwpCfgCir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerCosBwp.getBwpCfgCir())),
- ((ingressBwpPerCosBwp.getBwpCfgEir() == null) ?
- Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerCosBwp.getBwpCfgEir())),
- ((ingressBwpPerCosBwp.getBwpCfgCbs() == null) ? 0L : (long) ingressBwpPerCosBwp.getBwpCfgCbs()),
- ((ingressBwpPerCosBwp.getBwpCfgEbs() == null) ? 0L : (long) ingressBwpPerCosBwp.getBwpCfgEbs()));
+
+ return CarrierEthernetBandwidthProfile.builder()
+ .id(ceBwpId)
+ .cfgId(ceBwpCfgId)
+ .type(ceBwpType)
+ .cir((ingressBwpPerCosBwp.getBwpCfgCir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerCosBwp.getBwpCfgCir()))
+ .eir((ingressBwpPerCosBwp.getBwpCfgEir() == null) ?
+ Bandwidth.bps(0) : Bandwidth.bps(ingressBwpPerCosBwp.getBwpCfgEir()))
+ .cbs((ingressBwpPerCosBwp.getBwpCfgCbs() == null) ?
+ 0L : (long) ingressBwpPerCosBwp.getBwpCfgCbs())
+ .ebs((ingressBwpPerCosBwp.getBwpCfgEbs() == null) ?
+ 0L : (long) ingressBwpPerCosBwp.getBwpCfgEbs())
+ .build();
} else {
log.error("Could not find valid BW profile for LTP {}", nrpLtp.getId());
return null;