Refactor of CFM code part 5 - SonarQube recommended code changes
previously:
Refactor of CFM code part 4 - Microsemi driver - updating modules.deps with the move of the driver code
Refactor of CFM code part 3 - Microsemi driver: moved everything out of drivers/microsemi to /drivers/microsemi/ea1000 to make room for future drivers
Refactor of CFM code parti 2 - API: moved everything from incubator/*/src/main/java/org/onosproject/incubator/net/l2monitoring to apps/cfm/*/src/main/java/org/onosproject/incubator/net/l2monitoring - this means that services belonging to l2 monitoring will now only be loaded when cfm app is started
Refactor of CFM code part 1 - NBI: moves the CLI and REST part of the app down a level to an nbi folder for a more consistent approach with other modules
Change-Id: I39b302fd8620f59d34ab41208cbc28765951aad4
diff --git a/apps/cfm/README.md b/apps/cfm/README.md
deleted file mode 100644
index c2c27fa..0000000
--- a/apps/cfm/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Layer 2 Monitoring with CFM and SOAM in ONOS
-Please see the README.md file in the API at
-incubator/api/src/main/java/org/onosproject/incubator/net/l2monitoring/README.md
\ No newline at end of file
diff --git a/apps/cfm/api/README.md b/apps/cfm/api/README.md
index 6123509..1f23f54 100644
--- a/apps/cfm/api/README.md
+++ b/apps/cfm/api/README.md
@@ -44,8 +44,8 @@
ONOS as a new structure under reusing common ONOS classes such as DeviceId,
PortNumber, NetworkResource, Identifier, MacAddress etc.
-* onos/incubator/src/main/java/org/onosproject/api/net/l2monitoring/cfm
-* onos/incubator/src/main/java/org/onosproject/api/net/l2monitoring/soam
+* onos/apps/cfm/api/src/main/java/org/onosproject/l2monitoring/cfm
+* onos/apps/cfm/api/src/main/java/org/onosproject/l2monitoring/soam
## Java Model
These immutable objects are defined as Java POJOs with little dependencies on
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Component.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Component.java
index 9c3e726..b559ee1 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Component.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Component.java
@@ -24,7 +24,7 @@
/**
* Components which can be managed in a manner equivalent to an 802.1Q bridge.
*
- * Direct child of the {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation}.
+ * Direct child of the {@link MaintenanceAssociation}.
*/
public interface Component {
@@ -59,7 +59,7 @@
TagType tagType();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.Component}.
+ * Builder for {@link Component}.
*/
interface ComponentBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultComponent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultComponent.java
index e8f43ae..39b4a6b 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultComponent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultComponent.java
@@ -22,7 +22,7 @@
import org.onlab.packet.VlanId;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.Component}.
+ * The default implementation of {@link Component}.
*/
public final class DefaultComponent implements Component {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceAssociation.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceAssociation.java
index 38c3d6f..9da0f21 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceAssociation.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceAssociation.java
@@ -26,7 +26,7 @@
import com.google.common.collect.Lists;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation}.
+ * The default implementation of {@link MaintenanceAssociation}.
*/
public final class DefaultMaintenanceAssociation implements MaintenanceAssociation {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceDomain.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceDomain.java
index c6e16b0..b073d89 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceDomain.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMaintenanceDomain.java
@@ -26,7 +26,7 @@
import com.google.common.collect.Lists;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain}.
+ * The default implementation of {@link MaintenanceDomain}.
*/
public final class DefaultMaintenanceDomain implements MaintenanceDomain {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMep.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMep.java
index 72c9769..8e5c4dd 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMep.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMep.java
@@ -26,7 +26,7 @@
import org.onosproject.net.PortNumber;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep}.
+ * The default implementation of {@link Mep}.
*/
public class DefaultMep implements Mep {
@@ -334,7 +334,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep}.
+ * Builder for {@link Mep}.
*/
protected static class DefaultMepBuilder implements Mep.MepBuilder {
protected final MepId mepId;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepEntry.java
index 1fa255e..edbe643 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepEntry.java
@@ -33,7 +33,7 @@
import com.google.common.collect.Lists;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MepEntry}.
+ * The default implementation of {@link MepEntry}.
*/
public final class DefaultMepEntry extends DefaultMep implements MepEntry {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbCreate.java
index b6eb62a..5bc9e07 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbCreate.java
@@ -19,11 +19,10 @@
import org.onlab.packet.MacAddress;
import org.onlab.util.HexString;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbCreate}.
+ * The default implementation of {@link MepLbCreate}.
*/
public final class DefaultMepLbCreate implements MepLbCreate {
@@ -31,7 +30,7 @@
private final MepId remoteMepId;
private final Integer numberMessages;
private final String dataTlvHex;
- private final Priority vlanPriority;
+ private final Mep.Priority vlanPriority;
private final Boolean vlanDropEligible;
private DefaultMepLbCreate(DefaultMepLbCreateBuilder builder) {
@@ -64,7 +63,7 @@
}
@Override
- public Priority vlanPriority() {
+ public Mep.Priority vlanPriority() {
return vlanPriority;
}
@@ -86,7 +85,7 @@
private final MepId remoteMepId;
private Integer numberMessages;
private String dataTlvHex;
- private Priority vlanPriority;
+ private Mep.Priority vlanPriority;
private Boolean vlanDropEligible;
private DefaultMepLbCreateBuilder(MacAddress remoteMepAddress) {
@@ -126,7 +125,7 @@
}
@Override
- public MepLbCreateBuilder vlanPriority(Priority vlanPriority) {
+ public MepLbCreateBuilder vlanPriority(Mep.Priority vlanPriority) {
this.vlanPriority = vlanPriority;
return this;
}
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbEntry.java
index 0ebe47b..74604a2 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLbEntry.java
@@ -16,7 +16,7 @@
package org.onosproject.incubator.net.l2monitoring.cfm;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry}.
+ * The default implementation of {@link MepLbEntry}.
*/
public final class DefaultMepLbEntry implements MepLbEntry {
private final long nextLbmIdentifier;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLtCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLtCreate.java
index 790278a..665a015 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLtCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultMepLtCreate.java
@@ -21,7 +21,7 @@
import java.util.BitSet;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtCreate}.
+ * The default implementation of {@link MepLtCreate}.
*/
public final class DefaultMepLtCreate implements MepLtCreate {
private final MacAddress remoteMepAddress;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultRemoteMepEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultRemoteMepEntry.java
index 377ddde..8a83e5e 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultRemoteMepEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/DefaultRemoteMepEntry.java
@@ -23,7 +23,7 @@
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry}.
+ * The default implementation of {@link RemoteMepEntry}.
*/
public class DefaultRemoteMepEntry implements RemoteMepEntry {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceAssociation.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceAssociation.java
index 37c1a84..2b205a2 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceAssociation.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceAssociation.java
@@ -27,7 +27,7 @@
* A model of the Maintenance Association.
*
* See IEEE 802.1Q Section 12.14 CFM entities
- * Direct child of {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain}
+ * Direct child of {@link MaintenanceDomain}
*/
public interface MaintenanceAssociation extends NetworkResource {
/**
@@ -105,7 +105,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation}.
+ * Builder for {@link MaintenanceAssociation}.
*/
interface MaBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceDomain.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceDomain.java
index f98b76b..da5f89b 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceDomain.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MaintenanceDomain.java
@@ -17,9 +17,24 @@
import java.util.Collection;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
+import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatHistory;
+import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate;
+import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementEntry;
+import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatCurrent;
+import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory;
import org.onosproject.net.NetworkResource;
/**
@@ -28,37 +43,37 @@
* See IEEE 802.1Q Section 12.14.5.1.3 CFM entities.<br>
* This is the root of the L2 Monitoring hierarchy<br>
* |-Maintenance-Domain*<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId}
+ * |-{@link MdId}
* (MdIdCharStr or MdIdDomainName or MdIdMacUint or MdIdNone)<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation Maintenance-Association}*<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort}
- * ({@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr}
- * or {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid}
- * or {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet}
- * or {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId}
- * or {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731})<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.Component}*<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.Mep}* (Maintenance-Association-EndPoint)
- * and {@link org.onosproject.incubator.net.l2monitoring.cfm.MepEntry}*<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId}<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry}<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtEntry}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtTransactionEntry}*<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtReply}*<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.SenderIdTlv}<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate} (SOAM)*
- * and {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.SoamId DmId}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatHistory}*<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate} (SOAM)*
- * and {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementEntry}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.SoamId LmId}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatCurrent}<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory}*<br>
- * | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry}*<br>
- * | | |-{@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId RemoteMepId}<br>
- * |-{@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId RemoteMepId}*<br>
+ * |-{@link MaintenanceAssociation Maintenance-Association}*<br>
+ * |-{@link MaIdShort}
+ * ({@link MaIdCharStr}
+ * or {@link MaIdPrimaryVid}
+ * or {@link MaId2Octet}
+ * or {@link MaIdRfc2685VpnId}
+ * or {@link MaIdIccY1731})<br>
+ * |-{@link Component}*<br>
+ * |-{@link Mep}* (Maintenance-Association-EndPoint)
+ * and {@link MepEntry}*<br>
+ * | |-{@link MepId}<br>
+ * | |-{@link MepLbEntry}<br>
+ * | |-{@link MepLtEntry}<br>
+ * | | |-{@link MepLtTransactionEntry}*<br>
+ * | | |-{@link MepLtReply}*<br>
+ * | | |-{@link SenderIdTlv}<br>
+ * | |-{@link DelayMeasurementCreate} (SOAM)*
+ * and {@link DelayMeasurementEntry}<br>
+ * | | |-{@link SoamId DmId}<br>
+ * | | |-{@link DelayMeasurementStatCurrent}<br>
+ * | | |-{@link DelayMeasurementStatHistory}*<br>
+ * | |-{@link LossMeasurementCreate} (SOAM)*
+ * and {@link LossMeasurementEntry}<br>
+ * | | |-{@link SoamId LmId}<br>
+ * | | |-{@link LossMeasurementStatCurrent}<br>
+ * | | |-{@link LossMeasurementStatHistory}*<br>
+ * | |-{@link RemoteMepEntry}*<br>
+ * | | |-{@link MepId RemoteMepId}<br>
+ * |-{@link MepId RemoteMepId}*<br>
*<br>
* *above indicates 0-many can be created
* -Create suffix means the Object is part of a request
@@ -107,7 +122,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain}.
+ * Builder for {@link MaintenanceDomain}.
*/
interface MdBuilder {
MdBuilder mdLevel(MdLevel mdLevel);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Mep.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Mep.java
index ff06932..a31799f 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Mep.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/Mep.java
@@ -212,7 +212,7 @@
/**
* Supported FNG Address Types.
- * See {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep.FngAddress}
+ * See {@link Mep.FngAddress}
*/
public enum FngAddressType {
IPV4,
@@ -235,7 +235,7 @@
/**
* Options for setting the lowest fault defect.
- * Each comprises a set of {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep.FaultDefectType}
+ * Each comprises a set of {@link Mep.FaultDefectType}
*/
public enum LowestFaultDefect {
ALL_DEFECTS(FaultDefectType.DEF_RDI_CCM,
@@ -344,7 +344,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep}.
+ * Builder for {@link Mep}.
*/
interface MepBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepEntry.java
index 5259ec6..e1c3846 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepEntry.java
@@ -145,7 +145,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepEntry}.
+ * Builder for {@link MepEntry}.
*/
interface MepEntryBuilder extends MepBuilder {
MepEntryBuilder macAddress(MacAddress macAddress);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbCreate.java
index cdb02ca..e167fc9 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbCreate.java
@@ -16,7 +16,6 @@
package org.onosproject.incubator.net.l2monitoring.cfm;
import org.onlab.packet.MacAddress;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
/**
@@ -54,7 +53,7 @@
* [802.1q] 12.14.7.3.2:e
* @return The priority to be used
*/
- Priority vlanPriority();
+ Mep.Priority vlanPriority();
/**
* The drop eligible parameter to be used in the transmitted LBMs.
@@ -63,7 +62,7 @@
Boolean vlanDropEligible();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbCreate}.
+ * Builder for {@link MepLbCreate}.
*/
interface MepLbCreateBuilder {
MepLbCreateBuilder numberMessages(int numberMessages);
@@ -89,7 +88,7 @@
*/
MepLbCreateBuilder dataTlvB64(String dataTlv);
- MepLbCreateBuilder vlanPriority(Priority vlanPriority);
+ MepLbCreateBuilder vlanPriority(Mep.Priority vlanPriority);
MepLbCreateBuilder vlanDropEligible(boolean vlanDropEligible);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbEntry.java
index fe72023..a1468d9 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLbEntry.java
@@ -58,7 +58,7 @@
long countLbrMacMisMatch();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry}.
+ * Builder for {@link MepLbEntry}.
*/
interface MepLbEntryBuilder {
MepLbEntryBuilder nextLbmIdentifier(long nextLbmIdentifier);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtCreate.java
index adf472b..7d39152 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtCreate.java
@@ -53,7 +53,7 @@
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtCreate}.
+ * Builder for {@link MepLtCreate}.
*/
interface MepLtCreateBuilder {
MepLtCreateBuilder transmitLtmFlags(BitSet transmitLtmFlags);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtEntry.java
index 310b58a..96b7fc4 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtEntry.java
@@ -49,7 +49,7 @@
Collection<MepLtTransactionEntry> linktraceDatabase();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtEntry}.
+ * Builder for {@link MepLtEntry}.
*/
interface MepLtEntryBuilder {
MepLtEntryBuilder nextLtmIdentifier(int nextLtmIdentifier);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtReply.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtReply.java
index 4fa0004..4ec43f4 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtReply.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtReply.java
@@ -63,7 +63,7 @@
LtrReply ltrRelay();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtReply}.
+ * Builder for {@link MepLtReply}.
*/
public interface MepLtReplyBuilder {
MepLtReplyBuilder replyOrder(int replyOrder);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtTransactionEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtTransactionEntry.java
index 82ddfe1..0838183 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtTransactionEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepLtTransactionEntry.java
@@ -69,7 +69,7 @@
Collection<MepLtReply> ltrReplies();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtTransactionEntry}.
+ * Builder for {@link MepLtTransactionEntry}.
*/
interface MepLtEntryBuilder {
MepLtEntryBuilder macAddress(MacAddress macAddress);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepTsCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepTsCreate.java
index fce75aa..3df59e1 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepTsCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/MepTsCreate.java
@@ -62,7 +62,7 @@
Optional<TestType> testType();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.MepTsCreate}.
+ * Builder for {@link MepTsCreate}.
*/
interface MepTsCreateBuilder {
MepTsCreateBuilder isReceiver(Optional<Boolean> isReceiver);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/RemoteMepEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/RemoteMepEntry.java
index 91d45d8..09ca3f7 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/RemoteMepEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/RemoteMepEntry.java
@@ -73,7 +73,7 @@
SenderIdTlvType senderIdTlvType();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.cfm.RemoteMepEntry}.
+ * Builder for {@link RemoteMepEntry}.
*/
public interface RemoteMepEntryBuilder {
RemoteMepEntryBuilder failedOrOkTime(Duration failedOrOkTime);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MaIdShort.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MaIdShort.java
index 6e1d6fb..bac5dbd 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MaIdShort.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MaIdShort.java
@@ -50,23 +50,23 @@
*/
enum MaIdType {
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr}.
+ * Implemented as {@link MaIdCharStr}.
*/
CHARACTERSTRING,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet}.
+ * Implemented as {@link MaId2Octet}.
*/
TWOOCTET,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731}.
+ * Implemented as {@link MaIdIccY1731}.
*/
ICCY1731,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid}.
+ * Implemented as {@link MaIdPrimaryVid}.
*/
PRIMARYVID,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId}.
+ * Implemented as {@link MaIdRfc2685VpnId}.
*/
RFC2685VPNID
}
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdId.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdId.java
index 4d82f51..a94ccbe 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdId.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdId.java
@@ -56,19 +56,19 @@
*/
enum MdNameType {
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr}.
+ * Implemented as {@link MdIdCharStr}.
*/
CHARACTERSTRING,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName}.
+ * Implemented as {@link MdIdDomainName}.
*/
DOMAINNAME,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint}.
+ * Implemented as {@link MdIdMacUint}.
*/
MACANDUINT,
/**
- * Implemented as {@link org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone}.
+ * Implemented as {@link MdIdNone}.
*/
NONE
}
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdMaNameUtil.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdMaNameUtil.java
new file mode 100644
index 0000000..661cf15
--- /dev/null
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/identifier/MdMaNameUtil.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.net.l2monitoring.cfm.identifier;
+
+/**
+ * Utility for generating an MaIdShort or MdId from string.
+ */
+public final class MdMaNameUtil {
+
+ private MdMaNameUtil() {
+ //Singleton
+ }
+
+ /**
+ * Create an MdId from a pair of strings.
+ * @param mdNameType the name type
+ * @param mdName the name
+ * @return an MdId
+ */
+ public static MdId parseMdName(String mdNameType, String mdName) {
+ MdId.MdNameType nameTypeEnum = MdId.MdNameType.valueOf(mdNameType);
+ switch (nameTypeEnum) {
+ case DOMAINNAME:
+ return MdIdDomainName.asMdId(mdName);
+ case MACANDUINT:
+ return MdIdMacUint.asMdId(mdName);
+ case NONE:
+ return MdIdNone.asMdId();
+ case CHARACTERSTRING:
+ default:
+ return MdIdCharStr.asMdId(mdName);
+ }
+ }
+
+ /**
+ * Create an MaIdShort from a pair of strings.
+ * @param maNameType the name type
+ * @param maName the name
+ * @return an MaIdShort
+ */
+ public static MaIdShort parseMaName(String maNameType, String maName) {
+ MaIdShort.MaIdType nameTypeEnum = MaIdShort.MaIdType.valueOf(maNameType);
+ switch (nameTypeEnum) {
+ case ICCY1731:
+ return MaIdIccY1731.asMaId(maName);
+ case PRIMARYVID:
+ return MaIdPrimaryVid.asMaId(maName);
+ case RFC2685VPNID:
+ return MaIdRfc2685VpnId.asMaIdHex(maName);
+ case TWOOCTET:
+ return MaId2Octet.asMaId(maName);
+ case CHARACTERSTRING:
+ default:
+ return MaIdCharStr.asMaId(maName);
+ }
+ }
+}
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepListener.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepListener.java
index 655823f..4b74f01 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepListener.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepListener.java
@@ -18,7 +18,7 @@
import org.onosproject.event.EventListener;
/**
- * Entity capable of receiving {@link org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMepEvent} events.
+ * Entity capable of receiving {@link CfmMepEvent} events.
*/
public interface CfmMepListener extends EventListener<CfmMepEvent> {
}
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepService.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepService.java
index c774c65..33fbf63 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepService.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepService.java
@@ -33,7 +33,7 @@
public interface CfmMepService
extends ListenerService<CfmMepEvent, CfmMepListener>, CfmMepServiceBase {
/**
- * Retrieve all {@link org.onosproject.incubator.net.l2monitoring.cfm.MepEntry}(s) belonging to an MA.
+ * Retrieve all {@link MepEntry}(s) belonging to an MA.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @return A collection of MEP Entries
@@ -43,7 +43,7 @@
throws CfmConfigException;
/**
- * Retrieve all {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep}(s) belonging to an MA.
+ * Retrieve all {@link Mep}(s) belonging to an MA.
* Note: This just returns the configuration part of the Mep, not the MepEntry
* which contains config and state
* @param deviceId A device id
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepServiceBase.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepServiceBase.java
index 71e5611..2fdb4cc 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepServiceBase.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/CfmMepServiceBase.java
@@ -19,16 +19,21 @@
import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
import org.onosproject.incubator.net.l2monitoring.cfm.MepEntry;
import org.onosproject.incubator.net.l2monitoring.cfm.MepLbCreate;
+import org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry;
import org.onosproject.incubator.net.l2monitoring.cfm.MepLtCreate;
+import org.onosproject.incubator.net.l2monitoring.cfm.MepLtEntry;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import java.util.Optional;
+/**
+ * A common base interface for Mep service.
+ */
public interface CfmMepServiceBase {
/**
- * Retrieve a named {@link org.onosproject.incubator.net.l2monitoring.cfm.MepEntry} belonging to an MA.
+ * Retrieve a named {@link MepEntry} belonging to an MA.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mepId A Mep Id
@@ -39,7 +44,7 @@
throws CfmConfigException;
/**
- * Delete a named {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep} belonging to an MA.
+ * Delete a named {@link Mep} belonging to an MA.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mepId A Mep Id
@@ -51,7 +56,7 @@
throws CfmConfigException;
/**
- * Create a named {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep} on an MA.
+ * Create a named {@link Mep} on an MA.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mep A Mep object
@@ -62,7 +67,7 @@
throws CfmConfigException;
/**
- * Create a {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry Loopback} session on the named Mep.
+ * Create a {@link MepLbEntry Loopback} session on the named Mep.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mepId A Mep Id
@@ -73,7 +78,7 @@
MepLbCreate lbCreate) throws CfmConfigException;
/**
- * Abort a {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry Loopback} session on the named Mep.
+ * Abort a {@link MepLbEntry Loopback} session on the named Mep.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mepId A Mep Id
@@ -83,7 +88,7 @@
throws CfmConfigException;
/**
- * Create a {@link org.onosproject.incubator.net.l2monitoring.cfm.MepLtEntry Linktrace} session on the named Mep.
+ * Create a {@link MepLtEntry Linktrace} session on the named Mep.
* @param mdName A Maintenance Domain
* @param maName A Maintetance Association in the MD
* @param mepId A Mep Id
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MdStore.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MdStore.java
index 26a3933..a4c6a90 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MdStore.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MdStore.java
@@ -23,7 +23,7 @@
import java.util.Optional;
/**
- * {@link org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain Maintenance Domain's} storage interface.
+ * {@link MaintenanceDomain Maintenance Domain's} storage interface.
* Note: because the MaintenanceDomain is immutable if anything needs to be
* changed in it, then it must be replaced in the store. This includes adding
* and deleting Maintenance Associations from an MD.
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MepStore.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MepStore.java
index ed4bb35..d00c3e1 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MepStore.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/service/MepStore.java
@@ -26,7 +26,7 @@
import java.util.Optional;
/**
- * {@link org.onosproject.incubator.net.l2monitoring.cfm.Mep Maintenance Association Endpoint's} storage interface.
+ * {@link Mep Maintenance Association Endpoint's} storage interface.
* Note: because the Mep is immutable if anything needs to be
* changed in it, then it must be replaced in the store.
*/
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/DefaultMeasurementCreateBase.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/DefaultMeasurementCreateBase.java
index 62b9e3a..a0c0b83 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/DefaultMeasurementCreateBase.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/DefaultMeasurementCreateBase.java
@@ -27,7 +27,7 @@
import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
/**
- * Abstract implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.MeasurementCreateBase}.
+ * Abstract implementation of {@link MeasurementCreateBase}.
*/
public abstract class DefaultMeasurementCreateBase
implements MeasurementCreateBase {
@@ -144,7 +144,7 @@
/**
* Abstract Builder class for building.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.MeasurementCreateBase}.
+ * {@link MeasurementCreateBase}.
*/
protected abstract static class DefaultMeasCreateBaseBuilder implements MeasCreateBaseBuilder {
protected final Version version;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/MeasurementCreateBase.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/MeasurementCreateBase.java
index 89428b0..b1debde 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/MeasurementCreateBase.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/MeasurementCreateBase.java
@@ -17,11 +17,9 @@
import java.time.Duration;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
-import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.DataPattern;
-import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.TestTlvPattern;
-import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate;
/**
* A base interface with attributes that are common to both Delay and Loss Measurements.
@@ -32,7 +30,7 @@
* The exact PDUs to use are specified by this object in combination with measurement-type
* @return The version of the PDUs
*/
- Version version();
+ DelayMeasurementCreate.Version version();
/**
* The remote MEP to perform the tests against.
@@ -52,7 +50,7 @@
* The priority of frames with Performance Monitoring OAM message information.
* @return A priority enumerated value 0-7
*/
- Priority priority();
+ Mep.Priority priority();
/**
* The Loss Measurement frame size between 64 bytes and the maximum transmission unit of the EVC.
@@ -72,7 +70,7 @@
* test-tlv-included is 'true' the value of this object is ignored
* @return The data pattern - ones or zeroes
*/
- DataPattern dataPattern();
+ DelayMeasurementCreate.DataPattern dataPattern();
/**
* Whether a Test TLV or Data TLV is included when the size of the LM frame is determined by the frame-size object.
@@ -90,7 +88,7 @@
* test-tlv-included is 'false' the value of this object is ignored
* @return A TLV pattern enum
*/
- TestTlvPattern testTlvPattern();
+ DelayMeasurementCreate.TestTlvPattern testTlvPattern();
/**
* The Measurement Interval for FLR statistics.
@@ -156,7 +154,7 @@
SessionType sessionType();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.MeasurementCreateBase}.
+ * Builder for {@link MeasurementCreateBase}.
*/
public interface MeasCreateBaseBuilder {
MeasCreateBaseBuilder messagePeriod(
@@ -164,11 +162,11 @@
MeasCreateBaseBuilder frameSize(Short frameSize) throws SoamConfigException;
- MeasCreateBaseBuilder dataPattern(DataPattern dataPattern);
+ MeasCreateBaseBuilder dataPattern(DelayMeasurementCreate.DataPattern dataPattern);
MeasCreateBaseBuilder testTlvIncluded(boolean testTlvIncluded);
- MeasCreateBaseBuilder testTlvPattern(TestTlvPattern testTlvPattern);
+ MeasCreateBaseBuilder testTlvPattern(DelayMeasurementCreate.TestTlvPattern testTlvPattern);
MeasCreateBaseBuilder measurementInterval(
Duration measurementInterval) throws SoamConfigException;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/SoamDmProgrammable.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/SoamDmProgrammable.java
index 77582e9..36aa1c7 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/SoamDmProgrammable.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/SoamDmProgrammable.java
@@ -20,7 +20,7 @@
/**
* Behaviour that allows Layer 2 SOAM PM in the form of Delay Measurement to be implemented by devices.
*
- * Has all of the same methods as {@link org.onosproject.incubator.net.l2monitoring.soam.SoamService},
+ * Has all of the same methods as {@link SoamService},
* so we don't repeat them here
*/
public interface SoamDmProgrammable extends HandlerBehaviour, SoamService {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementCreate.java
index f74ff04..3fe924d 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementCreate.java
@@ -18,13 +18,13 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.soam.DefaultMeasurementCreateBase;
import org.onosproject.incubator.net.l2monitoring.soam.SoamConfigException;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate}.
+ * The default implementation of {@link DelayMeasurementCreate}.
*/
public class DefaultDelayMeasurementCreate extends DefaultMeasurementCreateBase
implements DelayMeasurementCreate {
@@ -84,13 +84,13 @@
}
public static DmCreateBuilder builder(DmType dmCfgType,
- Version version, MepId remoteMepId, Priority priority)
+ Version version, MepId remoteMepId, Mep.Priority priority)
throws SoamConfigException {
return new DefaultDmCreateBuilder(dmCfgType, version, remoteMepId, priority);
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate}.
+ * Builder for {@link DelayMeasurementCreate}.
*/
protected static class DefaultDmCreateBuilder extends DefaultMeasCreateBaseBuilder
implements DmCreateBuilder {
@@ -104,7 +104,7 @@
protected Collection<DelayMeasurementThreshold> thresholds;
protected DefaultDmCreateBuilder(DmType dmCfgType, Version version,
- MepId remoteMepId, Priority priority)
+ MepId remoteMepId, Mep.Priority priority)
throws SoamConfigException {
super(version, remoteMepId, priority);
this.dmCfgType = dmCfgType;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementEntry.java
index c53c63b..87f813d 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementEntry.java
@@ -19,15 +19,15 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.soam.SoamConfigException;
import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
import com.google.common.collect.Lists;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry}.
+ * The default implementation of {@link DelayMeasurementEntry}.
*/
public final class DefaultDelayMeasurementEntry
extends DefaultDelayMeasurementCreate implements DelayMeasurementEntry {
@@ -112,14 +112,14 @@
}
public static DmEntryBuilder builder(SoamId dmId, DmType dmCfgType,
- Version version, MepId remoteMepId, Priority priority)
+ Version version, MepId remoteMepId, Mep.Priority priority)
throws SoamConfigException {
return new DefaultDmEntryBuilder(dmId, dmCfgType, version,
remoteMepId, priority);
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry}.
+ * Builder for {@link DelayMeasurementEntry}.
*/
private static final class DefaultDmEntryBuilder extends DefaultDmCreateBuilder
implements DmEntryBuilder {
@@ -135,7 +135,7 @@
private Collection<DelayMeasurementStatHistory> historicalResults;
private DefaultDmEntryBuilder(SoamId dmId, DmType dmCfgType,
- Version version, MepId remoteMepId, Priority priority)
+ Version version, MepId remoteMepId, Mep.Priority priority)
throws SoamConfigException {
super(dmCfgType, version, remoteMepId, priority);
if (dmId == null) {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStat.java
index 01f0bc4..a819388 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStat.java
@@ -22,7 +22,7 @@
/**
* Abstract default implementation of DelayMeasurementStat.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStat}.
+ * {@link DelayMeasurementStat}.
*/
public abstract class DefaultDelayMeasurementStat implements DelayMeasurementStat {
@@ -326,7 +326,7 @@
}
/**
- * Abstract builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStat}.
+ * Abstract builder for {@link DelayMeasurementStat}.
*/
protected abstract static class DefaultDmStatBuilder implements DmStatBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatCurrent.java
index 7263134..b755e3a 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatCurrent.java
@@ -20,7 +20,7 @@
/**
* The default implementation of DelayMeasurementStatCurrent.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}.
+ * {@link DelayMeasurementStatCurrent}.
*/
public final class DefaultDelayMeasurementStatCurrent
extends DefaultDelayMeasurementStat
@@ -43,7 +43,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}.
+ * Builder for {@link DelayMeasurementStatCurrent}.
*/
private static final class DefaultDmStatCurrentBuilder extends DefaultDmStatBuilder
implements DmStatCurrentBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatHistory.java
index 4db3683..d735782 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementStatHistory.java
@@ -22,7 +22,7 @@
/**
* The default implementation of DelayMeasurementStatHistory.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatHistory}.
+ * {@link DelayMeasurementStatHistory}.
*/
public class DefaultDelayMeasurementStatHistory extends DefaultDelayMeasurementStat
implements DelayMeasurementStatHistory {
@@ -53,7 +53,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatHistory}.
+ * Builder for {@link DelayMeasurementStatHistory}.
*/
private static final class DefaultDmStatHistoryBuilder
extends DefaultDmStatBuilder implements DmStatHistoryBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementThreshold.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementThreshold.java
index 90a8c25..d037dbc 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementThreshold.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DefaultDelayMeasurementThreshold.java
@@ -23,7 +23,7 @@
/**
* The default implementation of DelayMeasurementThreshold.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementThreshold}.
+ * {@link DelayMeasurementThreshold}.
*/
public final class DefaultDelayMeasurementThreshold
implements DelayMeasurementThreshold {
@@ -230,7 +230,7 @@
}
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementThreshold}.
+ * Builder for {@link DelayMeasurementThreshold}.
*/
private static final class DefaultDmThresholdBuilder implements DmThresholdBuilder {
private final SoamId threshId;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementCreate.java
index 4934146..39a8969 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementCreate.java
@@ -88,7 +88,7 @@
Collection<DelayMeasurementThreshold> thresholds();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate}.
+ * Builder for {@link DelayMeasurementCreate}.
*/
public interface DmCreateBuilder extends MeasCreateBaseBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntry.java
index 3571922..cd9beba 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntry.java
@@ -106,7 +106,7 @@
Collection<DelayMeasurementStatHistory> historicalResults();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry}.
+ * Builder for {@link DelayMeasurementEntry}.
*/
public interface DmEntryBuilder extends DmCreateBuilder {
DmEntryBuilder sessionStatus(SessionStatus sessionStatus);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStat.java
index c218c06..2fadfc1 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStat.java
@@ -278,7 +278,7 @@
/**
* Abstract Builder interface for DelayMeasurementStat.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStat}.
+ * {@link DelayMeasurementStat}.
*/
interface DmStatBuilder {
DmStatBuilder frameDelayTwoWayMin(Duration frameDelayTwoWayMin);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatCurrent.java
index f9bb25f..205a905 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatCurrent.java
@@ -28,7 +28,7 @@
Instant startTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}.
+ * Builder for {@link DelayMeasurementStatCurrent}.
*/
public interface DmStatCurrentBuilder extends DmStatBuilder {
DmStatCurrentBuilder startTime(Instant startTime);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatHistory.java
index c55c66a..4ce8de3 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStatHistory.java
@@ -36,7 +36,7 @@
Instant endTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatHistory}.
+ * Builder for {@link DelayMeasurementStatHistory}.
*/
public interface DmStatHistoryBuilder extends DmStatBuilder {
DmStatHistoryBuilder endTime(Instant endTime);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThreshold.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThreshold.java
index 78ae5d4..a9c7f26 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThreshold.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThreshold.java
@@ -186,7 +186,7 @@
Duration averageFrameDelayRangeBackward();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementThreshold}.
+ * Builder for {@link DelayMeasurementThreshold}.
*/
public interface DmThresholdBuilder {
DmThresholdBuilder addToThresholdsEnabled(
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStat.java
index 0616a55..e85c10b 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStat.java
@@ -20,7 +20,7 @@
import org.onosproject.incubator.net.l2monitoring.soam.MilliPct;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStat}.
+ * The default implementation of {@link LossAvailabilityStat}.
*/
public abstract class DefaultLaStat implements LossAvailabilityStat {
private final Duration elapsedTime;
@@ -141,7 +141,7 @@
/**
* Abstract base class for builders of.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStat}.
+ * {@link LossAvailabilityStat}.
*/
protected abstract static class DefaultLaStatBuilder implements LaStatBuilder {
private final Duration elapsedTime;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatCurrent.java
index 9564ef0..0c7f0f9 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatCurrent.java
@@ -20,7 +20,7 @@
/**
* The default implementation of LossAvailabilityStatCurrent.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStatCurrent}.
+ * {@link LossAvailabilityStatCurrent}.
*/
public final class DefaultLaStatCurrent extends DefaultLaStat
implements LossAvailabilityStatCurrent {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatHistory.java
index 6203bbd..ca3b1b8 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLaStatHistory.java
@@ -22,7 +22,7 @@
/**
* The default implementation of LossAvailabilityStatHistory.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStatHistory}.
+ * {@link LossAvailabilityStatHistory}.
*/
public final class DefaultLaStatHistory extends DefaultLaStat
implements LossAvailabilityStatHistory {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmCreate.java
index c735994..600da83 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmCreate.java
@@ -27,7 +27,7 @@
import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate}.
+ * The default implementation of {@link LossMeasurementCreate}.
*/
public class DefaultLmCreate extends DefaultMeasurementCreateBase
implements LossMeasurementCreate {
@@ -101,7 +101,7 @@
/**
* Implementation of LmCreateBuilder.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate.LmCreateBuilder}
+ * {@link LossMeasurementCreate.LmCreateBuilder}
*/
protected static class DefaultLmCreateBuilder extends DefaultMeasCreateBaseBuilder
implements LmCreateBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmEntry.java
index 3e45303..f19f25c 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmEntry.java
@@ -19,15 +19,15 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.onosproject.incubator.net.l2monitoring.cfm.Mep.Priority;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.soam.MilliPct;
import org.onosproject.incubator.net.l2monitoring.soam.SoamConfigException;
import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
-import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
+import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
+import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementEntry}.
+ * The default implementation of {@link LossMeasurementEntry}.
*/
public final class DefaultLmEntry extends DefaultLmCreate
implements LossMeasurementEntry {
@@ -113,8 +113,8 @@
return availabilityHistories;
}
- public static LmEntryBuilder builder(Version version, MepId remoteMepId,
- Priority priority, LmType lmCfgType, SoamId lmId)
+ public static LmEntryBuilder builder(DelayMeasurementCreate.Version version, MepId remoteMepId,
+ Mep.Priority priority, LmType lmCfgType, SoamId lmId)
throws SoamConfigException {
return new DefaultLmEntryBuilder(version, remoteMepId,
priority, lmCfgType, lmId);
@@ -134,8 +134,8 @@
private LossAvailabilityStatCurrent availabilityCurrent;
private Collection<LossAvailabilityStatHistory> availabilityHistories;
- protected DefaultLmEntryBuilder(Version version, MepId remoteMepId,
- Priority priority, LmType lmCfgType, SoamId lmId)
+ protected DefaultLmEntryBuilder(DelayMeasurementCreate.Version version, MepId remoteMepId,
+ Mep.Priority priority, LmType lmCfgType, SoamId lmId)
throws SoamConfigException {
super(version, remoteMepId, priority, lmCfgType);
this.lmId = lmId;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStat.java
index 0410e47..334b403 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStat.java
@@ -20,7 +20,7 @@
import org.onosproject.incubator.net.l2monitoring.soam.MilliPct;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStat}.
+ * The default implementation of {@link LossMeasurementStat}.
*/
public abstract class DefaultLmStat implements LossMeasurementStat {
private final Duration elapsedTime;
@@ -127,7 +127,7 @@
/**
* Abstract implementation of LmStatBuilder.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStat.LmStatBuilder}
+ * {@link LossMeasurementStat.LmStatBuilder}
*/
protected abstract static class DefaultLmStatBuilder implements LmStatBuilder {
private final Duration elapsedTime;
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatCurrent.java
index 1920845..2eb8a0e 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatCurrent.java
@@ -20,7 +20,7 @@
/**
* The default implementation of LossMeasurementStatCurrent.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatCurrent}
+ * {@link LossMeasurementStatCurrent}
*/
public final class DefaultLmStatCurrent extends DefaultLmStat
implements LossMeasurementStatCurrent {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatHistory.java
index 1109e92..4feccb8 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmStatHistory.java
@@ -22,7 +22,7 @@
/**
* The default implementation of LossMeasurementStatHistory.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory}
+ * {@link LossMeasurementStatHistory}
*/
public final class DefaultLmStatHistory extends DefaultLmStat
implements LossMeasurementStatHistory {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmThreshold.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmThreshold.java
index 0487516..cd38c2e 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmThreshold.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/DefaultLmThreshold.java
@@ -22,7 +22,7 @@
import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
/**
- * The default implementation of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementThreshold}.
+ * The default implementation of {@link LossMeasurementThreshold}.
*/
public final class DefaultLmThreshold implements LossMeasurementThreshold {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStat.java
index 09b6e0e..85f155d 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStat.java
@@ -170,7 +170,7 @@
/**
* Abstract builder for classes derived from LossAvailabilityStat.
- * {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStat}.
+ * {@link LossAvailabilityStat}.
*/
public interface LaStatBuilder {
LaStatBuilder forwardHighLoss(Long forwardHighLoss);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatCurrent.java
index 9c1465a..ea80afc 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatCurrent.java
@@ -19,7 +19,7 @@
/**
* Object for representing Loss Availability Stats Current.
- * Extends {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStat}
+ * Extends {@link LossAvailabilityStat}
*/
public interface LossAvailabilityStatCurrent extends LossAvailabilityStat {
/**
@@ -29,7 +29,7 @@
Instant startTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStatCurrent}.
+ * Builder for {@link LossAvailabilityStatCurrent}.
*/
public interface LaStatCurrentBuilder extends LaStatBuilder {
LossAvailabilityStatCurrent build();
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatHistory.java
index 49beef5..47b4462 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossAvailabilityStatHistory.java
@@ -21,7 +21,7 @@
/**
* Object for representing Loss Availability Stats History.
- * Extends {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStat}
+ * Extends {@link LossAvailabilityStat}
*/
public interface LossAvailabilityStatHistory extends LossAvailabilityStat {
/**
@@ -37,7 +37,7 @@
Instant endTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossAvailabilityStatHistory}.
+ * Builder for {@link LossAvailabilityStatHistory}.
*/
public interface LaStatHistoryBuilder extends LaStatBuilder {
LossAvailabilityStatHistory build();
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreate.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreate.java
index 032a4bb..ff6328b 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreate.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreate.java
@@ -125,7 +125,7 @@
Collection<LossMeasurementThreshold> lossMeasurementThreshold();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate}.
+ * Builder for {@link LossMeasurementCreate}.
*/
public interface LmCreateBuilder extends MeasCreateBaseBuilder {
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementEntry.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementEntry.java
index fb0cecb..99a3a95 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementEntry.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementEntry.java
@@ -113,7 +113,7 @@
Collection<LossAvailabilityStatHistory> availabilityHistories();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementEntry}.
+ * Builder for {@link LossMeasurementEntry}.
*/
public interface LmEntryBuilder extends LmCreateBuilder {
LmEntryBuilder measuredForwardFlr(MilliPct measuredForwardFlr);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStat.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStat.java
index f61aab5..2beef59 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStat.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStat.java
@@ -21,8 +21,8 @@
/**
* Abstract base interface for the creation of Loss Measurement Stat.
- * This is the base for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory}
- * and {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatCurrent}
+ * This is the base for {@link LossMeasurementStatHistory}
+ * and {@link LossMeasurementStatCurrent}
*/
public interface LossMeasurementStat {
/**
@@ -142,7 +142,7 @@
Long soamPdusReceived();
/**
- * Base interface for builders of {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStat}.
+ * Base interface for builders of {@link LossMeasurementStat}.
*/
interface LmStatBuilder {
LmStatBuilder forwardTransmittedFrames(Long forwardTransmittedFrames);
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatCurrent.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatCurrent.java
index c5b2423..8f7addd 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatCurrent.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatCurrent.java
@@ -19,7 +19,7 @@
/**
* Object for representing Loss Availability Stats Current.
- * Extends {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStat}
+ * Extends {@link LossMeasurementStat}
*/
public interface LossMeasurementStatCurrent extends LossMeasurementStat {
/**
@@ -29,7 +29,7 @@
Instant startTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatCurrent}.
+ * Builder for {@link LossMeasurementStatCurrent}.
*/
public interface LmStatCurrentBuilder extends LmStatBuilder {
LossMeasurementStatCurrent build();
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatHistory.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatHistory.java
index 90c7a5f..9387c89 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatHistory.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementStatHistory.java
@@ -21,7 +21,7 @@
/**
* Object for representing Loss Measurement Stats History.
- * Extends {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStat}
+ * Extends {@link LossMeasurementStat}
*/
public interface LossMeasurementStatHistory extends LossMeasurementStat {
/**
@@ -37,7 +37,7 @@
Instant endTime();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementStatHistory}.
+ * Builder for {@link LossMeasurementStatHistory}.
*/
public interface LmStatHistoryBuilder extends LmStatBuilder {
LossMeasurementStatHistory build();
diff --git a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementThreshold.java b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementThreshold.java
index 1624204..491d69d 100644
--- a/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementThreshold.java
+++ b/apps/cfm/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementThreshold.java
@@ -150,7 +150,7 @@
MilliPct backwardAvailableRatio();
/**
- * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementThreshold}.
+ * Builder for {@link LossMeasurementThreshold}.
*/
public interface LmThresholdBuilder {
diff --git a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntryTest.java b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntryTest.java
index ad2439a..3e3cd11 100644
--- a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntryTest.java
+++ b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementEntryTest.java
@@ -15,8 +15,6 @@
*/
package org.onosproject.incubator.net.l2monitoring.soam.delay;
-import static org.junit.Assert.*;
-
import java.time.Duration;
import org.junit.Before;
@@ -30,6 +28,8 @@
import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementCreate.Version;
import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementEntry.SessionStatus;
+import static org.junit.Assert.assertEquals;
+
public class DelayMeasurementEntryTest {
DelayMeasurementEntry dmE1;
diff --git a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThresholdOptionTest.java b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThresholdOptionTest.java
index f838143..970452e 100644
--- a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThresholdOptionTest.java
+++ b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementThresholdOptionTest.java
@@ -15,8 +15,6 @@
*/
package org.onosproject.incubator.net.l2monitoring.soam.delay;
-import static org.junit.Assert.*;
-
import java.time.Duration;
import org.junit.Before;
@@ -25,6 +23,8 @@
import org.onosproject.incubator.net.l2monitoring.soam.SoamId;
import org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementThreshold.ThresholdOption;
+import static org.junit.Assert.assertEquals;
+
public class DelayMeasurementThresholdOptionTest {
DelayMeasurementThreshold dmT1;
diff --git a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreateTest.java b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreateTest.java
index c7d1264..43d9aa4 100644
--- a/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreateTest.java
+++ b/apps/cfm/api/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/loss/LossMeasurementCreateTest.java
@@ -15,8 +15,6 @@
*/
package org.onosproject.incubator.net.l2monitoring.soam.loss;
-import static org.junit.Assert.*;
-
import java.time.Duration;
import org.junit.Before;
@@ -36,6 +34,8 @@
import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate.LmCreateBuilder;
import org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementCreate.LmType;
+import static org.junit.Assert.assertEquals;
+
public class LossMeasurementCreateTest {
LossMeasurementCreate lmc1;
diff --git a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/impl/DistributedMdStore.java b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/impl/DistributedMdStore.java
index 82c550d..81813f8 100644
--- a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/impl/DistributedMdStore.java
+++ b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/cfm/impl/DistributedMdStore.java
@@ -108,12 +108,9 @@
.register(InternetDomainName.class)
.register(MacAddress.class)
.register(ImmutablePair.class)
- .register(org.onosproject.incubator.net.l2monitoring
- .cfm.Component.MhfCreationType.class)
- .register(org.onosproject.incubator.net.l2monitoring
- .cfm.Component.IdPermissionType.class)
- .register(org.onosproject.incubator.net.l2monitoring
- .cfm.Component.TagType.class)
+ .register(org.onosproject.incubator.net.l2monitoring.cfm.Component.MhfCreationType.class)
+ .register(org.onosproject.incubator.net.l2monitoring.cfm.Component.IdPermissionType.class)
+ .register(org.onosproject.incubator.net.l2monitoring.cfm.Component.TagType.class)
.build("md")))
.build();
mapListener = new InternalMdListener();
diff --git a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/SoamManager.java b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/SoamManager.java
index ca8a373..79a6480 100644
--- a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/SoamManager.java
+++ b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/SoamManager.java
@@ -230,7 +230,7 @@
@Override
public LossMeasurementStatCurrent getLmCurrentStat(MdId mdName,
- MaIdShort maName, MepId mepId, SoamId lmId) {
+ MaIdShort maName, MepId mepId, SoamId lmId) {
throw new UnsupportedOperationException("Not yet implemented");
}
diff --git a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/package-info.java b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/package-info.java
index fd932e0..a0d89e8 100644
--- a/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/package-info.java
+++ b/apps/cfm/app/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/impl/package-info.java
@@ -17,4 +17,4 @@
/**
* An implementation of Layer 2 CFM Service Operations and Maintenance (SOAM).
*/
-package org.onosproject.incubator.net.l2monitoring.soam.impl;
\ No newline at end of file
+package org.onosproject.incubator.net.l2monitoring.impl;
\ No newline at end of file
diff --git a/apps/cfm/app/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/impl/TestSoamDmProgrammable.java b/apps/cfm/app/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/impl/TestSoamDmProgrammable.java
index 9750550..c084a7a 100644
--- a/apps/cfm/app/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/impl/TestSoamDmProgrammable.java
+++ b/apps/cfm/app/src/test/java/org/onosproject/incubator/net/l2monitoring/soam/impl/TestSoamDmProgrammable.java
@@ -42,8 +42,6 @@
import java.util.Collection;
import java.util.Optional;
-import static org.onosproject.incubator.net.l2monitoring.soam.impl.SoamManagerTest.*;
-
/**
* A dummy implementation of the SoamDmProgrammable for test purposes.
*/
@@ -80,7 +78,7 @@
.build();
dmEntry1 = DefaultDelayMeasurementEntry
- .builder(DMID101, DelayMeasurementCreate.DmType.DM1DMTX,
+ .builder(SoamManagerTest.DMID101, DelayMeasurementCreate.DmType.DM1DMTX,
DelayMeasurementCreate.Version.Y17312011,
MepId.valueOf((short) 11), Mep.Priority.PRIO5)
.currentResult(current)
@@ -94,7 +92,8 @@
MdId mdName, MaIdShort maName, MepId mepId)
throws CfmConfigException, SoamConfigException {
Collection<DelayMeasurementEntry> dmEntries = new ArrayList<>();
- if (mdName.equals(MDNAME1) && maName.equals(MANAME1) && mepId.equals(MEPID1)) {
+ if (mdName.equals(SoamManagerTest.MDNAME1) && maName.equals(SoamManagerTest.MANAME1)
+ && mepId.equals(SoamManagerTest.MEPID1)) {
dmEntries.add(dmEntry1);
return dmEntries;
}
@@ -105,7 +104,8 @@
public DelayMeasurementEntry getDm(
MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId)
throws CfmConfigException, SoamConfigException {
- if (mdName.equals(MDNAME1) && maName.equals(MANAME1) && mepId.equals(MEPID1)) {
+ if (mdName.equals(SoamManagerTest.MDNAME1) && maName.equals(SoamManagerTest.MANAME1)
+ && mepId.equals(SoamManagerTest.MEPID1)) {
return dmEntry1;
}
return null;
@@ -115,7 +115,8 @@
public DelayMeasurementStatCurrent getDmCurrentStat(
MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId)
throws CfmConfigException, SoamConfigException {
- if (mdName.equals(MDNAME1) && maName.equals(MANAME1) && mepId.equals(MEPID1)) {
+ if (mdName.equals(SoamManagerTest.MDNAME1) && maName.equals(SoamManagerTest.MANAME1)
+ && mepId.equals(SoamManagerTest.MEPID1)) {
return dmEntry1.currentResult();
}
return null;
@@ -125,7 +126,8 @@
public Collection<DelayMeasurementStatHistory> getDmHistoricalStats(
MdId mdName, MaIdShort maName, MepId mepId, SoamId dmId)
throws CfmConfigException, SoamConfigException {
- if (mdName.equals(MDNAME1) && maName.equals(MANAME1) && mepId.equals(MEPID1)) {
+ if (mdName.equals(SoamManagerTest.MDNAME1) && maName.equals(SoamManagerTest.MANAME1)
+ && mepId.equals(SoamManagerTest.MEPID1)) {
return dmEntry1.historicalResults();
}
return null;
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/CfmWebComponent.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/CfmWebComponent.java
index 6ead985..a31a407 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/CfmWebComponent.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/CfmWebComponent.java
@@ -82,8 +82,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.onosproject.incubator.net.l2monitoring.soam.loss.LossMeasurementThreshold.*;
-
/**
* Enables the CFM REST Web Service component at /onos/cfm.
* Each codec for the rest interfaces should be registered here.
@@ -95,6 +93,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CodecService codecService;
+ /**
+ * On activation of this component register these codecs with the codec service.
+ */
@Activate
public void activate() {
codecService.registerCodec(MaintenanceDomain.class,
@@ -146,7 +147,7 @@
new LossAvailabilityStatHistoryCodec());
codecService.registerCodec(CounterOption.class,
new LmCounterOptionCodec());
- codecService.registerCodec(ThresholdOption.class,
+ codecService.registerCodec(LossMeasurementThreshold.ThresholdOption.class,
new LmThresholdOptionCodec());
codecService.registerCodec(StartTime.class, new StartTimeCodec());
@@ -155,6 +156,9 @@
log.info("CFM Web Component Started");
}
+ /**
+ * On deactivation of this component unregister these codecs from the codec service.
+ */
@Deactivate
public void deactivate() {
log.info("CFM Web Component Stopped");
@@ -189,7 +193,7 @@
codecService.unregisterCodec(LossAvailabilityStatCurrent.class);
codecService.unregisterCodec(LossAvailabilityStatHistory.class);
codecService.unregisterCodec(CounterOption.class);
- codecService.unregisterCodec(ThresholdOption.class);
+ codecService.unregisterCodec(LossMeasurementThreshold.ThresholdOption.class);
}
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaAddCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaAddCommand.java
index d449cce..1fec9f3 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaAddCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaAddCommand.java
@@ -23,17 +23,8 @@
import org.onosproject.incubator.net.l2monitoring.cfm.DefaultComponent;
import org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceAssociation;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
@@ -44,60 +35,55 @@
@Command(scope = "onos", name = "cfm-ma-add",
description = "Add a CFM Maintenance Association to a Maintenance Domain.")
public class CfmMaAddCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "name",
+ @Argument(name = "name",
description = "Maintenance Domain name and type (in brackets)",
- required = true, multiValued = false)
- String mdName = null;
+ required = true)
+ private String mdName = null;
@Argument(index = 1, name = "name-type",
description = "Maintenance Assocation name type",
- required = true, multiValued = false)
- String nameType = null;
+ required = true)
+ private String nameType = null;
@Argument(index = 2, name = "name",
description = "Maintenance Assocation name. Restrictions apply depending " +
"on name-type",
- required = true, multiValued = false)
- String name = null;
+ required = true)
+ private String name = null;
@Argument(index = 3, name = "ccm-interval",
description = "CCM Interval values from list",
- required = true, multiValued = false)
- String ccmInterval = null;
+ required = true)
+ private String ccmInterval = null;
@Argument(index = 4, name = "numeric-id",
- description = "An optional numeric id for Maintenance Association [1-65535]",
- required = false, multiValued = false)
- short numericId = 0;
+ description = "An optional numeric id for Maintenance Association [1-65535]")
+ private Short numericId = null;
@Argument(index = 5, name = "component-id",
description = "An id for a Component in the Component List [1-65535]." +
"The CLI allows creation of only 1 component. If more are " +
- "required use the REST interface",
- required = false, multiValued = false)
- short componentId = 0;
+ "required use the REST interface")
+ private Short componentId = null;
@Argument(index = 6, name = "component-tag-type",
- description = "Tag Type value for the component",
- required = false, multiValued = false)
- String tagType = null;
+ description = "Tag Type value for the component")
+ private String tagType = null;
@Argument(index = 7, name = "component-mhf-creation",
- description = "MEP Half function creation type for the component",
- required = false, multiValued = false)
- String mhfCreationType = null;
+ description = "MEP Half function creation type for the component")
+ private String mhfCreationType = null;
@Argument(index = 8, name = "component-vid",
description = "A VID for the component [1-4095]. This CLI allows " +
"only the specification of 1 VID. If more are required use " +
- "the REST interface",
- required = false, multiValued = false)
- short vid = 0;
+ "the REST interface")
+ private Short vid = null;
@Argument(index = 9, name = "rmep",
description = "Remote Mep numeric identifier [1-8192]",
required = true, multiValued = true)
- String[] rmepArray = null;
+ private String[] rmepArray = null;
@Override
protected void execute() {
@@ -109,56 +95,23 @@
"Must be in the format of <identifier(name-type)>");
}
- MdId mdId = null;
- MdId.MdNameType mdNameTypeEnum = MdId.MdNameType.valueOf(mdNameParts[1]);
- switch (mdNameTypeEnum) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(mdNameParts[0]);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(mdNameParts[0]);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(mdNameParts[0]);
- }
+ MdId mdId = CfmMdListMdCommand.parseMdName(mdNameParts[0] + "(" + mdNameParts[1] + ")");
- MaIdShort maId = null;
- MaIdShort.MaIdType maNameTypeEnum = MaIdShort.MaIdType.valueOf(nameType);
- switch (maNameTypeEnum) {
- case TWOOCTET:
- maId = MaId2Octet.asMaId(name);
- break;
- case ICCY1731:
- maId = MaIdIccY1731.asMaId(name);
- break;
- case PRIMARYVID:
- maId = MaIdPrimaryVid.asMaId(name);
- break;
- case RFC2685VPNID:
- maId = MaIdRfc2685VpnId.asMaIdHex(name);
- break;
- case CHARACTERSTRING:
- default:
- maId = MaIdCharStr.asMaId(name);
- }
+ MaIdShort maId = CfmMdListMdCommand.parseMaName(name + "(" + nameType + ")");
- MaintenanceAssociation.MaBuilder builder = null;
try {
- builder = DefaultMaintenanceAssociation.builder(maId, mdId.getNameLength());
+ MaintenanceAssociation.MaBuilder builder = DefaultMaintenanceAssociation
+ .builder(maId, mdId.getNameLength());
if (ccmInterval != null && !ccmInterval.isEmpty()) {
builder = builder.ccmInterval(MaintenanceAssociation.CcmInterval.valueOf(ccmInterval));
}
for (String rmep:rmepArray) {
builder = builder.addToRemoteMepIdList(MepId.valueOf(Short.parseShort(rmep)));
}
- if (numericId > 0) {
+ if (numericId != null) {
builder = builder.maNumericId(numericId);
}
- if (componentId > 0) {
+ if (componentId != null) {
Component.ComponentBuilder compBuilder =
DefaultComponent.builder(componentId);
if (tagType != null && !tagType.isEmpty()) {
@@ -169,7 +122,7 @@
compBuilder = compBuilder.mhfCreationType(
Component.MhfCreationType.valueOf(mhfCreationType));
}
- if (vid > 0) {
+ if (vid != null) {
compBuilder = compBuilder.addToVidList(VlanId.vlanId(vid));
}
builder = builder.addToComponentList(compBuilder.build());
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaDeleteCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaDeleteCommand.java
index 4228b78..b28a35e 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaDeleteCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMaDeleteCommand.java
@@ -18,17 +18,8 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
@@ -39,58 +30,26 @@
description = "Delete a CFM Maintenance Association and its children.")
public class CfmMaDeleteCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "name",
+ private static final int MA_NAME_PARTS_COUNT = 4;
+ @Argument(name = "name",
description = "Maintenance Domain name and type (in brackets) " +
"and the Maintenance Association name and type (in brackets)",
- required = true, multiValued = false)
- String name = null;
+ required = true)
+ private String name = null;
@Override
protected void execute() {
CfmMdService service = get(CfmMdService.class);
String[] nameParts = name.split("[()]");
- if (nameParts.length != 4) {
+ if (nameParts.length != MA_NAME_PARTS_COUNT) {
throw new IllegalArgumentException("Invalid name format. Must be in " +
"the format of <identifier(name-type)identifier(name-type)>");
}
- MdId mdId = null;
- MdId.MdNameType nameTypeEnum = MdId.MdNameType.valueOf(nameParts[1]);
- switch (nameTypeEnum) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(nameParts[0]);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(nameParts[0]);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(nameParts[0]);
- }
+ MdId mdId = CfmMdListMdCommand.parseMdName(nameParts[0] + "(" + nameParts[1] + ")");
- MaIdShort maId = null;
- MaIdShort.MaIdType maNameTypeEnum = MaIdShort.MaIdType.valueOf(nameParts[3]);
- switch (maNameTypeEnum) {
- case TWOOCTET:
- maId = MaId2Octet.asMaId(nameParts[2]);
- break;
- case ICCY1731:
- maId = MaIdIccY1731.asMaId(nameParts[2]);
- break;
- case PRIMARYVID:
- maId = MaIdPrimaryVid.asMaId(nameParts[2]);
- break;
- case RFC2685VPNID:
- maId = MaIdRfc2685VpnId.asMaIdHex(nameParts[2]);
- break;
- case CHARACTERSTRING:
- default:
- maId = MaIdCharStr.asMaId(nameParts[2]);
- }
+ MaIdShort maId = CfmMdListMdCommand.parseMaName(nameParts[2] + "(" + nameParts[3] + ")");
try {
boolean deleted = service.deleteMaintenanceAssociation(mdId, maId);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdAddCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdAddCommand.java
index 922ed64..c73fff3 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdAddCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdAddCommand.java
@@ -21,15 +21,9 @@
import org.onosproject.incubator.net.l2monitoring.cfm.DefaultMaintenanceDomain;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
-import java.util.Optional;
-
/**
* Adds a Maintenance Domain to the existing list.
*/
@@ -37,58 +31,39 @@
description = "Add a CFM Maintenance Domain.")
public class CfmMdAddCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "name-type",
+ @Argument(name = "name-type",
description = "Maintenance Domain name type",
- required = true, multiValued = false)
- String nameType = null;
+ required = true)
+ private String nameType = null;
@Argument(index = 1, name = "name",
description = "Maintenance Domain name. Restrictions apply depending " +
"on name-type. Leave empty if name type is none",
- required = true, multiValued = false)
- String name = null;
+ required = true)
+ private String name = null;
@Argument(index = 2, name = "level",
description = "Maintenance Domain level LEVEL0-LEVEL7",
- required = true, multiValued = false)
- String level = null;
+ required = true)
+ private String level = null;
@Argument(index = 3, name = "numeric-id",
- description = "An optional numeric id for Maintenance Domain [1-65535]",
- required = false, multiValued = false)
- short numericId = 0;
+ description = "An optional numeric id for Maintenance Domain [1-65535]")
+ private Short numericId = null;
@Override
protected void execute() {
CfmMdService service = get(CfmMdService.class);
- MdId mdId = null;
- MdId.MdNameType nameTypeEnum = MdId.MdNameType.valueOf(nameType);
- switch (nameTypeEnum) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(name);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(name);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(name);
- }
+ MdId mdId = CfmMdListMdCommand.parseMdName(name + "(" + nameType + ")");
+
MaintenanceDomain.MdLevel levelEnum =
MaintenanceDomain.MdLevel.valueOf(level);
- Optional<Short> numericIdOpt = Optional.empty();
- if (numericId > 0) {
- numericIdOpt = Optional.of(numericId);
- }
- MaintenanceDomain.MdBuilder builder = null;
try {
- builder = DefaultMaintenanceDomain.builder(mdId).mdLevel(levelEnum);
- if (numericIdOpt.isPresent()) {
- builder = builder.mdNumericId(numericIdOpt.get());
+ MaintenanceDomain.MdBuilder builder = DefaultMaintenanceDomain
+ .builder(mdId).mdLevel(levelEnum);
+ if (numericId != null) {
+ builder = builder.mdNumericId(numericId);
}
boolean created = service.createMaintenanceDomain(builder.build());
print("Maintenance Domain with id %s is successfully %s.",
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdDeleteCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdDeleteCommand.java
index 3cf3c26..85f47eb 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdDeleteCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdDeleteCommand.java
@@ -19,10 +19,6 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
@@ -33,10 +29,10 @@
description = "Delete a CFM Maintenance Domain and its children.")
public class CfmMdDeleteCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "name",
+ @Argument(name = "name",
description = "Maintenance Domain name and type (in brackets)",
- required = true, multiValued = false)
- String name = null;
+ required = true)
+ private String name = null;
@Override
protected void execute() {
@@ -48,22 +44,7 @@
"Must be in the format of <identifier(name-type)>");
}
- MdId mdId = null;
- MdId.MdNameType nameTypeEnum = MdId.MdNameType.valueOf(nameParts[1]);
- switch (nameTypeEnum) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(nameParts[0]);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(nameParts[0]);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(nameParts[0]);
- }
+ MdId mdId = CfmMdListMdCommand.parseMdName(nameParts[0] + "(" + nameParts[1] + ")");
try {
boolean deleted = service.deleteMaintenanceDomain(mdId);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdListMdCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdListMdCommand.java
index 6f41005..7965113 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdListMdCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMdListMdCommand.java
@@ -20,84 +20,76 @@
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdMaNameUtil;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService;
-import java.util.Optional;
-
/**
* Lists a particular Maintenance Domain.
*/
@Command(scope = "onos", name = "cfm-md-list",
description = "Lists a single CFM Maintenance Domain or all if none specified.")
public class CfmMdListMdCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "name",
- description = "Maintenance Domain name and type (in brackets)",
- required = false, multiValued = false)
- String name = null;
+ @Argument(name = "name",
+ description = "Maintenance Domain name and type (in brackets)")
+ private String name = null;
@Override
protected void execute() {
- CfmMdService service = get(CfmMdService.class);
+ CfmMdService service;
+ service = get(CfmMdService.class);
if (name != null) {
MdId mdId = parseMdName(name);
print("Maintenance Domain:");
- Optional<MaintenanceDomain> md = service.getMaintenanceDomain(mdId);
- print(printMd(md));
- md.get().maintenanceAssociationList().forEach(ma -> printMa(Optional.of(ma)));
- } else {
- service.getAllMaintenanceDomain().forEach(md -> {
- print(printMd(Optional.of(md)));
+ service.getMaintenanceDomain(mdId).ifPresent(md -> {
+ print(printMd(md));
+ md.maintenanceAssociationList().forEach(CfmMdListMdCommand::printMa);
});
+ } else {
+ service.getAllMaintenanceDomain().forEach(md -> print(printMd(md)));
}
}
- public static String printMd(Optional<MaintenanceDomain> md) {
- if (!md.isPresent()) {
- return new String("MD not found");
+ private static String printMd(MaintenanceDomain md) {
+ if (md == null) {
+ return "MD not found";
} else {
- StringBuffer sb = new StringBuffer("\tMD: ");
- sb.append(md.get().mdId().mdName());
- sb.append("(" + md.get().mdId().nameType());
- sb.append(") Lvl:" + md.get().mdLevel().ordinal());
- sb.append(", Num: " + md.get().mdNumericId());
+ StringBuilder sb = new StringBuilder("\tMD: ");
+ sb.append(md.mdId().mdName());
+ sb.append("(");
+ sb.append(md.mdId().nameType());
+ sb.append(") Lvl:");
+ sb.append(md.mdLevel().ordinal());
+ sb.append(", Num: ");
+ sb.append(md.mdNumericId());
- md.get().maintenanceAssociationList().
- forEach(ma -> sb.append(printMa(Optional.of(ma))));
+ md.maintenanceAssociationList().
+ forEach(ma -> sb.append(printMa(ma)));
return sb.toString();
}
}
- public static String printMa(Optional<MaintenanceAssociation> ma) {
- if (!ma.isPresent()) {
+ private static String printMa(MaintenanceAssociation ma) {
+ if (ma == null) {
return "\n\tNo MA found";
}
StringBuilder sb = new StringBuilder("\n\t\tMA: ");
- sb.append(ma.get().maId().maName());
+ sb.append(ma.maId().maName());
sb.append("(");
- sb.append(ma.get().maId().nameType());
+ sb.append(ma.maId().nameType());
sb.append(") CCM: ");
- sb.append(ma.get().ccmInterval());
+ sb.append(ma.ccmInterval());
sb.append(" Num: ");
- sb.append(ma.get().maNumericId());
+ sb.append(ma.maNumericId());
- ma.get().remoteMepIdList().forEach(rmep -> {
+ ma.remoteMepIdList().forEach(rmep -> {
sb.append("\n\t\t\tRmep: ");
sb.append(rmep);
});
- ma.get().componentList().forEach(comp -> {
+ ma.componentList().forEach(comp -> {
sb.append("\n\t\t\tComponent: ");
sb.append(comp.componentId());
sb.append(" Perm: ");
@@ -116,59 +108,24 @@
return sb.toString();
}
- public static MdId parseMdName(String mdStr) {
+ static MdId parseMdName(String mdStr) {
String[] nameParts = mdStr.split("[()]");
if (nameParts.length != 2) {
throw new IllegalArgumentException("Invalid name format. " +
"Must be in the format of <identifier(name-type)>");
}
- MdId mdId = null;
- MdId.MdNameType nameTypeEnum = MdId.MdNameType.valueOf(nameParts[1]);
- switch (nameTypeEnum) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(nameParts[0]);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(nameParts[0]);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(nameParts[0]);
- }
- return mdId;
+ return MdMaNameUtil.parseMdName(nameParts[1], nameParts[0]);
}
- public static MaIdShort parseMaName(String maStr) {
+ static MaIdShort parseMaName(String maStr) {
String[] nameParts = maStr.split("[()]");
if (nameParts.length != 2) {
throw new IllegalArgumentException("Invalid name format. " +
"Must be in the format of <identifier(name-type)>");
}
- MaIdShort maId = null;
- MaIdShort.MaIdType nameTypeEnum = MaIdShort.MaIdType.valueOf(nameParts[1]);
- switch (nameTypeEnum) {
- case ICCY1731:
- maId = MaIdIccY1731.asMaId(nameParts[0]);
- break;
- case PRIMARYVID:
- maId = MaIdPrimaryVid.asMaId(nameParts[0]);
- break;
- case RFC2685VPNID:
- maId = MaIdRfc2685VpnId.asMaIdHex(nameParts[0]);
- break;
- case TWOOCTET:
- maId = MaId2Octet.asMaId(nameParts[0]);
- break;
- case CHARACTERSTRING:
- default:
- maId = MaIdCharStr.asMaId(nameParts[0]);
- }
- return maId;
+ return MdMaNameUtil.parseMaName(nameParts[1], nameParts[0]);
}
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListCommand.java
index b406947..55ed5ef 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListCommand.java
@@ -39,18 +39,15 @@
description = "Lists a filtered set of MEPs or all if no parameters specified.")
public class CfmMepListCommand extends AbstractShellCommand {
private final Logger log = getLogger(getClass());
- @Argument(index = 0, name = "md",
- description = "Maintenance Domain name and type (in brackets) - will use all MDs if not specified",
- required = false, multiValued = false)
- String mdStr = null;
+ @Argument(name = "md",
+ description = "Maintenance Domain name and type (in brackets) - will use all MDs if not specified")
+ private String mdStr = null;
@Argument(index = 1, name = "ma",
- description = "Maintenance Association name and type (in brackets) - requires MD",
- required = false, multiValued = false)
- String maStr = null;
+ description = "Maintenance Association name and type (in brackets) - requires MD")
+ private String maStr = null;
@Argument(index = 2, name = "mep",
- description = "MEP identifier - requires MD and MA",
- required = false, multiValued = false)
- String mepStr = null;
+ description = "MEP identifier - requires MD and MA")
+ private String mepStr = null;
@Override
protected void execute() {
@@ -83,9 +80,8 @@
} else {
//MD and MA given but no MEP given
try {
- mepService.getAllMeps(mdId, maId).forEach(mep -> {
- print(printMepEntry(mep));
- });
+ mepService.getAllMeps(mdId, maId)
+ .forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}",
mdId.mdName(), maId.maName(), e);
@@ -96,9 +92,8 @@
mdService.getAllMaintenanceAssociation(mdId).forEach(ma -> {
print(printMaId(ma.maId()));
try {
- mepService.getAllMeps(mdId, ma.maId()).forEach(mep -> {
- print(printMepEntry(mep));
- });
+ mepService.getAllMeps(mdId, ma.maId())
+ .forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}",
mdId.mdName(), ma.maId().maName(), e);
@@ -113,9 +108,8 @@
mdService.getAllMaintenanceAssociation(md.mdId()).forEach(ma -> {
print(printMaId(ma.maId()));
try {
- mepService.getAllMeps(md.mdId(), ma.maId()).forEach(mep -> {
- print(printMepEntry(mep));
- });
+ mepService.getAllMeps(md.mdId(), ma.maId())
+ .forEach(mep -> print(printMepEntry(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for {}/{}",
md.mdId().mdName(), ma.maId().maName(), e);
@@ -130,25 +124,38 @@
* @param mep The MEPEntry to print
* @return A string with MepEntry details
*/
- public static String printMepEntry(MepEntry mep) {
+ private static String printMepEntry(MepEntry mep) {
StringBuffer sb = new StringBuffer("MEP: ");
sb.append(mep.mepId());
- sb.append(" Device:" + mep.deviceId());
- sb.append(", Port: " + mep.port());
- sb.append(", Vlan: " + mep.primaryVid());
- sb.append(", AdminSt: " + mep.administrativeState());
- sb.append(", CciEnabled: " + mep.cciEnabled());
- sb.append(", Priority: " + mep.ccmLtmPriority());
+ sb.append(" Device:");
+ sb.append(mep.deviceId());
+ sb.append(", Port: ");
+ sb.append(mep.port());
+ sb.append(", Vlan: ");
+ sb.append(mep.primaryVid());
+ sb.append(", AdminSt: ");
+ sb.append(mep.administrativeState());
+ sb.append(", CciEnabled: ");
+ sb.append(mep.cciEnabled());
+ sb.append(", Priority: ");
+ sb.append(mep.ccmLtmPriority());
sb.append("\n"); //The following are state
- sb.append(", Total CCMs: " + mep.totalCcmsTransmitted());
- sb.append(", MAC: " + mep.macAddress());
- sb.append(", Fault: " + mep.fngState());
+ sb.append(", Total CCMs: ");
+ sb.append(mep.totalCcmsTransmitted());
+ sb.append(", MAC: ");
+ sb.append(mep.macAddress());
+ sb.append(", Fault: ");
+ sb.append(mep.fngState());
mep.activeRemoteMepList().forEach(rmep -> {
- sb.append("\n\tRmep: " + rmep.remoteMepId());
- sb.append(", Mac: " + rmep.macAddress());
- sb.append(", State: " + rmep.state());
- sb.append(", Failed Time: " + rmep.failedOrOkTime());
+ sb.append("\n\tRmep: ");
+ sb.append(rmep.remoteMepId());
+ sb.append(", Mac: ");
+ sb.append(rmep.macAddress());
+ sb.append(", State: ");
+ sb.append(rmep.state());
+ sb.append(", Failed Time: ");
+ sb.append(rmep.failedOrOkTime());
});
@@ -156,18 +163,12 @@
return sb.toString();
}
- public static String printMdId(MdId mdId) {
- StringBuffer sb = new StringBuffer("MD: ");
- sb.append(mdId.mdName());
- sb.append("(" + mdId.nameType() + ")");
- return sb.toString();
+ private static String printMdId(MdId mdId) {
+ return "MD: " + mdId.mdName() + "(" + mdId.nameType() + ")";
}
- public static String printMaId(MaIdShort maId) {
- StringBuffer sb = new StringBuffer("MA: ");
- sb.append(maId.maName());
- sb.append("(" + maId.nameType() + ")");
- return sb.toString();
+ private static String printMaId(MaIdShort maId) {
+ return "MA: " + maId.maName() + "(" + maId.nameType() + ")";
}
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListDeviceCommand.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListDeviceCommand.java
index c99399a..5067cc1 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListDeviceCommand.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/CfmMepListDeviceCommand.java
@@ -22,9 +22,6 @@
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMepService;
import org.onosproject.net.DeviceId;
-import org.slf4j.Logger;
-
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Lists all the MEPs on a particular device.
@@ -32,11 +29,10 @@
@Command(scope = "onos", name = "cfm-mep-device-list",
description = "Lists a set of MEPs filtered by device.")
public class CfmMepListDeviceCommand extends AbstractShellCommand {
- private final Logger log = getLogger(getClass());
- @Argument(index = 0, name = "device",
+ @Argument(name = "device",
description = "Device Id",
- required = true, multiValued = false)
- String deviceStr = null;
+ required = true)
+ private String deviceStr = null;
@Override
protected void execute() {
@@ -44,9 +40,8 @@
if (deviceStr != null) {
DeviceId deviceId = DeviceId.deviceId(deviceStr);
try {
- mepService.getAllMepsByDevice(deviceId).forEach(mep -> {
- print(printMep(mep));
- });
+ mepService.getAllMepsByDevice(deviceId)
+ .forEach(mep -> print(printMep(mep)));
} catch (CfmConfigException e) {
log.error("Error retrieving Meps for Device {}",
deviceId, e);
@@ -59,19 +54,12 @@
* @param mep The MEP to print
* @return A string with MD name, MA name and Mep details
*/
- public static String printMep(Mep mep) {
- StringBuffer sb = new StringBuffer("MEP: ");
- sb.append(mep.mdId().mdName() + "/");
- sb.append(mep.maId().maName() + "/");
- sb.append(mep.mepId());
- sb.append(" Device:" + mep.deviceId());
- sb.append(", Port: " + mep.port());
- sb.append(", Vlan: " + mep.primaryVid());
- sb.append(", AdminSt: " + mep.administrativeState());
- sb.append(", CciEnabled: " + mep.cciEnabled());
- sb.append(", Priority: " + mep.ccmLtmPriority());
-
- return sb.toString();
+ private static String printMep(Mep mep) {
+ return "MEP: " + mep.mdId().mdName() + "/" + mep.maId().maName() + "/" +
+ mep.mepId() + " Device:" + mep.deviceId() + ", Port: " +
+ mep.port() + ", Vlan: " + mep.primaryVid() + ", AdminSt: " +
+ mep.administrativeState() + ", CciEnabled: " + mep.cciEnabled() +
+ ", Priority: " + mep.ccmLtmPriority();
}
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMaNameCompleter.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMaNameCompleter.java
index b484212..1463804 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMaNameCompleter.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMaNameCompleter.java
@@ -34,16 +34,8 @@
CfmMdService service = get(CfmMdService.class);
service.getAllMaintenanceDomain().forEach(md ->
md.maintenanceAssociationList().forEach(ma ->
- choices.add(new StringBuilder(md.mdId().mdName())
- .append("(")
- .append(md.mdId().nameType())
- .append(")")
- .append(ma.maId().maName())
- .append("(")
- .append(ma.maId().nameType())
- .append(")").toString())
- )
- );
+ choices.add(md.mdId().mdName() + "(" + md.mdId().nameType() + ")" +
+ ma.maId().maName() + "(" + ma.maId().nameType() + ")")));
return choices;
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMepIdCompleter.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMepIdCompleter.java
index 6019916..a26a460 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMepIdCompleter.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/cli/completer/CfmMepIdCompleter.java
@@ -41,32 +41,17 @@
CfmMepService mepService = get(CfmMepService.class);
mdService.getAllMaintenanceDomain().forEach(md -> {
- choices.add(new StringBuilder(md.mdId().mdName())
- .append("(")
- .append(md.mdId().nameType())
- .append(")").toString());
+ choices.add(md.mdId().mdName() + "(" + md.mdId().nameType() + ")");
md.maintenanceAssociationList().forEach(ma -> {
- choices.add(new StringBuilder(md.mdId().mdName())
- .append("(")
- .append(md.mdId().nameType())
- .append(") ")
- .append(ma.maId().maName())
- .append("(")
- .append(ma.maId().nameType())
- .append(")").toString());
+ choices.add(md.mdId().mdName() + "(" + md.mdId().nameType() +
+ ") " + ma.maId().maName() + "(" + ma.maId().nameType() + ")");
try {
mepService.getAllMeps(md.mdId(), ma.maId()).forEach(mep ->
- choices.add(new StringBuilder(md.mdId().mdName())
- .append("(")
- .append(md.mdId().nameType())
- .append(") ")
- .append(ma.maId().maName())
- .append("(")
- .append(ma.maId().nameType())
- .append(") ")
- .append(mep.mepId()).toString())
+ choices.add(md.mdId().mdName() + "(" +
+ md.mdId().nameType() + ") " + ma.maId().maName() +
+ "(" + ma.maId().nameType() + ") " + mep.mepId())
);
} catch (CfmConfigException e) {
log.warn("Unable to retrieve mep details", e);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MaWebResource.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MaWebResource.java
index 85b7ac4..e0390a9 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MaWebResource.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MaWebResource.java
@@ -17,6 +17,7 @@
import java.io.InputStream;
import java.net.URI;
+import java.util.Optional;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -134,9 +135,9 @@
log.debug("POST called to Create MA");
try {
MdId mdId = MdIdCharStr.asMdId(mdName);
- MaintenanceDomain md = get(CfmMdService.class)
- .getMaintenanceDomain(mdId).get();
- if (md == null) {
+ Optional<MaintenanceDomain> md = get(CfmMdService.class)
+ .getMaintenanceDomain(mdId);
+ if (!md.isPresent()) {
return Response.serverError().entity("{ \"failure\":\"md "
+ mdName + " does not exist\" }").build();
}
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MdWebResource.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MdWebResource.java
index 0e523a7..aa16d9e 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MdWebResource.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MdWebResource.java
@@ -49,7 +49,6 @@
@Path("md")
public class MdWebResource extends AbstractWebResource {
private final Logger log = LoggerFactory.getLogger(getClass());
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
/**
* Get all Maintenance Domains.
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MepWebResource.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MepWebResource.java
index 52d4150..a9d2c9e 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MepWebResource.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/rest/MepWebResource.java
@@ -180,7 +180,10 @@
try {
MdId mdId = MdIdCharStr.asMdId(mdName);
MaIdShort maId = MaIdCharStr.asMaId(maName);
- MaintenanceAssociation ma = get(CfmMdService.class).getMaintenanceAssociation(mdId, maId).get();
+ MaintenanceAssociation ma =
+ get(CfmMdService.class).getMaintenanceAssociation(mdId, maId)
+ .orElseThrow(() -> new IllegalArgumentException(
+ "MA " + mdName + "/" + maName + " not Found"));
ObjectMapper mapper = new ObjectMapper();
JsonNode cfg = mapper.readTree(input);
@@ -194,12 +197,14 @@
" already exists").build();
}
return Response
- .created(new URI("md/" + mdName + "/ma/" + ma.maId() + "/mep/" + mep.mepId()))
- .entity("{ \"success\":\"mep " + mdName + "/" + ma.maId() + "/" + mep.mepId() + " created\" }")
+ .created(new URI("md/" + mdName + "/ma/" + ma.maId() +
+ "/mep/" + mep.mepId()))
+ .entity("{ \"success\":\"mep " + mdName + "/" + ma.maId() +
+ "/" + mep.mepId() + " created\" }")
.build();
} catch (Exception | CfmConfigException e) {
log.error("Create Mep on " + mdName + "/" + maName + " failed because of exception {}",
- e.toString());
+ e);
return Response.serverError()
.entity("{ \"failure\":\"" + e.toString() + "\" }")
.build();
@@ -229,9 +234,25 @@
MdId mdId = MdIdCharStr.asMdId(mdName);
MaIdShort maId = MaIdCharStr.asMaId(maName);
- MaintenanceDomain md = get(CfmMdService.class).getMaintenanceDomain(mdId).get();
- MaintenanceAssociation ma = get(CfmMdService.class)
- .getMaintenanceAssociation(mdId, maId).get();
+ MaintenanceDomain md;
+ Optional<MaintenanceDomain> mdOpt = get(CfmMdService.class).getMaintenanceDomain(mdId);
+ if (mdOpt.isPresent()) {
+ md = mdOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + mdName + " does not exist\" }")
+ .build();
+ }
+ MaintenanceAssociation ma;
+ Optional<MaintenanceAssociation> maOpt = get(CfmMdService.class)
+ .getMaintenanceAssociation(mdId, maId);
+ if (maOpt.isPresent()) {
+ ma = maOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + maName + " does not exist\" }")
+ .build();
+ }
MepId mepId = MepId.valueOf(mepIdShort);
@@ -275,9 +296,25 @@
MdId mdId = MdIdCharStr.asMdId(mdName);
MaIdShort maId = MaIdCharStr.asMaId(maName);
- MaintenanceDomain md = get(CfmMdService.class).getMaintenanceDomain(mdId).get();
- MaintenanceAssociation ma = get(CfmMdService.class)
- .getMaintenanceAssociation(mdId, maId).get();
+ MaintenanceDomain md;
+ Optional<MaintenanceDomain> mdOpt = get(CfmMdService.class).getMaintenanceDomain(mdId);
+ if (mdOpt.isPresent()) {
+ md = mdOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + mdName + " does not exist\" }")
+ .build();
+ }
+ MaintenanceAssociation ma;
+ Optional<MaintenanceAssociation> maOpt = get(CfmMdService.class)
+ .getMaintenanceAssociation(mdId, maId);
+ if (maOpt.isPresent()) {
+ ma = maOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + maName + " does not exist\" }")
+ .build();
+ }
MepId mepId = MepId.valueOf(mepIdShort);
@@ -319,9 +356,25 @@
MdId mdId = MdIdCharStr.asMdId(mdName);
MaIdShort maId = MaIdCharStr.asMaId(maName);
- MaintenanceDomain md = get(CfmMdService.class).getMaintenanceDomain(mdId).get();
- MaintenanceAssociation ma = get(CfmMdService.class)
- .getMaintenanceAssociation(mdId, maId).get();
+ MaintenanceDomain md;
+ Optional<MaintenanceDomain> mdOpt = get(CfmMdService.class).getMaintenanceDomain(mdId);
+ if (mdOpt.isPresent()) {
+ md = mdOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + mdName + " does not exist\" }")
+ .build();
+ }
+ MaintenanceAssociation ma;
+ Optional<MaintenanceAssociation> maOpt = get(CfmMdService.class)
+ .getMaintenanceAssociation(mdId, maId);
+ if (maOpt.isPresent()) {
+ ma = maOpt.get();
+ } else {
+ return Response.serverError()
+ .entity("{ \"failure\":\"" + maName + " does not exist\" }")
+ .build();
+ }
MepId mepId = MepId.valueOf(mepIdShort);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/ComponentCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/ComponentCodec.java
index 6a53497..ee83dea 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/ComponentCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/ComponentCodec.java
@@ -42,6 +42,15 @@
private static final String MHF_CREATION_TYPE = "mhf-creation-type";
private static final String ID_PERMISSION = "id-permission";
+ /**
+ * Encodes the Component entity into JSON.
+ *
+ * @param component Component to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(Component component, CodecContext context) {
@@ -63,15 +72,31 @@
return (ObjectNode) context.mapper().createObjectNode().set(COMPONENT, node);
}
+ /**
+ * Encodes the collection of the Component entities.
+ *
+ * @param components collection of Component to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<Component> components, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
- components.forEach(component -> {
- an.add(encode(component, context));
- });
+ components.forEach(component -> an.add(encode(component, context)));
return an;
}
+ /**
+ * Decodes the Component entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded Component
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public Component decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -87,7 +112,7 @@
List<VlanId> vidList = (new VidCodec()).decode((ArrayNode)
nullIsIllegal(componentNode.get(VID_LIST), "vid-list is required"), context);
- if (vidList == null || vidList.size() < 1) {
+ if (vidList == null || vidList.isEmpty()) {
throw new IllegalArgumentException("A least one VID is required in component: " + componentId);
}
for (VlanId vid:vidList) {
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/FngAddressCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/FngAddressCodec.java
index 47cc9b6..1c0e725 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/FngAddressCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/FngAddressCodec.java
@@ -25,6 +25,8 @@
import org.onosproject.incubator.net.l2monitoring.cfm.Mep;
import org.onosproject.incubator.net.l2monitoring.cfm.Mep.FngAddress;
+import java.util.Locale;
+
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
@@ -33,6 +35,15 @@
*/
public class FngAddressCodec extends JsonCodec<FngAddress> {
+ /**
+ * Encodes the FngAddress entity into JSON.
+ *
+ * @param fngAddress FngAddress to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(FngAddress fngAddress, CodecContext context) {
checkNotNull(fngAddress, "FngAddress cannot be null");
@@ -47,6 +58,15 @@
return result;
}
+ /**
+ * Decodes the FngAddress entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded FngAddress
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public FngAddress decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -57,7 +77,7 @@
String addressType = nullIsIllegal(node.get("address-type"),
"address type is required").asText();
- Mep.FngAddressType type = Mep.FngAddressType.valueOf(addressType.toUpperCase());
+ Mep.FngAddressType type = Mep.FngAddressType.valueOf(addressType.toUpperCase(Locale.ENGLISH));
JsonNode ipAddressNode = node.get("ipAddress");
switch (type) {
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceAssociationCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceAssociationCodec.java
index 6c3829f..b1b9baa 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceAssociationCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceAssociationCodec.java
@@ -27,12 +27,8 @@
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation.CcmInterval;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceAssociation.MaBuilder;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaId2Octet;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdIccY1731;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdPrimaryVid;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdRfc2685VpnId;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MaIdShort;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdMaNameUtil;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MepId;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
@@ -53,6 +49,15 @@
private static final String RMEP_LIST = "rmep-list";
private static final String MA = "ma";
+ /**
+ * Encodes the MaintenanceAssociation entity into JSON.
+ *
+ * @param ma MaintenanceAssociation to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MaintenanceAssociation ma, CodecContext context) {
checkNotNull(ma, "Maintenance Association cannot be null");
@@ -72,6 +77,16 @@
return result;
}
+ /**
+ * Decodes the MaintenanceAssociation entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @param mdNameLen the length of the corresponding MD's name
+ * @return decoded MaintenanceAssociation
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
public MaintenanceAssociation decode(ObjectNode json, CodecContext context, int mdNameLen) {
if (json == null || !json.isObject()) {
return null;
@@ -86,25 +101,7 @@
}
try {
- MaIdShort maId = null;
- MaIdShort.MaIdType maIdType = MaIdShort.MaIdType.valueOf(maNameType);
- switch (maIdType) {
- case PRIMARYVID:
- maId = MaIdPrimaryVid.asMaId(maName);
- break;
- case TWOOCTET:
- maId = MaId2Octet.asMaId(maName);
- break;
- case RFC2685VPNID:
- maId = MaIdRfc2685VpnId.asMaIdHex(maName);
- break;
- case ICCY1731:
- maId = MaIdIccY1731.asMaId(maName);
- break;
- case CHARACTERSTRING:
- default:
- maId = MaIdCharStr.asMaId(maName);
- }
+ MaIdShort maId = MdMaNameUtil.parseMaName(maNameType, maName);
MaBuilder builder =
DefaultMaintenanceAssociation.builder(maId, mdNameLen);
@@ -140,6 +137,15 @@
}
+ /**
+ * Encodes the collection of the MaintenanceAssociation entities.
+ *
+ * @param maEntities collection of MaintenanceAssociation to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<MaintenanceAssociation> maEntities, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceDomainCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceDomainCodec.java
index a6bcf01..89b7cc1 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceDomainCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MaintenanceDomainCodec.java
@@ -24,10 +24,7 @@
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain;
import org.onosproject.incubator.net.l2monitoring.cfm.MaintenanceDomain.MdLevel;
import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdId;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdCharStr;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdDomainName;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdMacUint;
-import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdIdNone;
+import org.onosproject.incubator.net.l2monitoring.cfm.identifier.MdMaNameUtil;
import org.onosproject.incubator.net.l2monitoring.cfm.service.CfmConfigException;
import com.fasterxml.jackson.databind.JsonNode;
@@ -50,6 +47,15 @@
}
+ /**
+ * Encodes the MaintenanceDomain entity into JSON.
+ *
+ * @param md MaintenanceDomain to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MaintenanceDomain md, CodecContext context) {
checkNotNull(md, "Maintenance Domain cannot be null");
@@ -67,6 +73,15 @@
return result;
}
+ /**
+ * Decodes the MaintenanceDomain entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded MaintenanceDomain
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public MaintenanceDomain decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -82,24 +97,7 @@
}
try {
- MdId mdId = null;
- MdId.MdNameType nameType =
- MdId.MdNameType.valueOf(mdNameType);
- switch (nameType) {
- case DOMAINNAME:
- mdId = MdIdDomainName.asMdId(mdName);
- break;
- case MACANDUINT:
- mdId = MdIdMacUint.asMdId(mdName);
- break;
- case NONE:
- mdId = MdIdNone.asMdId();
- break;
- case CHARACTERSTRING:
- default:
- mdId = MdIdCharStr.asMdId(mdName);
- }
-
+ MdId mdId = MdMaNameUtil.parseMdName(mdNameType, mdName);
MaintenanceDomain.MdBuilder builder = DefaultMaintenanceDomain.builder(mdId);
JsonNode mdLevelNode = mdNode.get(MD_LEVEL);
if (mdLevelNode != null) {
@@ -118,6 +116,15 @@
}
}
+ /**
+ * Encodes the collection of the MaintenanceDomain entities.
+ *
+ * @param mdEntities collection of MaintenanceDomain to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<MaintenanceDomain> mdEntities, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepCodec.java
index 73a58b6..a095da8 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepCodec.java
@@ -53,6 +53,17 @@
private static final String DEFECT_PRESENT_TIME = "defect-present-time";
private static final String DEFECT_ABSENT_TIME = "defect-absent-time";
+ /**
+ * Decodes the Mep entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @param mdName The MD name
+ * @param maName The MA name
+ * @return decoded Mep
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
public Mep decode(ObjectNode json, CodecContext context, String
mdName, String maName) {
if (json == null || !json.isObject()) {
@@ -127,6 +138,15 @@
}
}
+ /**
+ * Encodes the Mep entity into JSON.
+ *
+ * @param mep Mep to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(Mep mep, CodecContext context) {
checkNotNull(mep, "Mep cannot be null");
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepEntryCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepEntryCodec.java
index d1618a7..f1799fb 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepEntryCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepEntryCodec.java
@@ -34,6 +34,15 @@
*/
public class MepEntryCodec extends JsonCodec<MepEntry> {
+ /**
+ * Encodes the MepEntry entity into JSON.
+ *
+ * @param mepEntry MepEntry to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MepEntry mepEntry, CodecContext context) {
checkNotNull(mepEntry, "Mep cannot be null");
@@ -41,7 +50,7 @@
ObjectNode result = context.mapper().createObjectNode();
//Get the common attributes
- Mep mep = (Mep) mepEntry;
+ Mep mep = mepEntry;
ObjectNode mepAttrs = new MepCodec().encode(mep, context);
Iterator<Entry<String, JsonNode>> elements = mepAttrs.fields();
while (elements.hasNext()) {
@@ -81,6 +90,15 @@
return result;
}
+ /**
+ * Encodes the collection of the MepEntry entities.
+ *
+ * @param mepEntryEntities collection of MepEntry to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<MepEntry> mepEntryEntities, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbCreateCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbCreateCodec.java
index e29415c..8b80237 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbCreateCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbCreateCodec.java
@@ -42,6 +42,15 @@
public static final String VLAN_PRIORITY = "vlanPriority";
public static final String LOOPBACK = "loopback";
+ /**
+ * Encodes the MepLbCreate entity into JSON.
+ *
+ * @param mepLbCreate MepLbCreate to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MepLbCreate mepLbCreate, CodecContext context) {
checkNotNull(mepLbCreate, "Mep Lb Create cannot be null");
@@ -66,7 +75,15 @@
return result;
}
-
+ /**
+ * Decodes the MepLbCreate entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded MepLbCreate
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public MepLbCreate decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -78,7 +95,7 @@
JsonNode remoteMepIdNode = loopbackNode.get(REMOTE_MEP_ID);
JsonNode remoteMepMacNode = loopbackNode.get(REMOTE_MEP_MAC);
- MepLbCreate.MepLbCreateBuilder lbCreateBuilder = null;
+ MepLbCreate.MepLbCreateBuilder lbCreateBuilder;
if (remoteMepIdNode != null) {
MepId remoteMepId = MepId.valueOf((short) remoteMepIdNode.asInt());
lbCreateBuilder = DefaultMepLbCreate.builder(remoteMepId);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbEntryCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbEntryCodec.java
index 62409cd..8ff8e23 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbEntryCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLbEntryCodec.java
@@ -28,6 +28,15 @@
*/
public class MepLbEntryCodec extends JsonCodec<MepLbEntry> {
+ /**
+ * Encodes the MepLbEntry entity into JSON.
+ *
+ * @param mepLbEntry MepLbEntry to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MepLbEntry mepLbEntry, CodecContext context) {
checkNotNull(mepLbEntry, "Mep Lb Entry cannot be null");
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLtCreateCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLtCreateCodec.java
index 0141a73..ba7aabe 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLtCreateCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/MepLtCreateCodec.java
@@ -40,6 +40,15 @@
private static final String LINKTRACE = "linktrace";
private static final String USE_FDB_ONLY = "use-fdb-only";
+ /**
+ * Encodes the MepLtCreate entity into JSON.
+ *
+ * @param mepLtCreate MepLtCreate to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MepLtCreate mepLtCreate, CodecContext context) {
checkNotNull(mepLtCreate, "Mep Lt Create cannot be null");
@@ -62,7 +71,15 @@
return result;
}
-
+ /**
+ * Decodes the MepLtCreate entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded MepLtCreate
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public MepLtCreate decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -74,7 +91,7 @@
JsonNode remoteMepIdNode = linktraceNode.get(REMOTE_MEP_ID);
JsonNode remoteMepMacNode = linktraceNode.get(REMOTE_MEP_MAC);
- MepLtCreate.MepLtCreateBuilder ltCreateBuilder = null;
+ MepLtCreate.MepLtCreateBuilder ltCreateBuilder;
if (remoteMepIdNode != null) {
MepId remoteMepId = MepId.valueOf((short) remoteMepIdNode.asInt());
ltCreateBuilder = DefaultMepLtCreate.builder(remoteMepId);
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RMepCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RMepCodec.java
index ff4f775..6f4fc53 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RMepCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RMepCodec.java
@@ -33,20 +33,45 @@
*/
public class RMepCodec extends JsonCodec<MepId> {
+ /**
+ * Encodes the MepId entity into JSON.
+ *
+ * @param rmep MepId to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(MepId rmep, CodecContext context) {
return context.mapper().createObjectNode().put("rmep", rmep.id());
}
+ /**
+ * Encodes the collection of the MepId entities.
+ *
+ * @param rmeps collection of MepId to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<MepId> rmeps, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
- rmeps.forEach(rmep -> {
- an.add(encode(rmep, context));
- });
+ rmeps.forEach(rmep -> an.add(encode(rmep, context)));
return an;
}
+ /**
+ * Decodes the MepId entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded MepId
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public MepId decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -60,6 +85,15 @@
}
+ /**
+ * Decodes the MepId JSON array into a collection of entities.
+ *
+ * @param json JSON array to decode
+ * @param context decoding context
+ * @return collection of decoded MepId
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public List<MepId> decode(ArrayNode json, CodecContext context) {
List<MepId> rmepList = new ArrayList<>();
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RemoteMepEntryCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RemoteMepEntryCodec.java
index 4f8344a..329cc72 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RemoteMepEntryCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/RemoteMepEntryCodec.java
@@ -29,6 +29,15 @@
*/
public class RemoteMepEntryCodec extends JsonCodec<RemoteMepEntry> {
+ /**
+ * Encodes the RemoteMepEntry entity into JSON.
+ *
+ * @param remoteMepEntry RemoteMepEntry to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(RemoteMepEntry remoteMepEntry, CodecContext context) {
checkNotNull(remoteMepEntry, "Mep cannot be null");
@@ -62,6 +71,15 @@
return result;
}
+ /**
+ * Encodes the collection of the RemoteMepEntry entities.
+ *
+ * @param remoteMepEntries collection of RemoteMepEntry to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<RemoteMepEntry> remoteMepEntries,
CodecContext context) {
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/VidCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/VidCodec.java
index a673719..cf97f01 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/VidCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/cfm/web/VidCodec.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.cfm.web;
+import static org.onlab.packet.VlanId.MAX_VLAN;
import static org.onlab.util.Tools.nullIsIllegal;
import java.util.ArrayList;
@@ -33,20 +34,45 @@
*/
public class VidCodec extends JsonCodec<VlanId> {
+ /**
+ * Encodes the VlanId entity into JSON.
+ *
+ * @param vid VlanId to encode
+ * @param context encoding context
+ * @return JSON node
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ObjectNode encode(VlanId vid, CodecContext context) {
return context.mapper().createObjectNode().put("vid", vid.toString());
}
+ /**
+ * Encodes the collection of the VlanId entities.
+ *
+ * @param vids collection of VlanId to encode
+ * @param context encoding context
+ * @return JSON array
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support encode operations
+ */
@Override
public ArrayNode encode(Iterable<VlanId> vids, CodecContext context) {
ArrayNode an = context.mapper().createArrayNode();
- vids.forEach(vid -> {
- an.add(encode(vid, context));
- });
+ vids.forEach(vid -> an.add(encode(vid, context)));
return an;
}
+ /**
+ * Decodes the VlanId entity from JSON.
+ *
+ * @param json JSON to decode
+ * @param context decoding context
+ * @return decoded VlanId
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public VlanId decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
@@ -56,12 +82,21 @@
JsonNode vidNode = json.get("vid");
int vid = (nullIsIllegal(vidNode.asInt(), "vid is required"));
- if (vid < 0 || vid > 4095) {
+ if (vid < 0 || vid > MAX_VLAN) {
throw new IllegalArgumentException("VID values must be between 0 and 4095");
}
return VlanId.vlanId((short) vid);
}
+ /**
+ * Decodes the VlanId JSON array into a collection of entities.
+ *
+ * @param json JSON array to decode
+ * @param context decoding context
+ * @return collection of decoded VlanId
+ * @throws java.lang.UnsupportedOperationException if the codec does not
+ * support decode operations
+ */
@Override
public List<VlanId> decode(ArrayNode json, CodecContext context) {
List<VlanId> vidList = new ArrayList<>();
diff --git a/apps/cfm/nbi/src/main/java/org/onosproject/soam/web/LossMeasurementThresholdCodec.java b/apps/cfm/nbi/src/main/java/org/onosproject/soam/web/LossMeasurementThresholdCodec.java
index 3a17f94..da87a82 100644
--- a/apps/cfm/nbi/src/main/java/org/onosproject/soam/web/LossMeasurementThresholdCodec.java
+++ b/apps/cfm/nbi/src/main/java/org/onosproject/soam/web/LossMeasurementThresholdCodec.java
@@ -29,6 +29,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
+
import static org.onosproject.incubator.net.l2monitoring.soam.loss.DefaultLmThreshold.*;
/**
@@ -131,7 +132,7 @@
LossMeasurementThreshold.LmThresholdBuilder builder = builder(thresholdId);
if (thrNode.get("thresholds") != null) {
- context.codec(ThresholdOption.class)
+ context.codec(LossMeasurementThreshold.ThresholdOption.class)
.decode((ArrayNode) (thrNode.get("thresholds")), context)
.forEach(builder::addToThreshold);
}
diff --git a/drivers/microsemi/ea1000/pom.xml b/drivers/microsemi/ea1000/pom.xml
index d34a507..7e9997c 100644
--- a/drivers/microsemi/ea1000/pom.xml
+++ b/drivers/microsemi/ea1000/pom.xml
@@ -101,18 +101,6 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
</dependency>
diff --git a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
index a5ff236..8a25aae 100755
--- a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
+++ b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000CfmMepProgrammable.java
@@ -107,14 +107,16 @@
implements CfmMepProgrammable {
private static final int NUMERIC_ID_MAX = 64;
- private static final int REMOTEMEPLIST_MIN_COUNT = 2;
- private static final int REMOTEMEPLIST_MAX_COUNT = 9;
private static final int COMPONENT_LIST_SIZE = 1;
private static final int VIDLIST_SIZE_MIN = 1;
private static final int MEP_PORT_MIN = 0;
private static final int MEP_PORT_MAX = 1;
+ public static final String MUST_1_64_MSG = " must be between 1 and 64 inclusive for EA1000";
private final Logger log = getLogger(getClass());
+ /**
+ * Creates the instance of the EA1000CfmMepProgrammable.
+ */
public EA1000CfmMepProgrammable() {
log.debug("Loaded handler behaviour EA1000CfmMepProgrammable");
}
@@ -142,10 +144,9 @@
.maintenanceAssociation().get(0).addToRemoteMeps(MepIdType.of(mep.mepId().value()));
//Add all of the existing meps on this MD/MA to the remote meps list
- cfmMepService.getAllMeps(mdName, maName).forEach(m -> {
- mseaCfmOpParam.mefCfm().maintenanceDomain().get(0)
- .maintenanceAssociation().get(0).addToRemoteMeps(MepIdType.of(m.mepId().value()));
- });
+ cfmMepService.getAllMeps(mdName, maName).forEach(m -> mseaCfmOpParam.mefCfm()
+ .maintenanceDomain().get(0).maintenanceAssociation().get(0)
+ .addToRemoteMeps(MepIdType.of(m.mepId().value())));
try {
mseaCfmService.setMseaCfm(mseaCfmOpParam, session, DatastoreId.RUNNING);
log.info("Created MEP {} on device {}", mdName + "/" + maName +
@@ -154,8 +155,8 @@
return true;
} catch (NetconfException e) {
log.error("Unable to create MEP {}/{}/{} on device {}",
- mdName, maName, mep.mepId(), handler().data().deviceId());
- throw new CfmConfigException("Unable to create MEP :" + e.getMessage());
+ mdName, maName, mep.mepId(), handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to create MEP :" + e.getMessage(), e);
}
}
@@ -183,8 +184,8 @@
}
} catch (NetconfException e) {
log.error("Unable to get MEP {}/{}/{} on device {}",
- mdName, maName, mepId, handler().data().deviceId());
- throw new CfmConfigException("Unable to get MEP :" + e.getMessage());
+ mdName, maName, mepId, handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to get MEP :" + e.getMessage(), e);
}
}
@@ -235,7 +236,7 @@
//The MA and/or MD have probably been deleted
// try to get numeric id values from oldMd
log.debug("Could not get MD/MA details from MD service during deletion of MEP {}." +
- "Continuing with values from event", new MepKeyId(mdName, maName, mepId));
+ "Continuing with values from event", new MepKeyId(mdName, maName, mepId), e);
yangMa.id(getMaNumericId(oldMd.get(), maName));
}
@@ -251,7 +252,7 @@
//The MD has probably been deleted
// try to get numeric id values from oldMd
log.debug("Could not get MD details from MD service during deletion of MEP {}." +
- "Continuing with values from event", new MepKeyId(mdName, maName, mepId));
+ "Continuing with values from event", new MepKeyId(mdName, maName, mepId), e);
yangMd.id(oldMd.get().mdNumericId());
}
yangMd.addToMaintenanceAssociation(yangMa);
@@ -290,14 +291,12 @@
.mefcfm.MaintenanceDomain yangMd = buildYangMdFromApiMd(md);
if (md.mdNumericId() <= 0 || md.mdNumericId() > NUMERIC_ID_MAX) {
- throw new CfmConfigException("Numeric id of MD " + mdId + " must"
- + " be between 1 and 64 inclusive for EA1000");
+ throw new CfmConfigException("Numeric id of MD " + mdId + MUST_1_64_MSG);
}
for (MaintenanceAssociation ma:md.maintenanceAssociationList()) {
if (ma.maNumericId() <= 0 || ma.maNumericId() > NUMERIC_ID_MAX) {
- throw new CfmConfigException("Numeric id of MA " + mdId + " must"
- + " be between 1 and 64 inclusive for EA1000");
+ throw new CfmConfigException("Numeric id of MA " + mdId + MUST_1_64_MSG);
}
org.onosproject.yang.gen.v1.mseacfm.rev20160229.mseacfm.mefcfm.maintenancedomain
.MaintenanceAssociation yangMa = buildYangMaFromApiMa(ma);
@@ -320,8 +319,8 @@
return created;
} catch (NetconfException e) {
log.error("Unable to create MD {} on device {}",
- mdId.mdName(), handler().data().deviceId());
- throw new CfmConfigException("Unable to create MD :" + e.getMessage());
+ mdId.mdName(), handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to create MD :" + e.getMessage(), e);
}
}
@@ -344,8 +343,8 @@
return created;
} catch (NetconfException e) {
log.error("Unable to create MA {} on device {}",
- mdId.mdName() + "/" + maId.maName(), handler().data().deviceId());
- throw new CfmConfigException("Unable to create MA :" + e.getMessage());
+ mdId.mdName() + "/" + maId.maName(), handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to create MA :" + e.getMessage(), e);
}
}
@@ -362,11 +361,9 @@
yangMd.addToMaintenanceAssociation(yangMa);
if (md.mdNumericId() <= 0 || md.mdNumericId() > NUMERIC_ID_MAX) {
- throw new CfmConfigException("Numeric id of MD " + mdName + " must"
- + " be between 1 and 64 inclusive for EA1000");
+ throw new CfmConfigException("Numeric id of MD " + mdName + MUST_1_64_MSG);
} else if (ma.maNumericId() <= 0 || ma.maNumericId() > NUMERIC_ID_MAX) {
- throw new CfmConfigException("Numeric id of MA " + maName + " must"
- + " be between 1 and 64 inclusive for EA1000");
+ throw new CfmConfigException("Numeric id of MA " + maName + MUST_1_64_MSG);
}
MefCfm mefCfm = new DefaultMefCfm();
@@ -391,7 +388,6 @@
// the Meps should have been deleted first
//If there are none known to ONOS we do not check for Meps on the actual device
// - there might might be some orphaned ones down there - we want to delete these
- //FIXME: When CfmMepService is extended to be persistent come back and enable check
CfmMdService mdService = checkNotNull(handler().get(CfmMdService.class));
MseaCfmNetconfService mseaCfmService =
checkNotNull(handler().get(MseaCfmNetconfService.class));
@@ -404,6 +400,7 @@
mdNumericId = mdService.getMaintenanceDomain(mdId).get().mdNumericId();
yangMd.id(mdNumericId);
} catch (NoSuchElementException e) {
+ log.debug("Cannot get numericId of MD from service - getting from oldValue", e);
yangMd.id(oldMd.get().mdNumericId());
}
@@ -415,13 +412,12 @@
try {
boolean deleted = mseaCfmService.deleteMseaMd(mseaCfmOpParam, session, DatastoreId.RUNNING);
- log.info("Deleted MD {} on device {}", mdName,
- handler().data().deviceId());
+ log.info("Deleted MD {} on device {}", mdName, handler().data().deviceId());
return deleted;
} catch (NetconfException e) {
log.error("Unable to delete MD {} ({}) on device {}",
- mdName, mdNumericId, handler().data().deviceId());
- throw new CfmConfigException("Unable to delete MD :" + e.getMessage());
+ mdName, mdNumericId, handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to delete MD :" + e.getMessage(), e);
}
}
@@ -447,6 +443,7 @@
mdService.getMaintenanceAssociation(mdId, maId).get().maNumericId();
yangMa.id(maNumericId);
} catch (NoSuchElementException e) {
+ log.debug("Cannot get numericId of MA from service - getting from oldValue", e);
yangMa.id(getMaNumericId(oldMd.get(), maId));
}
@@ -457,6 +454,7 @@
mdNumericId = mdService.getMaintenanceDomain(mdId).get().mdNumericId();
yangMd.id(mdNumericId);
} catch (NoSuchElementException e) {
+ log.debug("Cannot get numericId of MD from service - getting from oldValue", e);
yangMd.id(oldMd.get().mdNumericId());
}
yangMd.addToMaintenanceAssociation(yangMa);
@@ -475,8 +473,8 @@
} catch (NetconfException e) {
log.error("Unable to delete MA {} ({}) on device {}",
mdId.mdName() + "/" + maId.maName(),
- mdNumericId + "/" + maNumericId, handler().data().deviceId());
- throw new CfmConfigException("Unable to delete MA :" + e.getMessage());
+ mdNumericId + "/" + maNumericId, handler().data().deviceId(), e);
+ throw new CfmConfigException("Unable to delete MA :" + e.getMessage(), e);
}
}
@@ -523,7 +521,7 @@
mseaCfmOpParam.mefCfm(mefCfm);
try {
- boolean result = false;
+ boolean result;
if (isCreate) {
result = mseaCfmService.setMseaCfm(mseaCfmOpParam, session, DatastoreId.RUNNING);
} else {
@@ -535,9 +533,9 @@
} catch (NetconfException e) {
log.error("Unable to {} RemoteMep {} in MA {} on device {}",
isCreate ? "create" : "delete", remoteMep, mdId.mdName() + "/" + maId.maName(),
- handler().data().deviceId());
+ handler().data().deviceId(), e);
throw new CfmConfigException("Unable to " + (isCreate ? "create" : "delete")
- + " Remote Mep:" + e.getMessage());
+ + " Remote Mep:" + e.getMessage(), e);
}
}
@@ -671,25 +669,9 @@
}
if (apiMa.ccmInterval() != null) {
- switch (apiMa.ccmInterval()) {
- case INTERVAL_3MS:
- yamgMa.ccmInterval(CcmIntervalEnum.YANGAUTOPREFIX3_3MS);
- break;
- case INTERVAL_10MS:
- yamgMa.ccmInterval(CcmIntervalEnum.YANGAUTOPREFIX10MS);
- break;
- case INTERVAL_100MS:
- yamgMa.ccmInterval(CcmIntervalEnum.YANGAUTOPREFIX100MS);
- break;
- case INTERVAL_1S:
- yamgMa.ccmInterval(CcmIntervalEnum.YANGAUTOPREFIX1S);
- break;
- default:
- throw new CfmConfigException("EA1000 only supports "
- + "3ms, 10ms, 100ms and 1s for CCM Interval. Rejecting: "
- + apiMa.ccmInterval().name());
- }
+ yamgMa.ccmInterval(getYangCcmIntervalFromApi(apiMa.ccmInterval()));
}
+
if (apiMa.componentList() == null || apiMa.componentList().size() != COMPONENT_LIST_SIZE) {
throw new CfmConfigException("EA1000 supports only 1 Component in an MA");
}
@@ -724,6 +706,24 @@
return yamgMa;
}
+ private static CcmIntervalEnum getYangCcmIntervalFromApi(
+ MaintenanceAssociation.CcmInterval cci) throws CfmConfigException {
+ switch (cci) {
+ case INTERVAL_3MS:
+ return CcmIntervalEnum.YANGAUTOPREFIX3_3MS;
+ case INTERVAL_10MS:
+ return CcmIntervalEnum.YANGAUTOPREFIX10MS;
+ case INTERVAL_100MS:
+ return CcmIntervalEnum.YANGAUTOPREFIX100MS;
+ case INTERVAL_1S:
+ return CcmIntervalEnum.YANGAUTOPREFIX1S;
+ default:
+ throw new CfmConfigException("EA1000 only supports "
+ + "3ms, 10ms, 100ms and 1s for CCM Interval. Rejecting: "
+ + cci.name());
+ }
+ }
+
private static MaintenanceAssociationEndPoint buildYangMepFromApiMep(Mep mep)
throws CfmConfigException {
MaintenanceAssociationEndPoint mepBuilder =
@@ -786,7 +786,7 @@
.maintenancedomain.maintenanceassociation
.maintenanceassociationendpoint.remotemepdatabase.RemoteMep
rmep:yangMep.remoteMepDatabase().remoteMep()) {
- builder = (MepEntry.MepEntryBuilder) builder.addToActiveRemoteMepList(
+ builder = builder.addToActiveRemoteMepList(
getApiRemoteMepFromYangRemoteMep(rmep));
}
}
@@ -805,9 +805,8 @@
AugmentedMseaCfmMaintenanceAssociationEndPoint augmentedyangMep = yangMep
.augmentation(DefaultAugmentedMseaCfmMaintenanceAssociationEndPoint.class);
- if (augmentedyangMep != null) {
- if (augmentedyangMep.lastDefectSent() != null) {
- builder = (MepEntry.MepEntryBuilder) builder
+ if (augmentedyangMep != null && augmentedyangMep.lastDefectSent() != null) {
+ builder = builder
.activeXconCcmDefect(augmentedyangMep.lastDefectSent().bits()
.get(Bits.CROSS_CONNECT_CCM.bits()))
.activeErrorCcmDefect(augmentedyangMep.lastDefectSent().bits()
@@ -818,7 +817,6 @@
.get(Bits.REMOTE_RDI.bits()))
.activeRemoteCcmDefect(augmentedyangMep.lastDefectSent().bits()
.get(Bits.REMOTE_INVALID_CCM.bits()));
- }
}
return builder.buildEntry();
diff --git a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000FlowRuleProgrammable.java b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000FlowRuleProgrammable.java
index b8258df..1e0dfd9 100644
--- a/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000FlowRuleProgrammable.java
+++ b/drivers/microsemi/ea1000/src/main/java/org/onosproject/drivers/microsemi/EA1000FlowRuleProgrammable.java
@@ -124,6 +124,7 @@
*/
public class EA1000FlowRuleProgrammable extends AbstractHandlerBehaviour implements FlowRuleProgrammable {
+ public static final int RADIX_16 = 16;
protected final Logger log = getLogger(getClass());
public static final String MICROSEMI_DRIVERS = "com.microsemi.drivers";
public static final int PRIORITY_DEFAULT = 50000;
@@ -141,7 +142,7 @@
*/
@Override
public Collection<FlowEntry> getFlowEntries() {
- Collection<FlowEntry> flowEntryCollection = new HashSet<FlowEntry>();
+ Collection<FlowEntry> flowEntryCollection = new HashSet<>();
UniSideInterfaceAssignmentEnum portAssignment = UniSideInterfaceAssignmentEnum.UNI_C_ON_HOST;
NetconfController controller = checkNotNull(handler().get(NetconfController.class));
@@ -156,9 +157,9 @@
CoreService coreService = checkNotNull(handler().get(CoreService.class));
ApplicationId appId = coreService.getAppId(MICROSEMI_DRIVERS);
MseaSaFilteringNetconfService mseaSaFilteringService =
- (MseaSaFilteringNetconfService) checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
+ checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
MseaUniEvcServiceNetconfService mseaUniEvcServiceSvc =
- (MseaUniEvcServiceNetconfService) checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
+ checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
log.debug("getFlowEntries() called on EA1000FlowRuleProgrammable");
//First get the MseaSaFiltering rules
@@ -230,21 +231,21 @@
*/
@Override
public Collection<FlowRule> applyFlowRules(Collection<FlowRule> rules) {
- Collection<FlowRule> frAdded = new HashSet<FlowRule>();
- if (rules == null || rules.size() == 0) {
+ Collection<FlowRule> frAdded = new HashSet<>();
+ if (rules == null || rules.isEmpty()) {
return rules;
}
NetconfController controller = checkNotNull(handler().get(NetconfController.class));
NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession();
MseaSaFilteringNetconfService mseaSaFilteringService =
- (MseaSaFilteringNetconfService) checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
+ checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
MseaUniEvcServiceNetconfService mseaUniEvcServiceSvc =
- (MseaUniEvcServiceNetconfService) checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
+ checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
log.debug("applyFlowRules() called on EA1000FlowRuleProgrammable with {} rules.", rules.size());
- // FIXME: Change this so it's dynamically driven
+ // TODO: Change this so it's dynamically driven
UniSideInterfaceAssignmentEnum portAssignment = UniSideInterfaceAssignmentEnum.UNI_C_ON_HOST;
- List<SourceAddressRange> saRangeList = new ArrayList<SourceAddressRange>();
+ List<SourceAddressRange> saRangeList = new ArrayList<>();
Map<Integer, Evc> evcMap = new HashMap<>();
//Retrieve the list of actual EVCs and the CeVlanMaps from device
@@ -282,12 +283,13 @@
//If there are IPv4 Flow Rules created commit them now through the
//MseaSaFiltering service
- if (saRangeList.size() > 0) {
+ if (!saRangeList.isEmpty()) {
try {
mseaSaFilteringService.setMseaSaFiltering(
buildSaFilteringObject(saRangeList), session, DatastoreId.RUNNING);
} catch (NetconfException e) {
- log.error("Error applying Flow Rules to SA Filtering - will try again: " + e.getMessage());
+ log.error("Error applying Flow Rules to SA Filtering - " +
+ "will try again: " + e.getMessage(), e);
sessionMutex.release();
return frAdded;
}
@@ -303,7 +305,7 @@
+ deviceName.getSchemeSpecificPart()));
uni.evc(evcList);
- List<BwpGroup> bwpGroupList = new ArrayList<BwpGroup>();
+ List<BwpGroup> bwpGroupList = new ArrayList<>();
BwpGroup bwpGrp = new DefaultBwpGroup();
bwpGrp.groupIndex((short) 0);
bwpGroupList.add(bwpGrp);
@@ -319,7 +321,7 @@
try {
mseaUniEvcServiceSvc.setMseaUniEvcService(mseaUniEvcServiceFilter, session, DatastoreId.RUNNING);
} catch (NetconfException e) {
- log.error("Error applying Flow Rules to EVC - will try again: " + e.getMessage());
+ log.error("Error applying Flow Rules to EVC - will try again: " + e.getMessage(), e);
sessionMutex.release();
return frAdded;
}
@@ -341,13 +343,13 @@
NetconfController controller = checkNotNull(handler().get(NetconfController.class));
NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession();
MseaSaFilteringNetconfService mseaSaFilteringService =
- (MseaSaFilteringNetconfService) checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
+ checkNotNull(handler().get(MseaSaFilteringNetconfService.class));
MseaUniEvcServiceNetconfService mseaUniEvcServiceSvc =
- (MseaUniEvcServiceNetconfService) checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
+ checkNotNull(handler().get(MseaUniEvcServiceNetconfService.class));
UniSideInterfaceAssignmentEnum portAssignment = UniSideInterfaceAssignmentEnum.UNI_C_ON_HOST;
log.debug("removeFlowRules() called on EA1000FlowRuleProgrammable with {} rules.", rulesToRemove.size());
- if (rulesToRemove.size() == 0) {
+ if (rulesToRemove.isEmpty()) {
return rulesToRemove;
}
@@ -369,11 +371,11 @@
log.warn("Error on removeFlowRules.", e1);
}
- List<SourceAddressRange> saRangeList = new ArrayList<SourceAddressRange>();
+ List<SourceAddressRange> saRangeList = new ArrayList<>();
Map<Integer, String> ceVlanMapMap = new HashMap<>();
Map<Integer, List<Short>> flowIdMap = new HashMap<>();
- Collection<FlowRule> rulesRemoved = new HashSet<FlowRule>();
+ Collection<FlowRule> rulesRemoved = new HashSet<>();
for (FlowRule ruleToRemove : rulesToRemove) {
// IP SA Filtering can only apply to Port 0 optics
if (ruleToRemove.selector().getCriterion(Type.IPV4_SRC) != null &&
@@ -416,13 +418,13 @@
rulesRemoved.add(ruleToRemove);
} else {
- log.info("Unexpected Flow Rule type removal: " + ruleToRemove);
+ log.warn("Unexpected Flow Rule type removal: " + ruleToRemove);
}
}
//If there are IPv4 Flow Rules created commit them now through the
//MseaSaFiltering service
- if (saRangeList.size() > 0 && acvtiveFiltRanges.size() == 0) {
+ if (!saRangeList.isEmpty() && acvtiveFiltRanges.isEmpty()) {
try {
SourceIpaddressFiltering saFilter =
new DefaultSourceIpaddressFiltering();
@@ -432,26 +434,26 @@
mseaSaFilteringService.deleteMseaSaFilteringRange(
mseaSaFiltering, session, DatastoreId.RUNNING);
} catch (NetconfException e) {
- log.warn("Remove FlowRule on MseaSaFilteringService could not delete all SARules - "
- + "they may already have been deleted: " + e.getMessage());
+ log.debug("Remove FlowRule on MseaSaFilteringService could not delete all SARules - "
+ + "they may already have been deleted: " + e.getMessage(), e);
}
- } else if (saRangeList.size() > 0) {
+ } else if (!saRangeList.isEmpty()) {
try {
mseaSaFilteringService.deleteMseaSaFilteringRange(
buildSaFilteringObject(saRangeList), session, DatastoreId.RUNNING);
} catch (NetconfException e) {
log.warn("Remove FlowRule on MseaSaFilteringService could not delete SARule - "
- + "it may already have been deleted: " + e.getMessage());
+ + "it may already have been deleted: " + e.getMessage(), e);
}
}
- if (ceVlanMapMap.size() > 0) {
+ if (!ceVlanMapMap.isEmpty()) {
try {
mseaUniEvcServiceSvc.removeEvcUniFlowEntries(ceVlanMapMap, flowIdMap,
session, DatastoreId.RUNNING, portAssignment);
} catch (NetconfException e) {
- log.warn("Remove FlowRule on MseaUniEvcService could not delete EVC - "
- + "it may already have been deleted: " + e.getMessage());
+ log.debug("Remove FlowRule on MseaUniEvcService could not delete EVC - "
+ + "it may already have been deleted: " + e.getMessage(), e);
}
}
@@ -468,7 +470,7 @@
* @return - the CEVlanMap we're looking for
*/
private String getCeVlanMapForIdxFromEvcList(List<Evc> evcList, long evcIndex, UniSide side) {
- if (evcList != null && evcList.size() > 0) {
+ if (evcList != null && !evcList.isEmpty()) {
for (Evc evc:evcList) {
if (evc.evcIndex() == evcIndex && evc.evcPerUni() != null) {
if (side == UniSide.CUSTOMER &&
@@ -581,7 +583,7 @@
epun.ingressBwpGroupIndex(getMeterId(fr.treatment()));
epuc.ceVlanMap(new ServiceListType(oppositeCeVlanMap));
- epuc.ingressBwpGroupIndex(new Long(0));
+ epuc.ingressBwpGroupIndex(0);
} else {
epuc.ceVlanMap(new ServiceListType(newCeVlanMap));
epuc.tagManipulation(tm);
@@ -589,11 +591,11 @@
epuc.ingressBwpGroupIndex(getMeterId(fr.treatment()));
epun.ceVlanMap(new ServiceListType(oppositeCeVlanMap));
- epun.ingressBwpGroupIndex(new Long(0));
+ epun.ingressBwpGroupIndex(0);
}
evc.evcIndex(fr.tableId());
- evc.name(new Identifier45("EVC-" + String.valueOf(fr.tableId())));
+ evc.name(new Identifier45("EVC-" + fr.tableId()));
DefaultEvcPerUni epu = new DefaultEvcPerUni();
epu.evcPerUnin(epun);
@@ -626,7 +628,7 @@
private Collection<FlowEntry> convertSaFilteringToFlowRules(
MseaSaFiltering saFilteringCurrent, ApplicationId appId) {
- Collection<FlowEntry> flowEntryCollection = new HashSet<FlowEntry>();
+ Collection<FlowEntry> flowEntryCollection = new HashSet<>();
List<SourceAddressRange> saRangelist =
saFilteringCurrent.sourceIpaddressFiltering().interfaceEth0().sourceAddressRange();
@@ -645,7 +647,7 @@
FlowRule.Builder feBuilder = new DefaultFlowRule.Builder();
if (sa.name() != null && sa.name().startsWith("Flow:")) {
String[] nameParts = sa.name().split(":");
- Long cookie = Long.valueOf(nameParts[1], 16);
+ Long cookie = Long.valueOf(nameParts[1], RADIX_16);
feBuilder = feBuilder.withCookie(cookie);
} else {
feBuilder = feBuilder.fromApp(appId);
@@ -670,7 +672,7 @@
private Collection<FlowEntry> convertEvcUniToFlowRules(
MseaUniEvcService uniEvcCurrent, UniSideInterfaceAssignmentEnum portAssignment) {
- Collection<FlowEntry> flowEntryCollection = new HashSet<FlowEntry>();
+ Collection<FlowEntry> flowEntryCollection = new HashSet<>();
if (uniEvcCurrent == null || uniEvcCurrent.mefServices() == null ||
uniEvcCurrent.mefServices().uni() == null || uniEvcCurrent.mefServices().uni().evc() == null) {
@@ -698,7 +700,7 @@
.forDevice(handler().data().deviceId())
.withSelector(tsUniN)
.withTreatment(uniNTreatment)
- .forTable(new Long(evc.evcIndex()).intValue()) //narrowing to int
+ .forTable(Math.toIntExact(evc.evcIndex())) //narrowing to int
.makePermanent()
.withPriority(PRIORITY_DEFAULT)
.withCookie(flowId)
@@ -724,7 +726,7 @@
.forDevice(handler().data().deviceId())
.withSelector(tsUniC)
.withTreatment(uniCTreatment)
- .forTable(new Long(evc.evcIndex()).intValue()) //narrowing to int
+ .forTable(Math.toIntExact(evc.evcIndex())) //narrowing to int
.makePermanent()
.withPriority(PRIORITY_DEFAULT)
.withCookie(flowId)
@@ -762,7 +764,8 @@
private Criterion criterionPortForUniSide(
UniSideInterfaceAssignmentEnum portAssignment, boolean portN) {
boolean cOnOptics = (portAssignment == UniSideInterfaceAssignmentEnum.UNI_C_ON_OPTICS);
- int portNum = ((cOnOptics && portN) || (!cOnOptics && !portN)) ? 1 : 0;
+ //If both are true or both are false then return 1
+ int portNum = (cOnOptics == portN) ? 1 : 0;
return Criteria.matchInPort(PortNumber.portNumber(portNum));
}
@@ -770,8 +773,8 @@
EvcPerUni evcPerUni, boolean portN) {
TrafficTreatment.Builder trBuilder = DefaultTrafficTreatment.builder();
- TagManipulation tm = null;
- short meterId = 0;
+ TagManipulation tm;
+ short meterId;
if (portN) {
tm = evcPerUni.evcPerUnin().tagManipulation();
meterId = (short) evcPerUni.evcPerUnin().ingressBwpGroupIndex();
@@ -782,7 +785,6 @@
if (meterId > 0L) {
trBuilder = trBuilder.meter(MeterId.meterId((long) meterId));
-// trBuilder = trBuilder.meter(MeterId.meterId(meterId)).transition(0);
}
if (tm == null) {