Removed the Pavlin FlowPath abstraction.
(sorry Pavlin)
Change-Id: Ia99db095994d5ecdf63d9ab10856e69487f9c0dc
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
index d88a296..7c229b6 100644
--- a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
@@ -36,7 +36,6 @@
import net.onrc.onos.core.topology.Port;
import net.onrc.onos.core.topology.Switch;
import net.onrc.onos.core.topology.Topology;
-import net.onrc.onos.core.util.FlowPath;
import net.onrc.onos.core.util.PortNumber;
import net.onrc.onos.core.util.SwitchPort;
@@ -48,7 +47,7 @@
import com.google.common.collect.ListMultimap;
public class Forwarding implements /*IOFMessageListener,*/ IFloodlightModule,
- IForwardingService, IPacketListener, ChangedListener {
+ IPacketListener, ChangedListener {
private static final Logger log = LoggerFactory.getLogger(Forwarding.class);
private static final int SLEEP_TIME_FOR_DB_HOST_INSTALLED = 100; // milliseconds
@@ -60,8 +59,6 @@
private static final ScheduledExecutorService EXECUTOR_SERVICE =
Executors.newScheduledThreadPool(NUMBER_OF_THREAD_FOR_EXECUTOR);
- private final String callerId = "Forwarding";
-
private final HighLevelIntentChangedHandler highLevelIntentChangedHandler =
new HighLevelIntentChangedHandler();
@@ -171,18 +168,12 @@
@Override
public Collection<Class<? extends IFloodlightService>> getModuleServices() {
- List<Class<? extends IFloodlightService>> services =
- new ArrayList<Class<? extends IFloodlightService>>(1);
- services.add(IForwardingService.class);
- return services;
+ return null;
}
@Override
public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
- Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
- new HashMap<Class<? extends IFloodlightService>, IFloodlightService>(1);
- impls.put(IForwardingService.class, this);
- return impls;
+ return null;
}
@Override
@@ -471,14 +462,6 @@
pathRuntime.executeIntentOperations(operations);
}
- @Override
- public void flowsInstalled(Collection<FlowPath> installedFlowPaths) {
- }
-
- @Override
- public void flowRemoved(FlowPath removedFlowPath) {
- }
-
public void flowRemoved(ShortestPathIntent spfIntent) {
if (log.isTraceEnabled()) {
log.trace("ShortestPathIntent {} was removed", spfIntent.getId());
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/IForwardingService.java b/src/main/java/net/onrc/onos/apps/forwarding/IForwardingService.java
deleted file mode 100644
index e8a8d7a..0000000
--- a/src/main/java/net/onrc/onos/apps/forwarding/IForwardingService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.onrc.onos.apps.forwarding;
-
-import java.util.Collection;
-
-import net.floodlightcontroller.core.module.IFloodlightService;
-import net.onrc.onos.core.util.FlowPath;
-
-/**
- * Temporary interface that allows the Forwarding module to be
- * notified when a flow has been installed.
- * <p/>
- * This should be refactored to a listener framework in the future.
- */
-public interface IForwardingService extends IFloodlightService {
- /**
- * Notify the Forwarding module that a collection of flows has been
- * installed in the network.
- *
- * @param installedFlowPaths the collection of FlowPaths that have
- * been installed in the network.
- */
- public void flowsInstalled(Collection<FlowPath> installedFlowPaths);
-
- /**
- * Notify the Forwarding module that a flow has expired and been
- * removed from the network.
- *
- * @param removedFlowPath The FlowPath that was removed
- */
- public void flowRemoved(FlowPath removedFlowPath);
-}
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
index 49128ea..7118f71 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
@@ -36,21 +36,8 @@
import net.onrc.onos.core.intent.runtime.IPathCalcRuntimeService;
import net.onrc.onos.core.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.core.main.config.IConfigInfoService;
-import net.onrc.onos.core.packet.Ethernet;
-import net.onrc.onos.core.packet.IPv4;
import net.onrc.onos.core.registry.IControllerRegistryService;
-import net.onrc.onos.core.util.CallerId;
-import net.onrc.onos.core.util.DataPath;
import net.onrc.onos.core.util.Dpid;
-import net.onrc.onos.core.util.FlowEntryAction;
-import net.onrc.onos.core.util.FlowEntryActions;
-import net.onrc.onos.core.util.FlowEntryMatch;
-import net.onrc.onos.core.util.FlowId;
-import net.onrc.onos.core.util.FlowPath;
-import net.onrc.onos.core.util.FlowPathFlags;
-import net.onrc.onos.core.util.FlowPathType;
-import net.onrc.onos.core.util.FlowPathUserState;
-import net.onrc.onos.core.util.IPv4Net;
import net.onrc.onos.core.util.PortNumber;
import net.onrc.onos.core.util.SwitchPort;
import net.sf.json.JSONArray;
@@ -67,7 +54,6 @@
import org.slf4j.LoggerFactory;
import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
import com.google.common.net.InetAddresses;
@@ -81,7 +67,6 @@
IArpRequester, IOFSwitchListener, IConfigInfoService {
private static final Logger log = LoggerFactory.getLogger(SdnIp.class);
- private final CallerId callerId = new CallerId("SDNIP");
private IFloodlightProviderService floodlightProvider;
private ILinkDiscoveryService linkDiscoveryService;
@@ -151,7 +136,7 @@
private Map<InetAddress, Path> pushedPaths;
private Map<Prefix, Path> prefixToPath;
// private Multimap<Prefix, PushedFlowMod> pushedFlows;
- private Multimap<Prefix, FlowId> pushedFlowIds;
+ //private Multimap<Prefix, FlowId> pushedFlowIds;
// XXX FlowCache has been removed
//private FlowCache flowCache;
@@ -297,7 +282,7 @@
pushedPaths = new HashMap<>();
prefixToPath = new HashMap<>();
// pushedFlows = HashMultimap.<Prefix, PushedFlowMod>create();
- pushedFlowIds = HashMultimap.create();
+ // pushedFlowIds = HashMultimap.create();
//flowCache = new FlowCache(floodlightProvider);
@@ -532,6 +517,7 @@
log.debug("Adding flows for prefix {}, next hop mac {}",
prefix, nextHopMacAddress);
+ /*
FlowPath flowPath = new FlowPath();
flowPath.setInstallerId(callerId);
@@ -585,9 +571,9 @@
flowEntryMatch.enableDstIPv4Net(dstIPv4Net);
flowPath.setFlowEntryMatch(flowEntryMatch);
- /*
+ *
* Create the Flow Entry Action(s): dst-MAC rewrite action
- */
+ *
FlowEntryActions flowEntryActions = new FlowEntryActions();
FlowEntryAction flowEntryAction1 = new FlowEntryAction();
flowEntryAction1.setActionSetEthernetDstAddr(nextHopMacAddress);
@@ -610,8 +596,9 @@
pushedFlowIds.put(prefix, flowPath.flowId());
}
- */
+
}
+ */
}
private void processRibDelete(RibUpdate update) {
@@ -667,7 +654,7 @@
// removeAll() statement should be replaced with the second removeAll()
// statement.
//
- pushedFlowIds.removeAll(prefix);
+ // pushedFlowIds.removeAll(prefix);
/*
Collection<FlowId> flowIds = pushedFlowIds.removeAll(prefix);
for (FlowId flowId : flowIds) {
@@ -764,11 +751,12 @@
}
private void calculateAndPushPath(Path path, MACAddress dstMacAddress) {
- Interface dstInterface = path.getDstInterface();
+ // Interface dstInterface = path.getDstInterface();
log.debug("Setting up path to {}, {}", path.getDstIpAddress().getHostAddress(),
dstMacAddress);
+ /*
FlowPath flowPath = new FlowPath();
flowPath.setInstallerId(callerId);
@@ -818,7 +806,7 @@
// Entries
log.debug("FlowPath of MAC based forwarding: {}", flowPath.toString());
// TODO: Add the flow by using the new Path Intent framework
- /*
+
if (flowManagerService.addFlow(flowPath) == null) {
log.error("Failed to set up MAC based forwarding path to {}, {}",
path.getDstIpAddress().getHostAddress(),dstMacAddress);
@@ -827,8 +815,9 @@
log.debug("Successfully set up MAC based forwarding path to {}, {}",
path.getDstIpAddress().getHostAddress(),dstMacAddress);
}
- */
+
}
+ */
}
@Override
@@ -892,210 +881,6 @@
pathRuntime.executeIntentOperations(operations);
}
- /*
- * Proactively install all BGP traffic paths from BGP host attachment point
- * in SDN network to all the virtual gateways to BGP peers in other networks.
- */
- private void setupBgpPaths() {
-
- for (BgpPeer bgpPeer : bgpPeers.values()) {
-
- FlowPath flowPath = new FlowPath();
- flowPath.setInstallerId(callerId);
-
- // Set flowPath FlowPathType and FlowPathUserState
- flowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
- flowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
-
- // Install flow paths between BGPd and its peers
- // There is no need to set the FlowPathFlags
- flowPath.setFlowPathFlags(new FlowPathFlags(0));
-
- Interface peerInterface = interfaces.get(bgpPeer.getInterfaceName());
- // Create the Flow Path Match condition(s)
- FlowEntryMatch flowEntryMatch = new FlowEntryMatch();
- flowEntryMatch.enableEthernetFrameType(Ethernet.TYPE_IPV4);
-
- // Match both source address and dest address
- IPv4Net dstIPv4Net = new IPv4Net(bgpPeer.getIpAddress().getHostAddress()
- + "/32");
-
- flowEntryMatch.enableDstIPv4Net(dstIPv4Net);
-
- IPv4Net srcIPv4Net = new IPv4Net(peerInterface.getIpAddress()
- .getHostAddress() + "/32");
- flowEntryMatch.enableSrcIPv4Net(srcIPv4Net);
-
- // Match TCP protocol
- flowEntryMatch.enableIpProto(IPv4.PROTOCOL_TCP);
-
- // Match destination TCP port
- flowEntryMatch.enableDstTcpUdpPort(BGP_PORT);
- flowPath.setFlowEntryMatch(flowEntryMatch);
-
- /**
- * Create the DataPath: BGP -> BGP peer
- */
- // Flow path for src-TCP-port
- DataPath dataPath = new DataPath();
-
- SwitchPort srcPort =
- new SwitchPort(bgpdAttachmentPoint.dpid(),
- bgpdAttachmentPoint.port());
- dataPath.setSrcPort(srcPort);
-
- SwitchPort dstPort =
- new SwitchPort(new Dpid(peerInterface.getDpid()),
- new PortNumber(peerInterface.getSwitchPort().port()));
- dataPath.setDstPort(dstPort);
-
- flowPath.setDataPath(dataPath);
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
- log.error("Failed to set up path BGP -> peer {}"+"; dst-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully set up path BGP -> peer {}"+"; dst-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
-
- // Disable dst-TCP-port, and set src-TCP-port
- flowEntryMatch.disableDstTcpUdpPort();
- flowEntryMatch.enableSrcTcpUdpPort(BGP_PORT);
- flowPath.setFlowEntryMatch(flowEntryMatch);
-
- // Create a new FlowId
- flowPath.setFlowId(new FlowId());
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
- log.error("Failed to set up path BGP -> Peer {}" + "; src-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully set up path BGP -> Peer {}" + "; src-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
-
- /**
- * Create the DataPath: BGP <-BGP peer
- */
- // Reversed BGP flow path for src-TCP-port
- flowPath.setFlowId(new FlowId());
-
- DataPath reverseDataPath = new DataPath();
-
- SwitchPort reverseDstPort =
- new SwitchPort(bgpdAttachmentPoint.dpid(),
- bgpdAttachmentPoint.port());
- reverseDataPath.setDstPort(reverseDstPort);
-
- SwitchPort reverseSrcPort =
- new SwitchPort(new Dpid(peerInterface.getDpid()),
- new PortNumber(peerInterface.getSwitchPort().port()));
- reverseDataPath.setSrcPort(reverseSrcPort);
- flowPath.setDataPath(reverseDataPath);
-
- // Reverse the dst IP and src IP addresses
- flowEntryMatch.enableDstIPv4Net(srcIPv4Net);
- flowEntryMatch.enableSrcIPv4Net(dstIPv4Net);
- flowPath.setFlowEntryMatch(flowEntryMatch);
-
- log.debug("Reversed BGP FlowPath: {}", flowPath.toString());
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
-
- log.error("Failed to set up path BGP <- Peer {}" + "; src-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully set up path BGP <- Peer {}" + "; src-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
-
- // Reversed BGP flow path for dst-TCP-port
- flowPath.setFlowId(new FlowId());
-
- // Disable src-TCP-port, and set the dst-TCP-port
- flowEntryMatch.disableSrcTcpUdpPort();
- flowEntryMatch.enableDstTcpUdpPort(BGP_PORT);
- flowPath.setFlowEntryMatch(flowEntryMatch);
-
- log.debug("Reversed BGP FlowPath: {}", flowPath.toString());
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
- log.error("Failed to setting up path BGP <- Peer {}" + "; dst-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully setting up path BGP <- Peer {}" + "; dst-TCP-port:179",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
-
- /**
- * ICMP paths between BGPd and its peers
- */
- // match ICMP protocol BGP <- Peer
- flowPath.setFlowId(new FlowId());
-
- flowEntryMatch.enableIpProto(IPv4.PROTOCOL_ICMP);
- flowEntryMatch.disableSrcTcpUdpPort();
- flowEntryMatch.disableDstTcpUdpPort();
-
- flowPath.setFlowEntryMatch(flowEntryMatch);
-
- flowPath.setDataPath(reverseDataPath);
-
- log.debug("Reversed ICMP FlowPath: {}", flowPath.toString());
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
-
- log.error("Failed to set up ICMP path BGP <- Peer {}",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully set up ICMP path BGP <- Peer {}",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
-
- // match ICMP protocol BGP -> Peer
- flowPath.setFlowId(new FlowId());
- flowEntryMatch.enableDstIPv4Net(dstIPv4Net);
- flowEntryMatch.enableSrcIPv4Net(srcIPv4Net);
- flowPath.setFlowEntryMatch(flowEntryMatch);
- flowPath.setDataPath(dataPath);
- log.debug("ICMP flowPath: {}", flowPath.toString());
-
- // TODO: Add the flow by using the new Path Intent framework
- /*
- if (flowManagerService.addFlow(flowPath) == null) {
-
- log.error("Failed to set up ICMP path BGP -> Peer {}",
- bgpPeer.getIpAddress().getHostAddress());
- }
- else {
- log.debug("Successfully set up ICMP path BGP -> Peer {}",
- bgpPeer.getIpAddress().getHostAddress());
- }
- */
- }
- }
-
@Override
public void arpResponse(InetAddress ipAddress, MACAddress macAddress) {
log.debug("Received ARP response: {} => {}",
@@ -1251,7 +1036,7 @@
/*setupArpFlows();
setupDefaultDropFlows();*/
- setupBgpPaths();
+ //setupBgpPaths();
setupFullMesh();
// Suppress link discovery on external-facing router ports
diff --git a/src/main/java/net/onrc/onos/core/datagrid/web/DatagridWebRoutable.java b/src/main/java/net/onrc/onos/core/datagrid/web/DatagridWebRoutable.java
index c59cd87..8637d3b 100644
--- a/src/main/java/net/onrc/onos/core/datagrid/web/DatagridWebRoutable.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/web/DatagridWebRoutable.java
@@ -19,7 +19,6 @@
router.attach("/add/intents/json", IntentResource.class);
router.attach("/get/intent/{intent_id}/json", IntentResource.class);
router.attach("/get/ng-events/json", GetNGEventsResource.class);
- router.attach("/get/ng-flows/summary/json", GetNGFlowsSummaryResource.class);
router.attach("/get/intents/{category}/json", IntentResource.class);
router.attach("/get/intent/{category}/{intent_id}/json", IntentResource.class);
router.attach("/delete/intents/json", IntentResource.class);
diff --git a/src/main/java/net/onrc/onos/core/datagrid/web/GetNGFlowsSummaryResource.java b/src/main/java/net/onrc/onos/core/datagrid/web/GetNGFlowsSummaryResource.java
deleted file mode 100644
index da30293..0000000
--- a/src/main/java/net/onrc/onos/core/datagrid/web/GetNGFlowsSummaryResource.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package net.onrc.onos.core.datagrid.web;
-
-import java.util.ArrayList;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import net.onrc.onos.core.intent.Intent;
-import net.onrc.onos.core.intent.Intent.IntentState;
-import net.onrc.onos.core.intent.IntentMap;
-import net.onrc.onos.core.intent.Path;
-import net.onrc.onos.core.intent.PathIntent;
-import net.onrc.onos.core.intent.ShortestPathIntent;
-import net.onrc.onos.core.intent.runtime.IPathCalcRuntimeService;
-import net.onrc.onos.core.topology.LinkEvent;
-import net.onrc.onos.core.util.CallerId;
-import net.onrc.onos.core.util.Dpid;
-import net.onrc.onos.core.util.FlowEntry;
-import net.onrc.onos.core.util.FlowId;
-import net.onrc.onos.core.util.FlowPath;
-import net.onrc.onos.core.util.FlowPathType;
-import net.onrc.onos.core.util.FlowPathUserState;
-import net.onrc.onos.core.util.PortNumber;
-import net.onrc.onos.core.util.SwitchPort;
-
-import org.restlet.resource.Get;
-import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * REST API call to get a summary of Flow Paths.
- * <p/>
- * NOTE: This REST API call is needed for the ONOS GUI.
- * <p/>
- * GET /wm/onos/datagrid/get/ng-flows/summary/json
- */
-public class GetNGFlowsSummaryResource extends ServerResource {
- public static final Logger log = LoggerFactory.getLogger(GetNGFlowsSummaryResource.class);
-
- @Get("json")
- public ArrayList<FlowPath> retrieve() {
- ArrayList<FlowPath> result = new ArrayList<>();
- SortedMap<Long, FlowPath> sortedFlowPaths = new TreeMap<>();
-
- IPathCalcRuntimeService pathRuntime =
- (IPathCalcRuntimeService) getContext().
- getAttributes().get(IPathCalcRuntimeService.class.getCanonicalName());
- log.debug("Get NG Flows Summary");
-
-
- IntentMap parentIntentMap = pathRuntime.getHighLevelIntents();
- IntentMap intentMap = pathRuntime.getPathIntents();
- for (Intent parentIntent : parentIntentMap.getAllIntents()) {
- // Get only installed Shortest Paths
- if (parentIntent.getState() != IntentState.INST_ACK) {
- continue;
- }
- if (!(parentIntent instanceof ShortestPathIntent)) {
- continue;
- }
- ShortestPathIntent spIntent = (ShortestPathIntent) parentIntent;
-
- // Get the Path Intent
- Intent intent = intentMap.getIntent(spIntent.getPathIntentId());
- if (!(intent instanceof PathIntent)) {
- continue;
- }
- PathIntent pathIntent = (PathIntent) intent;
-
- // Decode the Shortest Path ID
- String applnIntentId = parentIntent.getId();
- String intentId = applnIntentId.split(":")[1];
-
- // Create the Flow Path
- FlowId flowId = new FlowId(intentId);
- FlowPath flowPath = new FlowPath();
- flowPath.setFlowId(flowId);
- sortedFlowPaths.put(flowPath.flowId().value(), flowPath);
-
- flowPath.setInstallerId(new CallerId("E"));
- flowPath.setFlowEntryActions(null);
- flowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
- flowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
-
- // Setup the Source and Destination DPID and Port
- Dpid srcDpid = new Dpid(spIntent.getSrcSwitchDpid());
- PortNumber srcPort = new PortNumber((short) spIntent.getSrcPortNumber());
- Dpid dstDpid = new Dpid(spIntent.getDstSwitchDpid());
- PortNumber dstPort = new PortNumber((short) spIntent.getDstPortNumber());
- SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
- SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
- flowPath.dataPath().setSrcPort(srcSwitchPort);
- flowPath.dataPath().setDstPort(dstSwitchPort);
-
- // Extract the Flow Entries
- Path path = pathIntent.getPath();
- FlowEntry flowEntry;
- ArrayList<FlowEntry> flowEntries = new ArrayList<>();
- for (LinkEvent linkEvent : path) {
- Dpid dpid = linkEvent.getSrc().getDpid();
- flowEntry = new FlowEntry();
- flowEntry.setDpid(dpid);
- flowEntries.add(flowEntry);
- }
- // Add the final Flow Entry
- flowEntry = new FlowEntry();
- flowEntry.setDpid(new Dpid(spIntent.getDstSwitchDpid()));
- flowEntries.add(flowEntry);
- flowPath.dataPath().setFlowEntries(flowEntries);
- }
-
- // Prepare the return result
- for (FlowPath flowPath : sortedFlowPaths.values()) {
- result.add(flowPath);
- }
-
- return result;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/intent/Action.java b/src/main/java/net/onrc/onos/core/intent/Action.java
index 8f8c8b2..5d564d6 100644
--- a/src/main/java/net/onrc/onos/core/intent/Action.java
+++ b/src/main/java/net/onrc/onos/core/intent/Action.java
@@ -1,7 +1,5 @@
package net.onrc.onos.core.intent;
-import net.onrc.onos.core.util.FlowEntryAction;
-
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.action.OFAction;
@@ -12,13 +10,6 @@
public abstract class Action {
/**
- * This function converts the Action into a legacy FlowEntryAction.
- *
- * @return an equivalent FlowEntryAction object
- */
- public abstract FlowEntryAction getFlowEntryAction();
-
- /**
* Builds and returns an OFAction given an OFFactory.
*
* @param factory the OFFactory to use for building
diff --git a/src/main/java/net/onrc/onos/core/intent/ForwardAction.java b/src/main/java/net/onrc/onos/core/intent/ForwardAction.java
index a3792d1..9c0a249 100644
--- a/src/main/java/net/onrc/onos/core/intent/ForwardAction.java
+++ b/src/main/java/net/onrc/onos/core/intent/ForwardAction.java
@@ -1,8 +1,5 @@
package net.onrc.onos.core.intent;
-import net.onrc.onos.core.util.FlowEntryAction;
-import net.onrc.onos.core.util.PortNumber;
-
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.action.OFAction;
import org.projectfloodlight.openflow.types.OFPort;
@@ -33,18 +30,6 @@
return Long.toString(dstPort);
}
- /**
- * Converts the FowardAction into a legacy FlowEntryAction object.
- *
- * @return an equivalent FlowEntryAction object
- */
- @Override
- public FlowEntryAction getFlowEntryAction() {
- FlowEntryAction action = new FlowEntryAction();
- action.setActionOutput(new PortNumber((short) dstPort));
- return action;
- }
-
@Override
public OFAction getOFAction(OFFactory factory) {
return factory.actions().output(OFPort.of((int) dstPort), Short.MAX_VALUE);
diff --git a/src/main/java/net/onrc/onos/core/intent/Match.java b/src/main/java/net/onrc/onos/core/intent/Match.java
index 14d8b92..6397de8 100644
--- a/src/main/java/net/onrc/onos/core/intent/Match.java
+++ b/src/main/java/net/onrc/onos/core/intent/Match.java
@@ -3,11 +3,6 @@
import java.util.Objects;
import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.core.packet.Ethernet;
-import net.onrc.onos.core.util.FlowEntryMatch;
-import net.onrc.onos.core.util.IPv4;
-import net.onrc.onos.core.util.IPv4Net;
-import net.onrc.onos.core.util.PortNumber;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.match.Match.Builder;
@@ -110,35 +105,6 @@
}
}
- /**
- * Converts the Match into a legacy FlowEntryMatch object.
- *
- * @return an equivalent FlowEntryMatch object
- */
- public FlowEntryMatch getFlowEntryMatch() {
- FlowEntryMatch match = new FlowEntryMatch();
- if (srcMac != null) {
- match.enableSrcMac(srcMac);
- }
- if (dstMac != null) {
- match.enableDstMac(dstMac);
- }
- if (srcIp != ShortestPathIntent.EMPTYIPADDRESS) {
- match.enableEthernetFrameType(Ethernet.TYPE_IPV4);
- IPv4 srcIPv4 = new IPv4(srcIp);
- IPv4Net srcIP = new IPv4Net(srcIPv4, IPV4_PREFIX_LEN);
- match.enableSrcIPv4Net(srcIP);
- }
- if (dstIp != ShortestPathIntent.EMPTYIPADDRESS) {
- match.enableEthernetFrameType(Ethernet.TYPE_IPV4);
- IPv4 dstIPv4 = new IPv4(dstIp);
- IPv4Net dstIP = new IPv4Net(dstIPv4, IPV4_PREFIX_LEN);
- match.enableDstIPv4Net(dstIP);
- }
- match.enableInPort(new PortNumber((short) srcPort));
- return match;
- }
-
public Builder getOFMatchBuilder(OFFactory factory) {
Builder matchBuilder = factory.buildMatch();
diff --git a/src/main/java/net/onrc/onos/core/util/CallerId.java b/src/main/java/net/onrc/onos/core/util/CallerId.java
deleted file mode 100644
index da83241..0000000
--- a/src/main/java/net/onrc/onos/core/util/CallerId.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.onrc.onos.core.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing a Caller ID for an ONOS component.
- * This class is immutable.
- */
-public final class CallerId {
- private final String value;
-
- /**
- * Default constructor.
- */
- public CallerId() {
- this.value = null;
- }
-
- /**
- * Copy constructor.
- *
- * @param otherCallerId the caller ID copied from
- */
- public CallerId(CallerId otherCallerId) {
- // Note: make a full copy if we change value to a mutable type
- value = otherCallerId.value;
- }
-
- /**
- * Constructor from a string value.
- *
- * @param value the value to use.
- */
- public CallerId(String value) {
- this.value = value;
- }
-
- /**
- * Get the value of the Caller ID.
- *
- * @return the value of the Caller ID.
- */
- @JsonProperty("value")
- public String value() {
- return value;
- }
-
- /**
- * Convert the Caller ID value to a string.
- *
- * @return the Caller ID value to a string.
- */
- @Override
- public String toString() {
- return value;
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof CallerId)) {
- return false;
- }
-
- CallerId otherCallerId = (CallerId) other;
-
- return value.equals(otherCallerId.value);
- }
-
- @Override
- public int hashCode() {
- return value.hashCode();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/DataPath.java b/src/main/java/net/onrc/onos/core/util/DataPath.java
deleted file mode 100644
index 3d89e96..0000000
--- a/src/main/java/net/onrc/onos/core/util/DataPath.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package net.onrc.onos.core.util;
-
-import java.util.ArrayList;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The data forwarding path state from a source to a destination.
- */
-public class DataPath {
- private SwitchPort srcPort; // The source port
- private SwitchPort dstPort; // The destination port
- private ArrayList<FlowEntry> flowEntries; // The Flow Entries
-
- /**
- * Default constructor.
- */
- public DataPath() {
- srcPort = new SwitchPort();
- dstPort = new SwitchPort();
- flowEntries = new ArrayList<FlowEntry>();
- }
-
- /**
- * Get the data path source port.
- *
- * @return the data path source port.
- */
- @JsonProperty("srcPort")
- public SwitchPort srcPort() {
- return srcPort;
- }
-
- /**
- * Set the data path source port.
- *
- * @param srcPort the data path source port to set.
- */
- @JsonProperty("srcPort")
- public void setSrcPort(SwitchPort srcPort) {
- this.srcPort = srcPort;
- }
-
- /**
- * Get the data path destination port.
- *
- * @return the data path destination port.
- */
- @JsonProperty("dstPort")
- public SwitchPort dstPort() {
- return dstPort;
- }
-
- /**
- * Set the data path destination port.
- *
- * @param dstPort the data path destination port to set.
- */
- @JsonProperty("dstPort")
- public void setDstPort(SwitchPort dstPort) {
- this.dstPort = dstPort;
- }
-
- /**
- * Get the data path flow entries.
- *
- * @return the data path flow entries.
- */
- @JsonProperty("flowEntries")
- public ArrayList<FlowEntry> flowEntries() {
- return flowEntries;
- }
-
- /**
- * Set the data path flow entries.
- *
- * @param flowEntries the data path flow entries to set.
- */
- @JsonProperty("flowEntries")
- public void setFlowEntries(ArrayList<FlowEntry> flowEntries) {
- this.flowEntries = flowEntries;
- }
-
- /**
- * Apply Flow Path Flags to the pre-computed Data Path.
- *
- * @param flowPathFlags the Flow Path Flags to apply.
- */
- public void applyFlowPathFlags(FlowPathFlags flowPathFlags) {
- if (flowPathFlags == null) {
- return; // Nothing to do
- }
-
- // Discard the first Flow Entry
- if (flowPathFlags.isDiscardFirstHopEntry()) {
- if (flowEntries.size() > 0) {
- flowEntries.remove(0);
- }
- }
-
- // Keep only the first Flow Entry
- if (flowPathFlags.isKeepOnlyFirstHopEntry()) {
- if (flowEntries.size() > 1) {
- FlowEntry flowEntry = flowEntries.get(0);
- flowEntries.clear();
- flowEntries.add(flowEntry);
- }
- }
- }
-
- /**
- * Remove Flow Entries that were deleted.
- */
- public void removeDeletedFlowEntries() {
- //
- // NOTE: We create a new ArrayList, and add only the Flow Entries
- // that are NOT FE_USER_DELETE.
- // This is sub-optimal: if it adds notable processing cost,
- // the Flow Entries container should be changed to LinkedList
- // or some other container that has O(1) cost of removing an entry.
- //
-
- // Test first whether any Flow Entry was deleted
- boolean foundDeletedFlowEntry = false;
- for (FlowEntry flowEntry : this.flowEntries) {
- if (flowEntry.flowEntryUserState() ==
- FlowEntryUserState.FE_USER_DELETE) {
- foundDeletedFlowEntry = true;
- break;
- }
- }
- if (!foundDeletedFlowEntry) {
- return; // Nothing to do
- }
-
- // Create a new collection and exclude the deleted flow entries
- ArrayList<FlowEntry> newFlowEntries = new ArrayList<FlowEntry>();
- for (FlowEntry flowEntry : this.flowEntries()) {
- if (flowEntry.flowEntryUserState() !=
- FlowEntryUserState.FE_USER_DELETE) {
- newFlowEntries.add(flowEntry);
- }
- }
- setFlowEntries(newFlowEntries);
- }
-
- /**
- * Convert the data path to a string.
- * <p/>
- * The string has the following form:
- * [src=01:01:01:01:01:01:01:01/1111 flowEntry=<entry1> flowEntry=<entry2>
- * flowEntry=<entry3> dst=02:02:02:02:02:02:02:02/2222]
- *
- * @return the data path as a string.
- */
- @Override
- public String toString() {
- StringBuilder ret = new StringBuilder();
-
- ret.append("[src=" + this.srcPort.toString());
-
- for (FlowEntry fe : flowEntries) {
- ret.append(" flowEntry=" + fe.toString());
- }
- ret.append(" dst=" + this.dstPort.toString() + "]");
-
- return ret.toString();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java b/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java
deleted file mode 100644
index 4e0d40c..0000000
--- a/src/main/java/net/onrc/onos/core/util/DataPathEndpoints.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package net.onrc.onos.core.util;
-
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Data Path Endpoints.
- * This class is immutable.
- */
-public final class DataPathEndpoints {
- private final SwitchPort srcPort; // The source port
- private final SwitchPort dstPort; // The destination port
-
- /**
- * Default constructor.
- */
- public DataPathEndpoints() {
- srcPort = null;
- dstPort = null;
- }
-
- /**
- * Constructor for given source and destination ports.
- *
- * @param srcPort the source port to use.
- * @param dstPort the destination port to use.
- */
- public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) {
- this.srcPort = srcPort;
- this.dstPort = dstPort;
- }
-
- /**
- * Get the data path source port.
- *
- * @return the data path source port.
- */
- @JsonProperty("srcPort")
- public SwitchPort srcPort() {
- return srcPort;
- }
-
- /**
- * Get the data path destination port.
- *
- * @return the data path destination port.
- */
- @JsonProperty("dstPort")
- public SwitchPort dstPort() {
- return dstPort;
- }
-
- /**
- * Convert the data path endpoints to a string.
- * <p/>
- * The string has the following form:
- * [src=01:01:01:01:01:01:01:01/1111 dst=02:02:02:02:02:02:02:02/2222]
- *
- * @return the data path endpoints as a string.
- */
- @Override
- public String toString() {
- String ret = "[src=" + this.srcPort.toString() +
- " dst=" + this.dstPort.toString() + "]";
- return ret;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntry.java b/src/main/java/net/onrc/onos/core/util/FlowEntry.java
deleted file mode 100644
index 4d1eb45..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntry.java
+++ /dev/null
@@ -1,483 +0,0 @@
-package net.onrc.onos.core.util;
-
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry.
- * <p/>
- * NOTE: The specification is incomplete. E.g., the entry needs to
- * support multiple in-ports and multiple out-ports.
- */
-public class FlowEntry {
- private FlowId flowId; // FlowID of the Flow Entry
- private FlowEntryId flowEntryId; // The Flow Entry ID
- private int idleTimeout; // The Flow idle timeout
- private int hardTimeout; // The Flow hard timeout
- private int priority; // The Flow priority
- private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
- private FlowEntryActions flowEntryActions; // The Flow Entry Actions
- private Dpid dpid; // The Switch DPID
- private PortNumber inPort; // The Switch incoming port. Used only
- // when the entry is used to return
- // Shortest Path computation.
- private PortNumber outPort; // The Switch outgoing port. Used only
- // when the entry is used to return
- // Shortest Path computation.
- private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
- private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
- // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
- private FlowEntryErrorState flowEntryErrorState;
-
- /**
- * Default constructor.
- */
- public FlowEntry() {
- // TODO: Test code
- /*
- MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06");
- IPv4 ipv4 = new IPv4("1.2.3.4");
- IPv4Net ipv4net = new IPv4Net("5.6.7.0/24");
-
- flowEntryMatch = new FlowEntryMatch();
- flowEntryMatch.enableInPort(new Port((short)10));
- flowEntryMatch.enableSrcMac(mac);
- flowEntryMatch.enableDstMac(mac);
- flowEntryMatch.enableVlanId((short)20);
- flowEntryMatch.enableVlanPriority((byte)30);
- flowEntryMatch.enableEthernetFrameType((short)40);
- flowEntryMatch.enableIpToS((byte)50);
- flowEntryMatch.enableIpProto((byte)60);
- flowEntryMatch.enableSrcIPv4Net(ipv4net);
- flowEntryMatch.enableDstIPv4Net(ipv4net);
- flowEntryMatch.enableSrcTcpUdpPort((short)70);
- flowEntryMatch.enableDstTcpUdpPort((short)80);
-
- FlowEntryAction action = null;
- FlowEntryActions actions = new FlowEntryActions();
-
- action = new FlowEntryAction();
- action.setActionOutput(new Port((short)12));
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionOutputToController((short)13);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetVlanId((short)14);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetVlanPriority((byte)15);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionStripVlan(true);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetEthernetSrcAddr(mac);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetEthernetDstAddr(mac);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIPv4SrcAddr(ipv4);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIPv4DstAddr(ipv4);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIpToS((byte)16);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetTcpUdpSrcPort((short)17);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetTcpUdpDstPort((short)18);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionEnqueue(new Port((short)19), 20);
- actions.addAction(action);
-
- setFlowEntryActions(actions);
- */
-
- priority = FlowPath.PRIORITY_DEFAULT;
- flowEntryActions = new FlowEntryActions();
- flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
- flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
- }
-
- /**
- * Get the Flow ID.
- *
- * @return the Flow ID.
- */
- @JsonIgnore
- public FlowId flowId() {
- return flowId;
- }
-
- /**
- * Set the Flow ID.
- *
- * @param flowId the Flow ID to set.
- */
- public void setFlowId(FlowId flowId) {
- this.flowId = flowId;
- }
-
- /**
- * Test whether the Flow ID is valid.
- *
- * @return true if the Flow ID is valid, otherwise false.
- */
- @JsonIgnore
- public boolean isValidFlowId() {
- if (this.flowId == null) {
- return false;
- }
- return (this.flowId.isValid());
- }
-
- /**
- * Get the Flow Entry ID.
- *
- * @return the Flow Entry ID.
- */
- @JsonProperty("flowEntryId")
- public FlowEntryId flowEntryId() {
- return flowEntryId;
- }
-
- /**
- * Set the Flow Entry ID.
- *
- * @param flowEntryId the Flow Entry ID to set.
- */
- @JsonProperty("flowEntryId")
- public void setFlowEntryId(FlowEntryId flowEntryId) {
- this.flowEntryId = flowEntryId;
- }
-
- /**
- * Test whether the Flow Entry ID is valid.
- *
- * @return true if the Flow Entry ID is valid, otherwise false.
- */
- @JsonIgnore
- public boolean isValidFlowEntryId() {
- if (this.flowEntryId == null) {
- return false;
- }
- return (this.flowEntryId.isValid());
- }
-
- /**
- * Get the flow idle timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @return the flow idle timeout.
- */
- @JsonProperty("idleTimeout")
- public int idleTimeout() {
- return idleTimeout;
- }
-
- /**
- * Set the flow idle timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @param idleTimeout the flow idle timeout to set.
- */
- @JsonProperty("idleTimeout")
- public void setIdleTimeout(int idleTimeout) {
- this.idleTimeout = 0xffff & idleTimeout;
- }
-
- /**
- * Get the flow hard timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @return the flow hard timeout.
- */
- @JsonProperty("hardTimeout")
- public int hardTimeout() {
- return hardTimeout;
- }
-
- /**
- * Set the flow hard timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @param hardTimeout the flow hard timeout to set.
- */
- @JsonProperty("hardTimeout")
- public void setHardTimeout(int hardTimeout) {
- this.hardTimeout = 0xffff & hardTimeout;
- }
-
- /**
- * Get the flow priority.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- *
- * @return the flow priority.
- */
- @JsonProperty("priority")
- public int priority() {
- return priority;
- }
-
- /**
- * Set the flow priority.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- *
- * @param priority the flow priority to set.
- */
- @JsonProperty("priority")
- public void setPriority(int priority) {
- this.priority = 0xffff & priority;
- }
-
- /**
- * Get the Flow Entry Match.
- *
- * @return the Flow Entry Match.
- */
- @JsonProperty("flowEntryMatch")
- public FlowEntryMatch flowEntryMatch() {
- return flowEntryMatch;
- }
-
- /**
- * Set the Flow Entry Match.
- *
- * @param flowEntryMatch the Flow Entry Match to set.
- */
- @JsonProperty("flowEntryMatch")
- public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
- this.flowEntryMatch = flowEntryMatch;
- }
-
- /**
- * Get the Flow Entry Actions.
- *
- * @return the Flow Entry Actions.
- */
- @JsonProperty("flowEntryActions")
- public FlowEntryActions flowEntryActions() {
- return flowEntryActions;
- }
-
- /**
- * Set the Flow Entry Actions.
- *
- * @param flowEntryActions the Flow Entry Actions to set.
- */
- @JsonProperty("flowEntryActions")
- public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
- this.flowEntryActions = flowEntryActions;
- }
-
- /**
- * Get the Switch DPID.
- *
- * @return the Switch DPID.
- */
- @JsonProperty("dpid")
- public Dpid dpid() {
- return dpid;
- }
-
- /**
- * Set the Switch DPID.
- *
- * @param dpid the Switch DPID to set.
- */
- @JsonProperty("dpid")
- public void setDpid(Dpid dpid) {
- this.dpid = dpid;
- }
-
- /**
- * Get the Switch incoming port.
- * <p/>
- * Used only when the entry is used to return Shortest Path computation.
- *
- * @return the Switch incoming port.
- */
- @JsonProperty("inPort")
- public PortNumber inPort() {
- return inPort;
- }
-
- /**
- * Set the Switch incoming port.
- * <p/>
- * Used only when the entry is used to return Shortest Path computation.
- *
- * @param inPort the Switch incoming port to set.
- */
- @JsonProperty("inPort")
- public void setInPort(PortNumber inPort) {
- this.inPort = inPort;
- }
-
- /**
- * Get the Switch outgoing port.
- * <p/>
- * Used only when the entry is used to return Shortest Path computation.
- *
- * @return the Switch outgoing port.
- */
- @JsonProperty("outPort")
- public PortNumber outPort() {
- return outPort;
- }
-
- /**
- * Set the Switch outgoing port.
- * <p/>
- * Used only when the entry is used to return Shortest Path computation.
- *
- * @param outPort the Switch outgoing port to set.
- */
- @JsonProperty("outPort")
- public void setOutPort(PortNumber outPort) {
- this.outPort = outPort;
- }
-
- /**
- * Get the Flow Entry User state.
- *
- * @return the Flow Entry User state.
- */
- @JsonProperty("flowEntryUserState")
- public FlowEntryUserState flowEntryUserState() {
- return flowEntryUserState;
- }
-
- /**
- * Set the Flow Entry User state.
- *
- * @param flowEntryUserState the Flow Entry User state to set.
- */
- @JsonProperty("flowEntryUserState")
- public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
- this.flowEntryUserState = flowEntryUserState;
- }
-
- /**
- * Get the Flow Entry Switch state.
- * <p/>
- * The Flow Entry Error state is used if FlowEntrySwitchState is
- * FE_SWITCH_FAILED.
- *
- * @return the Flow Entry Switch state.
- */
- @JsonProperty("flowEntrySwitchState")
- public FlowEntrySwitchState flowEntrySwitchState() {
- return flowEntrySwitchState;
- }
-
- /**
- * Set the Flow Entry Switch state.
- * <p/>
- * The Flow Entry Error state is used if FlowEntrySwitchState is
- * FE_SWITCH_FAILED.
- *
- * @param flowEntrySwitchState the Flow Entry Switch state to set.
- */
- @JsonProperty("flowEntrySwitchState")
- public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
- this.flowEntrySwitchState = flowEntrySwitchState;
- }
-
- /**
- * Get the Flow Entry Error state.
- *
- * @return the Flow Entry Error state.
- */
- @JsonProperty("flowEntryErrorState")
- public FlowEntryErrorState flowEntryErrorState() {
- return flowEntryErrorState;
- }
-
- /**
- * Set the Flow Entry Error state.
- *
- * @param flowEntryErrorState the Flow Entry Error state to set.
- */
- @JsonProperty("flowEntryErrorState")
- public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
- this.flowEntryErrorState = flowEntryErrorState;
- }
-
- /**
- * Convert the flow entry to a string.
- * <p/>
- * The string has the following form:
- * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
- * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
- * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
- * flowEntryErrorState=XXX]
- *
- * @return the flow entry as a string.
- */
- @Override
- public String toString() {
- StringBuilder ret = new StringBuilder();
- if (flowEntryId != null) {
- ret.append("[flowEntryId=" + this.flowEntryId.toString());
- } else {
- ret.append("[");
- }
- if (flowId != null) {
- ret.append(" flowId=" + this.flowId.toString());
- }
- ret.append(" idleTimeout=" + this.idleTimeout);
- ret.append(" hardTimeout=" + this.hardTimeout);
- ret.append(" priority=" + this.priority);
- if (flowEntryMatch != null) {
- ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
- }
- ret.append(" flowEntryActions=" + this.flowEntryActions.toString());
- if (dpid != null) {
- ret.append(" dpid=" + this.dpid.toString());
- }
- if (inPort != null) {
- ret.append(" inPort=" + this.inPort.toString());
- }
- if (outPort != null) {
- ret.append(" outPort=" + this.outPort.toString());
- }
- ret.append(" flowEntryUserState=" + this.flowEntryUserState);
- ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
- if (flowEntryErrorState != null) {
- ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
- }
- ret.append("]");
-
- return ret.toString();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
deleted file mode 100644
index 0cc1d6d..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryAction.java
+++ /dev/null
@@ -1,1724 +0,0 @@
-package net.onrc.onos.core.util;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.projectfloodlight.openflow.types.OFPort;
-
-/**
- * The class representing a single Flow Entry action.
- * <p/>
- * A Flow Entry action that needs to be applied to each packet.
- * Note that it contains only a single action. Multiple actions are
- * listed in a list inside @ref FlowEntryActions.
- */
-public class FlowEntryAction {
- /**
- * Special action values.
- * <p/>
- * Those values are taken as-is from the OpenFlow-v1.0.0 specification
- * (pp 21-22).
- */
- public enum ActionValues {
- ACTION_OUTPUT((short) 0x0), // Output to switch port
- ACTION_SET_VLAN_VID((short) 0x1), // Set the 802.1q VLAN id
- ACTION_SET_VLAN_PCP((short) 0x2), // Set the 802.1q priority
- ACTION_STRIP_VLAN((short) 0x3), // Strip the 802.1q header
- ACTION_SET_DL_SRC((short) 0x4), // Ethernet source address
- ACTION_SET_DL_DST((short) 0x5), // Ethernet destination address
- ACTION_SET_NW_SRC((short) 0x6), // IP source address
- ACTION_SET_NW_DST((short) 0x7), // IP destination address
- ACTION_SET_NW_TOS((short) 0x8), // IP ToS (DSCP field, 6 bits)
- ACTION_SET_TP_SRC((short) 0x9), // TCP/UDP source port
- ACTION_SET_TP_DST((short) 0xa), // TCP/UDP destination port
- ACTION_ENQUEUE((short) 0xb), // Output to queue on port
- ACTION_VENDOR((short) 0xffff); // Vendor-specific
-
- private final short value; // The value
-
- /**
- * Constructor for a given value.
- *
- * @param value the value to use for the initialization.
- */
- private ActionValues(short value) {
- this.value = value;
- }
-
- /**
- * Get the value.
- *
- * @return the value.
- */
- public short getValue() {
- return value;
- }
- }
-
- /**
- * Action structure for ACTION_OUTPUT: Output to switch port.
- */
- public static class ActionOutput {
- private PortNumber port; // Output port
- private short maxLen; // Max. length (in bytes) to send to controller
- // if the port is set to PORT_CONTROLLER
-
- /**
- * Default constructor.
- */
- public ActionOutput() {
- this.port = null;
- this.maxLen = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionOutput(ActionOutput other) {
- if (other.port != null) {
- this.port = new PortNumber(other.port);
- }
- this.maxLen = other.maxLen;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionOutput(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given output port and maximum length.
- *
- * @param port the output port to set.
- * @param maxLen the maximum length (in bytes) to send to controller
- * if the port is set to PORT_CONTROLLER.
- */
- public ActionOutput(PortNumber port, short maxLen) {
- this.port = port;
- this.maxLen = maxLen;
- }
-
- /**
- * Constructor for a given output port.
- *
- * @param port the output port to set.
- */
- public ActionOutput(PortNumber port) {
- this.port = port;
- this.maxLen = 0;
- }
-
- /**
- * Get the output port.
- *
- * @return the output port.
- */
- @JsonProperty("port")
- public PortNumber port() {
- return this.port;
- }
-
- /**
- * Get the maximum length (in bytes) to send to controller if the
- * port is set to PORT_CONTROLLER.
- *
- * @return the maximum length (in bytes) to send to controller if the
- * port is set to PORT_CONTROLLER.
- */
- @JsonProperty("maxLen")
- public short maxLen() {
- return this.maxLen;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port.toString();
- ret += " maxLen=" + maxLen;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [port=XXX maxLen=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split(" ");
- String decode = null;
-
- // Decode the "port=XXX" part
- if (parts.length > 0) {
- decode = parts[0];
- }
- if (decode != null) {
- String[] tokens = decode.split("port=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- port = new PortNumber(tokens[1]);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Decode the "maxLen=XXX" part
- decode = null;
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- String[] tokens = decode.split("maxLen=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- maxLen = Short.valueOf(tokens[1]);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_VLAN_VID: Set the 802.1q VLAN id.
- */
- public static class ActionSetVlanId {
- private short vlanId; // The VLAN ID to set
-
- /**
- * Default constructor.
- */
- public ActionSetVlanId() {
- this.vlanId = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetVlanId(ActionSetVlanId other) {
- this.vlanId = other.vlanId;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetVlanId(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given VLAN ID.
- *
- * @param vlanId the VLAN ID to set.
- */
- public ActionSetVlanId(short vlanId) {
- this.vlanId = vlanId;
- }
-
- /**
- * Get the VLAN ID.
- *
- * @return the VLAN ID.
- */
- @JsonProperty("vlanId")
- public short vlanId() {
- return this.vlanId;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "vlanId=" + this.vlanId;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [vlanId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("vlanId=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- vlanId = Short.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_VLAN_PCP: Set the 802.1q priority.
- */
- public static class ActionSetVlanPriority {
- private byte vlanPriority; // The VLAN priority to set
-
- /**
- * Default constructor.
- */
- public ActionSetVlanPriority() {
- this.vlanPriority = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetVlanPriority(ActionSetVlanPriority other) {
- this.vlanPriority = other.vlanPriority;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetVlanPriority(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given VLAN priority.
- *
- * @param vlanPriority the VLAN priority to set.
- */
- public ActionSetVlanPriority(byte vlanPriority) {
- this.vlanPriority = vlanPriority;
- }
-
- /**
- * Get the VLAN priority.
- *
- * @return the VLAN priority.
- */
- @JsonProperty("vlanPriority")
- public byte vlanPriority() {
- return this.vlanPriority;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "vlanPriority=" + this.vlanPriority;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [vlanPriority=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("vlanPriority=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- vlanPriority = Byte.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_STRIP_VLAN: Strip the 802.1q header.
- */
- public static class ActionStripVlan {
- private boolean stripVlan; // If true, strip the VLAN header
-
- /**
- * Default constructor.
- */
- public ActionStripVlan() {
- this.stripVlan = false;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionStripVlan(ActionStripVlan other) {
- this.stripVlan = other.stripVlan;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionStripVlan(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given boolean flag.
- *
- * @param stripVlan if true, strip the VLAN header.
- */
- public ActionStripVlan(boolean stripVlan) {
- this.stripVlan = stripVlan;
- }
-
- /**
- * Get the boolean flag whether the VLAN header should be stripped.
- *
- * @return the boolean flag whether the VLAN header should be stripped.
- */
- @JsonProperty("stripVlan")
- public boolean stripVlan() {
- return this.stripVlan;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "stripVlan=" + this.stripVlan;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [stripVlan=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("stripVlan=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- stripVlan = Boolean.valueOf(decode);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_DL_SRC and ACTION_SET_DL_DST:
- * Set the Ethernet source/destination address.
- */
- public static class ActionSetEthernetAddr {
- private MACAddress addr; // The MAC address to set
-
- /**
- * Default constructor.
- */
- public ActionSetEthernetAddr() {
- this.addr = null;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetEthernetAddr(ActionSetEthernetAddr other) {
- if (other.addr != null) {
- this.addr = MACAddress.valueOf(other.addr.toLong());
- }
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetEthernetAddr(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given MAC address.
- *
- * @param addr the MAC address to set.
- */
- public ActionSetEthernetAddr(MACAddress addr) {
- this.addr = addr;
- }
-
- /**
- * Get the MAC address.
- *
- * @return the MAC address.
- */
- @JsonProperty("addr")
- public MACAddress addr() {
- return this.addr;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "addr=" + addr.toString();
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("addr=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- addr = MACAddress.valueOf(decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_NW_SRC and ACTION_SET_NW_DST:
- * Set the IPv4 source/destination address.
- */
- public static class ActionSetIPv4Addr {
- private IPv4 addr; // The IPv4 address to set
-
- /**
- * Default constructor.
- */
- public ActionSetIPv4Addr() {
- this.addr = null;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetIPv4Addr(ActionSetIPv4Addr other) {
- if (other.addr != null) {
- this.addr = new IPv4(other.addr);
- }
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetIPv4Addr(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given IPv4 address.
- *
- * @param addr the IPv4 address to set.
- */
- public ActionSetIPv4Addr(IPv4 addr) {
- this.addr = addr;
- }
-
- /**
- * Get the IPv4 address.
- *
- * @return the IPv4 address.
- */
- @JsonProperty("addr")
- public IPv4 addr() {
- return this.addr;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "addr=" + addr.toString();
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [addr=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("addr=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- addr = new IPv4(decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_NW_TOS:
- * Set the IP ToS (DSCP field, 6 bits).
- */
- public static class ActionSetIpToS {
- private byte ipToS; // The IP ToS to set DSCP field, 6 bits)
-
- /**
- * Default constructor.
- */
- public ActionSetIpToS() {
- this.ipToS = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetIpToS(ActionSetIpToS other) {
- this.ipToS = other.ipToS;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetIpToS(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given IP ToS (DSCP field, 6 bits).
- *
- * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
- */
- public ActionSetIpToS(byte ipToS) {
- this.ipToS = ipToS;
- }
-
- /**
- * Get the IP ToS (DSCP field, 6 bits).
- *
- * @return the IP ToS (DSCP field, 6 bits).
- */
- @JsonProperty("ipToS")
- public byte ipToS() {
- return this.ipToS;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "ipToS=" + ipToS;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [ipToS=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("ipToS=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- ipToS = Byte.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_SET_TP_SRC and ACTION_SET_TP_DST:
- * Set the TCP/UDP source/destination port.
- */
- public static class ActionSetTcpUdpPort {
- private short port; // The TCP/UDP port to set
-
- /**
- * Default constructor.
- */
- public ActionSetTcpUdpPort() {
- this.port = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionSetTcpUdpPort(ActionSetTcpUdpPort other) {
- this.port = other.port;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [port=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionSetTcpUdpPort(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given TCP/UDP port.
- *
- * @param port the TCP/UDP port to set.
- */
- public ActionSetTcpUdpPort(short port) {
- this.port = port;
- }
-
- /**
- * Get the TCP/UDP port.
- *
- * @return the TCP/UDP port.
- */
- @JsonProperty("port")
- public short port() {
- return this.port;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [port=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [port=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("port=");
- String decode = null;
-
- // Decode the value
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- try {
- port = Short.valueOf(decode);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- /**
- * Action structure for ACTION_ENQUEUE: Output to queue on port.
- */
- public static class ActionEnqueue {
- private PortNumber port; // Port that queue belongs. Should
- // refer to a valid physical port
- // (i.e. < PORT_MAX) or PORT_IN_PORT
- private int queueId; // Where to enqueue the packets
-
- /**
- * Default constructor.
- */
- public ActionEnqueue() {
- this.port = null;
- this.queueId = 0;
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public ActionEnqueue(ActionEnqueue other) {
- if (other.port != null) {
- this.port = new PortNumber(other.port);
- }
- this.queueId = other.queueId;
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public ActionEnqueue(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Constructor for a given port and queue ID.
- *
- * @param port the port to set.
- * @param queueId the queue ID on the port.
- */
- public ActionEnqueue(PortNumber port, int queueId) {
- this.port = port;
- this.queueId = queueId;
- }
-
- /**
- * Get the port.
- *
- * @return the port.
- */
- @JsonProperty("port")
- public PortNumber port() {
- return this.port;
- }
-
- /**
- * Get the queue ID.
- *
- * @return the queue ID.
- */
- @JsonProperty("queueId")
- public int queueId() {
- return this.queueId;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "port=" + port.toString();
- ret += " queueId=" + queueId;
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [port=XXX queueId=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split(" ");
- String decode = null;
-
- // Decode the "port=XXX" part
- if (parts.length > 0) {
- decode = parts[0];
- }
- if (decode != null) {
- String[] tokens = decode.split("port=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- Short valueShort = Short.valueOf(tokens[1]);
- port = new PortNumber(valueShort);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Decode the "queueId=XXX" part
- decode = null;
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode != null) {
- decode = decode.replace("]", "");
- String[] tokens = decode.split("queueId=");
- if (tokens.length > 1 && tokens[1] != null) {
- try {
- queueId = Short.valueOf(tokens[1]);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
- }
- }
-
- private ActionValues actionType; // The action type
-
- //
- // The actions.
- // NOTE: Only one action should be set.
- //
- private ActionOutput actionOutput;
- private ActionSetVlanId actionSetVlanId;
- private ActionSetVlanPriority actionSetVlanPriority;
- private ActionStripVlan actionStripVlan;
- private ActionSetEthernetAddr actionSetEthernetSrcAddr;
- private ActionSetEthernetAddr actionSetEthernetDstAddr;
- private ActionSetIPv4Addr actionSetIPv4SrcAddr;
- private ActionSetIPv4Addr actionSetIPv4DstAddr;
- private ActionSetIpToS actionSetIpToS;
- private ActionSetTcpUdpPort actionSetTcpUdpSrcPort;
- private ActionSetTcpUdpPort actionSetTcpUdpDstPort;
- private ActionEnqueue actionEnqueue;
-
- /**
- * Default constructor.
- */
- public FlowEntryAction() {
- actionType = ActionValues.ACTION_VENDOR; // XXX: Initial value
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public FlowEntryAction(FlowEntryAction other) {
- this.actionType = other.actionType;
-
- //
- if (other.actionOutput != null) {
- this.actionOutput = new ActionOutput(other.actionOutput);
- } else {
- this.actionOutput = null;
- }
- //
- if (other.actionSetVlanId != null) {
- this.actionSetVlanId = new ActionSetVlanId(other.actionSetVlanId);
- } else {
- this.actionSetVlanId = null;
- }
- //
- if (other.actionSetVlanPriority != null) {
- this.actionSetVlanPriority = new ActionSetVlanPriority(other.actionSetVlanPriority);
- } else {
- this.actionSetVlanPriority = null;
- }
- //
- if (other.actionStripVlan != null) {
- this.actionStripVlan = new ActionStripVlan(other.actionStripVlan);
- } else {
- this.actionStripVlan = null;
- }
- //
- if (other.actionSetEthernetSrcAddr != null) {
- this.actionSetEthernetSrcAddr = new ActionSetEthernetAddr(other.actionSetEthernetSrcAddr);
- } else {
- this.actionSetEthernetSrcAddr = null;
- }
- //
- if (other.actionSetEthernetDstAddr != null) {
- this.actionSetEthernetDstAddr = new ActionSetEthernetAddr(other.actionSetEthernetDstAddr);
- } else {
- this.actionSetEthernetDstAddr = null;
- }
- //
- if (other.actionSetIPv4SrcAddr != null) {
- this.actionSetIPv4SrcAddr = new ActionSetIPv4Addr(other.actionSetIPv4SrcAddr);
- } else {
- this.actionSetIPv4SrcAddr = null;
- }
- //
- if (other.actionSetIPv4DstAddr != null) {
- this.actionSetIPv4DstAddr = new ActionSetIPv4Addr(other.actionSetIPv4DstAddr);
- } else {
- this.actionSetIPv4DstAddr = null;
- }
- //
- if (other.actionSetIpToS != null) {
- this.actionSetIpToS = new ActionSetIpToS(other.actionSetIpToS);
- } else {
- this.actionSetIpToS = null;
- }
- //
- if (other.actionSetTcpUdpSrcPort != null) {
- this.actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpSrcPort);
- } else {
- this.actionSetTcpUdpSrcPort = null;
- }
- //
- if (other.actionSetTcpUdpDstPort != null) {
- this.actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(other.actionSetTcpUdpDstPort);
- } else {
- this.actionSetTcpUdpDstPort = null;
- }
- //
- if (other.actionEnqueue != null) {
- this.actionEnqueue = new ActionEnqueue(other.actionEnqueue);
- } else {
- this.actionEnqueue = null;
- }
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [type=XXX action=XXX]
- *
- * @param actionStr the action as a string.
- */
- public FlowEntryAction(String actionStr) {
- this.fromString(actionStr);
- }
-
- /**
- * Get the action type.
- *
- * @return the action type.
- */
- @JsonProperty("actionType")
- public ActionValues actionType() {
- return actionType;
- }
-
- /**
- * Get the output action.
- *
- * @return the output action.
- */
- @JsonProperty("actionOutput")
- public ActionOutput actionOutput() {
- return actionOutput;
- }
-
- /**
- * Set the output action on a port.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionOutput")
- public void setActionOutput(ActionOutput action) {
- actionOutput = action;
- actionType = ActionValues.ACTION_OUTPUT;
- }
-
- /**
- * Set the output action on a port.
- *
- * @param port the output port to set.
- */
- public void setActionOutput(PortNumber port) {
- actionOutput = new ActionOutput(port);
- actionType = ActionValues.ACTION_OUTPUT;
- }
-
- /**
- * Set the output action to controller.
- *
- * @param maxLen the maximum length (in bytes) to send to controller.
- */
- public void setActionOutputToController(short maxLen) {
- PortNumber port = new PortNumber(OFPort.CONTROLLER.getShortPortNumber());
- actionOutput = new ActionOutput(port, maxLen);
- actionType = ActionValues.ACTION_OUTPUT;
- }
-
- /**
- * Get the action to set the VLAN ID.
- *
- * @return the action to set the VLAN ID.
- */
- @JsonProperty("actionSetVlanId")
- public ActionSetVlanId actionSetVlanId() {
- return actionSetVlanId;
- }
-
- /**
- * Set the action to set the VLAN ID.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetVlanId")
- public void setActionSetVlanId(ActionSetVlanId action) {
- actionSetVlanId = action;
- actionType = ActionValues.ACTION_SET_VLAN_VID;
- }
-
- /**
- * Set the action to set the VLAN ID.
- *
- * @param vlanId the VLAN ID to set.
- */
- public void setActionSetVlanId(short vlanId) {
- actionSetVlanId = new ActionSetVlanId(vlanId);
- actionType = ActionValues.ACTION_SET_VLAN_VID;
- }
-
- /**
- * Get the action to set the VLAN priority.
- *
- * @return the action to set the VLAN priority.
- */
- @JsonProperty("actionSetVlanPriority")
- public ActionSetVlanPriority actionSetVlanPriority() {
- return actionSetVlanPriority;
- }
-
- /**
- * Set the action to set the VLAN priority.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetVlanPriority")
- public void setActionSetVlanPriority(ActionSetVlanPriority action) {
- actionSetVlanPriority = action;
- actionType = ActionValues.ACTION_SET_VLAN_PCP;
- }
-
- /**
- * Set the action to set the VLAN priority.
- *
- * @param vlanPriority the VLAN priority to set.
- */
- public void setActionSetVlanPriority(byte vlanPriority) {
- actionSetVlanPriority = new ActionSetVlanPriority(vlanPriority);
- actionType = ActionValues.ACTION_SET_VLAN_PCP;
- }
-
- /**
- * Get the action to strip the VLAN header.
- *
- * @return the action to strip the VLAN header.
- */
- @JsonProperty("actionStripVlan")
- public ActionStripVlan actionStripVlan() {
- return actionStripVlan;
- }
-
- /**
- * Set the action to strip the VLAN header.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionStripVlan")
- public void setActionStripVlan(ActionStripVlan action) {
- actionStripVlan = action;
- actionType = ActionValues.ACTION_STRIP_VLAN;
- }
-
- /**
- * Set the action to strip the VLAN header.
- *
- * @param stripVlan if true, strip the VLAN header.
- */
- public void setActionStripVlan(boolean stripVlan) {
- actionStripVlan = new ActionStripVlan(stripVlan);
- actionType = ActionValues.ACTION_STRIP_VLAN;
- }
-
- /**
- * Get the action to set the Ethernet source address.
- *
- * @return the action to set the Ethernet source address.
- */
- @JsonProperty("actionSetEthernetSrcAddr")
- public ActionSetEthernetAddr actionSetEthernetSrcAddr() {
- return actionSetEthernetSrcAddr;
- }
-
- /**
- * Set the action to set the Ethernet source address.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetEthernetSrcAddr")
- public void setActionSetEthernetSrcAddr(ActionSetEthernetAddr action) {
- actionSetEthernetSrcAddr = action;
- actionType = ActionValues.ACTION_SET_DL_SRC;
- }
-
- /**
- * Set the action to set the Ethernet source address.
- *
- * @param addr the MAC address to set as the Ethernet source address.
- */
- public void setActionSetEthernetSrcAddr(MACAddress addr) {
- actionSetEthernetSrcAddr = new ActionSetEthernetAddr(addr);
- actionType = ActionValues.ACTION_SET_DL_SRC;
- }
-
- /**
- * Get the action to set the Ethernet destination address.
- *
- * @return the action to set the Ethernet destination address.
- */
- @JsonProperty("actionSetEthernetDstAddr")
- public ActionSetEthernetAddr actionSetEthernetDstAddr() {
- return actionSetEthernetDstAddr;
- }
-
- /**
- * Set the action to set the Ethernet destination address.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetEthernetDstAddr")
- public void setActionSetEthernetDstAddr(ActionSetEthernetAddr action) {
- actionSetEthernetDstAddr = action;
- actionType = ActionValues.ACTION_SET_DL_DST;
- }
-
- /**
- * Set the action to set the Ethernet destination address.
- *
- * @param addr the MAC address to set as the Ethernet destination address.
- */
- public void setActionSetEthernetDstAddr(MACAddress addr) {
- actionSetEthernetDstAddr = new ActionSetEthernetAddr(addr);
- actionType = ActionValues.ACTION_SET_DL_DST;
- }
-
- /**
- * Get the action to set the IPv4 source address.
- *
- * @return the action to set the IPv4 source address.
- */
- @JsonProperty("actionSetIPv4SrcAddr")
- public ActionSetIPv4Addr actionSetIPv4SrcAddr() {
- return actionSetIPv4SrcAddr;
- }
-
- /**
- * Set the action to set the IPv4 source address.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetIPv4SrcAddr")
- public void setActionSetIPv4SrcAddr(ActionSetIPv4Addr action) {
- actionSetIPv4SrcAddr = action;
- actionType = ActionValues.ACTION_SET_NW_SRC;
- }
-
- /**
- * Set the action to set the IPv4 source address.
- *
- * @param addr the IPv4 address to set as the IPv4 source address.
- */
- public void setActionSetIPv4SrcAddr(IPv4 addr) {
- actionSetIPv4SrcAddr = new ActionSetIPv4Addr(addr);
- actionType = ActionValues.ACTION_SET_NW_SRC;
- }
-
- /**
- * Get the action to set the IPv4 destination address.
- *
- * @return the action to set the IPv4 destination address.
- */
- @JsonProperty("actionSetIPv4DstAddr")
- public ActionSetIPv4Addr actionSetIPv4DstAddr() {
- return actionSetIPv4DstAddr;
- }
-
- /**
- * Set the action to set the IPv4 destination address.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetIPv4DstAddr")
- public void setActionSetIPv4DstAddr(ActionSetIPv4Addr action) {
- actionSetIPv4DstAddr = action;
- actionType = ActionValues.ACTION_SET_NW_DST;
- }
-
- /**
- * Set the action to set the IPv4 destination address.
- *
- * @param addr the IPv4 address to set as the IPv4 destination address.
- */
- public void setActionSetIPv4DstAddr(IPv4 addr) {
- actionSetIPv4DstAddr = new ActionSetIPv4Addr(addr);
- actionType = ActionValues.ACTION_SET_NW_DST;
- }
-
- /**
- * Get the action to set the IP ToS (DSCP field, 6 bits).
- *
- * @return the action to set the IP ToS (DSCP field, 6 bits).
- */
- @JsonProperty("actionSetIpToS")
- public ActionSetIpToS actionSetIpToS() {
- return actionSetIpToS;
- }
-
- /**
- * Set the action to set the IP ToS (DSCP field, 6 bits).
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetIpToS")
- public void setActionSetIpToS(ActionSetIpToS action) {
- actionSetIpToS = action;
- actionType = ActionValues.ACTION_SET_NW_TOS;
- }
-
- /**
- * Set the action to set the IP ToS (DSCP field, 6 bits).
- *
- * @param ipToS the IP ToS (DSCP field, 6 bits) to set.
- */
- public void setActionSetIpToS(byte ipToS) {
- actionSetIpToS = new ActionSetIpToS(ipToS);
- actionType = ActionValues.ACTION_SET_NW_TOS;
- }
-
- /**
- * Get the action to set the TCP/UDP source port.
- *
- * @return the action to set the TCP/UDP source port.
- */
- @JsonProperty("actionSetTcpUdpSrcPort")
- public ActionSetTcpUdpPort actionSetTcpUdpSrcPort() {
- return actionSetTcpUdpSrcPort;
- }
-
- /**
- * Set the action to set the TCP/UDP source port.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetTcpUdpSrcPort")
- public void setActionSetTcpUdpSrcPort(ActionSetTcpUdpPort action) {
- actionSetTcpUdpSrcPort = action;
- actionType = ActionValues.ACTION_SET_TP_SRC;
- }
-
- /**
- * Set the action to set the TCP/UDP source port.
- *
- * @param port the TCP/UDP port to set as the TCP/UDP source port.
- */
- public void setActionSetTcpUdpSrcPort(short port) {
- actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(port);
- actionType = ActionValues.ACTION_SET_TP_SRC;
- }
-
- /**
- * Get the action to set the TCP/UDP destination port.
- *
- * @return the action to set the TCP/UDP destination port.
- */
- @JsonProperty("actionSetTcpUdpDstPort")
- public ActionSetTcpUdpPort actionSetTcpUdpDstPort() {
- return actionSetTcpUdpDstPort;
- }
-
- /**
- * Set the action to set the TCP/UDP destination port.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionSetTcpUdpDstPort")
- public void setActionSetTcpUdpDstPort(ActionSetTcpUdpPort action) {
- actionSetTcpUdpDstPort = action;
- actionType = ActionValues.ACTION_SET_TP_DST;
- }
-
- /**
- * Set the action to set the TCP/UDP destination port.
- *
- * @param port the TCP/UDP port to set as the TCP/UDP destination port.
- */
- public void setActionSetTcpUdpDstPort(short port) {
- actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(port);
- actionType = ActionValues.ACTION_SET_TP_DST;
- }
-
- /**
- * Get the action to output to queue on a port.
- *
- * @return the action to output to queue on a port.
- */
- @JsonProperty("actionEnqueue")
- public ActionEnqueue actionEnqueue() {
- return actionEnqueue;
- }
-
- /**
- * Set the action to output to queue on a port.
- *
- * @param action the action to set.
- */
- @JsonProperty("actionEnqueue")
- public void setActionEnqueue(ActionEnqueue action) {
- actionEnqueue = action;
- actionType = ActionValues.ACTION_ENQUEUE;
- }
-
- /**
- * Set the action to output to queue on a port.
- *
- * @param port the port to set.
- * @param queueId the queue ID to set.
- */
- public void setActionEnqueue(PortNumber port, int queueId) {
- actionEnqueue = new ActionEnqueue(port, queueId);
- actionType = ActionValues.ACTION_ENQUEUE;
- }
-
- /**
- * Convert the action to a string.
- * <p/>
- * The string has the following form:
- * [type=XXX action=XXX]
- *
- * @return the action as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- ret += "type=" + actionType;
- switch (actionType) {
- case ACTION_OUTPUT:
- ret += " action=" + actionOutput.toString();
- break;
- case ACTION_SET_VLAN_VID:
- ret += " action=" + actionSetVlanId.toString();
- break;
- case ACTION_SET_VLAN_PCP:
- ret += " action=" + actionSetVlanPriority.toString();
- break;
- case ACTION_STRIP_VLAN:
- ret += " action=" + actionStripVlan.toString();
- break;
- case ACTION_SET_DL_SRC:
- ret += " action=" + actionSetEthernetSrcAddr.toString();
- break;
- case ACTION_SET_DL_DST:
- ret += " action=" + actionSetEthernetDstAddr.toString();
- break;
- case ACTION_SET_NW_SRC:
- ret += " action=" + actionSetIPv4SrcAddr.toString();
- break;
- case ACTION_SET_NW_DST:
- ret += " action=" + actionSetIPv4DstAddr.toString();
- break;
- case ACTION_SET_NW_TOS:
- ret += " action=" + actionSetIpToS.toString();
- break;
- case ACTION_SET_TP_SRC:
- ret += " action=" + actionSetTcpUdpSrcPort.toString();
- break;
- case ACTION_SET_TP_DST:
- ret += " action=" + actionSetTcpUdpDstPort.toString();
- break;
- case ACTION_ENQUEUE:
- ret += " action=" + actionEnqueue.toString();
- break;
- case ACTION_VENDOR:
- ret += " action=VENDOR";
- break;
- default:
- ret += " action=unknown";
- break;
- }
- ret += "]";
-
- return ret;
- }
-
- /**
- * Convert a string to an action.
- * <p/>
- * The string has the following form:
- * [type=XXX action=XXX]
- *
- * @param actionStr the action as a string.
- */
- public void fromString(String actionStr) {
- String[] parts = actionStr.split("type=");
- String decode = null;
-
- // Extract the string after the "type="
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode == null) {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Remove the trailing ']'
- if ((decode.length() > 0) && (decode.charAt(decode.length() - 1) == ']')) {
- decode = decode.substring(0, decode.length() - 1);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Extract the type value and the action value
- parts = decode.split(" action=");
-
- // Decode the "type=XXX" payload
- if (parts.length > 0) {
- decode = parts[0];
- }
- if (decode != null) {
- try {
- actionType = Enum.valueOf(ActionValues.class, decode);
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action string");
- }
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Decode the "action=XXX" payload
- decode = null;
- if (parts.length > 1) {
- decode = parts[1];
- }
- if (decode == null) {
- throw new IllegalArgumentException("Invalid action string");
- }
- //
- try {
- switch (actionType) {
- case ACTION_OUTPUT:
- actionOutput = new ActionOutput(decode);
- break;
- case ACTION_SET_VLAN_VID:
- actionSetVlanId = new ActionSetVlanId(decode);
- break;
- case ACTION_SET_VLAN_PCP:
- actionSetVlanPriority = new ActionSetVlanPriority(decode);
- break;
- case ACTION_STRIP_VLAN:
- actionStripVlan = new ActionStripVlan(decode);
- break;
- case ACTION_SET_DL_SRC:
- actionSetEthernetSrcAddr = new ActionSetEthernetAddr(decode);
- break;
- case ACTION_SET_DL_DST:
- actionSetEthernetDstAddr = new ActionSetEthernetAddr(decode);
- break;
- case ACTION_SET_NW_SRC:
- actionSetIPv4SrcAddr = new ActionSetIPv4Addr(decode);
- break;
- case ACTION_SET_NW_DST:
- actionSetIPv4DstAddr = new ActionSetIPv4Addr(decode);
- break;
- case ACTION_SET_NW_TOS:
- actionSetIpToS = new ActionSetIpToS(decode);
- break;
- case ACTION_SET_TP_SRC:
- actionSetTcpUdpSrcPort = new ActionSetTcpUdpPort(decode);
- break;
- case ACTION_SET_TP_DST:
- actionSetTcpUdpDstPort = new ActionSetTcpUdpPort(decode);
- break;
- case ACTION_ENQUEUE:
- actionEnqueue = new ActionEnqueue(decode);
- break;
- case ACTION_VENDOR:
- // TODO: Handle it as appropriate
- break;
- default:
- throw new IllegalArgumentException("Invalid action string");
- }
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Invalid action type", e);
- }
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java b/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
deleted file mode 100644
index 62d9a65..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryActions.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package net.onrc.onos.core.util;
-
-import java.util.ArrayList;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing multiple Flow Entry actions.
- * <p/>
- * A set of Flow Entry actions need to be applied to each packet.
- */
-public class FlowEntryActions {
- private ArrayList<FlowEntryAction> actions; // The Flow Entry Actions
-
- /**
- * Default constructor.
- */
- public FlowEntryActions() {
- actions = new ArrayList<FlowEntryAction>();
- }
-
- /**
- * Constructor from a string.
- * <p/>
- * The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
- *
- * @param actionsStr the set of actions as a string.
- */
- public FlowEntryActions(String actionsStr) {
- this.fromString(actionsStr);
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public FlowEntryActions(FlowEntryActions other) {
- actions = new ArrayList<FlowEntryAction>();
-
- for (FlowEntryAction action : other.actions) {
- FlowEntryAction newAction = new FlowEntryAction(action);
- actions.add(newAction);
- }
- }
-
- /**
- * Get the Flow Entry Actions.
- *
- * @return the Flow Entry Actions.
- */
- @JsonProperty("actions")
- public ArrayList<FlowEntryAction> actions() {
- return actions;
- }
-
- /**
- * Set the Flow Entry Actions.
- *
- * @param actions the Flow Entry Actions to set.
- */
- @JsonProperty("actions")
- public void setActions(ArrayList<FlowEntryAction> actions) {
- this.actions = actions;
- }
-
- /**
- * Add a Flow Entry Action.
- *
- * @param flowEntryAction the Flow Entry Action to add.
- */
- public void addAction(FlowEntryAction flowEntryAction) {
- actions.add(flowEntryAction);
- }
-
- /**
- * Test whether the set of actions is empty.
- *
- * @return true if the set of actions is empty, otherwise false.
- */
- @JsonIgnore
- public Boolean isEmpty() {
- return actions.isEmpty();
- }
-
- /**
- * Convert the set of actions to a string.
- * <p/>
- * The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
- *
- * @return the set of actions as a string.
- */
- @Override
- public String toString() {
- StringBuilder ret = new StringBuilder();
-
- ret.append("[");
- for (FlowEntryAction action : actions) {
- ret.append(action.toString() + ";");
- }
- ret.append("]");
-
- return ret.toString();
- }
-
- /**
- * Convert a string to a set of actions.
- * <p/>
- * The string has the following form:
- * [[type=XXX action=XXX];[type=XXX action=XXX];...;]
- *
- * @param actionsStr the set of actions as a string.
- */
- public void fromString(String actionsStr) {
- String decode = actionsStr;
-
- actions = new ArrayList<FlowEntryAction>();
-
- if (decode.isEmpty()) {
- return; // Nothing to do
- }
-
- // Remove the '[' and ']' in the beginning and the end of the string
- if ((decode.length() > 1) && (decode.charAt(0) == '[') &&
- (decode.charAt(decode.length() - 1) == ']')) {
- decode = decode.substring(1, decode.length() - 1);
- } else {
- throw new IllegalArgumentException("Invalid action string");
- }
-
- // Split the string, and decode each action
- String[] parts = decode.split(";");
- for (int i = 0; i < parts.length; i++) {
- decode = parts[i];
- if ((decode == null) || decode.isEmpty()) {
- continue;
- }
- FlowEntryAction flowEntryAction = null;
- try {
- flowEntryAction = new FlowEntryAction(decode);
- } catch (IllegalArgumentException e) {
- // TODO: Ignore invalid actions for now
- continue;
- }
- if (flowEntryAction != null) {
- actions.add(flowEntryAction);
- }
- }
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java b/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java
deleted file mode 100644
index 4744baa..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryErrorState.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package net.onrc.onos.core.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry error state.
- */
-public class FlowEntryErrorState {
- private short type; // The error type (e.g., see OF-1.3.1 spec, pp. 95)
- private short code; // The error code (e.g., see OF-1.3.1 spec, pp. 95)
-
- /**
- * Default constructor.
- */
- public FlowEntryErrorState() {
- this.type = 0;
- this.code = 0;
- }
-
- /**
- * Constructor for a given error type and code.
- *
- * @param type the error type to use.
- * @param code the error code to use.
- */
- public FlowEntryErrorState(short type, short code) {
- this.type = type;
- this.code = code;
- }
-
- /**
- * Get the error type.
- *
- * @return the error type.
- */
- @JsonProperty("type")
- public short type() {
- return type;
- }
-
- /**
- * Set the error type.
- *
- * @param type the error type to use.
- */
- @JsonProperty("type")
- public void setType(short type) {
- this.type = type;
- }
-
- /**
- * Get the error code.
- *
- * @return the error code.
- */
- @JsonProperty("code")
- public short code() {
- return code;
- }
-
- /**
- * Set the error code.
- *
- * @param code the error code to use.
- */
- @JsonProperty("code")
- public void setCode(short code) {
- this.code = code;
- }
-
- /**
- * Set the values of the error type and code.
- *
- * @param newType the error type to use.
- * @param newCode the error code to use.
- */
- public void setValue(short newType, short newCode) {
- type = newType;
- code = newCode;
- }
-
- /**
- * Convert the error type and code to a string.
- * <p/>
- * The string has the following form:
- * [type=1 code=2]
- *
- * @return the error type and code as a string.
- */
- @Override
- public String toString() {
- String ret = "[type=" + this.type + " code=" + code + "]";
- return ret;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java b/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
deleted file mode 100644
index 4900890..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryId.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package net.onrc.onos.core.util;
-
-import java.math.BigInteger;
-
-import net.onrc.onos.core.util.serializers.FlowEntryIdDeserializer;
-import net.onrc.onos.core.util.serializers.FlowEntryIdSerializer;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * The class representing a Flow Entry ID.
- * This class is immutable.
- */
-@JsonDeserialize(using = FlowEntryIdDeserializer.class)
-@JsonSerialize(using = FlowEntryIdSerializer.class)
-public final class FlowEntryId {
- private static final long INVALID = -1;
- private final long value;
-
- /**
- * Default constructor.
- */
- public FlowEntryId() {
- this.value = FlowEntryId.INVALID;
- }
-
- /**
- * Constructor from an integer value.
- *
- * @param value the value to use.
- */
- public FlowEntryId(long value) {
- this.value = value;
- }
-
- /**
- * Constructor from a string.
- *
- * @param value the value to use.
- */
- public FlowEntryId(String value) {
- //
- // Use the help of BigInteger to parse strings representing
- // large unsigned hex long values.
- //
- char c = 0;
- if (value.length() > 2) {
- c = value.charAt(1);
- }
- if ((c == 'x') || (c == 'X')) {
- this.value = new BigInteger(value.substring(2), 16).longValue();
- } else {
- this.value = Long.decode(value);
- }
- }
-
- /**
- * Get the value of the Flow Entry ID.
- *
- * @return the value of the Flow Entry ID.
- */
- public long value() {
- return value;
- }
-
- /**
- * Test whether the Flow Entry ID is valid.
- *
- * @return true if the Flow Entry ID is valid, otherwise false.
- */
- @JsonIgnore
- public boolean isValid() {
- return (this.value() != FlowEntryId.INVALID);
- }
-
- /**
- * Returns true of the object is another Flow Entry ID with
- * the same value; otherwise, returns false.
- *
- * @param obj to compare
- */
- @Override
- public boolean equals(Object obj) {
- if (obj != null && obj.getClass() == this.getClass()) {
- FlowEntryId entry = (FlowEntryId) obj;
- return this.value() == entry.value();
- }
- return false;
- }
-
- /**
- * Return the hash code of the Flow Entry ID.
- */
- @Override
- public int hashCode() {
- return Long.valueOf(value).hashCode();
- }
-
- /**
- * Convert the Flow Entry ID value to a hexadecimal string.
- *
- * @return the Flow Entry ID value to a hexadecimal string.
- */
- @Override
- public String toString() {
- return "0x" + Long.toHexString(this.value);
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
deleted file mode 100644
index d3f8d71..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryMatch.java
+++ /dev/null
@@ -1,763 +0,0 @@
-package net.onrc.onos.core.util;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Entry Matching filter.
- * <p/>
- * The Flow Entry matching filter that is used to specify
- * the network data that would be forwarded on the data path from
- * the source to the destination. Examples: source or destination MAC address,
- * IP prefix that includes the destination's IP address, etc.
- */
-public class FlowEntryMatch {
- /**
- * A class for storing a value to match.
- */
- public static class Field<T> {
- /**
- * Default constructor.
- */
- public Field() {
- this.enabled = false;
- }
-
- /**
- * Constructor for a given value to match.
- *
- * @param value the value to match.
- */
- public Field(T value) {
- this.value = value;
- this.enabled = true;
- }
-
- /**
- * Get the value.
- *
- * @return the value.
- */
- public T value() {
- return this.value;
- }
-
- /**
- * Enable the matching for a given value.
- *
- * @param newValue the value to set.
- */
- public void enableMatch(T newValue) {
- this.value = newValue;
- this.enabled = true;
- }
-
- /**
- * Disable the matching.
- */
- public void disableMatch() {
- this.enabled = false;
- }
-
- /**
- * Test whether matching is enabled.
- *
- * @return true if matching is enabled, otherwise false.
- */
- public boolean enabled() {
- return this.enabled;
- }
-
- private T value; // The value to match
- private boolean enabled; // Set to true, if matching is enabled
- }
-
- private Field<PortNumber> inPort; // Matching input switch port
- private Field<MACAddress> srcMac; // Matching source MAC address
- private Field<MACAddress> dstMac; // Matching destination MAC address
- private Field<Short> ethernetFrameType; // Matching Ethernet frame type
- private Field<Short> vlanId; // Matching VLAN ID
- private Field<Byte> vlanPriority; // Matching VLAN priority
- private Field<IPv4Net> srcIPv4Net; // Matching source IPv4 prefix
- private Field<IPv4Net> dstIPv4Net; // Matching destination IPv4 prefix
- private Field<Byte> ipProto; // Matching IP protocol
- private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits)
- private Field<Short> srcTcpUdpPort; // Matching source TCP/UDP port
- private Field<Short> dstTcpUdpPort; // Matching destination TCP/UDP port
-
- /**
- * Default constructor.
- */
- public FlowEntryMatch() {
- }
-
- /**
- * Copy constructor.
- *
- * @param other the object to copy from.
- */
- public FlowEntryMatch(FlowEntryMatch other) {
- if ((other.inPort != null) && other.inPort.enabled()) {
- this.enableInPort(other.inPort.value());
- }
- if ((other.srcMac != null) && other.srcMac.enabled()) {
- this.enableSrcMac(other.srcMac.value());
- }
- if ((other.dstMac != null) && other.dstMac.enabled()) {
- this.enableDstMac(other.dstMac.value());
- }
- if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled()) {
- this.enableEthernetFrameType(other.ethernetFrameType.value());
- }
- if ((other.vlanId != null) && other.vlanId.enabled()) {
- this.enableVlanId(other.vlanId.value());
- }
- if ((other.vlanPriority != null) && other.vlanPriority.enabled()) {
- this.enableVlanPriority(other.vlanPriority.value());
- }
- if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled()) {
- this.enableSrcIPv4Net(other.srcIPv4Net.value());
- }
- if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled()) {
- this.enableDstIPv4Net(other.dstIPv4Net.value());
- }
- if ((other.ipProto != null) && other.ipProto.enabled()) {
- this.enableIpProto(other.ipProto.value());
- }
- if ((other.ipToS != null) && other.ipToS.enabled()) {
- this.enableIpToS(other.ipToS.value());
- }
- if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled()) {
- this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value());
- }
- if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled()) {
- this.enableDstTcpUdpPort(other.dstTcpUdpPort.value());
- }
- }
-
- /**
- * Get the matching input switch port.
- *
- * @return the matching input switch port.
- */
- @JsonProperty("inPort")
- public PortNumber inPort() {
- if (inPort != null) {
- return inPort.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on input switch port.
- *
- * @param newInPort the input switch port value to enable for matching.
- */
- @JsonProperty("inPort")
- public void enableInPort(PortNumber newInPort) {
- this.inPort = new Field<PortNumber>(newInPort);
- }
-
- /**
- * Disable the matching on input switch port.
- */
- public void disableInPort() {
- this.inPort = null;
- }
-
- /**
- * Test if matching on input switch port is enabled.
- *
- * @return true if matching on input switch port is enabled.
- */
- @JsonProperty("matchInPort")
- public boolean matchInPort() {
- if (inPort != null) {
- return inPort.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching source MAC address.
- *
- * @return the matching source MAC address.
- */
- @JsonProperty("srcMac")
- public MACAddress srcMac() {
- if (srcMac != null) {
- return srcMac.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on source MAC address.
- *
- * @param newSrcMac the source MAC address value to enable for matching.
- */
- @JsonProperty("srcMac")
- public void enableSrcMac(MACAddress newSrcMac) {
- this.srcMac = new Field<MACAddress>(newSrcMac);
- }
-
- /**
- * Disable the matching on source MAC address.
- */
- public void disableSrcMac() {
- this.srcMac = null;
- }
-
- /**
- * Test if matching on source MAC address is enabled.
- *
- * @return true if matching on source MAC address is enabled.
- */
- @JsonProperty("matchSrcMac")
- public boolean matchSrcMac() {
- if (srcMac != null) {
- return srcMac.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching destination MAC address.
- *
- * @return the matching destination MAC address.
- */
- @JsonProperty("dstMac")
- public MACAddress dstMac() {
- if (dstMac != null) {
- return dstMac.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on destination MAC address.
- *
- * @param newDstMac the destination MAC address value to enable for matching.
- */
- @JsonProperty("dstMac")
- public void enableDstMac(MACAddress newDstMac) {
- this.dstMac = new Field<MACAddress>(newDstMac);
- }
-
- /**
- * Disable the matching on destination MAC address.
- */
- public void disableDstMac() {
- this.dstMac = null;
- }
-
- /**
- * Test if matching on destination MAC address is enabled.
- *
- * @return true if matching on destination MAC address is enabled.
- */
- @JsonProperty("matchDstMac")
- public boolean matchDstMac() {
- if (dstMac != null) {
- return dstMac.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching Ethernet frame type.
- *
- * @return the matching Ethernet frame type.
- */
- @JsonProperty("ethernetFrameType")
- public Short ethernetFrameType() {
- if (ethernetFrameType != null) {
- return ethernetFrameType.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on Ethernet frame type.
- *
- * @param newEthernetFrameType the Ethernet frame type value to enable for
- * matching.
- */
- @JsonProperty("ethernetFrameType")
- public void enableEthernetFrameType(Short newEthernetFrameType) {
- this.ethernetFrameType = new Field<Short>(newEthernetFrameType);
- }
-
- /**
- * Disable the matching on Ethernet frame type.
- */
- public void disableEthernetFrameType() {
- this.ethernetFrameType = null;
- }
-
- /**
- * Test if matching on Ethernet frame type is enabled.
- *
- * @return true if matching on Ethernet frame type is enabled.
- */
- @JsonProperty("matchEthernetFrameType")
- public boolean matchEthernetFrameType() {
- if (ethernetFrameType != null) {
- return ethernetFrameType.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching VLAN ID.
- *
- * @return the matching VLAN ID.
- */
- @JsonProperty("vlanId")
- public Short vlanId() {
- if (vlanId != null) {
- return vlanId.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on VLAN ID.
- *
- * @param newVlanId the VLAN ID value to enable for matching.
- */
- @JsonProperty("vlanId")
- public void enableVlanId(Short newVlanId) {
- this.vlanId = new Field<Short>(newVlanId);
- }
-
- /**
- * Disable the matching on VLAN ID.
- */
- public void disableVlanId() {
- this.vlanId = null;
- }
-
- /**
- * Test if matching on VLAN ID is enabled.
- *
- * @return true if matching on VLAN ID is enabled.
- */
- @JsonProperty("matchVlanId")
- public boolean matchVlanId() {
- if (vlanId != null) {
- return vlanId.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching VLAN priority.
- *
- * @return the matching VLAN priority.
- */
- @JsonProperty("vlanPriority")
- public Byte vlanPriority() {
- if (vlanPriority != null) {
- return vlanPriority.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on VLAN priority.
- *
- * @param newVlanPriority the VLAN priority value to enable for matching.
- */
- @JsonProperty("vlanPriority")
- public void enableVlanPriority(Byte newVlanPriority) {
- this.vlanPriority = new Field<Byte>(newVlanPriority);
- }
-
- /**
- * Disable the matching on VLAN priority.
- */
- public void disableVlanPriority() {
- this.vlanPriority = null;
- }
-
- /**
- * Test if matching on VLAN priority is enabled.
- *
- * @return true if matching on VLAN priority is enabled.
- */
- @JsonProperty("matchVlanPriority")
- public boolean matchVlanPriority() {
- if (vlanPriority != null) {
- return vlanPriority.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching source IPv4 prefix.
- *
- * @return the matching source IPv4 prefix.
- */
- @JsonProperty("srcIPv4Net")
- public IPv4Net srcIPv4Net() {
- if (srcIPv4Net != null) {
- return srcIPv4Net.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on source IPv4 prefix.
- *
- * @param newSrcIPv4Net the source IPv4 prefix value to enable for matching.
- */
- @JsonProperty("srcIPv4Net")
- public void enableSrcIPv4Net(IPv4Net newSrcIPv4Net) {
- this.srcIPv4Net = new Field<IPv4Net>(newSrcIPv4Net);
- }
-
- /**
- * Disable the matching on source IPv4 prefix.
- */
- public void disableSrcIPv4Net() {
- this.srcIPv4Net = null;
- }
-
- /**
- * Test if matching on source IPv4 prefix is enabled.
- *
- * @return true if matching on source IPv4 prefix is enabled.
- */
- @JsonProperty("matchSrcIPv4Net")
- public boolean matchSrcIPv4Net() {
- if (srcIPv4Net != null) {
- return srcIPv4Net.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching destination IPv4 prefix.
- *
- * @return the matching destination IPv4 prefix.
- */
- @JsonProperty("dstIPv4Net")
- public IPv4Net dstIPv4Net() {
- if (dstIPv4Net != null) {
- return dstIPv4Net.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on destination IPv4 prefix.
- *
- * @param newDstIPv4Net the destination IPv4 prefix value to enable for
- * matching.
- */
- @JsonProperty("dstIPv4Net")
- public void enableDstIPv4Net(IPv4Net newDstIPv4Net) {
- this.dstIPv4Net = new Field<IPv4Net>(newDstIPv4Net);
- }
-
- /**
- * Disable the matching on destination IPv4 prefix.
- */
- public void disableDstIPv4Net() {
- this.dstIPv4Net = null;
- }
-
- /**
- * Test if matching on destination IPv4 prefix is enabled.
- *
- * @return true if matching on destination IPv4 prefix is enabled.
- */
- @JsonProperty("matchDstIPv4Net")
- public boolean matchDstIPv4Net() {
- if (dstIPv4Net != null) {
- return dstIPv4Net.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching IP protocol.
- *
- * @return the matching IP protocol.
- */
- @JsonProperty("ipProto")
- public Byte ipProto() {
- if (ipProto != null) {
- return ipProto.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on IP protocol.
- *
- * @param newIpProto the IP protocol value to enable for matching.
- */
- @JsonProperty("ipProto")
- public void enableIpProto(Byte newIpProto) {
- this.ipProto = new Field<Byte>(newIpProto);
- }
-
- /**
- * Disable the matching on IP protocol.
- */
- public void disableIpProto() {
- this.ipProto = null;
- }
-
- /**
- * Test if matching on IP protocol is enabled.
- *
- * @return true if matching on IP protocol is enabled.
- */
- @JsonProperty("matchIpProto")
- public boolean matchIpProto() {
- if (ipProto != null) {
- return ipProto.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching IP ToS (DSCP field, 6 bits).
- *
- * @return the matching IP ToS.
- */
- @JsonProperty("ipToS")
- public Byte ipToS() {
- if (ipToS != null) {
- return ipToS.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on IP ToS (DSCP field, 6 bits).
- *
- * @param newIpToS the IP ToS value to enable for matching.
- */
- @JsonProperty("ipToS")
- public void enableIpToS(Byte newIpToS) {
- this.ipToS = new Field<Byte>(newIpToS);
- }
-
- /**
- * Disable the matching on IP ToS (DSCP field, 6 bits).
- */
- public void disableIpToS() {
- this.ipToS = null;
- }
-
- /**
- * Test if matching on IP ToS (DSCP field, 6 bits) is enabled.
- *
- * @return true if matching on IP ToS is enabled.
- */
- @JsonProperty("matchIpToS")
- public boolean matchIpToS() {
- if (ipToS != null) {
- return ipToS.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching source TCP/UDP port.
- *
- * @return the matching source TCP/UDP port.
- */
- @JsonProperty("srcTcpUdpPort")
- public Short srcTcpUdpPort() {
- if (srcTcpUdpPort != null) {
- return srcTcpUdpPort.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on source TCP/UDP port.
- *
- * @param newSrcTcpUdpPort the source TCP/UDP port to enable for matching.
- */
- @JsonProperty("srcTcpUdpPort")
- public void enableSrcTcpUdpPort(Short newSrcTcpUdpPort) {
- this.srcTcpUdpPort = new Field<Short>(newSrcTcpUdpPort);
- }
-
- /**
- * Disable the matching on source TCP/UDP port.
- */
- public void disableSrcTcpUdpPort() {
- this.srcTcpUdpPort = null;
- }
-
- /**
- * Test if matching on source TCP/UDP port is enabled.
- *
- * @return true if matching on source TCP/UDP port is enabled.
- */
- @JsonProperty("matchSrcTcpUdpPort")
- public boolean matchSrcTcpUdpPort() {
- if (srcTcpUdpPort != null) {
- return srcTcpUdpPort.enabled();
- }
- return false;
- }
-
- /**
- * Get the matching destination TCP/UDP port.
- *
- * @return the matching destination TCP/UDP port.
- */
- @JsonProperty("dstTcpUdpPort")
- public Short dstTcpUdpPort() {
- if (dstTcpUdpPort != null) {
- return dstTcpUdpPort.value();
- }
- return null;
- }
-
- /**
- * Enable the matching on destination TCP/UDP port.
- *
- * @param newDstTcpUdpPort the destination TCP/UDP port to enable for
- * matching.
- */
- @JsonProperty("dstTcpUdpPort")
- public void enableDstTcpUdpPort(Short newDstTcpUdpPort) {
- this.dstTcpUdpPort = new Field<Short>(newDstTcpUdpPort);
- }
-
- /**
- * Disable the matching on destination TCP/UDP port.
- */
- public void disableDstTcpUdpPort() {
- this.dstTcpUdpPort = null;
- }
-
- /**
- * Test if matching on destination TCP/UDP port is enabled.
- *
- * @return true if matching on destination TCP/UDP port is enabled.
- */
- @JsonProperty("matchDstTcpUdpPort")
- public boolean matchDstTcpUdpPort() {
- if (dstTcpUdpPort != null) {
- return dstTcpUdpPort.enabled();
- }
- return false;
- }
-
- /**
- * Convert the matching filter to a string.
- * <p/>
- * The string has the following form:
- * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
- *
- * @return the matching filter as a string.
- */
- @Override
- public String toString() {
- String ret = "[";
- boolean addSpace = false;
-
- //
- // Conditionally add only those matching fields that are enabled
- //
- if (matchInPort()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "inPort=" + this.inPort().toString();
- }
- if (matchSrcMac()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "srcMac=" + this.srcMac().toString();
- }
- if (matchDstMac()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "dstMac=" + this.dstMac().toString();
- }
- if (matchEthernetFrameType()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
- }
- if (matchVlanId()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "vlanId=" + this.vlanId().toString();
- }
- if (matchVlanPriority()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "vlanPriority=" + this.vlanPriority().toString();
- }
- if (matchSrcIPv4Net()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "srcIPv4Net=" + this.srcIPv4Net().toString();
- }
- if (matchDstIPv4Net()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "dstIPv4Net=" + this.dstIPv4Net().toString();
- }
- if (matchIpProto()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "ipProto=" + this.ipProto().toString();
- }
- if (matchIpToS()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "ipToS=" + this.ipToS().toString();
- }
- if (matchSrcTcpUdpPort()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString();
- }
- if (matchDstTcpUdpPort()) {
- if (addSpace) {
- ret += " ";
- }
- addSpace = true;
- ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString();
- }
-
- ret += "]";
-
- return ret;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java b/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java
deleted file mode 100644
index 754755a..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntrySwitchState.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.onrc.onos.core.util;
-
-/**
- * The Flow Entry state as set by the controller.
- */
-public enum FlowEntrySwitchState {
- FE_SWITCH_UNKNOWN, // Initialization value: state unknown
- FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
- FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
- FE_SWITCH_UPDATED, // Switch updated with this entry
- FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java b/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java
deleted file mode 100644
index 8cad5d0..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowEntryUserState.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.onrc.onos.core.util;
-
-/**
- * The Flow Entry state as set by the user (via the ONOS API).
- */
-public enum FlowEntryUserState {
- FE_USER_UNKNOWN, // Initialization value: state unknown
- FE_USER_ADD, // Flow entry that is added
- FE_USER_MODIFY, // Flow entry that is modified
- FE_USER_DELETE // Flow entry that is deleted
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowId.java b/src/main/java/net/onrc/onos/core/util/FlowId.java
deleted file mode 100644
index a889fb3..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowId.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package net.onrc.onos.core.util;
-
-import java.math.BigInteger;
-
-import net.onrc.onos.core.util.serializers.FlowIdDeserializer;
-import net.onrc.onos.core.util.serializers.FlowIdSerializer;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * The class representing a Flow ID.
- * This class is immutable.
- */
-@JsonDeserialize(using = FlowIdDeserializer.class)
-@JsonSerialize(using = FlowIdSerializer.class)
-public final class FlowId implements Comparable<FlowId> {
- private static final long INVALID = -1;
- private final long value;
-
- /**
- * Default constructor.
- */
- public FlowId() {
- this.value = FlowId.INVALID;
- }
-
- /**
- * Constructor from an integer value.
- *
- * @param value the value to use.
- */
- public FlowId(long value) {
- this.value = value;
- }
-
- /**
- * Constructor from a string.
- *
- * @param value the value to use.
- */
- public FlowId(String value) {
- //
- // Use the help of BigInteger to parse strings representing
- // large unsigned hex long values.
- //
- char c = 0;
- if (value.length() > 2) {
- c = value.charAt(1);
- }
- if ((c == 'x') || (c == 'X')) {
- this.value = new BigInteger(value.substring(2), 16).longValue();
- } else {
- this.value = Long.decode(value);
- }
- }
-
- /**
- * Get the value of the Flow ID.
- *
- * @return the value of the Flow ID.
- */
- public long value() {
- return value;
- }
-
- /**
- * Test whether the Flow ID is valid.
- *
- * @return true if the Flow ID is valid, otherwise false.
- */
- @JsonIgnore
- public boolean isValid() {
- return (this.value() != FlowId.INVALID);
- }
-
- /**
- * Convert the Flow ID value to a hexadecimal string.
- *
- * @return the Flow ID value to a hexadecimal string.
- */
- @Override
- public String toString() {
- return "0x" + Long.toHexString(this.value);
- }
-
- /**
- * Compare two FlowId objects numerically using their Flow IDs.
- *
- * @return the value 0 if the Flow ID is equal to the argument's Flow ID;
- * a value less than 0 if the Flow ID is numerically less than the
- * argument's Flow ID; and a value greater than 0 if the Flow ID is
- * numerically greater than the argument's Flow ID.
- */
- @Override
- public int compareTo(FlowId o) {
- return Long.valueOf(this.value).compareTo(o.value());
- }
-
- /**
- * Test whether some other object is "equal to" this one.
- *
- * @param obj the reference object with which to compare.
- * @return true if this object is the same as the obj argument; false
- * otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof FlowId) {
- FlowId other = (FlowId) obj;
- return (this.value == other.value);
- }
- return false;
- }
-
- /**
- * Get the hash code for the object.
- *
- * @return a hash code value for this object.
- */
- @Override
- public int hashCode() {
- return Long.valueOf(this.value).hashCode();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPath.java b/src/main/java/net/onrc/onos/core/util/FlowPath.java
deleted file mode 100644
index 5cee39c..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowPath.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package net.onrc.onos.core.util;
-
-import java.util.ArrayList;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Path.
- */
-public class FlowPath implements Comparable<FlowPath> {
- public static final int PRIORITY_DEFAULT = 32768; // Default Flow Priority
-
- private FlowId flowId; // The Flow ID
- private CallerId installerId; // The Caller ID of the path installer
- private FlowPathType flowPathType; // The Flow Path type
- private FlowPathUserState flowPathUserState; // The Flow Path User state
- private FlowPathFlags flowPathFlags; // The Flow Path flags
- private int idleTimeout; // The Flow idle timeout
- private int hardTimeout; // The Flow hard timeout
- private int priority; // The Flow priority
- private DataPath dataPath; // The data path
- private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
- // Flow Entries
- private FlowEntryActions flowEntryActions; // The Flow Entry Actions for
- // the first Flow Entry
-
- /**
- * Default constructor.
- */
- public FlowPath() {
- flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
- flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN;
- flowPathFlags = new FlowPathFlags();
- priority = FlowPath.PRIORITY_DEFAULT;
- dataPath = new DataPath();
- flowEntryActions = new FlowEntryActions();
- }
-
- /**
- * Get the flow path Flow ID.
- *
- * @return the flow path Flow ID.
- */
- @JsonProperty("flowId")
- public FlowId flowId() {
- return flowId;
- }
-
- /**
- * Set the flow path Flow ID.
- *
- * @param flowId the flow path Flow ID to set.
- */
- @JsonProperty("flowId")
- public void setFlowId(FlowId flowId) {
- this.flowId = flowId;
- }
-
- /**
- * Test whether the Flow ID is valid.
- *
- * @return true if the Flow ID is valid, otherwise false.
- */
- @JsonIgnore
- public boolean isValidFlowId() {
- if (this.flowId == null) {
- return false;
- }
- return (this.flowId.isValid());
- }
-
- /**
- * Get the Caller ID of the flow path installer.
- *
- * @return the Caller ID of the flow path installer.
- */
- @JsonProperty("installerId")
- public CallerId installerId() {
- return installerId;
- }
-
- /**
- * Set the Caller ID of the flow path installer.
- *
- * @param installerId the Caller ID of the flow path installer.
- */
- @JsonProperty("installerId")
- public void setInstallerId(CallerId installerId) {
- this.installerId = installerId;
- }
-
- /**
- * Get the flow path type.
- *
- * @return the flow path type.
- */
- @JsonProperty("flowPathType")
- public FlowPathType flowPathType() {
- return flowPathType;
- }
-
- /**
- * Set the flow path type.
- *
- * @param flowPathType the flow path type to set.
- */
- @JsonProperty("flowPathType")
- public void setFlowPathType(FlowPathType flowPathType) {
- this.flowPathType = flowPathType;
- }
-
- /**
- * Get the flow path user state.
- *
- * @return the flow path user state.
- */
- @JsonProperty("flowPathUserState")
- public FlowPathUserState flowPathUserState() {
- return flowPathUserState;
- }
-
- /**
- * Set the flow path user state.
- *
- * @param flowPathUserState the flow path user state to set.
- */
- @JsonProperty("flowPathUserState")
- public void setFlowPathUserState(FlowPathUserState flowPathUserState) {
- this.flowPathUserState = flowPathUserState;
- }
-
- /**
- * Get the flow path flags.
- *
- * @return the flow path flags.
- */
- @JsonProperty("flowPathFlags")
- public FlowPathFlags flowPathFlags() {
- return flowPathFlags;
- }
-
- /**
- * Set the flow path flags.
- *
- * @param flowPathFlags the flow path flags to set.
- */
- @JsonProperty("flowPathFlags")
- public void setFlowPathFlags(FlowPathFlags flowPathFlags) {
- this.flowPathFlags = flowPathFlags;
- }
-
- /**
- * Get the flow idle timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @return the flow idle timeout.
- */
- @JsonProperty("idleTimeout")
- public int idleTimeout() {
- return idleTimeout;
- }
-
- /**
- * Set the flow idle timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @param idleTimeout the flow idle timeout to set.
- */
- @JsonProperty("idleTimeout")
- public void setIdleTimeout(int idleTimeout) {
- this.idleTimeout = 0xffff & idleTimeout;
- }
-
- /**
- * Get the flow hard timeout in seconds.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @return the flow hard timeout.
- */
- @JsonProperty("hardTimeout")
- public int hardTimeout() {
- return hardTimeout;
- }
-
- /**
- * Set the flow hard timeout.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- * If zero, the timeout is not set.
- *
- * @param hardTimeout the flow hard timeout to set.
- */
- @JsonProperty("hardTimeout")
- public void setHardTimeout(int hardTimeout) {
- this.hardTimeout = 0xffff & hardTimeout;
- }
-
- /**
- * Get the flow priority.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- *
- * @return the flow priority.
- */
- @JsonProperty("priority")
- public int priority() {
- return priority;
- }
-
- /**
- * Set the flow priority.
- * <p/>
- * It should be an unsigned integer in the interval [0, 65535].
- *
- * @param priority the flow priority to set.
- */
- @JsonProperty("priority")
- public void setPriority(int priority) {
- this.priority = 0xffff & priority;
- }
-
- /**
- * Get the flow path's data path.
- *
- * @return the flow path's data path.
- */
- @JsonProperty("dataPath")
- public DataPath dataPath() {
- return dataPath;
- }
-
- /**
- * Set the flow path's data path.
- *
- * @param dataPath the flow path's data path to set.
- */
- @JsonProperty("dataPath")
- public void setDataPath(DataPath dataPath) {
- this.dataPath = dataPath;
- }
-
- /**
- * Get the data path flow entries.
- *
- * @return the data path flow entries.
- */
- public ArrayList<FlowEntry> flowEntries() {
- return this.dataPath.flowEntries();
- }
-
- /**
- * Get the flow path's match conditions common for all Flow Entries.
- *
- * @return the flow path's match conditions common for all Flow Entries.
- */
- @JsonProperty("flowEntryMatch")
- public FlowEntryMatch flowEntryMatch() {
- return flowEntryMatch;
- }
-
- /**
- * Set the flow path's match conditions common for all Flow Entries.
- *
- * @param flowEntryMatch the flow path's match conditions common for all
- * Flow Entries.
- */
- @JsonProperty("flowEntryMatch")
- public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
- this.flowEntryMatch = flowEntryMatch;
- }
-
- /**
- * Get the flow path's flow entry actions for the first Flow Entry.
- *
- * @return the flow path's flow entry actions for the first Flow Entry.
- */
- @JsonProperty("flowEntryActions")
- public FlowEntryActions flowEntryActions() {
- return flowEntryActions;
- }
-
- /**
- * Set the flow path's flow entry actions for the first Flow Entry.
- *
- * @param flowEntryActions the flow path's flow entry actions for the first
- * Flow Entry.
- */
- @JsonProperty("flowEntryActions")
- public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
- this.flowEntryActions = flowEntryActions;
- }
-
- /**
- * Convert the flow path to a string.
- * <p/>
- * The string has the following form:
- * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX
- * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
- * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX]
- *
- * @return the flow path as a string.
- */
- @Override
- public String toString() {
- String ret = "[flowId=" + this.flowId.toString();
- ret += " installerId=" + this.installerId.toString();
- ret += " flowPathType=" + this.flowPathType;
- ret += " flowPathUserState=" + this.flowPathUserState;
- ret += " flowPathFlags=" + this.flowPathFlags.toString();
- ret += " idleTimeout=" + this.idleTimeout;
- ret += " hardTimeout=" + this.hardTimeout;
- ret += " priority=" + this.priority;
- if (dataPath != null) {
- ret += " dataPath=" + this.dataPath.toString();
- }
- if (flowEntryMatch != null) {
- ret += " flowEntryMatch=" + this.flowEntryMatch.toString();
- }
- if (flowEntryActions != null) {
- ret += " flowEntryActions=" + this.flowEntryActions.toString();
- }
- ret += "]";
- return ret;
- }
-
- /**
- * Compares this object with the specified object for order.
- * NOTE: The test is based on the Flow ID.
- *
- * @param f the object to be compared.
- * @return a negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object.
- */
- @Override
- public int compareTo(FlowPath f) {
- return (this.flowId.compareTo(f.flowId()));
- }
-
- /**
- * Test whether some other object is "equal to" this one.
- * NOTE: The test is based on the Flow ID.
- *
- * @param obj the reference object with which to compare.
- * @return true if this object is the same as the obj argument; false
- * otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof FlowPath) {
- FlowPath other = (FlowPath) obj;
- return (this.flowId.equals(other.flowId()));
- }
- return false;
- }
-
- /**
- * Get the hash code for the object.
- * NOTE: The computation is based on the Flow ID.
- *
- * @return a hash code value for this object.
- */
- @Override
- public int hashCode() {
- return this.flowId.hashCode();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
deleted file mode 100644
index 138f961..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowPathFlags.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package net.onrc.onos.core.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing the Flow Path flags.
- */
-public class FlowPathFlags {
- private long flags;
-
- // Discard the first-hop Flow Entry
- public static final long DISCARD_FIRST_HOP_ENTRY = (1 << 0);
-
- // Keep only the first-hop Flow Entry
- public static final long KEEP_ONLY_FIRST_HOP_ENTRY = (1 << 1);
-
- /**
- * Default constructor.
- */
- public FlowPathFlags() {
- this.flags = 0;
- }
-
- /**
- * Constructor for given flags.
- *
- * @param flags the flags value to set.
- */
- public FlowPathFlags(long flags) {
- this.flags = flags;
- }
-
- /**
- * Constructor for given flags as a string.
- * <p/>
- * The string value should contain the name of each flags to set. E.g.:
- * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
- *
- * @param flagsStr the string value of the flags to set.
- */
- public FlowPathFlags(String flagsStr) {
- this.setFlagsStr(flagsStr);
- }
-
- /**
- * Get the flags.
- *
- * @return the flags.
- */
- @JsonProperty("flags")
- public long flags() {
- return flags;
- }
-
- /**
- * Set the flags.
- *
- * @param flags the flags value to set.
- */
- @JsonProperty("flags")
- public void setFlags(long flags) {
- this.flags = flags;
- }
-
- /**
- * Set the flags as a string.
- * <p/>
- * The string value should contain the name of each flags to set. E.g.:
- * "DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY"
- *
- * @param flagsStr the string value of the flags to set.
- */
- @JsonProperty("flagsStr")
- public void setFlagsStr(String flagsStr) {
- this.flags = 0L;
-
- // Test all flags
- if (flagsStr.contains("DISCARD_FIRST_HOP_ENTRY")) {
- this.flags |= DISCARD_FIRST_HOP_ENTRY;
- }
- if (flagsStr.contains("KEEP_ONLY_FIRST_HOP_ENTRY")) {
- this.flags |= KEEP_ONLY_FIRST_HOP_ENTRY;
- }
- }
-
- /**
- * Test whether the DISCARD_FIRST_HOP_ENTRY flag is set.
- *
- * @return true if the DISCARD_FIRST_HOP_ENTRY flag is set,
- * otherwise false.
- */
- public boolean isDiscardFirstHopEntry() {
- return ((flags & DISCARD_FIRST_HOP_ENTRY) != 0);
- }
-
- /**
- * Test whether the KEEP_ONLY_FIRST_HOP_ENTRY flag is set.
- *
- * @return true if the KEEP_ONLY_FIRST_HOP_ENTRY flag is set,
- * otherwise false.
- */
- public boolean isKeepOnlyFirstHopEntry() {
- return ((flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0);
- }
-
- /**
- * Convert the Flow Path Flags to a string.
- * <p/>
- * The string has the following form:
- * [flags=DISCARD_FIRST_HOP_ENTRY,KEEP_ONLY_FIRST_HOP_ENTRY]
- *
- * @return the Flow Path flags as a string.
- */
- @Override
- public String toString() {
- String flagsStr = null;
- String ret = "[flags=";
-
- // Test all flags
- if ((this.flags & DISCARD_FIRST_HOP_ENTRY) != 0) {
- flagsStr += "DISCARD_FIRST_HOP_ENTRY";
- }
- if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
- if (flagsStr != null) {
- flagsStr += ",";
- }
- flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
- }
- if (flagsStr != null) {
- ret += flagsStr;
- }
- ret += "]";
-
- return ret;
- }
-
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathType.java b/src/main/java/net/onrc/onos/core/util/FlowPathType.java
deleted file mode 100644
index f18938d..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowPathType.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.onrc.onos.core.util;
-
-/**
- * The Flow Path types.
- */
-public enum FlowPathType {
- FP_TYPE_UNKNOWN, // Initialization value: state unknown
- FP_TYPE_SHORTEST_PATH, // Shortest path flow
- FP_TYPE_EXPLICIT_PATH // Flow path with explicit flow entries
-}
diff --git a/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java b/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java
deleted file mode 100644
index 4b637d1..0000000
--- a/src/main/java/net/onrc/onos/core/util/FlowPathUserState.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.onrc.onos.core.util;
-
-/**
- * The Flow Path state as set by the user (via the ONOS API).
- */
-public enum FlowPathUserState {
- FP_USER_UNKNOWN, // Initialization value: state unknown
- FP_USER_ADD, // Flow path that is added
- FP_USER_MODIFY, // Flow path that is modified
- FP_USER_DELETE // Flow path that is deleted
-}
diff --git a/src/main/java/net/onrc/onos/core/util/Switch.java b/src/main/java/net/onrc/onos/core/util/Switch.java
deleted file mode 100644
index 8ea1184..0000000
--- a/src/main/java/net/onrc/onos/core/util/Switch.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package net.onrc.onos.core.util;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-/**
- * The class representing a Switch.
- * This class is almost immutable: the switch state is mutable.
- * NOTE: Currently this class is (almost) not used.
- */
-public final class Switch {
- /**
- * The Switch state.
- */
- public enum SwitchState {
- INACTIVE,
- ACTIVE,
- }
-
- private final Dpid dpid; // The DPID of the switch
- private SwitchState state; // The state of the switch
-
- /**
- * Default constructor.
- * <p/>
- * NOTE: The default state for the switch is INACTIVE.
- */
- public Switch() {
- this.dpid = new Dpid();
- this.state = SwitchState.INACTIVE;
- }
-
- /**
- * Constructor for a given DPID.
- * <p/>
- * NOTE: The state for the switch with a given DPID is ACTIVE.
- *
- * @param dpid the DPID to use.
- */
- public Switch(Dpid dpid) {
- this.dpid = dpid;
- this.state = SwitchState.ACTIVE;
- }
-
- /**
- * Constructor for a given DPID and Switch State.
- *
- * @param dpid the DPID to use.
- * @param state the Switch State to use.
- */
- public Switch(Dpid dpid, SwitchState state) {
- this.dpid = dpid;
- this.state = state;
- }
-
- /**
- * Get the DPID.
- *
- * @return the DPID.
- */
- @JsonProperty("dpid")
- public Dpid dpid() {
- return dpid;
- }
-
- /**
- * Get the state.
- *
- * @return the state.
- */
- @JsonProperty("state")
- public SwitchState state() {
- return state;
- }
-
- /**
- * Set the state.
- *
- * @param state the state to use.
- */
- @JsonProperty("state")
- public void setState(SwitchState state) {
- this.state = state;
- }
-
- /**
- * Set the Switch State to ACTIVE.
- */
- public void setStateActive() {
- this.state = SwitchState.ACTIVE;
- }
-
- /**
- * Set the Switch State to INACTIVE.
- */
- public void setStateInactive() {
- this.state = SwitchState.INACTIVE;
- }
-
- /**
- * Convert the Switch value to a string.
- * <p/>
- * The string has the following form:
- * dpid/state
- *
- * @return the Switch value as a string.
- */
- @Override
- public String toString() {
- return this.dpid.toString() + "/" + this.state.toString();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java
deleted file mode 100644
index eadb2ce..0000000
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdDeserializer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package net.onrc.onos.core.util.serializers;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.util.FlowEntryId;
-
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.DeserializationContext;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Deserialize a Flow Entry ID from a string.
- */
-public class FlowEntryIdDeserializer extends JsonDeserializer<FlowEntryId> {
-
- private static final Logger log = LoggerFactory.getLogger(FlowEntryIdDeserializer.class);
-
- @Override
- public FlowEntryId deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- FlowEntryId flowEntryId = null;
-
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: " + fieldname + " Value: " + value);
- flowEntryId = new FlowEntryId(value);
- }
- }
- return flowEntryId;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java
deleted file mode 100644
index bc91f46..0000000
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowEntryIdSerializer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.onrc.onos.core.util.serializers;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.util.FlowEntryId;
-
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.map.SerializerProvider;
-
-/**
- * Serialize a Flow Entry ID as a hexadecimal string.
- */
-public class FlowEntryIdSerializer extends JsonSerializer<FlowEntryId> {
-
- @Override
- public void serialize(FlowEntryId flowEntryId, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeString(flowEntryId.toString());
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java
deleted file mode 100644
index ecdf41a..0000000
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdDeserializer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package net.onrc.onos.core.util.serializers;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.util.FlowId;
-
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.map.DeserializationContext;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Deserialize a Flow ID from a string.
- */
-public class FlowIdDeserializer extends JsonDeserializer<FlowId> {
-
- private static final Logger log = LoggerFactory.getLogger(FlowIdDeserializer.class);
-
- @Override
- public FlowId deserialize(JsonParser jp,
- DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- FlowId flowId = null;
-
- jp.nextToken(); // Move to JsonToken.START_OBJECT
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- String fieldname = jp.getCurrentName();
- if ("value".equals(fieldname)) {
- String value = jp.getText();
- log.debug("Fieldname: {} Value: {}", fieldname, value);
- flowId = new FlowId(value);
- }
- }
- return flowId;
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java b/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java
deleted file mode 100644
index 37a3e45..0000000
--- a/src/main/java/net/onrc/onos/core/util/serializers/FlowIdSerializer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.onrc.onos.core.util.serializers;
-
-import java.io.IOException;
-
-import net.onrc.onos.core.util.FlowId;
-
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.map.SerializerProvider;
-
-/**
- * Serialize a Flow ID as a hexadecimal string.
- */
-public class FlowIdSerializer extends JsonSerializer<FlowId> {
-
- @Override
- public void serialize(FlowId flowId, JsonGenerator jGen,
- SerializerProvider serializer)
- throws IOException, JsonProcessingException {
- jGen.writeStartObject();
- jGen.writeStringField("value", flowId.toString());
- jGen.writeEndObject();
- }
-}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
index 679e7f9..e48b01b 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
@@ -37,22 +37,7 @@
import net.onrc.onos.core.topology.TopologyBatchOperation;
import net.onrc.onos.core.topology.TopologyElement;
import net.onrc.onos.core.topology.TopologyEvent;
-import net.onrc.onos.core.util.CallerId;
-import net.onrc.onos.core.util.DataPath;
import net.onrc.onos.core.util.Dpid;
-import net.onrc.onos.core.util.FlowEntry;
-import net.onrc.onos.core.util.FlowEntryAction;
-import net.onrc.onos.core.util.FlowEntryActions;
-import net.onrc.onos.core.util.FlowEntryErrorState;
-import net.onrc.onos.core.util.FlowEntryId;
-import net.onrc.onos.core.util.FlowEntryMatch;
-import net.onrc.onos.core.util.FlowEntrySwitchState;
-import net.onrc.onos.core.util.FlowEntryUserState;
-import net.onrc.onos.core.util.FlowId;
-import net.onrc.onos.core.util.FlowPath;
-import net.onrc.onos.core.util.FlowPathFlags;
-import net.onrc.onos.core.util.FlowPathType;
-import net.onrc.onos.core.util.FlowPathUserState;
import net.onrc.onos.core.util.IPv4;
import net.onrc.onos.core.util.IPv4Net;
import net.onrc.onos.core.util.IPv6;
@@ -60,7 +45,6 @@
import net.onrc.onos.core.util.LinkTuple;
import net.onrc.onos.core.util.OnosInstanceId;
import net.onrc.onos.core.util.PortNumber;
-import net.onrc.onos.core.util.Switch;
import net.onrc.onos.core.util.SwitchPort;
import com.esotericsoftware.kryo.Kryo;
@@ -165,33 +149,7 @@
kryo.register(ArrayList.class);
// FlowPath and related classes
- kryo.register(CallerId.class);
- kryo.register(DataPath.class);
kryo.register(Dpid.class);
- kryo.register(FlowEntryAction.class);
- kryo.register(FlowEntryAction.ActionEnqueue.class);
- kryo.register(FlowEntryAction.ActionOutput.class);
- kryo.register(FlowEntryAction.ActionSetEthernetAddr.class);
- kryo.register(FlowEntryAction.ActionSetIpToS.class);
- kryo.register(FlowEntryAction.ActionSetIPv4Addr.class);
- kryo.register(FlowEntryAction.ActionSetTcpUdpPort.class);
- kryo.register(FlowEntryAction.ActionSetVlanId.class);
- kryo.register(FlowEntryAction.ActionSetVlanPriority.class);
- kryo.register(FlowEntryAction.ActionStripVlan.class);
- kryo.register(FlowEntryAction.ActionValues.class);
- kryo.register(FlowEntryActions.class);
- kryo.register(FlowEntryErrorState.class);
- kryo.register(FlowEntryId.class);
- kryo.register(FlowEntry.class);
- kryo.register(FlowEntryMatch.class);
- kryo.register(FlowEntryMatch.Field.class);
- kryo.register(FlowEntrySwitchState.class);
- kryo.register(FlowEntryUserState.class);
- kryo.register(FlowId.class);
- kryo.register(FlowPath.class);
- kryo.register(FlowPathFlags.class);
- kryo.register(FlowPathType.class);
- kryo.register(FlowPathUserState.class);
kryo.register(IPv4.class);
kryo.register(IPv4Net.class);
kryo.register(IPv6.class);
@@ -199,7 +157,6 @@
kryo.register(byte[].class);
kryo.register(MACAddress.class);
kryo.register(PortNumber.class);
- kryo.register(Switch.class);
kryo.register(SwitchPort.class);
kryo.register(LinkTuple.class);
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
deleted file mode 100644
index fbba92c..0000000
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryActionTest.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package net.onrc.onos.core.util;
-
-import static org.junit.Assert.assertEquals;
-import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.core.util.FlowEntryAction.ActionEnqueue;
-import net.onrc.onos.core.util.FlowEntryAction.ActionOutput;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetEthernetAddr;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetIPv4Addr;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetIpToS;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetTcpUdpPort;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetVlanId;
-import net.onrc.onos.core.util.FlowEntryAction.ActionSetVlanPriority;
-import net.onrc.onos.core.util.FlowEntryAction.ActionStripVlan;
-
-import org.junit.Test;
-import org.projectfloodlight.openflow.types.OFPort;
-
-public class FlowEntryActionTest {
-
- @Test
- public void testSetActionOutputActionOutput() {
- FlowEntryAction act = new FlowEntryAction();
- ActionOutput actout = new FlowEntryAction.ActionOutput(new PortNumber((short) 42));
- act.setActionOutput(actout);
-
- assertEquals("action output", FlowEntryAction.ActionValues.ACTION_OUTPUT, act.actionType());
- assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port());
- assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionOutputPort() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionOutput(new PortNumber((short) 42));
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionOutputToController() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionOutputToController((short) 0);
-
- FlowEntryAction actCopy = new FlowEntryAction();
- actCopy.setActionOutput(new PortNumber(OFPort.CONTROLLER.getShortPortNumber()));
-
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetVlanIdActionSetVlanId() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short) 42);
- act.setActionSetVlanId(actVlan);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID, act.actionType());
- assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetVlanIdShort() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetVlanId((short) 42);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetVlanPriorityActionSetVlanPriority() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte) 42);
- act.setActionSetVlanPriority(actVlan);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP, act.actionType());
- assertEquals("vlan priority should be the same", actVlan.vlanPriority(),
- act.actionSetVlanPriority().vlanPriority());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetVlanPriorityByte() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetVlanPriority((byte) 42);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionStripVlanActionStripVlan() {
- FlowEntryAction act = new FlowEntryAction();
- ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan();
- act.setActionStripVlan(actVlan);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_STRIP_VLAN, act.actionType());
- assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionStripVlanBoolean() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionStripVlan(true);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr() {
- FlowEntryAction act = new FlowEntryAction();
- byte[] mac = {1, 2, 3, 4, 5, 6};
- ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
- act.setActionSetEthernetSrcAddr(setEth);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_DL_SRC, act.actionType());
- assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr());
-
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetEthernetSrcAddrMACAddress() {
- FlowEntryAction act = new FlowEntryAction();
- byte[] mac = {1, 2, 3, 4, 5, 6};
- act.setActionSetEthernetSrcAddr(new MACAddress(mac));
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetEthernetDstAddrActionSetEthernetAddr() {
- FlowEntryAction act = new FlowEntryAction();
- byte[] mac = {1, 2, 3, 4, 5, 6};
- ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac));
- act.setActionSetEthernetDstAddr(setEth);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_DL_DST, act.actionType());
- assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetEthernetDstAddrMACAddress() {
- FlowEntryAction act = new FlowEntryAction();
- byte[] mac = {1, 2, 3, 4, 5, 6};
- act.setActionSetEthernetDstAddr(new MACAddress(mac));
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
- act.setActionSetIPv4SrcAddr(setIp);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_SRC, act.actionType());
- assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIPv4SrcAddrIPv4() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1"));
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIPv4DstAddrActionSetIPv4Addr() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1"));
- act.setActionSetIPv4DstAddr(setIp);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_DST, act.actionType());
- assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIPv4DstAddrIPv4() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1"));
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIpToSActionSetIpToS() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte) 42);
- act.setActionSetIpToS(setIpTos);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_NW_TOS, act.actionType());
- assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetIpToSByte() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetIpToS((byte) 1);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short) 42);
- act.setActionSetTcpUdpSrcPort(setPorts);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_SRC, act.actionType());
- assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetTcpUdpSrcPortShort() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetTcpUdpSrcPort((short) 1);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort() {
- FlowEntryAction act = new FlowEntryAction();
- ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short) 42);
- act.setActionSetTcpUdpDstPort(setPorts);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_SET_TP_DST, act.actionType());
- assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionSetTcpUdpDstPortShort() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionSetTcpUdpDstPort((short) 1);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionEnqueueActionEnqueue() {
- FlowEntryAction act = new FlowEntryAction();
- ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new PortNumber((short) 42), 1);
- act.setActionEnqueue(enq);
-
- assertEquals("action type", FlowEntryAction.ActionValues.ACTION_ENQUEUE, act.actionType());
- assertEquals("port should be the same", enq.port(), act.actionEnqueue().port());
- assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId());
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
- @Test
- public void testSetActionEnqueuePortInt() {
- FlowEntryAction act = new FlowEntryAction();
- act.setActionEnqueue(new PortNumber((short) 42), 1);
-
- FlowEntryAction actCopy = new FlowEntryAction(act);
- FlowEntryAction actCopy2 = new FlowEntryAction(act.toString());
-
- assertEquals("toString must match between copies", act.toString(),
- actCopy.toString());
- assertEquals("toString must match between copies", act.toString(),
- actCopy2.toString());
- }
-
-}
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
deleted file mode 100644
index 3f84c09..0000000
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryMatchTest.java
+++ /dev/null
@@ -1,320 +0,0 @@
-package net.onrc.onos.core.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class FlowEntryMatchTest {
-
- FlowEntryMatch match;
-
- PortNumber inport = new PortNumber((short) 1);
- byte[] byte1 = {1, 2, 3, 4, 5, 6};
- byte[] byte2 = {6, 5, 4, 3, 2, 1};
- MACAddress mac1 = new MACAddress(byte1);
- MACAddress mac2 = new MACAddress(byte2);
- Short ether = Short.valueOf((short) 2);
- Short vlanid = Short.valueOf((short) 3);
- Byte vlanprio = Byte.valueOf((byte) 4);
- IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
- IPv4Net ip2 = new IPv4Net("127.0.0.2/32");
- Byte ipproto = Byte.valueOf((byte) 5);
- Byte ipToS = Byte.valueOf((byte) 6);
- Short tport1 = Short.valueOf((short) 7);
- Short tport2 = Short.valueOf((short) 8);
-
- @Before
- public void setUp() throws Exception {
- match = new FlowEntryMatch();
- match.enableInPort(inport);
- match.enableSrcMac(mac1);
- match.enableDstMac(mac2);
- match.enableEthernetFrameType(ether);
- match.enableVlanId(vlanid);
- match.enableVlanPriority(vlanprio);
- match.enableSrcIPv4Net(ip1);
- match.enableDstIPv4Net(ip2);
- match.enableIpProto(ipproto);
- match.enableIpToS(ipToS);
- match.enableSrcTcpUdpPort(tport1);
- match.enableDstTcpUdpPort(tport2);
- }
-
- @Test
- public void testFlowEntryMatch() {
- FlowEntryMatch def = new FlowEntryMatch();
-
- assertEquals("default null", null, def.inPort());
- assertEquals("default null", null, def.srcMac());
- assertEquals("default null", null, def.dstMac());
- assertEquals("default null", null, def.ethernetFrameType());
- assertEquals("default null", null, def.vlanId());
- assertEquals("default null", null, def.vlanPriority());
- assertEquals("default null", null, def.srcIPv4Net());
- assertEquals("default null", null, def.dstIPv4Net());
- assertEquals("default null", null, def.ipProto());
- assertEquals("default null", null, def.ipToS());
- assertEquals("default null", null, def.srcTcpUdpPort());
- assertEquals("default null", null, def.dstTcpUdpPort());
- }
-
- @Test
- public void testFlowEntryMatchFlowEntryMatch() {
- FlowEntryMatch defBase = new FlowEntryMatch();
- FlowEntryMatch def = new FlowEntryMatch(defBase);
-
- assertEquals("default null", null, def.inPort());
- assertEquals("default null", null, def.srcMac());
- assertEquals("default null", null, def.dstMac());
- assertEquals("default null", null, def.ethernetFrameType());
- assertEquals("default null", null, def.vlanId());
- assertEquals("default null", null, def.vlanPriority());
- assertEquals("default null", null, def.srcIPv4Net());
- assertEquals("default null", null, def.dstIPv4Net());
- assertEquals("default null", null, def.ipProto());
- assertEquals("default null", null, def.ipToS());
- assertEquals("default null", null, def.srcTcpUdpPort());
- assertEquals("default null", null, def.dstTcpUdpPort());
-
- FlowEntryMatch copy = new FlowEntryMatch(match);
-
- assertEquals("inport", inport, copy.inPort());
- assertEquals("mac1", mac1, copy.srcMac());
- assertEquals("mac2", mac2, copy.dstMac());
- assertEquals("ether", ether, copy.ethernetFrameType());
- assertEquals("vlan id", vlanid, copy.vlanId());
- assertEquals("vlan prio", vlanprio, copy.vlanPriority());
- assertEquals("ip1", ip1, copy.srcIPv4Net());
- assertEquals("ip2", ip2, copy.dstIPv4Net());
- assertEquals("ip proto", ipproto, copy.ipProto());
- assertEquals("tos", ipToS, copy.ipToS());
- assertEquals("src port", tport1, copy.srcTcpUdpPort());
- assertEquals("dst port", tport2, copy.dstTcpUdpPort());
-
- }
-
- @Test
- public void testInPort() {
- assertEquals("inport", inport, match.inPort());
- }
-
- @Test
- public void testDisableInPort() {
- match.disableInPort();
- assertEquals("inport", null, match.inPort());
- assertFalse(match.matchInPort());
- }
-
- @Test
- public void testMatchInPort() {
- assertTrue(match.matchInPort());
- }
-
- @Test
- public void testSrcMac() {
- assertEquals("mac1", mac1, match.srcMac());
- }
-
- @Test
- public void testDisableSrcMac() {
- match.disableSrcMac();
- assertEquals("srcMac", null, match.srcMac());
- assertFalse(match.matchSrcMac());
- }
-
- @Test
- public void testMatchSrcMac() {
- assertTrue(match.matchSrcMac());
- }
-
- @Test
- public void testDstMac() {
- assertEquals("mac2", mac2, match.dstMac());
- }
-
- @Test
- public void testDisableDstMac() {
- match.disableDstMac();
- assertEquals("dstMac", null, match.dstMac());
- assertFalse(match.matchDstMac());
- }
-
- @Test
- public void testMatchDstMac() {
- assertTrue(match.matchDstMac());
- }
-
- @Test
- public void testEthernetFrameType() {
- assertEquals("ether", ether, match.ethernetFrameType());
- }
-
- @Test
- public void testDisableEthernetFrameType() {
- match.disableEthernetFrameType();
- assertEquals("ethernetFrameType", null, match.ethernetFrameType());
- assertFalse(match.matchEthernetFrameType());
- }
-
- @Test
- public void testMatchEthernetFrameType() {
- assertTrue(match.matchEthernetFrameType());
- }
-
- @Test
- public void testVlanId() {
- assertEquals("vlan id", vlanid, match.vlanId());
- }
-
- @Test
- public void testDisableVlanId() {
- match.disableVlanId();
- assertEquals("vlanId", null, match.vlanId());
- assertFalse(match.matchVlanId());
- }
-
- @Test
- public void testMatchVlanId() {
- assertTrue(match.matchVlanId());
- }
-
- @Test
- public void testVlanPriority() {
- assertEquals("vlan prio", vlanprio, match.vlanPriority());
- }
-
- @Test
- public void testDisableVlanPriority() {
- match.disableVlanPriority();
- assertEquals("vlanPriority", null, match.vlanPriority());
- assertFalse(match.matchVlanPriority());
- }
-
- @Test
- public void testMatchVlanPriority() {
- assertTrue(match.matchVlanPriority());
- }
-
- @Test
- public void testSrcIPv4Net() {
- assertEquals("ip1", ip1, match.srcIPv4Net());
- }
-
- @Test
- public void testDisableSrcIPv4Net() {
- match.disableSrcIPv4Net();
- assertEquals("srcIPv4Net", null, match.srcIPv4Net());
- assertFalse(match.matchSrcIPv4Net());
- }
-
- @Test
- public void testMatchSrcIPv4Net() {
- assertTrue(match.matchSrcIPv4Net());
- }
-
- @Test
- public void testDstIPv4Net() {
- assertEquals("ip2", ip2, match.dstIPv4Net());
- }
-
- @Test
- public void testDisableDstIPv4Net() {
- match.disableDstIPv4Net();
- assertEquals("dstIPv4Net", null, match.dstIPv4Net());
- assertFalse(match.matchDstIPv4Net());
- }
-
- @Test
- public void testMatchDstIPv4Net() {
- assertTrue(match.matchDstIPv4Net());
- }
-
- @Test
- public void testIpProto() {
- assertEquals("ip proto", ipproto, match.ipProto());
- }
-
- @Test
- public void testDisableIpProto() {
- match.disableIpProto();
- assertEquals("ipProto", null, match.ipProto());
- assertFalse(match.matchIpProto());
- }
-
- @Test
- public void testMatchIpProto() {
- assertTrue(match.matchIpProto());
- }
-
- @Test
- public void testIpToS() {
- assertEquals("tos", ipToS, match.ipToS());
- }
-
- @Test
- public void testDisableIpToS() {
- match.disableIpToS();
- assertEquals("ipToS", null, match.ipToS());
- assertFalse(match.matchIpToS());
- }
-
- @Test
- public void testMatchIpToS() {
- assertTrue(match.matchIpToS());
- }
-
- @Test
- public void testSrcTcpUdpPort() {
- assertEquals("src port", tport1, match.srcTcpUdpPort());
- }
-
- @Test
- public void testDisableSrcTcpUdpPort() {
- match.disableSrcTcpUdpPort();
- assertEquals("srcTcpUdpPort", null, match.srcTcpUdpPort());
- assertFalse(match.matchSrcTcpUdpPort());
- }
-
- @Test
- public void testMatchSrcTcpUdpPort() {
- assertTrue(match.matchSrcTcpUdpPort());
- }
-
- @Test
- public void testDstTcpUdpPort() {
- assertEquals("dst port", tport2, match.dstTcpUdpPort());
- }
-
- @Test
- public void testDisableDstTcpUdpPort() {
- match.disableDstTcpUdpPort();
- assertEquals("dstTcpUdpPort", null, match.dstTcpUdpPort());
- assertFalse(match.matchDstTcpUdpPort());
- }
-
- @Test
- public void testMatchDstTcpUdpPort() {
- assertTrue(match.matchDstTcpUdpPort());
- }
-
- @Test
- public void testToString() {
- FlowEntryMatch def = new FlowEntryMatch();
- assertEquals("match default", def.toString(), "[]");
-
- assertEquals(
- "match set",
- match.toString(),
- "[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01"
- + " ethernetFrameType=2 vlanId=3 vlanPriority=4"
- + " srcIPv4Net=127.0.0.1/32"
- + " dstIPv4Net=127.0.0.2/32 ipProto=5 ipToS=6"
- + " srcTcpUdpPort=7 dstTcpUdpPort=8]");
- }
-
-}
diff --git a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java b/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
deleted file mode 100644
index 769198a..0000000
--- a/src/test/java/net/onrc/onos/core/util/FlowEntryTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package net.onrc.onos.core.util;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import net.floodlightcontroller.util.MACAddress;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class FlowEntryTest {
-
- FlowEntry entry;
-
- FlowId flowId = new FlowId(0x1234);
- FlowEntryId flowEntryId = new FlowEntryId(0x5678);
- int idleTimeout = 5;
- int hardTimeout = 10;
- int priority = 15;
- FlowEntryMatch match;
- FlowEntryActions actions;
-
- Dpid dpid = new Dpid(0xCAFE);
-
- PortNumber inport = new PortNumber((short) 1);
- byte[] byte1 = {1, 2, 3, 4, 5, 6};
- byte[] byte2 = {6, 5, 4, 3, 2, 1};
- MACAddress mac1 = new MACAddress(byte1);
- MACAddress mac2 = new MACAddress(byte2);
- Short ether = Short.valueOf((short) 2);
- Short vlanid = Short.valueOf((short) 3);
- Byte vlanprio = Byte.valueOf((byte) 4);
- IPv4Net ip1 = new IPv4Net("127.0.0.1/32");
- IPv4Net ip2 = new IPv4Net(new IPv4("127.0.0.2"), (short) 32);
- IPv4 ipaddr1 = new IPv4("127.0.0.3");
- IPv4 ipaddr2 = new IPv4("127.0.0.4");
- Byte ipproto = Byte.valueOf((byte) 5);
- Byte ipToS = Byte.valueOf((byte) 6);
- Short tport1 = Short.valueOf((short) 7);
- Short tport2 = Short.valueOf((short) 8);
- PortNumber outport = new PortNumber((short) 9);
- PortNumber queueport = new PortNumber((short) 10);
- int queueId = 11;
-
- FlowEntryErrorState errorState = new FlowEntryErrorState((short) 12, (short) 13);
-
-
- @Before
- public void setUp() throws Exception {
- entry = new FlowEntry();
-
- flowId = new FlowId("0x1234");
- entry.setFlowId(flowId);
-
- flowEntryId = new FlowEntryId("0x5678");
- entry.setFlowEntryId(flowEntryId);
-
- entry.setIdleTimeout(5);
- entry.setHardTimeout(10);
- entry.setPriority(15);
-
- dpid = new Dpid("CA:FE");
- entry.setDpid(dpid);
-
- entry.setInPort(inport);
- entry.setOutPort(outport);
-
- match = new FlowEntryMatch();
- match.enableInPort(inport);
- match.enableSrcMac(mac1);
- match.enableDstMac(mac2);
- match.enableEthernetFrameType(ether);
- match.enableVlanId(vlanid);
- match.enableVlanPriority(vlanprio);
- match.enableSrcIPv4Net(ip1);
- match.enableDstIPv4Net(ip2);
- match.enableIpProto(ipproto);
- match.enableIpToS(ipToS);
- match.enableSrcTcpUdpPort(tport1);
- match.enableDstTcpUdpPort(tport2);
-
- entry.setFlowEntryMatch(match);
-
- FlowEntryAction action = null;
- actions = entry.flowEntryActions();
-
- action = new FlowEntryAction();
- action.setActionOutput(outport);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionOutputToController((short) 0);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetVlanId(vlanid);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetVlanPriority(vlanprio);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionStripVlan(true);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetEthernetSrcAddr(mac1);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetEthernetDstAddr(mac2);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIPv4SrcAddr(ipaddr1);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIPv4DstAddr(ipaddr2);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetIpToS(ipToS);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetTcpUdpSrcPort(tport1);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionSetTcpUdpDstPort(tport2);
- actions.addAction(action);
-
- action = new FlowEntryAction();
- action.setActionEnqueue(queueport, queueId);
- actions.addAction(action);
-
- entry.setFlowEntryUserState(FlowEntryUserState.FE_USER_ADD);
- entry.setFlowEntrySwitchState(FlowEntrySwitchState.FE_SWITCH_UPDATED);
- entry.setFlowEntryErrorState(errorState);
-
- }
-
- @Test
- public void testFlowEntry() {
- FlowEntry e = new FlowEntry();
-
- assertTrue(e.flowEntryActions().isEmpty());
- assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_UNKNOWN, e.flowEntryUserState());
- assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UNKNOWN, e.flowEntrySwitchState());
- }
-
- @Test
- public void testFlowId() {
- assertEquals("flowId", flowId, entry.flowId());
- }
-
- @Test
- public void testIsValidFlowId() {
- FlowEntry e = new FlowEntry();
-
- // Test a Flow Entry with empty Flow ID
- assertEquals("isValidFlowId", false, e.isValidFlowId());
-
- // Test a Flow Entry with invalid Flow ID
- e.setFlowId(new FlowId());
- assertEquals("isValidFlowId", false, e.isValidFlowId());
-
- // Test a Flow Entry with valid Flow ID
- e.setFlowId(new FlowId(0x1));
- assertEquals("isValidFlowId", true, e.isValidFlowId());
- assertEquals("isValidFlowId", true, entry.isValidFlowId());
- }
-
- @Test
- public void testFlowEntryId() {
- assertEquals("flowEntryId", flowEntryId, entry.flowEntryId());
- }
-
- @Test
- public void testIsValidFlowEntryId() {
- FlowEntry e = new FlowEntry();
-
- // Test a Flow Entry with empty Flow Entry ID
- assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId());
-
- // Test a Flow Entry with invalid Flow Entry ID
- e.setFlowEntryId(new FlowEntryId());
- assertEquals("isValidFlowEntryId", false, e.isValidFlowEntryId());
-
- // Test a Flow Entry with valid Flow Entry ID
- e.setFlowEntryId(new FlowEntryId(0x1));
- assertEquals("isValidFlowEntryId", true, e.isValidFlowEntryId());
- assertEquals("isValidFlowEntryId", true, entry.isValidFlowEntryId());
- }
-
- @Test
- public void testIdleTimeout() {
- assertEquals("idleTimeout", idleTimeout, entry.idleTimeout());
- }
-
- @Test
- public void testHardTimeout() {
- assertEquals("hardTimeout", hardTimeout, entry.hardTimeout());
- }
-
- @Test
- public void testPriority() {
- assertEquals("priority", priority, entry.priority());
- }
-
- @Test
- public void testFlowEntryMatch() {
- assertEquals("flowEntryMatch", match, entry.flowEntryMatch());
- }
-
- @Test
- public void testFlowEntryActions() {
- assertEquals("flowEntryActions", actions, entry.flowEntryActions());
- }
-
- @Test
- public void testSetFlowEntryActions() {
- FlowEntryActions acts = new FlowEntryActions();
- entry.setFlowEntryActions(acts);
- assertEquals("flowEntryActions", acts, entry.flowEntryActions());
- }
-
- @Test
- public void testDpid() {
- assertEquals("dpid", dpid, entry.dpid());
- }
-
- @Test
- public void testInPort() {
- assertEquals("inPort", inport, entry.inPort());
- }
-
- @Test
- public void testOutPort() {
- assertEquals("outPort", outport, entry.outPort());
- }
-
- @Test
- public void testFlowEntryUserState() {
- assertEquals("flowEntryUserState", FlowEntryUserState.FE_USER_ADD, entry.flowEntryUserState());
- }
-
- @Test
- public void testFlowEntrySwitchState() {
- assertEquals("flowEntrySwitchState", FlowEntrySwitchState.FE_SWITCH_UPDATED, entry.flowEntrySwitchState());
- }
-
- @Test
- public void testFlowEntryErrorState() {
- assertEquals("flowEntryErrorState", errorState, entry.flowEntryErrorState());
- }
-
- @Test
- public void testToString() {
- FlowEntry def = new FlowEntry();
- assertEquals("toString",
- "[ idleTimeout=0 hardTimeout=0 priority=32768"
- + " flowEntryActions=[] flowEntryUserState=FE_USER_UNKNOWN"
- + " flowEntrySwitchState=FE_SWITCH_UNKNOWN]",
- def.toString());
-
- assertEquals("toString",
- "[flowEntryId=0x5678 flowId=0x1234 idleTimeout=5 hardTimeout=10"
- + " priority=15"
- + " flowEntryMatch="
- + "[inPort=1 srcMac=01:02:03:04:05:06 dstMac=06:05:04:03:02:01"
- + " ethernetFrameType=2 vlanId=3 vlanPriority=4"
- + " srcIPv4Net=127.0.0.1/32 dstIPv4Net=127.0.0.2/32"
- + " ipProto=5 ipToS=6 srcTcpUdpPort=7 dstTcpUdpPort=8"
- + "]"
- + " flowEntryActions=["
- + "[type=ACTION_OUTPUT action=[port=9 maxLen=0]];"
- // PORT_CONTROLLER((short) 0xfffd) = 65533 (-3)
- + "[type=ACTION_OUTPUT action=[port=65533 maxLen=0]];"
- + "[type=ACTION_SET_VLAN_VID action=[vlanId=3]];"
- + "[type=ACTION_SET_VLAN_PCP action=[vlanPriority=4]];"
- + "[type=ACTION_STRIP_VLAN action=[stripVlan=true]];"
- + "[type=ACTION_SET_DL_SRC action=[addr=01:02:03:04:05:06]];"
- + "[type=ACTION_SET_DL_DST action=[addr=06:05:04:03:02:01]];"
- + "[type=ACTION_SET_NW_SRC action=[addr=127.0.0.3]];"
- + "[type=ACTION_SET_NW_DST action=[addr=127.0.0.4]];"
- + "[type=ACTION_SET_NW_TOS action=[ipToS=6]];"
- + "[type=ACTION_SET_TP_SRC action=[port=7]];"
- + "[type=ACTION_SET_TP_DST action=[port=8]];"
- + "[type=ACTION_ENQUEUE action=[port=10 queueId=11]];]"
- + " dpid=00:00:00:00:00:00:ca:fe inPort=1 outPort=9"
- + " flowEntryUserState=FE_USER_ADD"
- + " flowEntrySwitchState=FE_SWITCH_UPDATED"
- + " flowEntryErrorState=[type=12 code=13]]",
- entry.toString());
- }
-
-}