Introduced new field FlowPathType to the Flow Path.
The initial set of valid values are:
FP_TYPE_SHORTEST_PATH, // Shortest path flow
FP_TYPE_EXPLICIT_PATH // Flow path with explicit flow entries
For now, the type field is not used (explicitly) yet.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
index 7b38fef..dadda71 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -199,6 +199,13 @@
@Property("installer_id")
public void setInstallerId(String installerId);
+ @JsonProperty("flowPathType")
+ @Property("flow_path_type")
+ public String getFlowPathType();
+
+ @Property("flow_path_type")
+ public void setFlowPathType(String flowPathType);
+
@JsonProperty("flowPathFlags")
@Property("flow_path_flags")
public Long getFlowPathFlags();
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
index 3178b60..74cfcbe 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -80,6 +80,7 @@
//
// Set the Flow attributes:
// - flowPath.installerId()
+ // - flowPath.flowPathType()
// - flowPath.flowPathFlags()
// - flowPath.dataPath().srcPort()
// - flowPath.dataPath().dstPort()
@@ -97,6 +98,7 @@
// - flowPath.flowEntryActions()
//
flowObj.setInstallerId(flowPath.installerId().toString());
+ flowObj.setFlowPathType(flowPath.flowPathType().toString());
flowObj.setFlowPathFlags(flowPath.flowPathFlags().flags());
flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
@@ -751,6 +753,7 @@
//
String flowIdStr = flowObj.getFlowId();
String installerIdStr = flowObj.getInstallerId();
+ String flowPathType = flowObj.getFlowPathType();
Long flowPathFlags = flowObj.getFlowPathFlags();
String srcSwitchStr = flowObj.getSrcSwitch();
Short srcPortShort = flowObj.getSrcPort();
@@ -759,6 +762,7 @@
if ((flowIdStr == null) ||
(installerIdStr == null) ||
+ (flowPathType == null) ||
(flowPathFlags == null) ||
(srcSwitchStr == null) ||
(srcPortShort == null) ||
@@ -771,6 +775,7 @@
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(flowIdStr));
flowPath.setInstallerId(new CallerId(installerIdStr));
+ flowPath.setFlowPathType(FlowPathType.valueOf(flowPathType));
flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
flowPath.dataPath().srcPort().setDpid(new Dpid(srcSwitchStr));
flowPath.dataPath().srcPort().setPort(new Port(srcPortShort));
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 44607a9..cd1c994 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -295,10 +295,12 @@
Short srcPortShort = flowPathObj.getSrcPort();
String dstDpidStr = flowPathObj.getDstSwitch();
Short dstPortShort = flowPathObj.getDstPort();
+ String flowPathTypeStr = flowPathObj.getFlowPathType();
Long flowPathFlagsLong = flowPathObj.getFlowPathFlags();
if ((srcPortShort == null) ||
(dstDpidStr == null) ||
(dstPortShort == null) ||
+ (flowPathTypeStr == null) ||
(flowPathFlagsLong == null)) {
continue;
}
@@ -308,6 +310,7 @@
Port dstPort = new Port(dstPortShort);
SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+ FlowPathType flowPathType = FlowPathType.valueOf(flowPathTypeStr);
FlowPathFlags flowPathFlags = new FlowPathFlags(flowPathFlagsLong);
counterMyFlowPaths++;
@@ -713,6 +716,7 @@
FlowPath computedFlowPath = new FlowPath();
computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
+ computedFlowPath.setFlowPathType(flowPath.flowPathType());
computedFlowPath.setFlowPathFlags(new FlowPathFlags(flowPath.flowPathFlags().flags()));
computedFlowPath.setDataPath(dataPath);
computedFlowPath.setFlowEntryMatch(new FlowEntryMatch(flowPath.flowEntryMatch()));
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
index a56dbff..7892483 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -3,7 +3,6 @@
import net.floodlightcontroller.util.MACAddress;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.onrc.onos.ofcontroller.util.FlowPathFlags;
import org.codehaus.jackson.annotate.JsonProperty;
@@ -13,6 +12,7 @@
public class FlowPath implements Comparable<FlowPath> {
private FlowId flowId; // The Flow ID
private CallerId installerId; // The Caller ID of the path installer
+ private FlowPathType flowPathType; // The Flow Path type
private FlowPathFlags flowPathFlags; // The Flow Path flags
private DataPath dataPath; // The data path
private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
@@ -24,6 +24,7 @@
* Default constructor.
*/
public FlowPath() {
+ flowPathType = FlowPathType.FP_TYPE_UNKNOWN;
flowPathFlags = new FlowPathFlags();
dataPath = new DataPath();
flowEntryActions = new FlowEntryActions();
@@ -36,6 +37,7 @@
dataPath = new DataPath();
this.setFlowId(new FlowId(flowObj.getFlowId()));
this.setInstallerId(new CallerId(flowObj.getInstallerId()));
+ this.setFlowPathType(FlowPathType.valueOf(flowObj.getFlowPathType()));
this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags()));
this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
@@ -221,6 +223,24 @@
}
/**
+ * 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 flags.
*
* @return the flow path flags.
@@ -300,8 +320,8 @@
* Convert the flow path to a string.
*
* The string has the following form:
- * [flowId=XXX installerId=XXX flowPathFlags=XXX dataPath=XXX
- * flowEntryMatch=XXX flowEntryActions=XXX]
+ * [flowId=XXX installerId=XXX flowPathType = XXX flowPathFlags=XXX
+ * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX]
*
* @return the flow path as a string.
*/
@@ -309,6 +329,7 @@
public String toString() {
String ret = "[flowId=" + this.flowId.toString();
ret += " installerId=" + this.installerId.toString();
+ ret += " flowPathType=" + this.flowPathType;
ret += " flowPathFlags=" + this.flowPathFlags.toString();
if (dataPath != null)
ret += " dataPath=" + this.dataPath.toString();
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java
new file mode 100644
index 0000000..87f2d98
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathType.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.ofcontroller.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/ofcontroller/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
index 507cb99..45a43bf 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
@@ -113,6 +113,7 @@
kryo.register(FlowId.class);
kryo.register(FlowPath.class);
kryo.register(FlowPathFlags.class);
+ kryo.register(FlowPathType.class);
kryo.register(IPv4.class);
kryo.register(IPv4Net.class);
kryo.register(IPv6.class);
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
index bb0dbbf..db39153 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
@@ -104,6 +104,24 @@
/**
* Desc:
+ * Test method for get and set FlowPathType method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Flow Path Type.
+ * 2. Should get the Flow Path Type.
+ */
+ @Test
+ public void testSetGetFlowPathType() {
+ String flowId = "xx";
+ String flowPathType = "FP_TYPE_SHORTEST_PATH";
+ flowPath.setFlowId(flowId);
+ flowPath.setFlowPathType(flowPathType);
+ assertEquals(flowPath.getFlowPathType(), flowPathType);
+ }
+
+ /**
+ * Desc:
* Test method for get and set FlowPathFlags method.
* Condition:
* N/A
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
index 385b49d..cf6501a 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
@@ -415,6 +415,7 @@
public static class TestFlowPath implements IFlowPath {
private String state,type,flowId,installerId,srcSw,dstSw;
+ private String flowPathType;
private Long flowPathFlags;
private String dataPathSummary,userState;
private Short srcPort,dstPort;
@@ -431,6 +432,7 @@
private List<ISwitchObject> switches;
private String stateToUpdate,typeToUpdate,flowIdToUpdate,installerIdToUpdate,srcSwToUpdate,dstSwToUpdate;
+ private String flowPathTypeToUpdate;
private Long flowPathFlagsToUpdate;
private String dataPathSummaryToUpdate,userStateToUpdate;
private Short srcPortToUpdate,dstPortToUpdate;
@@ -469,6 +471,7 @@
if(typeToUpdate != null) { type = typeToUpdate; }
if(flowIdToUpdate != null) { flowId = flowIdToUpdate; }
if(installerIdToUpdate != null) { installerId = installerIdToUpdate; }
+ if(flowPathTypeToUpdate != null) { flowPathType = flowPathTypeToUpdate; }
if(flowPathFlagsToUpdate != null) { flowPathFlags = flowPathFlagsToUpdate; }
if(srcSwToUpdate != null) { srcSw = srcSwToUpdate; }
if(dstSwToUpdate != null) { dstSw = dstSwToUpdate; }
@@ -499,6 +502,7 @@
flowsToRemove.clear();
stateToUpdate = typeToUpdate = flowIdToUpdate = installerIdToUpdate = null;
+ flowPathTypeToUpdate = null;
flowPathFlagsToUpdate = null;
srcSwToUpdate = dstSwToUpdate = dataPathSummaryToUpdate = userStateToUpdate = null;
srcPortToUpdate = dstPortToUpdate = null;
@@ -517,6 +521,7 @@
public void setTypeForTest(String type) { this.type = type; }
public void setFlowIdForTest(String flowId) { this.flowId = flowId; }
public void setInstallerIdForTest(String installerId) { this.installerId = installerId; }
+ public void setFlowPathTypeForTest(String flowPathType) { this.flowPathType = flowPathType; }
public void setFlowPathFlagsForTest(Long flowPathFlags) { this.flowPathFlags = flowPathFlags; }
public void setSrcSwForTest(String srcSw) { this.srcSw = srcSw; }
public void setDstSwForTest(String dstSw) { this.dstSw = dstSw; }
@@ -570,6 +575,12 @@
public void setInstallerId(String installerId) { installerIdToUpdate = installerId; }
@Override
+ public String getFlowPathType() { return flowPathType; }
+
+ @Override
+ public void setFlowPathType(String flowPathType) { flowPathTypeToUpdate = flowPathType; }
+
+ @Override
public Long getFlowPathFlags() { return flowPathFlags; }
@Override
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
index ea09c17..820ad05 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
@@ -88,11 +88,12 @@
}
private IFlowPath createIFlowPathMock(long flowId, String installerID,
- long flowPathFlags,
+ String flowPathType, long flowPathFlags,
long srcDpid, int srcPort, long dstDpid, int dstPort) {
IFlowPath iFlowPath = createNiceMock(IFlowPath.class);
expect(iFlowPath.getFlowId()).andReturn(new FlowId(flowId).toString()).anyTimes();
expect(iFlowPath.getInstallerId()).andReturn(installerID).anyTimes();
+ expect(iFlowPath.getFlowPathType()).andReturn(flowPathType).anyTimes();
expect(iFlowPath.getFlowPathFlags()).andReturn(new Long(flowPathFlags)).anyTimes();
expect(iFlowPath.getSrcSwitch()).andReturn(new Dpid(srcDpid).toString()).anyTimes();
expect(iFlowPath.getSrcPort()).andReturn(new Short((short)srcPort)).anyTimes();
@@ -102,13 +103,14 @@
}
private FlowPath createTestFlowPath(long flowId, String installerId,
- final long flowPathFlags,
+ String flowPathType, final long flowPathFlags,
final long srcDpid, final int srcPort,
- final long dstDpid, final int dstPort
+ final long dstDpid, final int dstPort
) {
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(flowId));
flowPath.setInstallerId(new CallerId(installerId));
+ flowPath.setFlowPathType(FlowPathType.valueOf(flowPathType));
flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
flowPath.setDataPath(new DataPath() {{
setSrcPort(new SwitchPort(new Dpid(srcDpid), new Port((short)srcPort)));
@@ -119,9 +121,9 @@
}
private ArrayList<FlowPath> createTestFlowPaths() {
- FlowPath flowPath1 = createTestFlowPath(1, "foo caller id", 0, 1, 1, 2, 2);
- FlowPath flowPath2 = createTestFlowPath(2, "caller id", 0, 1, 1, 2, 2);
- FlowPath flowPath3 = createTestFlowPath(3, "caller id", 0, 1, 5, 2, 2);
+ FlowPath flowPath1 = createTestFlowPath(1, "foo caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
+ FlowPath flowPath2 = createTestFlowPath(2, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
+ FlowPath flowPath3 = createTestFlowPath(3, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 5, 2, 2);
ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
flowPaths.add(flowPath1);
@@ -194,6 +196,7 @@
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(0x100));
flowPath.setInstallerId(new CallerId("installer id"));
+ flowPath.setFlowPathType(FlowPathType.valueOf("FP_TYPE_SHORTEST_PATH"));
flowPath.setFlowPathFlags(new FlowPathFlags(0));
flowPath.setDataPath(dataPath);
flowPath.setFlowEntryMatch(match);
@@ -205,6 +208,7 @@
createdFlowPath.setFlowId("0x100");
createdFlowPath.setType("flow");
createdFlowPath.setInstallerId("installer id");
+ createdFlowPath.setFlowPathType("FP_TYPE_SHORTEST_PATH");
createdFlowPath.setFlowPathFlags(new Long((long)0));
createdFlowPath.setSrcSwitch("00:00:00:00:00:00:12:34");
createdFlowPath.setSrcPort(new Short((short)1));
@@ -353,7 +357,7 @@
public final void testGetFlowSuccessNormally() throws Exception {
// instantiate required objects
FlowManager fm = new FlowManager();
- IFlowPath iFlowPath = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
// setup expectations
expectInitWithContext();
@@ -367,11 +371,13 @@
fm.init(context);
FlowPath flowPath = fm.getFlow(new FlowId(1));
String installerId = flowPath.installerId().toString();
+ String flowPathType = flowPath.flowPathType().toString();
long flowPathFlags = flowPath.flowPathFlags().flags();
//verify the test
verifyAll();
assertEquals("caller id", installerId);
+ assertEquals("FP_TYPE_SHORTEST_PATH", flowPathType);
assertEquals(0L, flowPathFlags);
}
@@ -454,9 +460,9 @@
final String getAllFlowsWithoutFlowEntries = "getAllFlowsWithoutFlowEntries";
// create mock objects
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, getAllFlowsWithoutFlowEntries);
- IFlowPath flowPath1 = createIFlowPathMock(1, "", 0, 1, 2, 3, 4);
- IFlowPath flowPath2 = createIFlowPathMock(5, "", 0, 2, 3, 4, 5);
- IFlowPath flowPath3 = createIFlowPathMock(10, "", 0, 3, 4, 5, 6);
+ IFlowPath flowPath1 = createIFlowPathMock(1, "", "FP_TYPE_SHORTEST_PATH", 0, 1, 2, 3, 4);
+ IFlowPath flowPath2 = createIFlowPathMock(5, "", "FP_TYPE_SHORTEST_PATH", 0, 2, 3, 4, 5);
+ IFlowPath flowPath3 = createIFlowPathMock(10, "", "FP_TYPE_SHORTEST_PATH", 0, 3, 4, 5, 6);
// instantiate required objects
ArrayList<IFlowPath> flows = new ArrayList<IFlowPath>();
@@ -489,8 +495,8 @@
@Test
public final void testGetAllFlowsSuccessNormally() throws Exception {
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
- IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 0, 2, 5, 3, 5);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 2, 5, 3, 5);
// instantiate required objects
ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
@@ -541,6 +547,7 @@
FlowPath paramFlow = new FlowPath();
paramFlow.setFlowId(new FlowId(100));
paramFlow.setInstallerId(new CallerId("installer id"));
+ paramFlow.setFlowPathType(FlowPathType.valueOf("FP_TYPE_SHORTEST_PATH"));
paramFlow.setFlowPathFlags(new FlowPathFlags(0));
paramFlow.setDataPath(dataPath);
paramFlow.setFlowEntryMatch(match);
@@ -556,6 +563,7 @@
FlowPath flowPath = (FlowPath)EasyMock.getCurrentArguments()[0];
assertEquals(flowPath.flowId().value(), 100);
assertEquals(flowPath.installerId().toString(), "installer id");
+ assertEquals(flowPath.flowPathType().toString(), "PF_TYPE_SHORTEST_PATH");
assertEquals(flowPath.flowPathFlags().flags(), 0);
assertEquals(flowPath.dataPath().srcPort().toString(),
new SwitchPort(new Dpid(1), new Port((short)3)).toString());
@@ -577,6 +585,7 @@
verifyAll();
assertEquals(paramFlow.flowId().value(), resultFlow.flowId().value());
assertEquals(paramFlow.installerId().toString(), resultFlow.installerId().toString());
+ assertEquals(paramFlow.flowPathType().toString(), resultFlow.flowPathType().toString());
assertEquals(paramFlow.flowPathFlags().flags(), resultFlow.flowPathFlags().flags());
assertEquals(paramFlow.dataPath().toString(), resultFlow.dataPath().toString());
assertEquals(paramFlow.flowEntryMatch().toString(), resultFlow.flowEntryMatch().toString());
@@ -775,7 +784,7 @@
@Test
public final void testClearFlowSuccessNormally() throws Exception {
// create mock objects
- IFlowPath flowPath = createIFlowPathMock(123, "id", 0, 1, 2, 3, 4);
+ IFlowPath flowPath = createIFlowPathMock(123, "id", "FP_TYPE_SHORTEST_PATH", 0, 1, 2, 3, 4);
IFlowEntry flowEntry1 = createMock(IFlowEntry.class);
IFlowEntry flowEntry2 = createMock(IFlowEntry.class);
IFlowEntry flowEntry3 = createMock(IFlowEntry.class);
@@ -818,8 +827,8 @@
@Test
public final void testGetAllFlowsWithoutFlowEntriesSuccessNormally() throws Exception {
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
- IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 0, 2, 5, 3, 5);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 2, 5, 3, 5);
// instantiate required objects
ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
@@ -855,7 +864,7 @@
final String addFlowEntry = "addFlowEntry";
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", "FP_TYPE_SHORTEST_PATH", 0, 1, 1, 2, 2);
IFlowEntry iFlowEntry1 = createMock(IFlowEntry.class);
IFlowEntry iFlowEntry2 = createMock(IFlowEntry.class);
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlowEntry);
@@ -929,7 +938,7 @@
public final void testInstallFlowEntryWithIFlowPathSuccessNormally() throws Exception {
// create mock object
IOFSwitch iofSwitch = createNiceMock(IOFSwitch.class);
- IFlowPath iFlowPath = createIFlowPathMock(1, "id", 0, 1, 2, 3, 4);
+ IFlowPath iFlowPath = createIFlowPathMock(1, "id", "FP_TYPE_SHORTEST_PATH", 0, 1, 2, 3, 4);
IFlowEntry iFlowEntry = createMock(IFlowEntry.class);
BasicFactory basicFactory = createMock(BasicFactory.class);
diff --git a/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java b/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
index 89a12e5..7f18667 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/util/FlowPathTest.java
@@ -16,6 +16,7 @@
TestFlowPath iFlowPath = new TestFlowPath();
iFlowPath.setFlowIdForTest("0x1234");
iFlowPath.setInstallerIdForTest("installerId");
+ iFlowPath.setFlowPathTypeForTest("FP_TYPE_SHORTEST_PATH");
iFlowPath.setFlowPathFlagsForTest(0L);
iFlowPath.setSrcSwForTest("CA:FE");
iFlowPath.setSrcPortForTest((short)1);
@@ -38,6 +39,7 @@
@Test
public void testFlowPath(){
FlowPath flowPath = new FlowPath();
+ assertTrue ( flowPath.flowPathType() == FlowPathType.FP_TYPE_UNKNOWN);
assertFalse( flowPath.flowPathFlags().isDiscardFirstHopEntry() );
assertFalse( flowPath.flowPathFlags().isKeepOnlyFirstHopEntry() );
assertTrue( flowPath.flowEntryActions().isEmpty() );
@@ -48,6 +50,7 @@
TestFlowPath iFlowPath = new TestFlowPath();
iFlowPath.setFlowIdForTest("0x1234");
iFlowPath.setInstallerIdForTest("installerId");
+ iFlowPath.setFlowPathTypeForTest("FP_TYPE_SHORTEST_PATH");
iFlowPath.setFlowPathFlagsForTest(0L);
iFlowPath.setSrcSwForTest("CA:FE");
iFlowPath.setSrcPortForTest((short)1);
@@ -91,6 +94,7 @@
FlowPath flowPath = new FlowPath(iFlowPath);
assertEquals(flowPath.flowId().value(), 0x1234);
assertEquals(flowPath.installerId().value(), "installerId");
+ assertEquals(flowPath.flowPathType(), FlowPathType.FP_TYPE_SHORTEST_PATH);
assertEquals(flowPath.flowPathFlags().flags(), 0);
assertEquals(flowPath.dataPath().srcPort().dpid().value(), 0xCAFE);
assertEquals(flowPath.dataPath().srcPort().port().value(), 1);
@@ -134,6 +138,13 @@
assertEquals("FE_SWITCH_UPDATE_IN_PROGRESS", flowPath.dataPath().flowEntries().get(0).flowEntrySwitchState().toString());
}
+ @Test
+ public void testSetFlowPathType(){
+ FlowPath flowPath = new FlowPath();
+ FlowPathType type = FlowPathType.FP_TYPE_SHORTEST_PATH;
+ flowPath.setFlowPathType( type );
+ assertTrue( flowPath.flowPathType() == FlowPathType.FP_TYPE_SHORTEST_PATH );
+ }
@Test
public void testFlowPathFlags(){
@@ -166,7 +177,7 @@
@Test
public void testToString(){
- assertEquals("[flowId=0x1234 installerId=installerId flowPathFlags=[flags=] dataPath=[src=00:00:00:00:00:00:ca:fe/1 flowEntry=[flowEntryId=0x14 flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];] dpid=00:00:00:00:00:00:be:ef flowEntryUserState=FE_USER_MODIFY flowEntrySwitchState=FE_SWITCH_UPDATE_IN_PROGRESS] dst=00:00:00:00:00:00:ba:be/2] flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]]", flowPath.toString());
+ assertEquals("[flowId=0x1234 installerId=installerId flowPathType=FP_TYPE_SHORTEST_PATH flowPathFlags=[flags=] dataPath=[src=00:00:00:00:00:00:ca:fe/1 flowEntry=[flowEntryId=0x14 flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=23 maxLen=24]];[type=ACTION_OUTPUT action=[port=25 maxLen=26]];] dpid=00:00:00:00:00:00:be:ef flowEntryUserState=FE_USER_MODIFY flowEntrySwitchState=FE_SWITCH_UPDATE_IN_PROGRESS] dst=00:00:00:00:00:00:ba:be/2] flowEntryMatch=[] flowEntryActions=[[type=ACTION_OUTPUT action=[port=10 maxLen=11]];[type=ACTION_OUTPUT action=[port=12 maxLen=13]];]]", flowPath.toString());
}
@Test