From c4a9e1752a3fbfc0a136f89f6e0106b1db51f2cf Mon Sep 17 00:00:00 2001 From: Alex Reimers <alex@bigswitch.com> Date: Fri, 6 Apr 2012 16:49:53 -0700 Subject: [PATCH] Get all the OFActions working for IStaticFlowPusherService. --- .../staticflowentry/StaticFlowEntries.java | 13 +++++++++---- .../action/OFActionDataLayerDestination.java | 5 +++++ .../protocol/action/OFActionDataLayerSource.java | 5 +++++ .../openflow/protocol/action/OFActionEnqueue.java | 6 ++++++ .../action/OFActionNetworkLayerDestination.java | 5 +++++ .../protocol/action/OFActionNetworkLayerSource.java | 5 +++++ .../action/OFActionNetworkTypeOfService.java | 6 ++++++ .../action/OFActionTransportLayerDestination.java | 5 +++++ .../action/OFActionTransportLayerSource.java | 5 +++++ .../action/OFActionVirtualLanIdentifier.java | 5 +++++ .../action/OFActionVirtualLanPriorityCodePoint.java | 5 +++++ src/main/resources/floodlightdefault.properties | 3 ++- 12 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java index b8ebc7552..7d3715c46 100644 --- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java +++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java @@ -151,7 +151,7 @@ public class StaticFlowEntries { } /** - * Returns a + * Returns a String representation of all the openflow actions. * @param fmActions A list of OFActions to encode into one string * @return A string of the actions encoded for our database */ @@ -166,7 +166,12 @@ public class StaticFlowEntries { sb.append("output=" + Short.toString(((OFActionOutput)a).getPort())); break; case OPAQUE_ENQUEUE: - sb.append("enqueue=" + Integer.toString(((OFActionEnqueue)a).getQueueId())); + int queue = ((OFActionEnqueue)a).getQueueId(); + short port = ((OFActionEnqueue)a).getPort(); + sb.append("enqueue=" + Short.toString(port) + ":0x" + String.format("%02x", queue)); + break; + case STRIP_VLAN: + sb.append("strip-vlan"); break; case SET_VLAN_ID: sb.append("set-vlan-id=" + @@ -189,11 +194,11 @@ public class StaticFlowEntries { Byte.toString(((OFActionNetworkTypeOfService)a).getNetworkTypeOfService())); break; case SET_NW_SRC: - sb.append("set-nw-src=" + + sb.append("set-src-ip=" + IPv4.fromIPv4Address(((OFActionNetworkLayerSource)a).getNetworkAddress())); break; case SET_NW_DST: - sb.append("set-nw-dst=" + + sb.append("set-dst-ip=" + IPv4.fromIPv4Address(((OFActionNetworkLayerDestination)a).getNetworkAddress())); break; case SET_TP_SRC: diff --git a/src/main/java/org/openflow/protocol/action/OFActionDataLayerDestination.java b/src/main/java/org/openflow/protocol/action/OFActionDataLayerDestination.java index a23fd632a..48b8d0f84 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionDataLayerDestination.java +++ b/src/main/java/org/openflow/protocol/action/OFActionDataLayerDestination.java @@ -27,4 +27,9 @@ public class OFActionDataLayerDestination extends OFActionDataLayer { super.setType(OFActionType.SET_DL_DST); super.setLength((short) OFActionDataLayer.MINIMUM_LENGTH); } + + public OFActionDataLayerDestination(byte[] address) { + this(); + this.dataLayerAddress = address; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionDataLayerSource.java b/src/main/java/org/openflow/protocol/action/OFActionDataLayerSource.java index 5f8ae36bd..e04561cee 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionDataLayerSource.java +++ b/src/main/java/org/openflow/protocol/action/OFActionDataLayerSource.java @@ -27,4 +27,9 @@ public class OFActionDataLayerSource extends OFActionDataLayer { super.setType(OFActionType.SET_DL_SRC); super.setLength((short) OFActionDataLayer.MINIMUM_LENGTH); } + + public OFActionDataLayerSource(byte[] address) { + this(); + this.dataLayerAddress = address; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionEnqueue.java b/src/main/java/org/openflow/protocol/action/OFActionEnqueue.java index 450382a79..0ec2fa331 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionEnqueue.java +++ b/src/main/java/org/openflow/protocol/action/OFActionEnqueue.java @@ -37,6 +37,12 @@ public class OFActionEnqueue extends OFAction { super.setType(OFActionType.OPAQUE_ENQUEUE); super.setLength((short) MINIMUM_LENGTH); } + + public OFActionEnqueue(short port, int queueId) { + this(); + this.port = port; + this.queueId = queueId; + } /** * Get the output port diff --git a/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerDestination.java b/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerDestination.java index 2863a6335..13c14ff0b 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerDestination.java +++ b/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerDestination.java @@ -27,4 +27,9 @@ public class OFActionNetworkLayerDestination extends OFActionNetworkLayerAddress super.setType(OFActionType.SET_NW_DST); super.setLength((short) OFActionNetworkLayerAddress.MINIMUM_LENGTH); } + + public OFActionNetworkLayerDestination(int ip) { + this(); + this.networkAddress = ip; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerSource.java b/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerSource.java index a85ce97f4..ef1d005e3 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerSource.java +++ b/src/main/java/org/openflow/protocol/action/OFActionNetworkLayerSource.java @@ -27,4 +27,9 @@ public class OFActionNetworkLayerSource extends OFActionNetworkLayerAddress { super.setType(OFActionType.SET_NW_SRC); super.setLength((short) OFActionNetworkLayerAddress.MINIMUM_LENGTH); } + + public OFActionNetworkLayerSource(int ip) { + this(); + this.networkAddress = ip; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionNetworkTypeOfService.java b/src/main/java/org/openflow/protocol/action/OFActionNetworkTypeOfService.java index eeeec790b..0d381802c 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionNetworkTypeOfService.java +++ b/src/main/java/org/openflow/protocol/action/OFActionNetworkTypeOfService.java @@ -36,6 +36,12 @@ public class OFActionNetworkTypeOfService extends OFAction { super.setType(OFActionType.SET_NW_TOS); super.setLength((short) MINIMUM_LENGTH); } + + public OFActionNetworkTypeOfService(byte tos) { + this(); + this.networkTypeOfService = tos; + } + /** * @return the networkTypeOfService diff --git a/src/main/java/org/openflow/protocol/action/OFActionTransportLayerDestination.java b/src/main/java/org/openflow/protocol/action/OFActionTransportLayerDestination.java index 27cbc6104..7e7b0f1fc 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionTransportLayerDestination.java +++ b/src/main/java/org/openflow/protocol/action/OFActionTransportLayerDestination.java @@ -27,4 +27,9 @@ public class OFActionTransportLayerDestination extends OFActionTransportLayer { super.setType(OFActionType.SET_TP_DST); super.setLength((short) OFActionTransportLayer.MINIMUM_LENGTH); } + + public OFActionTransportLayerDestination(short port) { + this(); + this.transportPort = port; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionTransportLayerSource.java b/src/main/java/org/openflow/protocol/action/OFActionTransportLayerSource.java index 0ca52488a..385aa53c8 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionTransportLayerSource.java +++ b/src/main/java/org/openflow/protocol/action/OFActionTransportLayerSource.java @@ -27,4 +27,9 @@ public class OFActionTransportLayerSource extends OFActionTransportLayer { super.setType(OFActionType.SET_TP_SRC); super.setLength((short) OFActionTransportLayer.MINIMUM_LENGTH); } + + public OFActionTransportLayerSource(short port) { + this(); + this.transportPort = port; + } } diff --git a/src/main/java/org/openflow/protocol/action/OFActionVirtualLanIdentifier.java b/src/main/java/org/openflow/protocol/action/OFActionVirtualLanIdentifier.java index dc3949630..5bd0e0bda 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionVirtualLanIdentifier.java +++ b/src/main/java/org/openflow/protocol/action/OFActionVirtualLanIdentifier.java @@ -36,6 +36,11 @@ public class OFActionVirtualLanIdentifier extends OFAction { super.setType(OFActionType.SET_VLAN_ID); super.setLength((short) MINIMUM_LENGTH); } + + public OFActionVirtualLanIdentifier(short vlanId) { + this(); + this.virtualLanIdentifier = vlanId; + } /** * @return the virtualLanIdentifier diff --git a/src/main/java/org/openflow/protocol/action/OFActionVirtualLanPriorityCodePoint.java b/src/main/java/org/openflow/protocol/action/OFActionVirtualLanPriorityCodePoint.java index 8575253c5..9202df33f 100644 --- a/src/main/java/org/openflow/protocol/action/OFActionVirtualLanPriorityCodePoint.java +++ b/src/main/java/org/openflow/protocol/action/OFActionVirtualLanPriorityCodePoint.java @@ -36,6 +36,11 @@ public class OFActionVirtualLanPriorityCodePoint extends OFAction { super.setType(OFActionType.SET_VLAN_PCP); super.setLength((short) MINIMUM_LENGTH); } + + public OFActionVirtualLanPriorityCodePoint(byte priority) { + this(); + this.virtualLanPriorityCodePoint = priority; + } /** * @return the virtualLanPriorityCodePoint diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties index 6825109e8..728fae6ed 100644 --- a/src/main/resources/floodlightdefault.properties +++ b/src/main/resources/floodlightdefault.properties @@ -1,4 +1,5 @@ -floodlight.modules = net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\ +floodlight.modules = net.floodlightcontroller.storage.memory.MemoryStorageSource,\ +net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\ net.floodlightcontroller.forwarding.Forwarding,\ net.floodlightcontroller.jython.JythonDebugInterface,\ net.floodlightcontroller.counter.CounterStore,\ -- GitLab