aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-10-19 10:14:31 -0700
committerAshlee Young <ashlee@onosfw.com>2015-10-19 10:14:31 -0700
commite9bb60be43af477f17b30ee1f2ba205565b7fa15 (patch)
tree981fd759a44b751fc45cde774f46fda37c11c257 /framework/src/onos/core/api
parent74f3941756a1386cbc1fa99ee73fdc8376a0b6a0 (diff)
Updated onos src tree to commit id 1e60f97ae50c05b94fcb6a10520738bfb5efdfd1
Diffstat (limited to 'framework/src/onos/core/api')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/OduSignalId.java139
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java1
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java2
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java22
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java4
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java82
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java81
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java83
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java6
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java13
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java88
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java5
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java127
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceService.java85
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceStore.java89
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java2
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java1
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java14
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java30
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java1
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java39
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java91
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java41
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java113
24 files changed, 647 insertions, 512 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/OduSignalId.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/OduSignalId.java
new file mode 100644
index 00000000..e19a673d
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/OduSignalId.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+import org.onlab.util.HexString;
+
+import com.google.common.base.MoreObjects;
+/**
+ * Implementation of ODU Signal ID.
+ *
+ * <p>
+ * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)".
+ * </p>
+ */
+public class OduSignalId {
+
+ private final int tributaryPortNumber; // Tributary Port number
+ private final int tributarySlotLength; // Number of Tributary Slots included in tsmap
+ private final byte[] tributarySlotBitmap; // Tributary slot bitmap
+
+ public static final int TRIBUTARY_SLOT_BITMAP_SIZE = 10;
+
+ /**
+ * Creates an instance with the specified arguments.
+ *
+ * @param tributaryPortNumber tributary port number
+ * @param tributarySlotLen tributary slot len
+ * @param tributarySlotBitmap tributary slot bitmap
+ */
+ public OduSignalId(int tributaryPortNumber, int tributarySlotLen,
+ byte[] tributarySlotBitmap) {
+
+ checkArgument(tributaryPortNumber <= 80 ,
+ "tributaryPortNumber %s must be <= 80 ",
+ tributaryPortNumber);
+
+ checkArgument(tributarySlotBitmap.length == TRIBUTARY_SLOT_BITMAP_SIZE,
+ "number of elements in list " + HexString.toHexString(tributarySlotBitmap)
+ + " must be equal to " + TRIBUTARY_SLOT_BITMAP_SIZE);
+
+ checkArgument(tributarySlotLen <= 80 ,
+ "tributarySlotLen %s must be <= 80 ",
+ tributarySlotLen);
+
+ this.tributaryPortNumber = tributaryPortNumber;
+ this.tributarySlotLength = tributarySlotLen;
+ this.tributarySlotBitmap = Arrays.copyOf(tributarySlotBitmap, tributarySlotBitmap.length);
+ }
+
+ /**
+ * Returns the OduSignalId representing the specified parameters.
+ *
+ * @param tributaryPortNumber tributary port number
+ * @param tributarySlotLen tributary slot len
+ * @param tributarySlotBitmap tributary slot bitmap
+ * @return OduSignalId
+ */
+ public static OduSignalId oduSignalId(int tributaryPortNumber, int tributarySlotLen,
+ byte[] tributarySlotBitmap) {
+ return new OduSignalId(tributaryPortNumber, tributarySlotLen, tributarySlotBitmap);
+ }
+
+
+ /**
+ * Returns tributary port number.
+ *
+ * @return the tributaryPortNumber
+ */
+ public int tributaryPortNumber() {
+ return tributaryPortNumber;
+ }
+
+ /**
+ * Returns tributary slot length.
+ *
+ * @return the tributarySlotLen
+ */
+ public int tributarySlotLength() {
+ return tributarySlotLength;
+ }
+
+ /**
+ * Returns tributary slot bitmap.
+ *
+ * @return the tributarySlotBitmap
+ */
+ public byte[] tributarySlotBitmap() {
+ return Arrays.copyOf(tributarySlotBitmap, tributarySlotBitmap.length);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(tributaryPortNumber, tributarySlotLength, Arrays.hashCode(tributarySlotBitmap));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof OduSignalId)) {
+ return false;
+ }
+ final OduSignalId other = (OduSignalId) obj;
+ return Objects.equals(this.tributaryPortNumber, other.tributaryPortNumber)
+ && Objects.equals(this.tributarySlotLength, other.tributarySlotLength)
+ && Arrays.equals(tributarySlotBitmap, other.tributarySlotBitmap);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .omitNullValues()
+ .add("tributaryPortNumber", tributaryPortNumber)
+ .add("tributarySlotLength", tributarySlotLength)
+ .add("tributarySlotBitmap", HexString.toHexString(tributarySlotBitmap))
+ .toString();
+ }
+
+}
+
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
index ded3b3ae..0e509562 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
@@ -34,6 +34,7 @@ public class ControllerInfo {
*
* @param ip the ip address
* @param port the tcp port
+ * @param type the connection type
*/
public ControllerInfo(IpAddress ip, int port, String type) {
this.ip = ip;
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java
index a93dc071..965fd1f8 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java
@@ -54,6 +54,8 @@ public interface TypedStoredFlowEntry extends StoredFlowEntry {
/**
* Gets the flow live type for this entry.
+ *
+ * @return flow live type
*/
FlowLiveType flowLiveType();
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index 7e1d43a5..ae940bdc 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -25,6 +25,8 @@ import org.onlab.packet.VlanId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.OchSignal;
+import org.onosproject.net.OduSignalId;
+import org.onosproject.net.OduSignalType;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.criteria.Criterion.Type;
import org.onosproject.net.OchSignalType;
@@ -486,6 +488,26 @@ public final class Criteria {
return new OchSignalTypeCriterion(signalType);
}
+ /**
+ * Creates a match on ODU (Optical channel Data Unit) signal ID using the specified value.
+ *
+ * @param oduSignalId ODU Signal Id
+ * @return match criterion
+ */
+ public static Criterion matchOduSignalId(OduSignalId oduSignalId) {
+ return new OduSignalIdCriterion(oduSignalId);
+ }
+
+ /**
+ * Creates a match on ODU (Optical channel Data Unit) signal Type using the specified value.
+ *
+ * @param signalType ODU Signal Type
+ * @return match criterion
+ */
+ public static Criterion matchOduSignalType(OduSignalType signalType) {
+ return new OduSignalTypeCriterion(signalType);
+ }
+
public static Criterion dummy() {
return new DummyCriterion();
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
index 12ab57de..10cb629f 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
@@ -125,6 +125,10 @@ public interface Criterion {
OCH_SIGID,
/** Optical channel signal type (fixed or flexible). */
OCH_SIGTYPE,
+ /** ODU (Optical channel Data Unit) signal ID. */
+ ODU_SIGID,
+ /** ODU (Optical channel Data Unit) signal type. */
+ ODU_SIGTYPE,
/**
* An empty criterion.
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
new file mode 100644
index 00000000..cb513397
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flow.criteria;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.net.OduSignalId;
+
+/**
+ * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion.
+ * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGID" in
+ * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
+ * defined in protocol agnostic way.
+ */
+public final class OduSignalIdCriterion implements Criterion {
+
+ private final OduSignalId oduSignalId;
+
+ /**
+ * Create an instance with the specified ODU signal ID.
+ *
+ * @param oduSignalId - ODU signal ID
+ */
+ OduSignalIdCriterion(OduSignalId oduSignalId) {
+ this.oduSignalId = checkNotNull(oduSignalId);
+ }
+
+ @Override
+ public Type type() {
+ return Type.ODU_SIGID;
+ }
+
+ /**
+ * Returns the ODU Signal to match.
+ *
+ * @return the ODU signal to match
+ */
+ public OduSignalId oduSignalId() {
+ return oduSignalId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type(), oduSignalId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof OduSignalIdCriterion)) {
+ return false;
+ }
+ final OduSignalIdCriterion that = (OduSignalIdCriterion) obj;
+ return Objects.equals(this.oduSignalId, that.oduSignalId);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(type().toString())
+ .add("oduSignalId", oduSignalId)
+ .toString();
+ }
+
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
new file mode 100644
index 00000000..d92880db
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net.flow.criteria;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+import org.onosproject.net.OduSignalType;
+
+/**
+ * Implementation of ODU (Optical channel Data Unit) signal Type criterion.
+ * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGTYPE" in
+ * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but
+ * defined in protocol agnostic way.
+ */
+public final class OduSignalTypeCriterion implements Criterion {
+
+ private final OduSignalType signalType;
+
+ /**
+ * Create an instance with the specified ODU signal Type.
+ *
+ * @param signalType - ODU signal Type
+ */
+ OduSignalTypeCriterion(OduSignalType signalType) {
+ this.signalType = checkNotNull(signalType);
+ }
+
+ @Override
+ public Type type() {
+ return Type.ODU_SIGTYPE;
+ }
+
+ /**
+ * Returns the ODU Signal Type to match.
+ *
+ * @return the ODU signal Type to match
+ */
+ public OduSignalType signalType() {
+ return signalType;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type(), signalType);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof OduSignalTypeCriterion)) {
+ return false;
+ }
+ final OduSignalTypeCriterion that = (OduSignalTypeCriterion) obj;
+ return Objects.equals(this.signalType, that.signalType);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(type().toString())
+ .add("signalType", signalType)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java
deleted file mode 100644
index b712675b..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OpticalSignalTypeCriterion.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.net.flow.criteria;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Implementation of optical signal type criterion (8 bits unsigned
- * integer).
- *
- * @deprecated in Cardinal Release
- */
-@Deprecated
-public final class OpticalSignalTypeCriterion implements Criterion {
- private static final short MASK = 0xff;
- private final short signalType; // Signal type value: 8 bits
- private final Type type;
-
- /**
- * Constructor.
- *
- * @param signalType the optical signal type to match (8 bits unsigned
- * integer)
- * @param type the match type. Should be Type.OCH_SIGTYPE
- */
- OpticalSignalTypeCriterion(short signalType, Type type) {
- this.signalType = (short) (signalType & MASK);
- this.type = type;
- }
-
- @Override
- public Type type() {
- return this.type;
- }
-
- /**
- * Gets the optical signal type to match.
- *
- * @return the optical signal type to match (8 bits unsigned integer)
- */
- public short signalType() {
- return signalType;
- }
-
- @Override
- public String toString() {
- return toStringHelper(type().toString())
- .add("signalType", signalType).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type().ordinal(), signalType);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof OpticalSignalTypeCriterion) {
- OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj;
- return Objects.equals(signalType, that.signalType) &&
- Objects.equals(type, that.type);
- }
- return false;
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
index d01ea298..eddbbb71 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
@@ -59,6 +59,11 @@ public interface Instruction {
L0MODIFICATION,
/**
+ * Signifies that the traffic should be modified in L1 way.
+ */
+ L1MODIFICATION,
+
+ /**
* Signifies that the traffic should be modified in L2 way.
*/
L2MODIFICATION,
@@ -86,6 +91,7 @@ public interface Instruction {
/**
* Returns the type of instruction.
+ *
* @return type of instruction
*/
Type type();
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index c9f10685..26981e5e 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -25,10 +25,12 @@ import org.onosproject.core.GroupId;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
import org.onosproject.net.OchSignal;
+import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.L0SubType;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
+import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.L3SubType;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
@@ -47,7 +49,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public final class Instructions {
-
// Ban construction
private Instructions() {}
@@ -117,6 +118,16 @@ public final class Instructions {
}
/**
+ * Creates an L1 modification with the specified ODU signal Id.
+ *
+ * @param oduSignalId ODU Signal Id
+ * @return a L1 modification
+ */
+ public static L1ModificationInstruction modL1OduSignalId(OduSignalId oduSignalId) {
+ checkNotNull(oduSignalId, "L1 ODU signal ID cannot be null");
+ return new ModOduSignalIdInstruction(oduSignalId);
+ }
+ /**
* Creates a l2 src modification.
*
* @param addr the mac address to modify to
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
new file mode 100644
index 00000000..c6847d1c
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2014-2015 Open Networking Laboratory
+ *
+ * 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.net.flow.instructions;
+
+import org.onosproject.net.OduSignalId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
+public abstract class L1ModificationInstruction implements Instruction {
+
+ /**
+ * Represents the type of traffic treatment.
+ */
+ public enum L1SubType {
+ /**
+ * ODU (Optical channel Data Unit) Signal Id modification.
+ */
+ ODU_SIGID
+ }
+
+ public abstract L1SubType subtype();
+
+ @Override
+ public final Type type() {
+ return Type.L1MODIFICATION;
+ }
+
+ /**
+ * Represents an L1 ODU (Optical channel Data Unit) Signal Id modification instruction.
+ */
+ public static final class ModOduSignalIdInstruction extends L1ModificationInstruction {
+
+ private final OduSignalId oduSignalId;
+
+ ModOduSignalIdInstruction(OduSignalId oduSignalId) {
+ this.oduSignalId = oduSignalId;
+ }
+
+ @Override
+ public L1SubType subtype() {
+ return L1SubType.ODU_SIGID;
+ }
+
+ public OduSignalId oduSignalId() {
+ return oduSignalId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(oduSignalId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof ModOduSignalIdInstruction)) {
+ return false;
+ }
+ final ModOduSignalIdInstruction that = (ModOduSignalIdInstruction) obj;
+ return Objects.equals(this.oduSignalId, that.oduSignalId);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("oduSignalId", oduSignalId)
+ .toString();
+ }
+ }
+
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
index 068663bd..3403486c 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
@@ -55,9 +55,10 @@ public interface HostProviderService extends ProviderService<HostProvider> {
void hostVanished(HostId hostId);
/**
- * Notifies the core when a host is no longer detected on a network.
+ * Notifies the core when an IP is no longer associated with a host.
*
- * @param hostId id of the host that vanished
+ * @param hostId id of the host
+ * @param ipAddress ip address of host that vanished
*/
void removeIpFromHost(HostId hostId, IpAddress ipAddress);
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java
deleted file mode 100644
index 74f22ae9..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/PortAddresses.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * 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.net.host;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents address information bound to a port.
- */
-public final class PortAddresses {
-
- private final ConnectPoint connectPoint;
- private final Set<InterfaceIpAddress> ipAddresses;
- private final MacAddress macAddress;
- private final VlanId vlan;
-
- /**
- * Constructs a PortAddresses object for the given connection point, with a
- * set of IP addresses and a MAC address. Both address parameters are
- * optional and can be set to null.
- *
- * @param connectPoint the connection point these addresses are for
- * @param ipAddresses a set of interface IP addresses
- * @param mac a MAC address
- * @param vlan a VLAN ID
- */
- public PortAddresses(ConnectPoint connectPoint,
- Set<InterfaceIpAddress> ipAddresses, MacAddress mac, VlanId vlan) {
- this.connectPoint = connectPoint;
- this.ipAddresses = (ipAddresses == null) ?
- Collections.<InterfaceIpAddress>emptySet()
- : new HashSet<>(ipAddresses);
- this.macAddress = mac;
- this.vlan = vlan;
- }
-
- /**
- * Returns the connection point this address information is bound to.
- *
- * @return the connection point
- */
- public ConnectPoint connectPoint() {
- return connectPoint;
- }
-
- /**
- * Returns the set of interface IP addresses.
- *
- * @return the interface IP addresses
- */
- public Set<InterfaceIpAddress> ipAddresses() {
- return ipAddresses;
- }
-
- /**
- * Returns the MAC address.
- *
- * @return the MAC address
- */
- public MacAddress mac() {
- return macAddress;
- }
-
- /**
- * Returns the VLAN ID.
- *
- * @return the VLAN ID
- */
- public VlanId vlan() {
- return vlan;
- }
-
- @Override
- public boolean equals(Object other) {
- if (this == other) {
- return true;
- }
-
- if (!(other instanceof PortAddresses)) {
- return false;
- }
-
- PortAddresses otherPa = (PortAddresses) other;
-
- return Objects.equals(this.connectPoint, otherPa.connectPoint)
- && Objects.equals(this.ipAddresses, otherPa.ipAddresses)
- && Objects.equals(this.macAddress, otherPa.macAddress)
- && Objects.equals(this.vlan, otherPa.vlan);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(connectPoint, ipAddresses, macAddress, vlan);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("connect-point", connectPoint)
- .add("ip-addresses", ipAddresses)
- .add("mac-address", macAddress)
- .add("vlan", vlan)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceService.java
deleted file mode 100644
index 5468dfb7..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.net.resource.device;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.Port;
-import org.onosproject.net.intent.Intent;
-import org.onosproject.net.intent.IntentId;
-
-import java.util.Set;
-
-/**
- * Service for providing device resources.
- */
-@Beta
-public interface DeviceResourceService {
- /**
- * Request a set of ports needed to satisfy the intent.
- *
- * @param ports set of ports to allocate
- * @param intent the intent
- * @return true if ports were successfully allocated, false otherwise
- */
- boolean requestPorts(Set<Port> ports, Intent intent);
-
- /**
- * Returns the set of ports allocated for an intent.
- *
- * @param intentId the intent ID
- * @return set of allocated ports
- */
- Set<Port> getAllocations(IntentId intentId);
-
- /**
- * Returns the intent allocated to a port.
- *
- * @param port the port
- * @return intent ID allocated to the port
- */
- IntentId getAllocations(Port port);
-
- /**
- * Request a mapping between the given intents.
- *
- * @param keyIntentId the key intent ID
- * @param valIntentId the value intent ID
- * @return true if mapping was successful, false otherwise
- */
- boolean requestMapping(IntentId keyIntentId, IntentId valIntentId);
-
- /**
- * Returns the intents mapped to a lower intent.
- *
- * @param intentId the intent ID
- * @return the set of intent IDs
- */
- Set<IntentId> getMapping(IntentId intentId);
-
- /**
- * Release mapping of given intent.
- *
- * @param intentId intent ID
- */
- void releaseMapping(IntentId intentId);
-
- /**
- * Release ports associated with given intent ID.
- *
- * @param intentId intent ID
- */
- void releasePorts(IntentId intentId);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceStore.java
deleted file mode 100644
index a52a843f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/DeviceResourceStore.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.net.resource.device;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
-import org.onosproject.net.intent.IntentId;
-
-import java.util.Set;
-
-public interface DeviceResourceStore {
- /**
- * Returns unallocated ports on the given device.
- *
- * @param deviceId device ID
- * @return set of unallocated ports
- */
- Set<Port> getFreePorts(DeviceId deviceId);
-
- /**
- * Allocates the given ports to the given intent.
- *
- * @param ports set of ports to allocate
- * @param intentId intent ID
- * @return true if allocation was successful, false otherwise
- */
- boolean allocatePorts(Set<Port> ports, IntentId intentId);
-
- /**
- * Returns set of ports allocated for an intent.
- *
- * @param intentId the intent ID
- * @return set of allocated ports
- */
- Set<Port> getAllocations(IntentId intentId);
-
- /**
- * Returns intent allocated to a port.
- *
- * @param port the port
- * @return intent ID allocated to the port
- */
- IntentId getAllocations(Port port);
-
- /**
- * Allocates the mapping between the given intents.
- *
- * @param keyIntentId key intent ID
- * @param valIntentId value intent ID
- * @return true if mapping was successful, false otherwise
- */
- boolean allocateMapping(IntentId keyIntentId, IntentId valIntentId);
-
- /**
- * Returns the set of intents mapped to a lower intent.
- *
- * @param intentId intent ID
- * @return set of intent IDs
- */
- Set<IntentId> getMapping(IntentId intentId);
-
- /**
- * Releases the mapping of the given intent.
- *
- * @param intentId intent ID
- */
- void releaseMapping(IntentId intentId);
-
- /**
- * Releases the ports allocated to the given intent.
- *
- * @param intentId intent ID
- * @return true if release was successful, false otherwise
- */
- boolean releasePorts(IntentId intentId);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java
index 67c539df..f17bfb8e 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java
@@ -15,10 +15,12 @@
*/
package org.onosproject.net.resource.device;
+import com.google.common.annotations.Beta;
import org.onosproject.net.intent.IntentId;
import java.util.Set;
+@Beta
public interface IntentSetMultimap {
/**
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
index f59670bc..5216839e 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
@@ -94,6 +94,7 @@ public interface FlowStatisticService {
* @param pNumber the port number of the Device to query
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
+ * @param topn topn //FIXME what?
* @return list of flow entry load
*/
List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber,
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java
index 60da636a..1ec427c0 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java
@@ -94,6 +94,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns connect point.
+ *
+ * @return connect point
*/
public ConnectPoint connectPoint() {
return cp;
@@ -101,6 +103,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns total load of connect point.
+ *
+ * @return total load
*/
public Load totalLoad() {
return totalLoad;
@@ -108,6 +112,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns immediate load of connect point.
+ *
+ * @return immediate load
*/
public Load immediateLoad() {
return immediateLoad;
@@ -115,6 +121,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns short load of connect point.
+ *
+ * @return short load
*/
public Load shortLoad() {
return shortLoad;
@@ -122,6 +130,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns mid load of connect point.
+ *
+ * @return mid load
*/
public Load midLoad() {
return midLoad;
@@ -129,6 +139,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns long load of connect point.
+ *
+ * @return long load
*/
public Load longLoad() {
return longLoad;
@@ -136,6 +148,8 @@ public class SummaryFlowEntryWithLoad {
/**
* Returns unknown load of connect point.
+ *
+ * @return unknown load
*/
public Load unknownLoad() {
return unknownLoad;
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java
index 3e2dbdf8..a4cbd7d0 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java
@@ -36,19 +36,37 @@ public class TypedFlowEntryWithLoad {
private static final int MID_POLL_INTERVAL = 10;
private static final int LONG_POLL_INTERVAL = 15;
-
+ /**
+ * Creates a new typed flow entry with load.
+ *
+ * @param cp connect point
+ * @param tfe typed flow entry
+ * @param load load
+ */
public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe, Load load) {
this.cp = cp;
this.tfe = tfe;
this.load = load;
}
+ /**
+ * Creates a new typed flow entry with load.
+ *
+ * @param cp connect point
+ * @param tfe typed flow entry
+ */
public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe) {
this.cp = cp;
this.tfe = tfe;
this.load = new DefaultLoad(tfe.bytes(), 0, typedPollInterval(tfe));
}
+ /**
+ * Creates a new typed flow entry with load.
+ *
+ * @param cp connect point
+ * @param fe flow entry
+ */
public TypedFlowEntryWithLoad(ConnectPoint cp, FlowEntry fe) {
this.cp = cp;
this.tfe = newTypedStoredFlowEntry(fe);
@@ -70,6 +88,8 @@ public class TypedFlowEntryWithLoad {
/**
* Returns short polling interval.
+ *
+ * @return short poll interval
*/
public static int shortPollInterval() {
return CAL_AND_POLL_INTERVAL;
@@ -77,6 +97,8 @@ public class TypedFlowEntryWithLoad {
/**
* Returns mid polling interval.
+ *
+ * @return mid poll interval
*/
public static int midPollInterval() {
return MID_POLL_INTERVAL;
@@ -84,6 +106,8 @@ public class TypedFlowEntryWithLoad {
/**
* Returns long polling interval.
+ *
+ * @return long poll interval
*/
public static int longPollInterval() {
return LONG_POLL_INTERVAL;
@@ -91,6 +115,8 @@ public class TypedFlowEntryWithLoad {
/**
* Returns average polling interval.
+ *
+ * @return average poll interval
*/
public static int avgPollInterval() {
return (CAL_AND_POLL_INTERVAL + MID_POLL_INTERVAL + LONG_POLL_INTERVAL) / 3;
@@ -100,6 +126,7 @@ public class TypedFlowEntryWithLoad {
* Returns current typed flow entry's polling interval.
*
* @param tfe typed flow entry
+ * @return typed poll interval
*/
public static long typedPollInterval(TypedStoredFlowEntry tfe) {
checkNotNull(tfe, "TypedStoredFlowEntry cannot be null");
@@ -120,6 +147,7 @@ public class TypedFlowEntryWithLoad {
* Creates a new typed flow entry with the given flow entry fe.
*
* @param fe flow entry
+ * @return new typed flow entry
*/
public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) {
if (fe == null) {
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
index c0df7134..cfaf314c 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
@@ -63,6 +63,7 @@ public interface AsyncAtomicCounter {
/**
* Atomically sets the given value to the current value.
*
+ * @param value new value
* @return future void
*/
CompletableFuture<Void> set(long value);
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java
new file mode 100644
index 00000000..2ed15ff9
--- /dev/null
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/OduSignalIdTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * 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.net;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+import static org.onosproject.net.OduSignalId.oduSignalId;
+
+/**
+ * Test for OduSignalId.
+ */
+public class OduSignalIdTest {
+
+ private final OduSignalId odu1 = oduSignalId(7, 80, new byte[] {16, 16, 16, 16, 16, 16, 16, 16, 16, 16});
+ private final OduSignalId sameOdu1 = oduSignalId(7, 80, new byte[] {16, 16, 16, 16, 16, 16, 16, 16, 16, 16});
+ private final OduSignalId odu2 = oduSignalId(21, 80, new byte[] {10, 5, 10, 5, 10, 5, 10, 5, 10, 5});
+ private final OduSignalId sameOdu2 = oduSignalId(21, 80, new byte[] {10, 5, 10, 5, 10, 5, 10, 5, 10, 5});
+
+ @Test
+ public void testEquality() {
+ new EqualsTester()
+ .addEqualityGroup(odu1, sameOdu1)
+ .addEqualityGroup(odu2, sameOdu2)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
index 95d605c6..d86744df 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
@@ -15,6 +15,16 @@
*/
package org.onosproject.net.flow.criteria;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
+import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
+import static org.onosproject.net.OduSignalId.oduSignalId;
+import static org.onosproject.net.PortNumber.portNumber;
+
import org.junit.Test;
import org.onlab.packet.EthType;
import org.onlab.packet.Ip6Address;
@@ -26,20 +36,12 @@ import org.onlab.packet.VlanId;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.GridType;
import org.onosproject.net.Lambda;
+import org.onosproject.net.OchSignalType;
+import org.onosproject.net.OduSignalId;
+import org.onosproject.net.OduSignalType;
import org.onosproject.net.PortNumber;
import com.google.common.testing.EqualsTester;
-import org.onosproject.net.OchSignalType;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
-import static org.onosproject.net.PortNumber.portNumber;
-
/**
* Unit tests for the Criteria class and its subclasses.
*/
@@ -240,6 +242,18 @@ public class CriteriaTest {
Criterion matchOchSignal2 =
Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 4, 8));
+ final OduSignalId odu1 = oduSignalId(1, 80, new byte [] {1, 1, 2, 2, 1, 2, 2, 1, 2, 2});
+ final OduSignalId odu2 = oduSignalId(3, 8, new byte [] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0});
+ Criterion matchOduSignalId1 = Criteria.matchOduSignalId(odu1);
+ Criterion sameAsMatchOduSignalId1 = Criteria.matchOduSignalId(odu1);
+ Criterion matchOduSignalId2 = Criteria.matchOduSignalId(odu2);
+
+ final OduSignalType oduSigType1 = OduSignalType.ODU2;
+ final OduSignalType oduSigType2 = OduSignalType.ODU4;
+ Criterion matchOduSignalType1 = Criteria.matchOduSignalType(oduSigType1);
+ Criterion sameAsMatchOduSignalType1 = Criteria.matchOduSignalType(oduSigType1);
+ Criterion matchOduSignalType2 = Criteria.matchOduSignalType(oduSigType2);
+
/**
* Checks that a Criterion object has the proper type, and then converts
* it to the proper type.
@@ -294,6 +308,8 @@ public class CriteriaTest {
assertThatClassIsImmutable(MplsCriterion.class);
assertThatClassIsImmutable(IPv6ExthdrFlagsCriterion.class);
assertThatClassIsImmutable(LambdaCriterion.class);
+ assertThatClassIsImmutable(OduSignalIdCriterion.class);
+ assertThatClassIsImmutable(OduSignalTypeCriterion.class);
}
// PortCriterion class
@@ -1070,4 +1086,57 @@ public class CriteriaTest {
.addEqualityGroup(matchOchSignalType2)
.testEquals();
}
+
+ /**
+ * Test the OduSignalId method.
+ */
+ @Test
+ public void testMatchOduSignalIdMethod() {
+ OduSignalId odu = oduSignalId(1, 80, new byte[]{2, 1, 1, 3, 1, 1, 3, 1, 1, 3});
+
+ Criterion matchoduSignalId = Criteria.matchOduSignalId(odu);
+ OduSignalIdCriterion oduSignalIdCriterion =
+ checkAndConvert(matchoduSignalId,
+ Criterion.Type.ODU_SIGID,
+ OduSignalIdCriterion.class);
+ assertThat(oduSignalIdCriterion.oduSignalId(), is(equalTo(odu)));
+ }
+
+ /**
+ * Test the equals() method of the OduSignalIdCriterion class.
+ */
+ @Test
+ public void testOduSignalIdCriterionEquals() {
+ new EqualsTester()
+ .addEqualityGroup(matchOduSignalId1, sameAsMatchOduSignalId1)
+ .addEqualityGroup(matchOduSignalId2)
+ .testEquals();
+ }
+
+ // OduSignalTypeCriterion class
+
+ /**
+ * Test the OduSignalType method.
+ */
+ @Test
+ public void testMatchOduSignalTypeMethod() {
+ OduSignalType oduSigType = OduSignalType.ODU2;
+ Criterion matchoduSignalType = Criteria.matchOduSignalType(oduSigType);
+ OduSignalTypeCriterion oduSignalTypeCriterion =
+ checkAndConvert(matchoduSignalType,
+ Criterion.Type.ODU_SIGTYPE,
+ OduSignalTypeCriterion.class);
+ assertThat(oduSignalTypeCriterion.signalType(), is(equalTo(oduSigType)));
+ }
+
+ /**
+ * Test the equals() method of the OduSignalTypeCriterion class.
+ */
+ @Test
+ public void testOduSignalTypeCriterionEquals() {
+ new EqualsTester()
+ .addEqualityGroup(matchOduSignalType1, sameAsMatchOduSignalType1)
+ .addEqualityGroup(matchOduSignalType2)
+ .testEquals();
+ }
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
index 410349b5..a25783f9 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java
@@ -25,6 +25,7 @@ import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.GridType;
import org.onosproject.net.IndexedLambda;
import org.onosproject.net.Lambda;
+import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
import com.google.common.testing.EqualsTester;
@@ -38,6 +39,7 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
import static org.onlab.junit.UtilityClassChecker.assertThatClassIsUtility;
import static org.onosproject.net.PortNumber.portNumber;
+import static org.onosproject.net.OduSignalId.oduSignalId;
/**
* Unit tests for the Instructions class.
@@ -96,6 +98,7 @@ public class InstructionsTest {
assertThatClassIsImmutable(Instructions.OutputInstruction.class);
assertThatClassIsImmutable(L0ModificationInstruction.ModLambdaInstruction.class);
assertThatClassIsImmutable(L0ModificationInstruction.ModOchSignalInstruction.class);
+ assertThatClassIsImmutable(L1ModificationInstruction.ModOduSignalIdInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModEtherInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModVlanIdInstruction.class);
assertThatClassIsImmutable(L2ModificationInstruction.ModVlanPcpInstruction.class);
@@ -259,6 +262,44 @@ public class InstructionsTest {
assertThat(ochInstruction1.hashCode(), is(not(ochInstruction2.hashCode())));
}
+ // ModOduSignalIdInstruction
+
+ private final OduSignalId odu1 = oduSignalId(1, 80, new byte[] {8, 7, 6, 5, 7, 6, 5, 7, 6, 5});
+ private final OduSignalId odu2 = oduSignalId(2, 80, new byte[] {1, 1, 2, 2, 1, 2, 2, 1, 2, 2});
+ private final Instruction oduInstruction1 = Instructions.modL1OduSignalId(odu1);
+ private final Instruction sameAsOduInstruction1 = Instructions.modL1OduSignalId(odu1);
+ private final Instruction oduInstruction2 = Instructions.modL1OduSignalId(odu2);
+
+ /**
+ * Test the modL1OduSignalId().
+ */
+ @Test
+ public void testModL1OduSignalIdMethod() {
+ Instruction instruction = Instructions.modL1OduSignalId(odu1);
+ L1ModificationInstruction.ModOduSignalIdInstruction oduInstruction =
+ checkAndConvert(instruction, Instruction.Type.L1MODIFICATION,
+ L1ModificationInstruction.ModOduSignalIdInstruction.class);
+ assertThat(oduInstruction.oduSignalId(), is(odu1));
+ }
+
+ /**
+ * Test the equals() method of the ModOduSignalInstruction class.
+ */
+ @Test
+ public void testModOduSignalIdInstructionEquals() {
+ checkEqualsAndToString(oduInstruction1, sameAsOduInstruction1, oduInstruction2);
+ }
+
+ /**
+ * Test the hashCode() method of the ModOduSignalInstruction class.
+ */
+ @Test
+ public void testModOduSignalIdInstructionHashCode() {
+ assertThat(oduInstruction1.hashCode(), is(sameAsOduInstruction1.hashCode()));
+ assertThat(oduInstruction1.hashCode(), is(not(oduInstruction2.hashCode())));
+ }
+
+
// ModEtherInstruction
private static final String MAC1 = "00:00:00:00:00:01";
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java
deleted file mode 100644
index 7c10cd15..00000000
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/host/PortAddressesTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * 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.net.host;
-
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.NetTestTools;
-
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.testing.EqualsTester;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * Unit tests for port addresses class.
- */
-public class PortAddressesTest {
-
- PortAddresses addresses1;
- PortAddresses sameAsAddresses1;
- PortAddresses addresses2;
- PortAddresses addresses3;
-
- private static final ConnectPoint CONNECT_POINT1 =
- NetTestTools.connectPoint("cp1", 1);
- private static final IpAddress IP_ADDRESS1 = IpAddress.valueOf("1.2.3.4");
- private static final IpPrefix SUBNET_ADDRESS1 =
- IpPrefix.valueOf("1.2.0.0/16");
- private static final InterfaceIpAddress INTERFACE_ADDRESS_1 =
- new InterfaceIpAddress(IP_ADDRESS1, SUBNET_ADDRESS1);
-
- private static final ConnectPoint CONNECT_POINT2 =
- NetTestTools.connectPoint("cp2", 1);
- private static final IpAddress IP_ADDRESS2 = IpAddress.valueOf("1.2.3.5");
- private static final IpPrefix SUBNET_ADDRESS2 =
- IpPrefix.valueOf("1.3.0.0/16");
- private static final InterfaceIpAddress INTERFACE_ADDRESS_2 =
- new InterfaceIpAddress(IP_ADDRESS2, SUBNET_ADDRESS2);
-
- Set<InterfaceIpAddress> ipAddresses;
-
-
- /**
- * Initializes local data used by all test cases.
- */
- @Before
- public void setUpAddresses() {
- ipAddresses = ImmutableSet.of(INTERFACE_ADDRESS_1,
- INTERFACE_ADDRESS_2);
- addresses1 = new PortAddresses(CONNECT_POINT1, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- sameAsAddresses1 = new PortAddresses(CONNECT_POINT1, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- addresses2 = new PortAddresses(CONNECT_POINT2, ipAddresses,
- MacAddress.BROADCAST, VlanId.NONE);
- addresses3 = new PortAddresses(CONNECT_POINT2, ipAddresses,
- MacAddress.ZERO, VlanId.NONE);
- }
-
- /**
- * Checks that the PortAddresses class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PortAddresses.class);
- }
-
- /**
- * Checks the operation of the equals(), hash() and toString()
- * methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester()
- .addEqualityGroup(addresses1, sameAsAddresses1)
- .addEqualityGroup(addresses2)
- .addEqualityGroup(addresses3)
- .testEquals();
- }
-
- /**
- * Tests that object are created correctly.
- */
- @Test
- public void testConstruction() {
- assertThat(addresses1.mac(), is(MacAddress.BROADCAST));
- assertThat(addresses1.connectPoint(), is(CONNECT_POINT1));
- assertThat(addresses1.ipAddresses(), is(ipAddresses));
- assertThat(addresses1.vlan(), is(VlanId.NONE));
- }
-}