Skeletons for Intent-runtime, Flow-manager and Match-action modules.
This task is a part of ONOS-1395.
(Sub-tasks: ONOS-1397, ONOS-1398, ONOS-1400)
Change-Id: I30064f658b6c193aee8419079dad380163364475
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java b/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java
new file mode 100644
index 0000000..474ac75
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java
@@ -0,0 +1,102 @@
+package net.onrc.onos.api.flowmanager;
+
+import net.onrc.onos.core.util.Dpid;
+import net.onrc.onos.core.util.PortNumber;
+import net.onrc.onos.core.util.SwitchPort;
+
+/**
+ * A link representation used by IFlow objects.
+ * <p>
+ * TODO: Should lambda, bandwidth, tag, etc. be defined in this FlowLink, Path,
+ * Tree or IFlow? We have to define it.
+ */
+public class FlowLink {
+ protected SwitchPort srcSwitchPort;
+ protected SwitchPort dstSwitchPort;
+
+ /**
+ * Creates new FlowLink object using source/destination switch port pair.
+ *
+ * @param src The source switch port.
+ * @param dst The destination switch port.
+ */
+ public FlowLink(SwitchPort src, SwitchPort dst) {
+ this.srcSwitchPort = src;
+ this.dstSwitchPort = dst;
+ }
+
+ /**
+ * Creates new FlowLink object using DPID and port number pairs at
+ * source/destination switches.
+ *
+ * @param srcDpid The source switch DPID.
+ * @param srcPortNumber The source port number at the source switch.
+ * @param dstDpid The destination switch DPID.
+ * @param dstPortNumber The destination port number at the destination
+ * switch.
+ */
+ public FlowLink(Dpid srcDpid, PortNumber srcPortNumber,
+ Dpid dstDpid, PortNumber dstPortNumber) {
+ this.srcSwitchPort = new SwitchPort(srcDpid, srcPortNumber);
+ this.dstSwitchPort = new SwitchPort(dstDpid, dstPortNumber);
+ }
+
+ /**
+ * Gets the source switch port.
+ *
+ * @return The source switch port.
+ */
+ public SwitchPort getSrcSwitchPort() {
+ return srcSwitchPort;
+ }
+
+ /**
+ * Gets the source switch DPID.
+ *
+ * @return The source switch DPID.
+ */
+ public Dpid getSrcDpid() {
+ return srcSwitchPort.dpid();
+ }
+
+ /**
+ * Gets the source port number at the source switch.
+ *
+ * @return The source port number at the source switch.
+ */
+ public PortNumber getSrcPortNumber() {
+ return srcSwitchPort.port();
+ }
+
+ /**
+ * Gets the destination switch port.
+ *
+ * @return The destination switch port.
+ */
+ public SwitchPort getDstSwitchPort() {
+ return dstSwitchPort;
+ }
+
+ /**
+ * Gets the destination switch DPID.
+ *
+ * @return The destination switch DPID.
+ */
+ public Dpid getDstDpid() {
+ return dstSwitchPort.dpid();
+ }
+
+ /**
+ * Gets the destination port number at the destination switch.
+ *
+ * @return The destination port number at the destination switch.
+ */
+ public PortNumber getDstPortNumber() {
+ return dstSwitchPort.port();
+ }
+
+ @Override
+ public String toString() {
+ return srcSwitchPort + "-->" + dstSwitchPort;
+ }
+}