Sketched out packet service and related abstractions.
diff --git a/core/api/src/main/java/org/onlab/onos/net/PortNumber.java b/core/api/src/main/java/org/onlab/onos/net/PortNumber.java
index d5fc5f2..93ec91d 100644
--- a/core/api/src/main/java/org/onlab/onos/net/PortNumber.java
+++ b/core/api/src/main/java/org/onlab/onos/net/PortNumber.java
@@ -9,8 +9,17 @@
*/
public final class PortNumber {
+ // TODO: revisit the max and the logical port value assignments
+
private static final long MAX_NUMBER = (2L * Integer.MAX_VALUE) + 1;
+ public static final PortNumber FLOOD = new PortNumber(-1);
+ public static final PortNumber IN_PORT = new PortNumber(-2);
+ public static final PortNumber TABLE = new PortNumber(-3);
+ public static final PortNumber NORMAL = new PortNumber(-4);
+ public static final PortNumber ALL = new PortNumber(-4);
+ public static final PortNumber LOCAL = new PortNumber(-5);
+
private final long number;
// Public creation is prohibited
@@ -39,6 +48,16 @@
}
/**
+ * Indicates whether or not this port number is a reserved logical one or
+ * whether it corresponds to a normal physical port of a device or NIC.
+ *
+ * @return true if logical port number
+ */
+ public boolean isLogical() {
+ return number < 0 || number > MAX_NUMBER;
+ }
+
+ /**
* Returns the backing long value.
*
* @return port number as long