Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONOS
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 3a5c9e2..0d52171 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -200,6 +200,13 @@
@Property("installer_id")
public void setInstallerId(String installerId);
+ @JsonProperty("flowPathFlags")
+ @Property("flow_path_flags")
+ public Long getFlowPathFlags();
+
+ @Property("flow_path_flags")
+ public void setFlowPathFlags(Long flowPathFlags);
+
@JsonProperty("srcDpid")
@Property("src_switch")
public String getSrcSwitch();
@@ -247,13 +254,6 @@
public void removeFlowEntry(final IFlowEntry flowEntry);
@JsonIgnore
- @Property("matchEthernetFrameType")
- public Short getMatchEthernetFrameType();
-
- @Property("matchEthernetFrameType")
- public void setMatchEthernetFrameType(Short matchEthernetFrameType);
-
- @JsonIgnore
@Property("matchSrcMac")
public String getMatchSrcMac();
@@ -268,6 +268,27 @@
public void setMatchDstMac(String matchDstMac);
@JsonIgnore
+ @Property("matchEthernetFrameType")
+ public Short getMatchEthernetFrameType();
+
+ @Property("matchEthernetFrameType")
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+ @JsonIgnore
+ @Property("matchVlanId")
+ public Short getMatchVlanId();
+
+ @Property("matchVlanId")
+ public void setMatchVlanId(Short matchVlanId);
+
+ @JsonIgnore
+ @Property("matchVlanPriority")
+ public Byte getMatchVlanPriority();
+
+ @Property("matchVlanPriority")
+ public void setMatchVlanPriority(Byte matchVlanPriority);
+
+ @JsonIgnore
@Property("matchSrcIPv4Net")
public String getMatchSrcIPv4Net();
@@ -280,7 +301,35 @@
@Property("matchDstIPv4Net")
public void setMatchDstIPv4Net(String matchDstIPv4Net);
-
+
+ @JsonIgnore
+ @Property("matchIpProto")
+ public Byte getMatchIpProto();
+
+ @Property("matchIpProto")
+ public void setMatchIpProto(Byte matchIpProto);
+
+ @JsonIgnore
+ @Property("matchIpToS")
+ public Byte getMatchIpToS();
+
+ @Property("matchIpToS")
+ public void setMatchIpToS(Byte matchIpToS);
+
+ @JsonIgnore
+ @Property("matchSrcTcpUdpPort")
+ public Short getMatchSrcTcpUdpPort();
+
+ @Property("matchSrcTcpUdpPort")
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+ @JsonIgnore
+ @Property("matchDstTcpUdpPort")
+ public Short getMatchDstTcpUdpPort();
+
+ @Property("matchDstTcpUdpPort")
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
@JsonIgnore
@GremlinGroovy("it.in('flow').out('switch')")
public Iterable<ISwitchObject> getSwitches();
@@ -340,12 +389,6 @@
@Property("matchInPort")
public void setMatchInPort(Short matchInPort);
- @Property("matchEthernetFrameType")
- public Short getMatchEthernetFrameType();
-
- @Property("matchEthernetFrameType")
- public void setMatchEthernetFrameType(Short matchEthernetFrameType);
-
@Property("matchSrcMac")
public String getMatchSrcMac();
@@ -358,6 +401,24 @@
@Property("matchDstMac")
public void setMatchDstMac(String matchDstMac);
+ @Property("matchEthernetFrameType")
+ public Short getMatchEthernetFrameType();
+
+ @Property("matchEthernetFrameType")
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType);
+
+ @Property("matchVlanId")
+ public Short getMatchVlanId();
+
+ @Property("matchVlanId")
+ public void setMatchVlanId(Short matchVlanId);
+
+ @Property("matchVlanPriority")
+ public Byte getMatchVlanPriority();
+
+ @Property("matchVlanPriority")
+ public void setMatchVlanPriority(Byte matchVlanPriority);
+
@Property("matchSrcIPv4Net")
public String getMatchSrcIPv4Net();
@@ -370,11 +431,35 @@
@Property("matchDstIPv4Net")
public void setMatchDstIPv4Net(String matchDstIPv4Net);
- @Property("actionOutput")
- public Short getActionOutput();
+ @Property("matchIpProto")
+ public Byte getMatchIpProto();
- @Property("actionOutput")
- public void setActionOutput(Short actionOutput);
+ @Property("matchIpProto")
+ public void setMatchIpProto(Byte matchIpProto);
+
+ @Property("matchIpToS")
+ public Byte getMatchIpToS();
+
+ @Property("matchIpToS")
+ public void setMatchIpToS(Byte matchIpToS);
+
+ @Property("matchSrcTcpUdpPort")
+ public Short getMatchSrcTcpUdpPort();
+
+ @Property("matchSrcTcpUdpPort")
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort);
+
+ @Property("matchDstTcpUdpPort")
+ public Short getMatchDstTcpUdpPort();
+
+ @Property("matchDstTcpUdpPort")
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort);
+
+ @Property("actionOutputPort")
+ public Short getActionOutputPort();
+
+ @Property("actionOutputPort")
+ public void setActionOutputPort(Short actionOutputPort);
@Adjacency(label="flow")
public IFlowPath getFlow();
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 25a214a..1784540 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -48,6 +48,7 @@
import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
import net.onrc.onos.ofcontroller.util.FlowId;
import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
import net.onrc.onos.ofcontroller.util.IPv4Net;
import net.onrc.onos.ofcontroller.util.Port;
import net.onrc.onos.ofcontroller.util.SwitchPort;
@@ -330,9 +331,11 @@
Short srcPortShort = flowPathObj.getSrcPort();
String dstDpidStr = flowPathObj.getDstSwitch();
Short dstPortShort = flowPathObj.getDstPort();
+ Long flowPathFlagsLong = flowPathObj.getFlowPathFlags();
if ((srcPortShort == null) ||
(dstDpidStr == null) ||
- (dstPortShort == null)) {
+ (dstPortShort == null) ||
+ (flowPathFlagsLong == null)) {
continue;
}
@@ -341,6 +344,7 @@
Port dstPort = new Port(dstPortShort);
SwitchPort srcSwitchPort = new SwitchPort(srcDpid, srcPort);
SwitchPort dstSwitchPort = new SwitchPort(dstDpid, dstPort);
+ FlowPathFlags flowPathFlags = new FlowPathFlags(flowPathFlagsLong);
counterMyFlowPaths++;
@@ -363,6 +367,7 @@
dataPath.setSrcPort(srcSwitchPort);
dataPath.setDstPort(dstSwitchPort);
}
+ dataPath.applyFlowPathFlags(flowPathFlags);
String newDataPathSummaryStr = dataPath.dataPathSummary();
if (dataPathSummaryStr.equals(newDataPathSummaryStr))
@@ -568,33 +573,59 @@
//
// Set the Flow attributes:
// - flowPath.installerId()
+ // - flowPath.flowPathFlags()
// - flowPath.dataPath().srcPort()
// - flowPath.dataPath().dstPort()
- // - flowPath.matchEthernetFrameType()
- // - flowPath.matchSrcIPv4Net()
- // - flowPath.matchDstIPv4Net()
// - flowPath.matchSrcMac()
// - flowPath.matchDstMac()
+ // - flowPath.matchEthernetFrameType()
+ // - flowPath.matchVlanId()
+ // - flowPath.matchVlanPriority()
+ // - flowPath.matchSrcIPv4Net()
+ // - flowPath.matchDstIPv4Net()
+ // - flowPath.matchIpProto()
+ // - flowPath.matchIpToS()
+ // - flowPath.matchSrcTcpUdpPort()
+ // - flowPath.matchDstTcpUdpPort()
//
flowObj.setInstallerId(flowPath.installerId().toString());
+ flowObj.setFlowPathFlags(flowPath.flowPathFlags().flags());
flowObj.setSrcSwitch(flowPath.dataPath().srcPort().dpid().toString());
flowObj.setSrcPort(flowPath.dataPath().srcPort().port().value());
flowObj.setDstSwitch(flowPath.dataPath().dstPort().dpid().toString());
flowObj.setDstPort(flowPath.dataPath().dstPort().port().value());
+ if (flowPath.flowEntryMatch().matchSrcMac()) {
+ flowObj.setMatchSrcMac(flowPath.flowEntryMatch().srcMac().toString());
+ }
+ if (flowPath.flowEntryMatch().matchDstMac()) {
+ flowObj.setMatchDstMac(flowPath.flowEntryMatch().dstMac().toString());
+ }
if (flowPath.flowEntryMatch().matchEthernetFrameType()) {
flowObj.setMatchEthernetFrameType(flowPath.flowEntryMatch().ethernetFrameType());
}
+ if (flowPath.flowEntryMatch().matchVlanId()) {
+ flowObj.setMatchVlanId(flowPath.flowEntryMatch().vlanId());
+ }
+ if (flowPath.flowEntryMatch().matchVlanPriority()) {
+ flowObj.setMatchVlanPriority(flowPath.flowEntryMatch().vlanPriority());
+ }
if (flowPath.flowEntryMatch().matchSrcIPv4Net()) {
flowObj.setMatchSrcIPv4Net(flowPath.flowEntryMatch().srcIPv4Net().toString());
}
if (flowPath.flowEntryMatch().matchDstIPv4Net()) {
flowObj.setMatchDstIPv4Net(flowPath.flowEntryMatch().dstIPv4Net().toString());
}
- if (flowPath.flowEntryMatch().matchSrcMac()) {
- flowObj.setMatchSrcMac(flowPath.flowEntryMatch().srcMac().toString());
+ if (flowPath.flowEntryMatch().matchIpProto()) {
+ flowObj.setMatchIpProto(flowPath.flowEntryMatch().ipProto());
}
- if (flowPath.flowEntryMatch().matchDstMac()) {
- flowObj.setMatchDstMac(flowPath.flowEntryMatch().dstMac().toString());
+ if (flowPath.flowEntryMatch().matchIpToS()) {
+ flowObj.setMatchIpToS(flowPath.flowEntryMatch().ipToS());
+ }
+ if (flowPath.flowEntryMatch().matchSrcTcpUdpPort()) {
+ flowObj.setMatchSrcTcpUdpPort(flowPath.flowEntryMatch().srcTcpUdpPort());
+ }
+ if (flowPath.flowEntryMatch().matchDstTcpUdpPort()) {
+ flowObj.setMatchDstTcpUdpPort(flowPath.flowEntryMatch().dstTcpUdpPort());
}
if (dataPathSummaryStr != null) {
@@ -696,12 +727,18 @@
// - flowEntry.flowEntrySwitchState()
// - flowEntry.flowEntryErrorState()
// - flowEntry.matchInPort()
- // - flowEntry.matchEthernetFrameType()
- // - flowEntry.matchSrcIPv4Net()
- // - flowEntry.matchDstIPv4Net()
// - flowEntry.matchSrcMac()
// - flowEntry.matchDstMac()
- // - flowEntry.actionOutput()
+ // - flowEntry.matchEthernetFrameType()
+ // - flowEntry.matchVlanId()
+ // - flowEntry.matchVlanPriority()
+ // - flowEntry.matchSrcIPv4Net()
+ // - flowEntry.matchDstIPv4Net()
+ // - flowEntry.matchIpProto()
+ // - flowEntry.matchIpToS()
+ // - flowEntry.matchSrcTcpUdpPort()
+ // - flowEntry.matchDstTcpUdpPort()
+ // - flowEntry.actionOutputPort()
//
ISwitchObject sw =
op.searchSwitch(flowEntry.dpid().toString());
@@ -714,20 +751,38 @@
flowEntryObj.setMatchInPort(flowEntry.flowEntryMatch().inPort().value());
flowEntryObj.setInPort(inport);
}
+ if (flowEntry.flowEntryMatch().matchSrcMac()) {
+ flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+ }
+ if (flowEntry.flowEntryMatch().matchDstMac()) {
+ flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+ }
if (flowEntry.flowEntryMatch().matchEthernetFrameType()) {
flowEntryObj.setMatchEthernetFrameType(flowEntry.flowEntryMatch().ethernetFrameType());
}
+ if (flowEntry.flowEntryMatch().matchVlanId()) {
+ flowEntryObj.setMatchVlanId(flowEntry.flowEntryMatch().vlanId());
+ }
+ if (flowEntry.flowEntryMatch().matchVlanPriority()) {
+ flowEntryObj.setMatchVlanPriority(flowEntry.flowEntryMatch().vlanPriority());
+ }
if (flowEntry.flowEntryMatch().matchSrcIPv4Net()) {
flowEntryObj.setMatchSrcIPv4Net(flowEntry.flowEntryMatch().srcIPv4Net().toString());
}
if (flowEntry.flowEntryMatch().matchDstIPv4Net()) {
flowEntryObj.setMatchDstIPv4Net(flowEntry.flowEntryMatch().dstIPv4Net().toString());
}
- if (flowEntry.flowEntryMatch().matchSrcMac()) {
- flowEntryObj.setMatchSrcMac(flowEntry.flowEntryMatch().srcMac().toString());
+ if (flowEntry.flowEntryMatch().matchIpProto()) {
+ flowEntryObj.setMatchIpProto(flowEntry.flowEntryMatch().ipProto());
}
- if (flowEntry.flowEntryMatch().matchDstMac()) {
- flowEntryObj.setMatchDstMac(flowEntry.flowEntryMatch().dstMac().toString());
+ if (flowEntry.flowEntryMatch().matchIpToS()) {
+ flowEntryObj.setMatchIpToS(flowEntry.flowEntryMatch().ipToS());
+ }
+ if (flowEntry.flowEntryMatch().matchSrcTcpUdpPort()) {
+ flowEntryObj.setMatchSrcTcpUdpPort(flowEntry.flowEntryMatch().srcTcpUdpPort());
+ }
+ if (flowEntry.flowEntryMatch().matchDstTcpUdpPort()) {
+ flowEntryObj.setMatchDstTcpUdpPort(flowEntry.flowEntryMatch().dstTcpUdpPort());
}
for (FlowEntryAction fa : flowEntry.flowEntryActions()) {
@@ -735,7 +790,7 @@
IPortObject outport =
op.searchPort(flowEntry.dpid().toString(),
fa.actionOutput().port().value());
- flowEntryObj.setActionOutput(fa.actionOutput().port().value());
+ flowEntryObj.setActionOutputPort(fa.actionOutput().port().value());
flowEntryObj.setOutPort(outport);
}
}
@@ -1266,6 +1321,7 @@
//
String flowIdStr = flowObj.getFlowId();
String installerIdStr = flowObj.getInstallerId();
+ Long flowPathFlags = flowObj.getFlowPathFlags();
String srcSwitchStr = flowObj.getSrcSwitch();
Short srcPortShort = flowObj.getSrcPort();
String dstSwitchStr = flowObj.getDstSwitch();
@@ -1273,6 +1329,7 @@
if ((flowIdStr == null) ||
(installerIdStr == null) ||
+ (flowPathFlags == null) ||
(srcSwitchStr == null) ||
(srcPortShort == null) ||
(dstSwitchStr == null) ||
@@ -1284,6 +1341,7 @@
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(flowIdStr));
flowPath.setInstallerId(new CallerId(installerIdStr));
+ flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
flowPath.dataPath().srcPort().setDpid(new Dpid(srcSwitchStr));
flowPath.dataPath().srcPort().setPort(new Port(srcPortShort));
flowPath.dataPath().dstPort().setDpid(new Dpid(dstSwitchStr));
@@ -1293,21 +1351,40 @@
//
{
FlowEntryMatch match = new FlowEntryMatch();
- Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType != null)
- match.enableEthernetFrameType(matchEthernetFrameType);
- String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net != null)
- match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
- String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net != null)
- match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
String matchSrcMac = flowObj.getMatchSrcMac();
if (matchSrcMac != null)
match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
String matchDstMac = flowObj.getMatchDstMac();
if (matchDstMac != null)
match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+
flowPath.setFlowEntryMatch(match);
}
@@ -1356,28 +1433,46 @@
Short matchInPort = flowEntryObj.getMatchInPort();
if (matchInPort != null)
match.enableInPort(new Port(matchInPort));
- Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType != null)
- match.enableEthernetFrameType(matchEthernetFrameType);
- String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net != null)
- match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
- String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net != null)
- match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
String matchSrcMac = flowEntryObj.getMatchSrcMac();
if (matchSrcMac != null)
match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
String matchDstMac = flowEntryObj.getMatchDstMac();
if (matchDstMac != null)
match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowEntryObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowEntryObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowEntryObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
flowEntry.setFlowEntryMatch(match);
//
// Extract the actions
//
ArrayList<FlowEntryAction> actions = new ArrayList<FlowEntryAction>();
- Short actionOutputPort = flowEntryObj.getActionOutput();
+ Short actionOutputPort = flowEntryObj.getActionOutputPort();
if (actionOutputPort != null) {
FlowEntryAction action = new FlowEntryAction();
action.setActionOutput(new Port(actionOutputPort));
@@ -1420,6 +1515,7 @@
FlowPath computedFlowPath = new FlowPath();
computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
+ computedFlowPath.setFlowPathFlags(new FlowPathFlags(flowPath.flowPathFlags().flags()));
computedFlowPath.setDataPath(dataPath);
computedFlowPath.setFlowEntryMatch(new FlowEntryMatch(flowPath.flowEntryMatch()));
@@ -1553,31 +1649,6 @@
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_IN_PORT);
}
- // Match the Ethernet Frame Type
- Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType == null)
- matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType != null) {
- match.setDataLayerType(matchEthernetFrameType);
- match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
- }
-
- // Match the Source IPv4 Network prefix
- String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net == null)
- matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net != null) {
- match.setFromCIDR(matchSrcIPv4Net, OFMatch.STR_NW_SRC);
- }
-
- // Natch the Destination IPv4 Network prefix
- String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net == null)
- matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net != null) {
- match.setFromCIDR(matchDstIPv4Net, OFMatch.STR_NW_DST);
- }
-
// Match the Source MAC address
String matchSrcMac = flowEntryObj.getMatchSrcMac();
if (matchSrcMac == null)
@@ -1596,13 +1667,92 @@
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
}
+ // Match the Ethernet Frame Type
+ Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType == null)
+ matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null) {
+ match.setDataLayerType(matchEthernetFrameType);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
+ }
+
+ // Match the VLAN ID
+ Short matchVlanId = flowEntryObj.getMatchVlanId();
+ if (matchVlanId == null)
+ matchVlanId = flowObj.getMatchVlanId();
+ if (matchVlanId != null) {
+ match.setDataLayerVirtualLan(matchVlanId);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN);
+ }
+
+ // Match the VLAN priority
+ Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+ if (matchVlanPriority == null)
+ matchVlanPriority = flowObj.getMatchVlanPriority();
+ if (matchVlanPriority != null) {
+ match.setDataLayerVirtualLanPriorityCodePoint(matchVlanPriority);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN_PCP);
+ }
+
+ // Match the Source IPv4 Network prefix
+ String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net == null)
+ matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null) {
+ match.setFromCIDR(matchSrcIPv4Net, OFMatch.STR_NW_SRC);
+ }
+
+ // Natch the Destination IPv4 Network prefix
+ String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net == null)
+ matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null) {
+ match.setFromCIDR(matchDstIPv4Net, OFMatch.STR_NW_DST);
+ }
+
+ // Match the IP protocol
+ Byte matchIpProto = flowEntryObj.getMatchIpProto();
+ if (matchIpProto == null)
+ matchIpProto = flowObj.getMatchIpProto();
+ if (matchIpProto != null) {
+ match.setNetworkProtocol(matchIpProto);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_PROTO);
+ }
+
+ // Match the IP ToS (DSCP field, 6 bits)
+ Byte matchIpToS = flowEntryObj.getMatchIpToS();
+ if (matchIpToS == null)
+ matchIpToS = flowObj.getMatchIpToS();
+ if (matchIpToS != null) {
+ match.setNetworkTypeOfService(matchIpToS);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_TOS);
+ }
+
+ // Match the Source TCP/UDP port
+ Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort == null)
+ matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null) {
+ match.setTransportSource(matchSrcTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+ }
+
+ // Match the Destination TCP/UDP port
+ Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort == null)
+ matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null) {
+ match.setTransportDestination(matchDstTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_DST);
+ }
+
//
// Fetch the actions
//
// TODO: For now we support only the "OUTPUT" actions.
//
List<OFAction> actions = new ArrayList<OFAction>();
- Short actionOutputPort = flowEntryObj.getActionOutput();
+ Short actionOutputPort = flowEntryObj.getActionOutputPort();
if (actionOutputPort != null) {
OFActionOutput action = new OFActionOutput();
// XXX: The max length is hard-coded for now
@@ -1712,6 +1862,26 @@
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_IN_PORT);
}
+ // Match the Source MAC address
+ MACAddress matchSrcMac = flowEntryMatch.srcMac();
+ if ((matchSrcMac == null) && (flowPathMatch != null)) {
+ matchSrcMac = flowPathMatch.srcMac();
+ }
+ if (matchSrcMac != null) {
+ match.setDataLayerSource(matchSrcMac.toString());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+ }
+
+ // Match the Destination MAC address
+ MACAddress matchDstMac = flowEntryMatch.dstMac();
+ if ((matchDstMac == null) && (flowPathMatch != null)) {
+ matchDstMac = flowPathMatch.dstMac();
+ }
+ if (matchDstMac != null) {
+ match.setDataLayerDestination(matchDstMac.toString());
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+ }
+
// Match the Ethernet Frame Type
Short matchEthernetFrameType = flowEntryMatch.ethernetFrameType();
if ((matchEthernetFrameType == null) && (flowPathMatch != null)) {
@@ -1722,6 +1892,26 @@
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
}
+ // Match the VLAN ID
+ Short matchVlanId = flowEntryMatch.vlanId();
+ if ((matchVlanId == null) && (flowPathMatch != null)) {
+ matchVlanId = flowPathMatch.vlanId();
+ }
+ if (matchVlanId != null) {
+ match.setDataLayerVirtualLan(matchVlanId);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN);
+ }
+
+ // Match the VLAN priority
+ Byte matchVlanPriority = flowEntryMatch.vlanPriority();
+ if ((matchVlanPriority == null) && (flowPathMatch != null)) {
+ matchVlanPriority = flowPathMatch.vlanPriority();
+ }
+ if (matchVlanPriority != null) {
+ match.setDataLayerVirtualLanPriorityCodePoint(matchVlanPriority);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_VLAN_PCP);
+ }
+
// Match the Source IPv4 Network prefix
IPv4Net matchSrcIPv4Net = flowEntryMatch.srcIPv4Net();
if ((matchSrcIPv4Net == null) && (flowPathMatch != null)) {
@@ -1740,24 +1930,44 @@
match.setFromCIDR(matchDstIPv4Net.toString(), OFMatch.STR_NW_DST);
}
- // Match the Source MAC address
- MACAddress matchSrcMac = flowEntryMatch.srcMac();
- if ((matchSrcMac == null) && (flowPathMatch != null)) {
- matchSrcMac = flowPathMatch.srcMac();
+ // Match the IP protocol
+ Byte matchIpProto = flowEntryMatch.ipProto();
+ if ((matchIpProto == null) && (flowPathMatch != null)) {
+ matchIpProto = flowPathMatch.ipProto();
}
- if (matchSrcMac != null) {
- match.setDataLayerSource(matchSrcMac.toString());
- match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+ if (matchIpProto != null) {
+ match.setNetworkProtocol(matchIpProto);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_PROTO);
}
- // Match the Destination MAC address
- MACAddress matchDstMac = flowEntryMatch.dstMac();
- if ((matchDstMac == null) && (flowPathMatch != null)) {
- matchDstMac = flowPathMatch.dstMac();
+ // Match the IP ToS (DSCP field, 6 bits)
+ Byte matchIpToS = flowEntryMatch.ipToS();
+ if ((matchIpToS == null) && (flowPathMatch != null)) {
+ matchIpToS = flowPathMatch.ipToS();
}
- if (matchDstMac != null) {
- match.setDataLayerDestination(matchDstMac.toString());
- match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
+ if (matchIpToS != null) {
+ match.setNetworkTypeOfService(matchIpToS);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_NW_TOS);
+ }
+
+ // Match the Source TCP/UDP port
+ Short matchSrcTcpUdpPort = flowEntryMatch.srcTcpUdpPort();
+ if ((matchSrcTcpUdpPort == null) && (flowPathMatch != null)) {
+ matchSrcTcpUdpPort = flowPathMatch.srcTcpUdpPort();
+ }
+ if (matchSrcTcpUdpPort != null) {
+ match.setTransportSource(matchSrcTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_SRC);
+ }
+
+ // Match the Destination TCP/UDP port
+ Short matchDstTcpUdpPort = flowEntryMatch.dstTcpUdpPort();
+ if ((matchDstTcpUdpPort == null) && (flowPathMatch != null)) {
+ matchDstTcpUdpPort = flowPathMatch.dstTcpUdpPort();
+ }
+ if (matchDstTcpUdpPort != null) {
+ match.setTransportDestination(matchDstTcpUdpPort);
+ match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_TP_DST);
}
//
@@ -1908,6 +2118,7 @@
dataPath.setSrcPort(flowPath.dataPath().srcPort());
dataPath.setDstPort(flowPath.dataPath().dstPort());
}
+ dataPath.applyFlowPathFlags(flowPath.flowPathFlags());
//
// Set the incoming port matching and the outgoing port output
@@ -1936,6 +2147,7 @@
FlowPath computedFlowPath = new FlowPath();
computedFlowPath.setFlowId(new FlowId(flowPath.flowId().value()));
computedFlowPath.setInstallerId(new CallerId(flowPath.installerId().value()));
+ 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/flowmanager/web/AddShortestPathFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
index 9d2e0c9..2a75c6a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
@@ -53,10 +53,11 @@
if (flowPath != null) {
FlowPath addedFlowPath =
flowService.addAndMaintainShortestPathFlow(flowPath);
- if (addedFlowPath == null)
+ if (addedFlowPath == null) {
result = new FlowId(); // Error: Return empty Flow Id
- else
+ } else {
result = addedFlowPath.flowId();
+ }
}
return result;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index f057a29..f4e4223 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -157,8 +157,8 @@
private static final long LINK_LOCAL_VALUE = 0x0180c2000000L;
// BigSwitch OUI is 5C:16:C7, so 5D:16:C7 is the multicast version
- private static final String LLDP_BSN_DST_MAC_STRING = "5d:16:c7:00:00:01";
- //private static final String LLDP_BSN_DST_MAC_STRING = "ff:ff:ff:ff:ff:ff";
+ // private static final String LLDP_BSN_DST_MAC_STRING = "5d:16:c7:00:00:01";
+ private static final String LLDP_BSN_DST_MAC_STRING = "ff:ff:ff:ff:ff:ff";
// Direction TLVs are used to indicate if the LLDPs were sent
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
index 5f96414..9b06743 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
@@ -76,6 +76,31 @@
}
/**
+ * 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);
+ }
+ }
+ }
+
+ /**
* Get a string with the summary of the shortest-path data path
* computation.
*
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
index 0b79c01..a721ff2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryMatch.java
@@ -72,13 +72,13 @@
private Field<Port> 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<Short> ethernetFrameType; // Matching Ethernet frame type
- private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits)
- private Field<Byte> ipProto; // Matching IP protocol
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
@@ -100,20 +100,20 @@
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.ethernetFrameType != null) && other.ethernetFrameType.enabled())
- this.enableEthernetFrameType(other.ethernetFrameType.value());
- if ((other.ipToS != null) && other.ipToS.enabled())
- this.enableIpToS(other.ipToS.value());
- if ((other.ipProto != null) && other.ipProto.enabled())
- this.enableIpProto(other.ipProto.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())
@@ -244,6 +244,48 @@
}
/**
+ * 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 ethernetFrameType the Ethernet frame type value to enable for
+ * matching.
+ */
+ @JsonProperty("ethernetFrameType")
+ public void enableEthernetFrameType(Short ethernetFrameType) {
+ this.ethernetFrameType = new Field<Short>(ethernetFrameType);
+ }
+
+ /**
+ * 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.
@@ -326,130 +368,6 @@
}
/**
- * 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 ethernetFrameType the Ethernet frame type value to enable for
- * matching.
- */
- @JsonProperty("ethernetFrameType")
- public void enableEthernetFrameType(Short ethernetFrameType) {
- this.ethernetFrameType = new Field<Short>(ethernetFrameType);
- }
-
- /**
- * 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 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 ipToS the IP ToS value to enable for matching.
- */
- @JsonProperty("ipToS")
- public void enableIpToS(Byte ipToS) {
- this.ipToS = new Field<Byte>(ipToS);
- }
-
- /**
- * 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 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 ipProto the IP protocol value to enable for matching.
- */
- @JsonProperty("ipProto")
- public void enableIpProto(Byte ipProto) {
- this.ipProto = new Field<Byte>(ipProto);
- }
-
- /**
- * 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 source IPv4 prefix.
*
* @return the matching source IPv4 prefix.
@@ -533,6 +451,88 @@
}
/**
+ * 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 ipProto the IP protocol value to enable for matching.
+ */
+ @JsonProperty("ipProto")
+ public void enableIpProto(Byte ipProto) {
+ this.ipProto = new Field<Byte>(ipProto);
+ }
+
+ /**
+ * 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 ipToS the IP ToS value to enable for matching.
+ */
+ @JsonProperty("ipToS")
+ public void enableIpToS(Byte ipToS) {
+ this.ipToS = new Field<Byte>(ipToS);
+ }
+
+ /**
+ * 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.
@@ -649,6 +649,12 @@
addSpace = true;
ret += "dstMac=" + this.dstMac().toString();
}
+ if (matchEthernetFrameType()) {
+ if (addSpace)
+ ret += " ";
+ addSpace = true;
+ ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
+ }
if (matchVlanId()) {
if (addSpace)
ret += " ";
@@ -661,24 +667,6 @@
addSpace = true;
ret += "vlanPriority=" + this.vlanPriority().toString();
}
- if (matchEthernetFrameType()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ethernetFrameType=" + this.ethernetFrameType().toString();
- }
- if (matchIpToS()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ipToS=" + this.ipToS().toString();
- }
- if (matchIpProto()) {
- if (addSpace)
- ret += " ";
- addSpace = true;
- ret += "ipProto=" + this.ipProto().toString();
- }
if (matchSrcIPv4Net()) {
if (addSpace)
ret += " ";
@@ -691,6 +679,18 @@
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 += " ";
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 f9385e7..8acc2e9 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -5,6 +5,7 @@
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;
@@ -14,6 +15,7 @@
public class FlowPath implements Comparable<FlowPath> {
private FlowId flowId; // The Flow ID
private CallerId installerId; // The Caller ID of the path installer
+ private FlowPathFlags flowPathFlags; // The Flow Path flags
private DataPath dataPath; // The data path
private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all
// Flow Entries
@@ -22,6 +24,7 @@
* Default constructor.
*/
public FlowPath() {
+ flowPathFlags = new FlowPathFlags();
dataPath = new DataPath();
}
@@ -32,6 +35,7 @@
dataPath = new DataPath();
this.setFlowId(new FlowId(flowObj.getFlowId()));
this.setInstallerId(new CallerId(flowObj.getInstallerId()));
+ this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags()));
this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch()));
this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort()));
this.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch()));
@@ -41,21 +45,40 @@
//
{
FlowEntryMatch match = new FlowEntryMatch();
- Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType != null)
- match.enableEthernetFrameType(matchEthernetFrameType);
- String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net != null)
- match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
- String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net != null)
- match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
String matchSrcMac = flowObj.getMatchSrcMac();
if (matchSrcMac != null)
match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
String matchDstMac = flowObj.getMatchDstMac();
if (matchDstMac != null)
match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
+
this.setFlowEntryMatch(match);
}
@@ -75,28 +98,46 @@
Short matchInPort = flowEntryObj.getMatchInPort();
if (matchInPort != null)
match.enableInPort(new Port(matchInPort));
- Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
- if (matchEthernetFrameType != null)
- match.enableEthernetFrameType(matchEthernetFrameType);
- String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
- if (matchSrcIPv4Net != null)
- match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
- String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
- if (matchDstIPv4Net != null)
- match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
String matchSrcMac = flowEntryObj.getMatchSrcMac();
if (matchSrcMac != null)
match.enableSrcMac(MACAddress.valueOf(matchSrcMac));
String matchDstMac = flowEntryObj.getMatchDstMac();
if (matchDstMac != null)
match.enableDstMac(MACAddress.valueOf(matchDstMac));
+ Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType();
+ if (matchEthernetFrameType != null)
+ match.enableEthernetFrameType(matchEthernetFrameType);
+ Short matchVlanId = flowEntryObj.getMatchVlanId();
+ if (matchVlanId != null)
+ match.enableVlanId(matchVlanId);
+ Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority();
+ if (matchVlanPriority != null)
+ match.enableVlanPriority(matchVlanPriority);
+ String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net();
+ if (matchSrcIPv4Net != null)
+ match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net));
+ String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net();
+ if (matchDstIPv4Net != null)
+ match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net));
+ Byte matchIpProto = flowEntryObj.getMatchIpProto();
+ if (matchIpProto != null)
+ match.enableIpProto(matchIpProto);
+ Byte matchIpToS = flowEntryObj.getMatchIpToS();
+ if (matchIpToS != null)
+ match.enableIpToS(matchIpToS);
+ Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort();
+ if (matchSrcTcpUdpPort != null)
+ match.enableSrcTcpUdpPort(matchSrcTcpUdpPort);
+ Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort();
+ if (matchDstTcpUdpPort != null)
+ match.enableDstTcpUdpPort(matchDstTcpUdpPort);
flowEntry.setFlowEntryMatch(match);
//
// Extract the actions
//
ArrayList<FlowEntryAction> actions = new ArrayList<FlowEntryAction>();
- Short actionOutputPort = flowEntryObj.getActionOutput();
+ Short actionOutputPort = flowEntryObj.getActionOutputPort();
if (actionOutputPort != null) {
FlowEntryAction action = new FlowEntryAction();
action.setActionOutput(new Port(actionOutputPort));
@@ -153,6 +194,24 @@
}
/**
+ * 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 path's data path.
*
* @return the flow path's data path.
@@ -193,7 +252,7 @@
* Convert the flow path to a string.
*
* The string has the following form:
- * [flowId=XXX installerId=XXX dataPath=XXX]
+ * [flowId=XXX installerId=XXX flowPathFlags=XXX dataPath=XXX]
*
* @return the flow path as a string.
*/
@@ -201,6 +260,7 @@
public String toString() {
String ret = "[flowId=" + this.flowId.toString();
ret += " installerId=" + this.installerId.toString();
+ ret += " flowPathFlags=" + this.flowPathFlags.toString();
if (dataPath != null)
ret += " dataPath=" + this.dataPath.toString();
if (flowEntryMatch != null)
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
new file mode 100644
index 0000000..63241f0
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPathFlags.java
@@ -0,0 +1,128 @@
+package net.onrc.onos.ofcontroller.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
+ private final long DISCARD_FIRST_HOP_ENTRY = (1 << 0);
+
+ // Keep only the first-hop Flow Entry
+ private 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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) {
+ if (flagsStr != null)
+ flagsStr += ",";
+ flagsStr += "DISCARD_FIRST_HOP_ENTRY";
+ }
+ if ((this.flags & KEEP_ONLY_FIRST_HOP_ENTRY) != 0) {
+ if (flagsStr != null)
+ flagsStr += ",";
+ flagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY";
+ }
+ ret += "]";
+
+ return ret;
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
index eba7447..06d8522 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
@@ -177,22 +177,6 @@
/**
* Desc:
- * Test method for set and get MatchEthernetFrameType.
- * Condition:
- * N/A
- * Expect:
- * 1. Should set MatchEthernetFrameType.
- * 2. Should get MatchEthernetFrameType.
- */
- @Test
- public void testSetGetMatchEthernetFrameType() {
- Short matchEthernetFrameType = 1;
- flowEntry.setMatchEthernetFrameType(matchEthernetFrameType);
- assertEquals(flowEntry.getMatchEthernetFrameType(), matchEthernetFrameType);
- }
-
- /**
- * Desc:
* Test method for set and get MatchSrcMac.
* Condition:
* N/A
@@ -222,6 +206,54 @@
flowEntry.setMatchDstMac(matchDstMac);
assertEquals(flowEntry.getMatchDstMac(), matchDstMac);
}
+
+ /**
+ * Desc:
+ * Test method for set and get MatchEthernetFrameType.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchEthernetFrameType.
+ * 2. Should get MatchEthernetFrameType.
+ */
+ @Test
+ public void testSetGetMatchEthernetFrameType() {
+ Short matchEthernetFrameType = 1;
+ flowEntry.setMatchEthernetFrameType(matchEthernetFrameType);
+ assertEquals(flowEntry.getMatchEthernetFrameType(), matchEthernetFrameType);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanId.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanId.
+ * 2. Should get MatchVlanId.
+ */
+ @Test
+ public void testSetGetMatchVlanId() {
+ Short matchVlanId = 10;
+ flowEntry.setMatchVlanId(matchVlanId);
+ assertEquals(flowEntry.getMatchVlanId(), matchVlanId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanPriority.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanPriority.
+ * 2. Should get MatchVlanPriority.
+ */
+ @Test
+ public void testSetGetMatchVlanPriority() {
+ Byte matchVlanPriority = 10;
+ flowEntry.setMatchVlanPriority(matchVlanPriority);
+ assertEquals(flowEntry.getMatchVlanPriority(), matchVlanPriority);
+ }
/**
* Desc:
@@ -254,21 +286,85 @@
flowEntry.setMatchDstIPv4Net(dstIPv4Net);
assertEquals(flowEntry.getMatchDstIPv4Net(), dstIPv4Net);
}
-
+
/**
* Desc:
- * Test method for set and get ActionOutput.
+ * Test method for set and get MatchIpProto.
* Condition:
* N/A
* Expect:
- * 1. Should set ActionOutput.
- * 2. Should get ActionOutput.
+ * 1. Should set MatchIpProto.
+ * 2. Should get MatchIpProto.
*/
@Test
- public void testSetGetActionOutput() {
- Short actionOutput = 1;
- flowEntry.setActionOutput(actionOutput);
- assertEquals(flowEntry.getActionOutput(), actionOutput);
+ public void testSetGetMatchIpProto() {
+ Byte matchIpProto = 20;
+ flowEntry.setMatchIpProto(matchIpProto);
+ assertEquals(flowEntry.getMatchIpProto(), matchIpProto);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpToS.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpToS.
+ * 2. Should get MatchIpToS.
+ */
+ @Test
+ public void testSetGetMatchIpToS() {
+ Byte matchIpToS = 20;
+ flowEntry.setMatchIpToS(matchIpToS);
+ assertEquals(flowEntry.getMatchIpToS(), matchIpToS);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcTcpUdpPort.
+ * 2. Should get MatchSrcTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchSrcTcpUdpPort() {
+ Short srcTcpUdpPort = (short)65535;
+ flowEntry.setMatchSrcTcpUdpPort(srcTcpUdpPort);
+ assertEquals(flowEntry.getMatchSrcTcpUdpPort(), srcTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstTcpUdpPort.
+ * 2. Should get MatchDstTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchDstTcpUdpPort() {
+ Short dstTcpUdpPort = (short)65535;
+ flowEntry.setMatchDstTcpUdpPort(dstTcpUdpPort);
+ assertEquals(flowEntry.getMatchDstTcpUdpPort(), dstTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get ActionOutputPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set ActionOutputPort.
+ * 2. Should get ActionOutputPort.
+ */
+ @Test
+ public void testSetGetActionOutputPort() {
+ Short actionOutputPort = 1;
+ flowEntry.setActionOutputPort(actionOutputPort);
+ assertEquals(flowEntry.getActionOutputPort(), actionOutputPort);
}
/**
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 9765af8..bb0dbbf 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 FlowPathFlags method.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set the Flow Path Flags.
+ * 2. Should get the Flow Path Flags.
+ */
+ @Test
+ public void testSetGetFlowPathFlags() {
+ String flowId = "xx";
+ Long flowPathFlags = new Long(0x3);
+ flowPath.setFlowId(flowId);
+ flowPath.setFlowPathFlags(flowPathFlags);
+ assertEquals(flowPath.getFlowPathFlags(), flowPathFlags);
+ }
+
+ /**
+ * Desc:
* Test method for get and set SourceSwitch method.
* Condition:
* N/A
@@ -241,24 +259,6 @@
/**
* Desc:
- * Test method for set and get MatchEthernetFrameType
- * Condition:
- * N/A
- * Expect:
- * 1. Should set MatchEthernetFrameType.
- * 2. Should get MatchEthernetFrameType.
- */
- @Test
- public void testSetGetMatchEthernetFrameType() {
- String flowId = "xx";
- Short matchEthernetFrameTypeShort = 1;
- flowPath.setFlowId(flowId);
- flowPath.setMatchEthernetFrameType(matchEthernetFrameTypeShort);
- assertEquals(flowPath.getMatchEthernetFrameType(), matchEthernetFrameTypeShort);
- }
-
- /**
- * Desc:
* Test method for set and get MatchSrcMac
* Condition:
* N/A
@@ -292,15 +292,69 @@
flowPath.setMatchDstMac(matchDstMac);
assertEquals(flowPath.getMatchDstMac(), matchDstMac);
}
-
+
/**
* Desc:
- * Test method for set and get SrcIPv4Net.
+ * Test method for set and get MatchEthernetFrameType
* Condition:
* N/A
* Expect:
- * 1. Should set SrcIPv4Net.
- * 2. Should get SrcIPv4Net.
+ * 1. Should set MatchEthernetFrameType.
+ * 2. Should get MatchEthernetFrameType.
+ */
+ @Test
+ public void testSetGetMatchEthernetFrameType() {
+ String flowId = "xx";
+ Short matchEthernetFrameType = 1;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchEthernetFrameType(matchEthernetFrameType);
+ assertEquals(flowPath.getMatchEthernetFrameType(), matchEthernetFrameType);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanId
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanId.
+ * 2. Should get MatchVlanId.
+ */
+ @Test
+ public void testSetGetMatchVlanId() {
+ String flowId = "xx";
+ Short matchVlanId = 10;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchVlanId(matchVlanId);
+ assertEquals(flowPath.getMatchVlanId(), matchVlanId);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchVlanPriority
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchVlanPriority.
+ * 2. Should get MatchVlanPriority.
+ */
+ @Test
+ public void testSetGetMatchVlanPriority() {
+ String flowId = "xx";
+ Byte matchVlanPriority = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchVlanPriority(matchVlanPriority);
+ assertEquals(flowPath.getMatchVlanPriority(), matchVlanPriority);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcIPv4Net.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcIPv4Net.
+ * 2. Should get MatchSrcIPv4Net.
*/
@Test
public void testSetGetMatchSrcIPv4Net() {
@@ -313,12 +367,12 @@
/**
* Desc:
- * Test method for set and get DstIPv4Net.
+ * Test method for set and get MatchDstIPv4Net.
* Condition:
* N/A
* Expect:
- * 1. Should set DstIPv4Net.
- * 2. Should get DstIPv4Net.
+ * 1. Should set MatchDstIPv4Net.
+ * 2. Should get MatchDstIPv4Net.
*/
@Test
public void testSetGetMatchDstIPv4Net() {
@@ -328,7 +382,79 @@
flowPath.setMatchDstIPv4Net(ip);
assertEquals(flowPath.getMatchDstIPv4Net(), ip);
}
-
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpProto
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpProto.
+ * 2. Should get MatchIpProto.
+ */
+ @Test
+ public void testSetGetMatchIpProto() {
+ String flowId = "xx";
+ Byte matchIpProto = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchIpProto(matchIpProto);
+ assertEquals(flowPath.getMatchIpProto(), matchIpProto);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchIpToS
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchIpToS.
+ * 2. Should get MatchIpToS.
+ */
+ @Test
+ public void testSetGetMatchIpToS() {
+ String flowId = "xx";
+ Byte matchIpToS = 20;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchIpToS(matchIpToS);
+ assertEquals(flowPath.getMatchIpToS(), matchIpToS);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchSrcTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchSrcTcpUdpPort.
+ * 2. Should get MatchSrcTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchSrcTcpUdpPort() {
+ String flowId = "xx";
+ Short srcTcpUdpPort = (short)65535;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchSrcTcpUdpPort(srcTcpUdpPort);
+ assertEquals(flowPath.getMatchSrcTcpUdpPort(), srcTcpUdpPort);
+ }
+
+ /**
+ * Desc:
+ * Test method for set and get MatchDstTcpUdpPort.
+ * Condition:
+ * N/A
+ * Expect:
+ * 1. Should set MatchDstTcpUdpPort.
+ * 2. Should get MatchDstTcpUdpPort.
+ */
+ @Test
+ public void testSetGetMatchDstTcpUdpPort() {
+ String flowId = "xx";
+ Short dstTcpUdpPort = (short)65535;
+ flowPath.setFlowId(flowId);
+ flowPath.setMatchDstTcpUdpPort(dstTcpUdpPort);
+ assertEquals(flowPath.getMatchDstTcpUdpPort(), dstTcpUdpPort);
+ }
+
/**
* Desc:
* Test method for set and get UserState.
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 658aaaf..dd21a26 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,17 +415,31 @@
public static class TestFlowPath implements IFlowPath {
private String state,type,flowId,installerId,srcSw,dstSw;
+ private Long flowPathFlags;
private String dataPathSummary,userState;
- private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
- private Short srcPort,dstPort,matchEthernetFrameType;
+ private Short srcPort,dstPort;
+ private String matchSrcMac,matchDstMac;
+ private Short matchEthernetFrameType;
+ private Short matchVlanId;
+ private Byte matchVlanPriority;
+ private String matchSrcIpaddr,matchDstIpaddr;
+ private Byte matchIpProto, matchIpToS;
+ private Short matchSrcTcpUdpPort, matchDstTcpUdpPort;
private List<IFlowEntry> entries;
private List<ISwitchObject> switches;
private String stateToUpdate,typeToUpdate,flowIdToUpdate,installerIdToUpdate,srcSwToUpdate,dstSwToUpdate;
+ private Long flowPathFlagsToUpdate;
private String dataPathSummaryToUpdate,userStateToUpdate;
- private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
- private Short srcPortToUpdate,dstPortToUpdate,matchEthernetFrameTypeToUpdate;
+ private Short srcPortToUpdate,dstPortToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate;
+ private Short matchEthernetFrameTypeToUpdate;
+ private Short matchVlanIdToUpdate;
+ private Byte matchVlanPriorityToUpdate;
+ private String matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+ private Byte matchIpProtoToUpdate, matchIpToSToUpdate;
+ private Short matchSrcTcpUdpPortToUpdate, matchDstTcpUdpPortToUpdate;
private List<IFlowEntry> flowsToAdd;
private List<IFlowEntry> flowsToRemove;
@@ -453,17 +467,24 @@
if(typeToUpdate != null) { type = typeToUpdate; }
if(flowIdToUpdate != null) { flowId = flowIdToUpdate; }
if(installerIdToUpdate != null) { installerId = installerIdToUpdate; }
+ if(flowPathFlagsToUpdate != null) { flowPathFlags = flowPathFlagsToUpdate; }
if(srcSwToUpdate != null) { srcSw = srcSwToUpdate; }
if(dstSwToUpdate != null) { dstSw = dstSwToUpdate; }
if(dataPathSummaryToUpdate != null) { dataPathSummary = dataPathSummaryToUpdate; }
if(userStateToUpdate != null) { userState = userStateToUpdate; }
- if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
- if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
- if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
- if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
if(srcPortToUpdate != null) { srcPort = srcPortToUpdate; }
if(dstPortToUpdate != null) { dstPort = dstPortToUpdate; }
+ if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+ if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
if(matchEthernetFrameTypeToUpdate != null) { matchEthernetFrameType = matchEthernetFrameTypeToUpdate; }
+ if(matchVlanIdToUpdate != null) { matchVlanId = matchVlanIdToUpdate; }
+ if(matchVlanPriorityToUpdate != null) { matchVlanPriority = matchVlanPriorityToUpdate; }
+ if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+ if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+ if(matchIpProtoToUpdate != null) { matchIpProto = matchIpProtoToUpdate; }
+ if(matchIpToSToUpdate != null) { matchIpToS = matchIpToSToUpdate; }
+ if(matchSrcTcpUdpPortToUpdate != null) { matchSrcTcpUdpPort = matchSrcTcpUdpPortToUpdate; }
+ if(matchDstTcpUdpPortToUpdate != null) { matchDstTcpUdpPort = matchDstTcpUdpPortToUpdate; }
}
public void rollback() {
@@ -475,9 +496,16 @@
flowsToRemove.clear();
stateToUpdate = typeToUpdate = flowIdToUpdate = installerIdToUpdate = null;
+ flowPathFlagsToUpdate = null;
srcSwToUpdate = dstSwToUpdate = dataPathSummaryToUpdate = userStateToUpdate = null;
- matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
- srcPortToUpdate = dstPortToUpdate = matchEthernetFrameTypeToUpdate = null;
+ srcPortToUpdate = dstPortToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = null;
+ matchEthernetFrameTypeToUpdate = null;
+ matchVlanIdToUpdate = null;
+ matchVlanPriorityToUpdate = null;
+ matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ matchIpProtoToUpdate = matchIpToSToUpdate = null;
+ matchSrcTcpUdpPortToUpdate = matchDstTcpUdpPortToUpdate = null;
}
// Setter methods for test
@@ -485,17 +513,24 @@
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 setFlowPathFlagsForTest(Long flowPathFlags) { this.flowPathFlags = flowPathFlags; }
public void setSrcSwForTest(String srcSw) { this.srcSw = srcSw; }
public void setDstSwForTest(String dstSw) { this.dstSw = dstSw; }
public void setDataPathSummaryForTest(String dataPathSummary) { this.dataPathSummary = dataPathSummary; }
public void setUserStateForTest(String userState) { this.userState = userState; }
- public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
- public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
- public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
- public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
public void setSrcPortForTest(Short srcPort) { this.srcPort = srcPort; }
public void setDstPortForTest(Short dstPort) { this.dstPort = dstPort; }
+ public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+ public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
public void setMatchEthernetFrameTypeForTest(Short matchEthernetFrameType) { this.matchEthernetFrameType = matchEthernetFrameType; }
+ public void setMatchVlanIdForTest(Short matchVlanId) { this.matchVlanId = matchVlanId; }
+ public void setMatchVlanPriorityForTest(Byte matchVlanPriority) { this.matchVlanPriority = matchVlanPriority; }
+ public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+ public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+ public void setMatchIpProtoForTest(Byte matchIpProto) { this.matchIpProto = matchIpProto; }
+ public void setMatchIpToSForTest(Byte matchIpToS) { this.matchIpToS = matchIpToS; }
+ public void setMatchSrcTcpUdpPortForTest(Short matchSrcTcpUdpPort) { this.matchSrcTcpUdpPort = matchSrcTcpUdpPort; }
+ public void setMatchDstTcpUdpPortForTest(Short matchDstTcpUdpPort) { this.matchDstTcpUdpPort = matchDstTcpUdpPort; }
public void addFlowEntryForTest(IFlowEntry entry) { entries.add(entry); }
public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
@@ -530,6 +565,12 @@
public void setInstallerId(String installerId) { installerIdToUpdate = installerId; }
@Override
+ public Long getFlowPathFlags() { return flowPathFlags; }
+
+ @Override
+ public void setFlowPathFlags(Long flowPathFlags) { flowPathFlagsToUpdate = flowPathFlags; }
+
+ @Override
public String getSrcSwitch() { return srcSw; }
@Override
@@ -577,13 +618,6 @@
}
@Override
- public Short getMatchEthernetFrameType() { return matchEthernetFrameType; }
-
- @Override
- public void setMatchEthernetFrameType(Short matchEthernetFrameType) {
- matchEthernetFrameTypeToUpdate = matchEthernetFrameType; }
-
- @Override
public String getMatchSrcMac() { return matchSrcMac; }
@Override
@@ -596,6 +630,27 @@
public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
@Override
+ public Short getMatchEthernetFrameType() { return matchEthernetFrameType; }
+
+ @Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) {
+ matchEthernetFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public Short getMatchVlanId() { return matchVlanId; }
+
+ @Override
+ public void setMatchVlanId(Short matchVlanId) {
+ matchVlanIdToUpdate = matchVlanId; }
+
+ @Override
+ public Byte getMatchVlanPriority() { return matchVlanPriority; }
+
+ @Override
+ public void setMatchVlanPriority(Byte matchVlanPriority) {
+ matchVlanPriorityToUpdate = matchVlanPriority; }
+
+ @Override
public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
@Override
@@ -610,6 +665,34 @@
matchDstIpaddrToUpdate = matchDstIPv4Net; }
@Override
+ public Byte getMatchIpProto() { return matchIpProto; }
+
+ @Override
+ public void setMatchIpProto(Byte matchIpProto) {
+ matchIpProtoToUpdate = matchIpProto; }
+
+ @Override
+ public Byte getMatchIpToS() { return matchIpToS; }
+
+ @Override
+ public void setMatchIpToS(Byte matchIpToS) {
+ matchIpToSToUpdate = matchIpToS; }
+
+ @Override
+ public Short getMatchSrcTcpUdpPort() { return matchSrcTcpUdpPort; }
+
+ @Override
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort) {
+ matchSrcTcpUdpPortToUpdate = matchSrcTcpUdpPort; }
+
+ @Override
+ public Short getMatchDstTcpUdpPort() { return matchDstTcpUdpPort; }
+
+ @Override
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort) {
+ matchDstTcpUdpPortToUpdate = matchDstTcpUdpPort; }
+
+ @Override
public Iterable<ISwitchObject> getSwitches() { return switches; }
@Override
@@ -621,8 +704,15 @@
public static class TestFlowEntry implements IFlowEntry {
private String state,type,entryId,dpid,userState,switchState,errorStateType,errorStateCode;
- private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
- private Short matchInPort,matchEtherFrameType,actionOutput;
+ private Short matchInPort;
+ private String matchSrcMac,matchDstMac;
+ private Short matchEtherFrameType;
+ private Short matchVlanId;
+ private Byte matchVlanPriority;
+ private String matchSrcIpaddr,matchDstIpaddr;
+ private Byte matchIpProto, matchIpToS;
+ private Short matchSrcTcpUdpPort, matchDstTcpUdpPort;
+ private Short actionOutputPort;
private IFlowPath flowPath;
private ISwitchObject sw;
@@ -630,9 +720,15 @@
private String stateToUpdate,typeToUpdate,entryIdToUpdate,dpidToUpdate,
userStateToUpdate,switchStateToUpdate,errorStateTypeToUpdate,errorStateCodeToUpdate;
- private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
-
- private Short matchInPortToUpdate,matchEtherFrameTypeToUpdate,actionOutputToUpdate;
+ private Short matchInPortToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate;
+ private Short matchEtherFrameTypeToUpdate;
+ private Short matchVlanIdToUpdate;
+ private Byte matchVlanPriorityToUpdate;
+ private String matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+ private Byte matchIpProtoToUpdate, matchIpToSToUpdate;
+ private Short matchSrcTcpUdpPortToUpdate, matchDstTcpUdpPortToUpdate;
+ private Short actionOutputPortToUpdate;
private IFlowPath flowPathToUpdate;
private ISwitchObject swToUpdate;
@@ -653,13 +749,19 @@
if(switchStateToUpdate != null) { switchState = switchStateToUpdate; }
if(errorStateTypeToUpdate != null) { errorStateType = errorStateTypeToUpdate; }
if(errorStateCodeToUpdate != null) { errorStateCode = errorStateCodeToUpdate; }
+ if(matchInPortToUpdate != null) { matchInPort = matchInPortToUpdate; }
if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+ if(matchEtherFrameTypeToUpdate != null) { matchEtherFrameType = matchEtherFrameTypeToUpdate; }
+ if(matchVlanIdToUpdate != null) { matchVlanId = matchVlanIdToUpdate; }
+ if(matchVlanPriorityToUpdate != null) { matchVlanPriority = matchVlanPriorityToUpdate; }
if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
- if(matchInPortToUpdate != null) { matchInPort = matchInPortToUpdate; }
- if(matchEtherFrameTypeToUpdate != null) { matchEtherFrameType = matchEtherFrameTypeToUpdate; }
- if(actionOutputToUpdate != null) { actionOutput = actionOutputToUpdate; }
+ if(matchIpProtoToUpdate != null) { matchIpProto = matchIpProtoToUpdate; }
+ if(matchIpToSToUpdate != null) { matchIpToS = matchIpToSToUpdate; }
+ if(matchSrcTcpUdpPortToUpdate != null) { matchSrcTcpUdpPort = matchSrcTcpUdpPortToUpdate; }
+ if(matchDstTcpUdpPortToUpdate != null) { matchDstTcpUdpPort = matchDstTcpUdpPortToUpdate; }
+ if(actionOutputPortToUpdate != null) { actionOutputPort = actionOutputPortToUpdate; }
if(flowPathToUpdate != null) { flowPath = flowPathToUpdate; }
if(swToUpdate != null) { sw = swToUpdate; }
@@ -676,8 +778,15 @@
public void clearUncommitedData() {
stateToUpdate = typeToUpdate = entryIdToUpdate = dpidToUpdate = null;
userStateToUpdate = switchStateToUpdate = errorStateTypeToUpdate = errorStateCodeToUpdate = null;
- matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
- matchInPortToUpdate = matchEtherFrameTypeToUpdate = actionOutputToUpdate = null;
+ matchInPortToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = null;
+ matchEtherFrameTypeToUpdate = null;
+ matchVlanIdToUpdate = null;
+ matchVlanPriorityToUpdate = null;
+ matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ matchIpProtoToUpdate = matchIpToSToUpdate = null;
+ matchSrcTcpUdpPortToUpdate = matchDstTcpUdpPortToUpdate = null;
+ actionOutputPortToUpdate = null;
flowPathToUpdate = null;
swToUpdate = null;
inportToUpdate = outportToUpdate = null;
@@ -692,13 +801,19 @@
public void setSwitchStateForTest(String switchState) { this.switchState = switchState; }
public void setErrorStateTypeForTest(String errorStateType) { this.errorStateType = errorStateType; }
public void setErrorStateCodeForTest(String errorStateCode) { this.errorStateCode = errorStateCode; }
+ public void setMatchInPortForTest(Short matchInPort) { this.matchInPort = matchInPort; }
public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+ public void setMatchEtherFrameTypeForTest(Short matchEtherFrameType) { this.matchEtherFrameType = matchEtherFrameType; }
+ public void setMatchVlanIdForTest(Short matchVlanId) { this.matchVlanId = matchVlanId; }
+ public void setMatchVlanPriorityForTest(Byte matchVlanPriority) { this.matchVlanPriority = matchVlanPriority; }
public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
- public void setMatchInPortForTest(Short matchInPort) { this.matchInPort = matchInPort; }
- public void setMatchEtherFrameTypeForTest(Short matchEtherFrameType) { this.matchEtherFrameType = matchEtherFrameType; }
- public void setActionOutputForTest(Short actionOutput) { this.actionOutput = actionOutput; }
+ public void setMatchIpProtoForTest(Byte matchIpProto) { this.matchIpProto = matchIpProto; }
+ public void setMatchIpToSForTest(Byte matchIpToS) { this.matchIpToS = matchIpToS; }
+ public void setMatchSrcTcpUdpPortForTest(Short matchSrcTcpUdpPort) { this.matchSrcTcpUdpPort = matchSrcTcpUdpPort; }
+ public void setMatchDstTcpUdpPortForTest(Short matchDstTcpUdpPort) { this.matchDstTcpUdpPort = matchDstTcpUdpPort; }
+ public void setActionOutputPortForTest(Short actionOutputPort) { this.actionOutputPort = actionOutputPort; }
public void setFlowPathForTest(IFlowPath flowPath) { this.flowPath = flowPath; }
public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
public void setInportForTest(IPortObject inport) { this.inport = inport; }
@@ -765,12 +880,6 @@
public void setMatchInPort(Short matchInPort) { matchInPortToUpdate = matchInPort; }
@Override
- public Short getMatchEthernetFrameType() {return matchEtherFrameType; }
-
- @Override
- public void setMatchEthernetFrameType(Short matchEthernetFrameType) { matchEtherFrameTypeToUpdate = matchEthernetFrameType; }
-
- @Override
public String getMatchSrcMac() { return matchSrcMac; }
@Override
@@ -781,8 +890,26 @@
@Override
public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+ @Override
+ public Short getMatchEthernetFrameType() {return matchEtherFrameType; }
@Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) { matchEtherFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public Short getMatchVlanId() {return matchVlanId; }
+
+ @Override
+ public void setMatchVlanId(Short matchVlanId) { matchVlanId = matchVlanId; }
+
+ @Override
+ public Byte getMatchVlanPriority() {return matchVlanPriority; }
+
+ @Override
+ public void setMatchVlanPriority(Byte matchVlanPriority) { matchVlanPriority = matchVlanPriority; }
+
+ @Override
public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
@Override
@@ -793,12 +920,36 @@
@Override
public void setMatchDstIPv4Net(String matchDstIPv4Net) { matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+ @Override
+ public Byte getMatchIpProto() {return matchIpProto; }
@Override
- public Short getActionOutput() { return actionOutput; }
+ public void setMatchIpProto(Byte matchIpProto) { matchIpProto = matchIpProto; }
+
+ @Override
+ public Byte getMatchIpToS() {return matchIpToS; }
@Override
- public void setActionOutput(Short actionOutput) { actionOutputToUpdate = actionOutput; }
+ public void setMatchIpToS(Byte matchIpToS) { matchIpToS = matchIpToS; }
+
+ @Override
+ public Short getMatchSrcTcpUdpPort() {return matchSrcTcpUdpPort; }
+
+ @Override
+ public void setMatchSrcTcpUdpPort(Short matchSrcTcpUdpPort) { matchSrcTcpUdpPortToUpdate = matchSrcTcpUdpPort; }
+
+ @Override
+ public Short getMatchDstTcpUdpPort() {return matchDstTcpUdpPort; }
+
+ @Override
+ public void setMatchDstTcpUdpPort(Short matchDstTcpUdpPort) { matchDstTcpUdpPortToUpdate = matchDstTcpUdpPort; }
+
+ @Override
+ public Short getActionOutputPort() { return actionOutputPort; }
+
+ @Override
+ public void setActionOutputPort(Short actionOutputPort) { actionOutputPortToUpdate = actionOutputPort; }
@Override
public IFlowPath getFlow() { return flowPath; }
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 fb1d708..9f197a7 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
@@ -80,10 +80,12 @@
}
private IFlowPath createIFlowPathMock(long flowId, String installerID,
+ 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.getFlowPathFlags()).andReturn(new Long(flowPathFlags)).anyTimes();
expect(iFlowPath.getSrcSwitch()).andReturn(new Dpid(srcDpid).toString()).anyTimes();
expect(iFlowPath.getSrcPort()).andReturn(new Short((short)srcPort)).anyTimes();
expect(iFlowPath.getDstSwitch()).andReturn(new Dpid(dstDpid).toString()).anyTimes();
@@ -92,12 +94,14 @@
}
private FlowPath createTestFlowPath(long flowId, String installerId,
+ final long flowPathFlags,
final long srcDpid, final int srcPort,
final long dstDpid, final int dstPort
) {
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(flowId));
flowPath.setInstallerId(new CallerId(installerId));
+ flowPath.setFlowPathFlags(new FlowPathFlags(flowPathFlags));
flowPath.setDataPath(new DataPath() {{
setSrcPort(new SwitchPort(new Dpid(srcDpid), new Port((short)srcPort)));
setDstPort(new SwitchPort(new Dpid(dstDpid), new Port((short)dstPort)));
@@ -107,9 +111,9 @@
}
private ArrayList<FlowPath> createTestFlowPaths() {
- FlowPath flowPath1 = createTestFlowPath(1, "foo caller id", 1, 1, 2, 2);
- FlowPath flowPath2 = createTestFlowPath(2, "caller id", 1, 1, 2, 2);
- FlowPath flowPath3 = createTestFlowPath(3, "caller id", 1, 5, 2, 2);
+ 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);
ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
flowPaths.add(flowPath1);
@@ -182,6 +186,7 @@
FlowPath flowPath = new FlowPath();
flowPath.setFlowId(new FlowId(0x100));
flowPath.setInstallerId(new CallerId("installer id"));
+ flowPath.setFlowPathFlags(new FlowPathFlags(0));
flowPath.setDataPath(dataPath);
flowPath.setFlowEntryMatch(match);
@@ -192,6 +197,7 @@
createdFlowPath.setFlowId("0x100");
createdFlowPath.setType("flow");
createdFlowPath.setInstallerId("installer id");
+ createdFlowPath.setFlowPathFlags(new Long((long)0));
createdFlowPath.setSrcSwitch("00:00:00:00:00:00:12:34");
createdFlowPath.setSrcPort(new Short((short)1));
createdFlowPath.setDstSwitch("00:00:00:00:00:00:56:78");
@@ -339,7 +345,7 @@
public final void testGetFlowSuccessNormally() throws Exception {
// instantiate required objects
FlowManager fm = new FlowManager();
- IFlowPath iFlowPath = createIFlowPathMock(1, "caller id", 1, 1, 2, 2);
+ IFlowPath iFlowPath = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
// setup expectations
expectInitWithContext();
@@ -351,11 +357,14 @@
replayAll();
fm.init(context);
- String result = fm.getFlow(new FlowId(1)).installerId().toString();
+ FlowPath flowPath = fm.getFlow(new FlowId(1));
+ String installerId = flowPath.installerId().toString();
+ long flowPathFlags = flowPath.flowPathFlags().flags();
//verify the test
verifyAll();
- assertEquals("caller id", result);
+ assertEquals("caller id", installerId);
+ assertEquals(0L, flowPathFlags);
}
/**
@@ -437,9 +446,9 @@
final String getAllFlowsWithoutFlowEntries = "getAllFlowsWithoutFlowEntries";
// create mock objects
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, getAllFlowsWithoutFlowEntries);
- IFlowPath flowPath1 = createIFlowPathMock(1, "", 1, 2, 3, 4);
- IFlowPath flowPath2 = createIFlowPathMock(5, "", 2, 3, 4, 5);
- IFlowPath flowPath3 = createIFlowPathMock(10, "", 3, 4, 5, 6);
+ 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);
// instantiate required objects
ArrayList<IFlowPath> flows = new ArrayList<IFlowPath>();
@@ -472,8 +481,8 @@
@Test
public final void testGetAllFlowsSuccessNormally() throws Exception {
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 1, 1, 2, 2);
- IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 2, 5, 3, 5);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 0, 2, 5, 3, 5);
// instantiate required objects
ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
@@ -524,6 +533,7 @@
FlowPath paramFlow = new FlowPath();
paramFlow.setFlowId(new FlowId(100));
paramFlow.setInstallerId(new CallerId("installer id"));
+ paramFlow.setFlowPathFlags(new FlowPathFlags(0));
paramFlow.setDataPath(dataPath);
paramFlow.setFlowEntryMatch(match);
@@ -538,6 +548,7 @@
FlowPath flowPath = (FlowPath)EasyMock.getCurrentArguments()[0];
assertEquals(flowPath.flowId().value(), 100);
assertEquals(flowPath.installerId().toString(), "installer id");
+ assertEquals(flowPath.flowPathFlags().flags(), 0);
assertEquals(flowPath.dataPath().srcPort().toString(),
new SwitchPort(new Dpid(1), new Port((short)3)).toString());
@@ -558,6 +569,7 @@
verifyAll();
assertEquals(paramFlow.flowId().value(), resultFlow.flowId().value());
assertEquals(paramFlow.installerId().toString(), resultFlow.installerId().toString());
+ assertEquals(paramFlow.flowPathFlags().flags(), resultFlow.flowPathFlags().flags());
assertEquals(paramFlow.dataPath().toString(), resultFlow.dataPath().toString());
assertEquals(paramFlow.flowEntryMatch().toString(), resultFlow.flowEntryMatch().toString());
}
@@ -569,7 +581,7 @@
@Test
public final void testMeasurementStorePathFlowSuccessNormally() throws Exception {
// instantiate required objects
- FlowPath paramFlow = createTestFlowPath(100, "installer id", 1, 3, 2, 4);
+ FlowPath paramFlow = createTestFlowPath(100, "installer id", 0, 1, 3, 2, 4);
Map<Long, Object> shortestPathMap = new HashMap<Long, Object>();
FlowManager fm = new FlowManager();
@@ -592,6 +604,7 @@
verifyAll();
assertEquals(paramFlow.flowId().value(), resultFlowPath.flowId().value());
assertEquals(paramFlow.installerId().toString(), resultFlowPath.installerId().toString());
+ assertEquals(paramFlow.flowPathFlags().flags(), resultFlowPath.flowPathFlags().flags());
assertEquals(paramFlow.dataPath().toString(), resultFlowPath.dataPath().toString());
assertEquals(paramFlow.flowEntryMatch().toString(), resultFlowPath.flowEntryMatch().toString());
}
@@ -608,9 +621,9 @@
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlow);
// instantiate required objects
- FlowPath flow1 = createTestFlowPath(1, "installer id", 1, 2, 3, 4);
- FlowPath flow2 = createTestFlowPath(2, "installer id", 2, 3, 4, 5);
- FlowPath flow3 = createTestFlowPath(3, "installer id", 3, 4, 5, 6);
+ FlowPath flow1 = createTestFlowPath(1, "installer id", 0, 1, 2, 3, 4);
+ FlowPath flow2 = createTestFlowPath(2, "installer id", 0, 2, 3, 4, 5);
+ FlowPath flow3 = createTestFlowPath(3, "installer id", 0, 3, 4, 5, 6);
Map<Long, Object> shortestPathMap = new HashMap<Long, Object>();
// setup expectations
@@ -675,7 +688,7 @@
mockStaticPartial(System.class, "nanoTime");
// instantiate required objects
- FlowPath flow1 = createTestFlowPath(1, "installer id", 1, 2, 3, 4);
+ FlowPath flow1 = createTestFlowPath(1, "installer id", 0, 1, 2, 3, 4);
Map<Long, Object> shortestPathMap = new HashMap<Long, Object>();
// setup expectations
@@ -718,7 +731,7 @@
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlow);
// instantiate required objects
- FlowPath flow1 = createTestFlowPath(1, "installer id", 1, 2, 3, 4);
+ FlowPath flow1 = createTestFlowPath(1, "installer id", 0, 1, 2, 3, 4);
Map<Long, Object> shortestPathMap = new HashMap<Long, Object>();
// setup expectations
@@ -757,7 +770,7 @@
@Test
public final void testMeasurementClearAllPathsSuccessNormally() throws Exception {
// instantiate required objects
- FlowPath paramFlow = createTestFlowPath(100, "installer id", 1, 3, 2, 4);
+ FlowPath paramFlow = createTestFlowPath(100, "installer id", 0, 1, 3, 2, 4);
Map<Long, Object> shortestPathMap = new HashMap<Long, Object>();
FlowManager fm = new FlowManager();
@@ -980,7 +993,7 @@
@Test
public final void testClearFlowSuccessNormally() throws Exception {
// create mock objects
- IFlowPath flowPath = createIFlowPathMock(123, "id", 1, 2, 3, 4);
+ IFlowPath flowPath = createIFlowPathMock(123, "id", 0, 1, 2, 3, 4);
IFlowEntry flowEntry1 = createMock(IFlowEntry.class);
IFlowEntry flowEntry2 = createMock(IFlowEntry.class);
IFlowEntry flowEntry3 = createMock(IFlowEntry.class);
@@ -1023,8 +1036,8 @@
@Test
public final void testGetAllFlowsWithoutFlowEntriesSuccessNormally() throws Exception {
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 1, 1, 2, 2);
- IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 2, 5, 3, 5);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
+ IFlowPath iFlowPath2 = createIFlowPathMock(2, "caller id", 0, 2, 5, 3, 5);
// instantiate required objects
ArrayList<IFlowPath> flowPaths = new ArrayList<IFlowPath>();
@@ -1060,7 +1073,7 @@
final String addFlowEntry = "addFlowEntry";
// create mock objects
- IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 1, 1, 2, 2);
+ IFlowPath iFlowPath1 = createIFlowPathMock(1, "caller id", 0, 1, 1, 2, 2);
IFlowEntry iFlowEntry1 = createMock(IFlowEntry.class);
IFlowEntry iFlowEntry2 = createMock(IFlowEntry.class);
FlowManager fm = createPartialMockAndInvokeDefaultConstructor(FlowManager.class, addFlowEntry);
@@ -1127,7 +1140,7 @@
public final void testInstallFlowEntryWithIFlowPathSuccessNormally() throws Exception {
// create mock object
IOFSwitch iofSwitch = createNiceMock(IOFSwitch.class);
- IFlowPath iFlowPath = createIFlowPathMock(1, "id", 1, 2, 3, 4);
+ IFlowPath iFlowPath = createIFlowPathMock(1, "id", 0, 1, 2, 3, 4);
IFlowEntry iFlowEntry = createMock(IFlowEntry.class);
BasicFactory basicFactory = createMock(BasicFactory.class);
@@ -1140,12 +1153,18 @@
expect(iFlowEntry.getUserState()).andReturn("FE_USER_ADD");
iFlowEntry.setSwitchState("FE_SWITCH_UPDATED");
expect(iFlowEntry.getMatchInPort()).andReturn(new Short((short) 1));
- expect(iFlowEntry.getMatchEthernetFrameType()).andReturn(new Short((short)0x0800));
- expect(iFlowEntry.getMatchSrcIPv4Net()).andReturn("192.168.0.1");
- expect(iFlowEntry.getMatchDstIPv4Net()).andReturn("192.168.0.2");
expect(iFlowEntry.getMatchSrcMac()).andReturn("01:23:45:67:89:01");
expect(iFlowEntry.getMatchDstMac()).andReturn("01:23:45:67:89:02");
- expect(iFlowEntry.getActionOutput()).andReturn(new Short((short) 2));
+ expect(iFlowEntry.getMatchEthernetFrameType()).andReturn(new Short((short)0x0800));
+ expect(iFlowEntry.getMatchVlanId()).andReturn(new Short((short)0x1234));
+ expect(iFlowEntry.getMatchVlanPriority()).andReturn(new Byte((byte)0x10));
+ expect(iFlowEntry.getMatchSrcIPv4Net()).andReturn("192.168.0.1");
+ expect(iFlowEntry.getMatchDstIPv4Net()).andReturn("192.168.0.2");
+ expect(iFlowEntry.getMatchIpProto()).andReturn(new Byte((byte)0x20));
+ expect(iFlowEntry.getMatchIpToS()).andReturn(new Byte((byte)0x3));
+ expect(iFlowEntry.getMatchSrcTcpUdpPort()).andReturn(new Short((short)40000));
+ expect(iFlowEntry.getMatchDstTcpUdpPort()).andReturn(new Short((short)80));
+ expect(iFlowEntry.getActionOutputPort()).andReturn(new Short((short) 2));
expect(floodlightProvider.getOFMessageFactory()).andReturn(basicFactory);
expect(basicFactory.getMessage(OFType.FLOW_MOD)).andReturn(new OFFlowMod());
expect(iofSwitch.getStringId()).andReturn(new Dpid(100).toString());
diff --git a/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java b/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java
index e6d7d16..ba23a01 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/routing/TopoRouteServiceTest.java
@@ -41,6 +41,7 @@
import net.onrc.onos.ofcontroller.routing.TopoRouteService;
import net.onrc.onos.ofcontroller.util.DataPath;
import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowPathFlags;
import net.onrc.onos.ofcontroller.util.Port;
import net.onrc.onos.ofcontroller.util.SwitchPort;
@@ -132,6 +133,20 @@
String expectedResult = "1/00:00:00:00:00:00:0a:01/2;1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
assertEquals(dataPathSummaryStr, expectedResult);
+ // Test if we apply various Flow Path Flags
+ String expectedResult2 = "1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ String expectedResult3 = "1/00:00:00:00:00:00:0a:03/2;";
+ FlowPathFlags flowPathFlags2 = new FlowPathFlags("DISCARD_FIRST_HOP_ENTRY");
+ FlowPathFlags flowPathFlags3 = new FlowPathFlags("KEEP_ONLY_FIRST_HOP_ENTRY");
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags2);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult2);
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags3);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult3);
+
//
// Test Shortest-Path computation to non-existing destination
//
@@ -180,6 +195,20 @@
String expectedResult = "1/00:00:00:00:00:00:0a:01/2;1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
assertEquals(dataPathSummaryStr, expectedResult);
+ // Test if we apply various Flow Path Flags
+ String expectedResult2 = "1/00:00:00:00:00:00:0a:03/2;2/00:00:00:00:00:00:0a:04/3;1/00:00:00:00:00:00:0a:06/1;";
+ String expectedResult3 = "1/00:00:00:00:00:00:0a:03/2;";
+ FlowPathFlags flowPathFlags2 = new FlowPathFlags("DISCARD_FIRST_HOP_ENTRY");
+ FlowPathFlags flowPathFlags3 = new FlowPathFlags("KEEP_ONLY_FIRST_HOP_ENTRY");
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags2);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult2);
+ //
+ dataPath.applyFlowPathFlags(flowPathFlags3);
+ dataPathSummaryStr = dataPath.dataPathSummary();
+ assertEquals(dataPathSummaryStr, expectedResult3);
+
//
// Test Shortest-Path computation to non-existing destination
//
diff --git a/start-onos.sh b/start-onos.sh
index c356c87..13ea0ac 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -5,8 +5,11 @@
ONOS_HOME=`dirname $0`
fi
-ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
-LOGDIR=${ONOS_HOME}/onos-logs
+## Because the script change dir to $ONOS_HOME, we can set ONOS_LOGBACK and LOGDIR relative to $ONOS_HOME
+#ONOS_LOGBACK="${ONOS_HOME}/logback.`hostname`.xml"
+#LOGDIR=${ONOS_HOME}/onos-logs
+ONOS_LOGBACK="./logback.`hostname`.xml"
+LOGDIR=./onos-logs
ONOS_LOG="${LOGDIR}/onos.`hostname`.log"
PCAP_LOG="${LOGDIR}/onos.`hostname`.pcap"
LOGS="$ONOS_LOG $PCAP_LOG"
@@ -96,20 +99,26 @@
echo
# XXX : MVN has to run at the project top dir
+ echo $ONOS_HOME
cd ${ONOS_HOME}
- echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos.properties\""
- ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos.properties" > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
+ pwd
+ echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties\""
+
+ ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties" > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
echo "Waiting for ONOS to start..."
COUNT=0
ESTATE=0
while [ "$COUNT" != "10" ]; do
- COUNT=$((COUNT + 1))
+ echo -n "."
+ sleep 1
+# COUNT=$((COUNT + 1))
+# sleep $COUNT
n=`jps -l |grep "${MAIN_CLASS}" | wc -l`
if [ "$n" -ge "1" ]; then
+ echo ""
exit 0
fi
- sleep $COUNT
done
echo "Timed out"
exit 1
diff --git a/web/add_flow.py b/web/add_flow.py
index 4f502f6..9ecb102 100755
--- a/web/add_flow.py
+++ b/web/add_flow.py
@@ -129,8 +129,9 @@
my_dst_port = my_args[5]
#
- # Extract the "match" and "action" arguments
+ # Extract the "flowPathFlags", "match" and "action" arguments
#
+ flowPathFlags = 0L
match = {}
matchInPortEnabled = True # NOTE: Enabled by default
actions = []
@@ -149,7 +150,12 @@
arg2 = my_args[idx]
idx = idx + 1
- if arg1 == "matchInPort":
+ if arg1 == "flowPathFlags":
+ if "DISCARD_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x1
+ if "KEEP_ONLY_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x2
+ elif arg1 == "matchInPort":
# Just mark whether inPort matching is enabled
matchInPortEnabled = arg2 in ['True', 'true']
# inPort = {}
@@ -166,21 +172,15 @@
dstMac['value'] = arg2
match['dstMac'] = dstMac
# match['matchDstMac'] = True
+ elif arg1 == "matchEthernetFrameType":
+ match['ethernetFrameType'] = int(arg2, 0)
+ # match['matchEthernetFrameType'] = True
elif arg1 == "matchVlanId":
match['vlanId'] = int(arg2, 0)
# match['matchVlanId'] = True
elif arg1 == "matchVlanPriority":
match['vlanPriority'] = int(arg2, 0)
# match['matchVlanPriority'] = True
- elif arg1 == "matchEthernetFrameType":
- match['ethernetFrameType'] = int(arg2, 0)
- # match['matchEthernetFrameType'] = True
- elif arg1 == "matchIpToS":
- match['ipToS'] = int(arg2, 0)
- # match['matchIpToS'] = True
- elif arg1 == "matchIpProto":
- match['ipProto'] = int(arg2, 0)
- # match['matchIpProto'] = True
elif arg1 == "matchSrcIPv4Net":
srcIPv4Net = {}
srcIPv4Net['value'] = arg2
@@ -191,6 +191,12 @@
dstIPv4Net['value'] = arg2
match['dstIPv4Net'] = dstIPv4Net
# match['matchDstIPv4Net'] = True
+ elif arg1 == "matchIpProto":
+ match['ipProto'] = int(arg2, 0)
+ # match['matchIpProto'] = True
+ elif arg1 == "matchIpToS":
+ match['ipToS'] = int(arg2, 0)
+ # match['matchIpToS'] = True
elif arg1 == "matchSrcTcpUdpPort":
match['srcTcpUdpPort'] = int(arg2, 0)
# match['matchSrcTcpUdpPort'] = True
@@ -223,24 +229,6 @@
action['actionSetVlanPriority'] = vlanPriority
# action['actionType'] = 'ACTION_SET_VLAN_PCP'
actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetIpToS":
- ipToS = {}
- ipToS['ipToS'] = int(arg2, 0)
- action['actionSetIpToS'] = ipToS
- # action['actionType'] = 'ACTION_SET_NW_TOS'
- actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetTcpUdpSrcPort":
- tcpUdpSrcPort = {}
- tcpUdpSrcPort['port'] = int(arg2, 0)
- action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
- # action['actionType'] = 'ACTION_SET_TP_SRC'
- actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetTcpUdpDstPort":
- tcpUdpDstPort = {}
- tcpUdpDstPort['port'] = int(arg2, 0)
- action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
- # action['actionType'] = 'ACTION_SET_TP_DST'
- actions.append(copy.deepcopy(action))
elif arg1 == "actionStripVlan":
stripVlan = {}
stripVlan['stripVlan'] = arg2 in ['True', 'true']
@@ -279,6 +267,24 @@
action['actionSetIPv4DstAddr'] = setIPv4DstAddr
# action['actionType'] = 'ACTION_SET_NW_DST'
actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetIpToS":
+ ipToS = {}
+ ipToS['ipToS'] = int(arg2, 0)
+ action['actionSetIpToS'] = ipToS
+ # action['actionType'] = 'ACTION_SET_NW_TOS'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpSrcPort":
+ tcpUdpSrcPort = {}
+ tcpUdpSrcPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
+ # action['actionType'] = 'ACTION_SET_TP_SRC'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpDstPort":
+ tcpUdpDstPort = {}
+ tcpUdpDstPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
+ # action['actionType'] = 'ACTION_SET_TP_DST'
+ actions.append(copy.deepcopy(action))
elif arg1 == "actionEnqueue":
# TODO: Implement ACTION_ENQUEUE
actionEnqueue = {}
@@ -302,6 +308,7 @@
'my_src_port' : my_src_port,
'my_dst_dpid' : my_dst_dpid,
'my_dst_port' : my_dst_port,
+ 'flowPathFlags' : flowPathFlags,
'match' : match,
'matchInPortEnabled' : matchInPortEnabled,
'actions' : actions,
@@ -325,6 +332,7 @@
my_flow_id = parsed_args['my_flow_id']
my_installer_id = parsed_args['my_installer_id']
+ myFlowPathFlags = parsed_args['flowPathFlags']
match = parsed_args['match']
matchInPortEnabled = parsed_args['matchInPortEnabled']
actions = parsed_args['actions']
@@ -335,10 +343,13 @@
flow_id['value'] = my_flow_id
installer_id = {}
installer_id['value'] = my_installer_id
+ flowPathFlags = {}
+ flowPathFlags['flags'] = myFlowPathFlags
flow_path = {}
flow_path['flowId'] = flow_id
flow_path['installerId'] = installer_id
+ flow_path['flowPathFlags'] = flowPathFlags
if (len(match) > 0):
flow_path['flowEntryMatch'] = copy.deepcopy(match)
@@ -461,7 +472,7 @@
if __name__ == "__main__":
- usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Match Conditions] [Actions]\n" % (sys.argv[0])
+ usage_msg = "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Flags:\n"
usage_msg = usage_msg + " -m [monitorname] Monitor and maintain the installed shortest path(s)\n"
@@ -472,36 +483,39 @@
usage_msg = usage_msg + " -f <filename> Read the flow(s) to install from a file\n"
usage_msg = usage_msg + " File format: one line per flow starting with <flow-id>\n"
usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Flow Path Flags:\n"
+ usage_msg = usage_msg + " flowPathFlags <Flags> (flag names separated by ',')\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Known flags:\n"
+ usage_msg = usage_msg + " DISCARD_FIRST_HOP_ENTRY : Discard the first-hop flow entry\n"
+ usage_msg = usage_msg + " KEEP_ONLY_FIRST_HOP_ENTRY : Keep only the first-hop flow entry\n"
+ usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Match Conditions:\n"
usage_msg = usage_msg + " matchInPort <True|False> (default to True)\n"
usage_msg = usage_msg + " matchSrcMac <source MAC address>\n"
usage_msg = usage_msg + " matchDstMac <destination MAC address>\n"
- usage_msg = usage_msg + " matchSrcIPv4Net <source IPv4 network address>\n"
- usage_msg = usage_msg + " matchDstIPv4Net <destination IPv4 network address>\n"
usage_msg = usage_msg + " matchEthernetFrameType <Ethernet frame type>\n"
- usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Match Conditions (not implemented yet):\n"
usage_msg = usage_msg + " matchVlanId <VLAN ID>\n"
usage_msg = usage_msg + " matchVlanPriority <VLAN priority>\n"
- usage_msg = usage_msg + " matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
+ usage_msg = usage_msg + " matchSrcIPv4Net <source IPv4 network address>\n"
+ usage_msg = usage_msg + " matchDstIPv4Net <destination IPv4 network address>\n"
usage_msg = usage_msg + " matchIpProto <IP protocol>\n"
+ usage_msg = usage_msg + " matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
usage_msg = usage_msg + " matchSrcTcpUdpPort <source TCP/UDP port>\n"
usage_msg = usage_msg + " matchDstTcpUdpPort <destination TCP/UDP port>\n"
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Actions:\n"
usage_msg = usage_msg + " actionOutput <True|False> (default to True)\n"
+ usage_msg = usage_msg + " actionSetVlanId <VLAN ID>\n"
+ usage_msg = usage_msg + " actionSetVlanPriority <VLAN priority>\n"
+ usage_msg = usage_msg + " actionStripVlan <True|False>\n"
usage_msg = usage_msg + " actionSetEthernetSrcAddr <source MAC address>\n"
usage_msg = usage_msg + " actionSetEthernetDstAddr <destination MAC address>\n"
usage_msg = usage_msg + " actionSetIPv4SrcAddr <source IPv4 address>\n"
usage_msg = usage_msg + " actionSetIPv4DstAddr <destination IPv4 address>\n"
- usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Actions (not implemented yet):\n"
- usage_msg = usage_msg + " actionSetVlanId <VLAN ID>\n"
- usage_msg = usage_msg + " actionSetVlanPriority <VLAN priority>\n"
usage_msg = usage_msg + " actionSetIpToS <IP ToS (DSCP field, 6 bits)>\n"
usage_msg = usage_msg + " actionSetTcpUdpSrcPort <source TCP/UDP port>\n"
usage_msg = usage_msg + " actionSetTcpUdpDstPort <destination TCP/UDP port>\n"
- usage_msg = usage_msg + " actionStripVlan <True|False>\n"
usage_msg = usage_msg + " actionEnqueue <dummy argument>\n"
# app.debug = False;
diff --git a/web/get_flow.py b/web/get_flow.py
index 033176d..6599360 100755
--- a/web/get_flow.py
+++ b/web/get_flow.py
@@ -36,12 +36,23 @@
def print_flow_path(parsedResult):
flowId = parsedResult['flowId']['value']
installerId = parsedResult['installerId']['value']
+ flowPathFlags = parsedResult['flowPathFlags']['flags']
srcSwitch = parsedResult['dataPath']['srcPort']['dpid']['value']
srcPort = parsedResult['dataPath']['srcPort']['port']['value']
dstSwitch = parsedResult['dataPath']['dstPort']['dpid']['value']
dstPort = parsedResult['dataPath']['dstPort']['port']['value']
- print "FlowPath: (flowId = %s installerId = %s src = %s/%s dst = %s/%s)" % (flowId, installerId, srcSwitch, srcPort, dstSwitch, dstPort)
+ flowPathFlagsStr = ""
+ if (flowPathFlags & 0x1):
+ if flowPathFlagsStr:
+ flowPathFlagsStr += ","
+ flowPathFlagsStr += "DISCARD_FIRST_HOP_ENTRY"
+ if (flowPathFlags & 0x2):
+ if flowPathFlagsStr:
+ flowPathFlagsStr += ","
+ flowPathFlagsStr += "KEEP_ONLY_FIRST_HOP_ENTRY"
+
+ print "FlowPath: (flowId = %s installerId = %s flowPathFlags = 0x%x(%s) src = %s/%s dst = %s/%s)" % (flowId, installerId, flowPathFlags, flowPathFlagsStr, srcSwitch, srcPort, dstSwitch, dstPort)
match = parsedResult['flowEntryMatch'];
#
# Print the common conditions
@@ -55,20 +66,20 @@
matchSrcMac = match['matchSrcMac']
dstMac = match['dstMac']
matchDstMac = match['matchDstMac']
+ ethernetFrameType = match['ethernetFrameType']
+ matchEthernetFrameType = match['matchEthernetFrameType']
vlanId = match['vlanId']
matchVlanId = match['matchVlanId']
vlanPriority = match['vlanPriority']
matchVlanPriority = match['matchVlanPriority']
- ethernetFrameType = match['ethernetFrameType']
- matchEthernetFrameType = match['matchEthernetFrameType']
- ipToS = match['ipToS']
- matchIpToS = match['matchIpToS']
- ipProto = match['ipProto']
- matchIpProto = match['matchIpProto']
srcIPv4Net = match['srcIPv4Net']
matchSrcIPv4Net = match['matchSrcIPv4Net']
dstIPv4Net = match['dstIPv4Net']
matchDstIPv4Net = match['matchDstIPv4Net']
+ ipProto = match['ipProto']
+ matchIpProto = match['matchIpProto']
+ ipToS = match['ipToS']
+ matchIpToS = match['matchIpToS']
srcTcpUdpPort = match['srcTcpUdpPort']
matchSrcTcpUdpPort = match['matchSrcTcpUdpPort']
dstTcpUdpPort = match['dstTcpUdpPort']
@@ -79,20 +90,20 @@
print " srcMac: %s" % srcMac['value']
if matchDstMac == True:
print " dstMac: %s" % dstMac['value']
+ if matchEthernetFrameType == True:
+ print " ethernetFrameType: %s" % hex(ethernetFrameType)
if matchVlanId == True:
print " vlanId: %s" % vlanId
if matchVlanPriority == True:
print " vlanPriority: %s" % vlanPriority
- if matchEthernetFrameType == True:
- print " ethernetFrameType: %s" % hex(ethernetFrameType)
- if matchIpToS == True:
- print " ipToS: %s" % ipToS
- if matchIpProto == True:
- print " ipProto: %s" % ipProto
if matchSrcIPv4Net == True:
print " srcIPv4Net: %s" % srcIPv4Net['value']
if matchDstIPv4Net == True:
print " dstIPv4Net: %s" % dstIPv4Net['value']
+ if matchIpProto == True:
+ print " ipProto: %s" % ipProto
+ if matchIpToS == True:
+ print " ipToS: %s" % ipToS
if matchSrcTcpUdpPort == True:
print " srcTcpUdpPort: %s" % srcTcpUdpPort
if matchDstTcpUdpPort == True:
@@ -119,20 +130,20 @@
matchSrcMac = match['matchSrcMac']
dstMac = match['dstMac']
matchDstMac = match['matchDstMac']
+ ethernetFrameType = match['ethernetFrameType']
+ matchEthernetFrameType = match['matchEthernetFrameType']
vlanId = match['vlanId']
matchVlanId = match['matchVlanId']
vlanPriority = match['vlanPriority']
matchVlanPriority = match['matchVlanPriority']
- ethernetFrameType = match['ethernetFrameType']
- matchEthernetFrameType = match['matchEthernetFrameType']
- ipToS = match['ipToS']
- matchIpToS = match['matchIpToS']
- ipProto = match['ipProto']
- matchIpProto = match['matchIpProto']
srcIPv4Net = match['srcIPv4Net']
matchSrcIPv4Net = match['matchSrcIPv4Net']
dstIPv4Net = match['dstIPv4Net']
matchDstIPv4Net = match['matchDstIPv4Net']
+ ipProto = match['ipProto']
+ matchIpProto = match['matchIpProto']
+ ipToS = match['ipToS']
+ matchIpToS = match['matchIpToS']
srcTcpUdpPort = match['srcTcpUdpPort']
matchSrcTcpUdpPort = match['matchSrcTcpUdpPort']
dstTcpUdpPort = match['dstTcpUdpPort']
@@ -143,20 +154,20 @@
print " srcMac: %s" % srcMac['value']
if matchDstMac == True:
print " dstMac: %s" % dstMac['value']
+ if matchEthernetFrameType == True:
+ print " ethernetFrameType: %s" % hex(ethernetFrameType)
if matchVlanId == True:
print " vlanId: %s" % vlanId
if matchVlanPriority == True:
print " vlanPriority: %s" % vlanPriority
- if matchEthernetFrameType == True:
- print " ethernetFrameType: %s" % hex(ethernetFrameType)
- if matchIpToS == True:
- print " ipToS: %s" % ipToS
- if matchIpProto == True:
- print " ipProto: %s" % ipProto
if matchSrcIPv4Net == True:
print " srcIPv4Net: %s" % srcIPv4Net['value']
if matchDstIPv4Net == True:
print " dstIPv4Net: %s" % dstIPv4Net['value']
+ if matchIpProto == True:
+ print " ipProto: %s" % ipProto
+ if matchIpToS == True:
+ print " ipToS: %s" % ipToS
if matchSrcTcpUdpPort == True:
print " srcTcpUdpPort: %s" % srcTcpUdpPort
if matchDstTcpUdpPort == True:
diff --git a/web/measurement_store_flow.py b/web/measurement_store_flow.py
index 637ab3e..ad0eadf 100755
--- a/web/measurement_store_flow.py
+++ b/web/measurement_store_flow.py
@@ -60,8 +60,9 @@
my_dst_port = my_args[5]
#
- # Extract the "match" and "action" arguments
+ # Extract the "flowPathFlags", "match" and "action" arguments
#
+ flowPathFlags = 0L
match = {}
matchInPortEnabled = True # NOTE: Enabled by default
actions = []
@@ -80,7 +81,12 @@
arg2 = my_args[idx]
idx = idx + 1
- if arg1 == "matchInPort":
+ if arg1 == "flowPathFlags":
+ if "DISCARD_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x1
+ if "KEEP_ONLY_FIRST_HOP_ENTRY" in arg2:
+ flowPathFlags = flowPathFlags + 0x2
+ elif arg1 == "matchInPort":
# Just mark whether inPort matching is enabled
matchInPortEnabled = arg2 in ['True', 'true']
# inPort = {}
@@ -97,21 +103,15 @@
dstMac['value'] = arg2
match['dstMac'] = dstMac
# match['matchDstMac'] = True
+ elif arg1 == "matchEthernetFrameType":
+ match['ethernetFrameType'] = int(arg2, 0)
+ # match['matchEthernetFrameType'] = True
elif arg1 == "matchVlanId":
match['vlanId'] = int(arg2, 0)
# match['matchVlanId'] = True
elif arg1 == "matchVlanPriority":
match['vlanPriority'] = int(arg2, 0)
# match['matchVlanPriority'] = True
- elif arg1 == "matchEthernetFrameType":
- match['ethernetFrameType'] = int(arg2, 0)
- # match['matchEthernetFrameType'] = True
- elif arg1 == "matchIpToS":
- match['ipToS'] = int(arg2, 0)
- # match['matchIpToS'] = True
- elif arg1 == "matchIpProto":
- match['ipProto'] = int(arg2, 0)
- # match['matchIpProto'] = True
elif arg1 == "matchSrcIPv4Net":
srcIPv4Net = {}
srcIPv4Net['value'] = arg2
@@ -122,6 +122,12 @@
dstIPv4Net['value'] = arg2
match['dstIPv4Net'] = dstIPv4Net
# match['matchDstIPv4Net'] = True
+ elif arg1 == "matchIpProto":
+ match['ipProto'] = int(arg2, 0)
+ # match['matchIpProto'] = True
+ elif arg1 == "matchIpToS":
+ match['ipToS'] = int(arg2, 0)
+ # match['matchIpToS'] = True
elif arg1 == "matchSrcTcpUdpPort":
match['srcTcpUdpPort'] = int(arg2, 0)
# match['matchSrcTcpUdpPort'] = True
@@ -154,24 +160,6 @@
action['actionSetVlanPriority'] = vlanPriority
# action['actionType'] = 'ACTION_SET_VLAN_PCP'
actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetIpToS":
- ipToS = {}
- ipToS['ipToS'] = int(arg2, 0)
- action['actionSetIpToS'] = ipToS
- # action['actionType'] = 'ACTION_SET_NW_TOS'
- actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetTcpUdpSrcPort":
- tcpUdpSrcPort = {}
- tcpUdpSrcPort['port'] = int(arg2, 0)
- action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
- # action['actionType'] = 'ACTION_SET_TP_SRC'
- actions.append(copy.deepcopy(action))
- elif arg1 == "actionSetTcpUdpDstPort":
- tcpUdpDstPort = {}
- tcpUdpDstPort['port'] = int(arg2, 0)
- action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
- # action['actionType'] = 'ACTION_SET_TP_DST'
- actions.append(copy.deepcopy(action))
elif arg1 == "actionStripVlan":
stripVlan = {}
stripVlan['stripVlan'] = arg2 in ['True', 'true']
@@ -210,6 +198,24 @@
action['actionSetIPv4DstAddr'] = setIPv4DstAddr
# action['actionType'] = 'ACTION_SET_NW_DST'
actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetIpToS":
+ ipToS = {}
+ ipToS['ipToS'] = int(arg2, 0)
+ action['actionSetIpToS'] = ipToS
+ # action['actionType'] = 'ACTION_SET_NW_TOS'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpSrcPort":
+ tcpUdpSrcPort = {}
+ tcpUdpSrcPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpSrcPort'] = tcpUdpSrcPort
+ # action['actionType'] = 'ACTION_SET_TP_SRC'
+ actions.append(copy.deepcopy(action))
+ elif arg1 == "actionSetTcpUdpDstPort":
+ tcpUdpDstPort = {}
+ tcpUdpDstPort['port'] = int(arg2, 0)
+ action['actionSetTcpUdpDstPort'] = tcpUdpDstPort
+ # action['actionType'] = 'ACTION_SET_TP_DST'
+ actions.append(copy.deepcopy(action))
elif arg1 == "actionEnqueue":
# TODO: Implement ACTION_ENQUEUE
actionEnqueue = {}
@@ -233,6 +239,7 @@
'my_src_port' : my_src_port,
'my_dst_dpid' : my_dst_dpid,
'my_dst_port' : my_dst_port,
+ 'flowPathFlags' : flowPathFlags,
'match' : match,
'matchInPortEnabled' : matchInPortEnabled,
'actions' : actions,
@@ -243,6 +250,7 @@
my_flow_id = parsed_args['my_flow_id']
my_installer_id = parsed_args['my_installer_id']
+ myFlowPathFlags = parsed_args['flowPathFlags']
match = parsed_args['match']
matchInPortEnabled = parsed_args['matchInPortEnabled']
actions = parsed_args['actions']
@@ -253,10 +261,13 @@
flow_id['value'] = my_flow_id
installer_id = {}
installer_id['value'] = my_installer_id
+ flowPathFlags = {}
+ flowPathFlags['flags'] = myFlowPathFlags
flow_path = {}
flow_path['flowId'] = flow_id
flow_path['installerId'] = installer_id
+ flow_path['flowPathFlags'] = flowPathFlags
if (len(match) > 0):
flow_path['flowEntryMatch'] = copy.deepcopy(match)
@@ -346,42 +357,45 @@
if __name__ == "__main__":
usage_msg = "Store Flow Paths into ONOS for measurement purpose.\n"
usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Match Conditions] [Actions]\n" % (sys.argv[0])
+ usage_msg = usage_msg + "Usage: %s [Flags] <flow-id> <installer-id> <src-dpid> <src-port> <dest-dpid> <dest-port> [Flow Path Flags] [Match Conditions] [Actions]\n" % (sys.argv[0])
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Flags:\n"
usage_msg = usage_msg + " -f <filename> Read the flow(s) to install from a file\n"
usage_msg = usage_msg + " File format: one line per flow starting with <flow-id>\n"
usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Flow Path Flags:\n"
+ usage_msg = usage_msg + " flowPathFlags <Flags> (flag names separated by ',')\n"
+ usage_msg = usage_msg + "\n"
+ usage_msg = usage_msg + " Known flags:\n"
+ usage_msg = usage_msg + " DISCARD_FIRST_HOP_ENTRY : Discard the first-hop flow entry\n"
+ usage_msg = usage_msg + " KEEP_ONLY_FIRST_HOP_ENTRY : Keep only the first-hop flow entry\n"
+ usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Match Conditions:\n"
usage_msg = usage_msg + " matchInPort <True|False> (default to True)\n"
usage_msg = usage_msg + " matchSrcMac <source MAC address>\n"
usage_msg = usage_msg + " matchDstMac <destination MAC address>\n"
- usage_msg = usage_msg + " matchSrcIPv4Net <source IPv4 network address>\n"
- usage_msg = usage_msg + " matchDstIPv4Net <destination IPv4 network address>\n"
usage_msg = usage_msg + " matchEthernetFrameType <Ethernet frame type>\n"
- usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Match Conditions (not implemented yet):\n"
usage_msg = usage_msg + " matchVlanId <VLAN ID>\n"
usage_msg = usage_msg + " matchVlanPriority <VLAN priority>\n"
- usage_msg = usage_msg + " matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
+ usage_msg = usage_msg + " matchSrcIPv4Net <source IPv4 network address>\n"
+ usage_msg = usage_msg + " matchDstIPv4Net <destination IPv4 network address>\n"
usage_msg = usage_msg + " matchIpProto <IP protocol>\n"
+ usage_msg = usage_msg + " matchIpToS <IP ToS (DSCP field, 6 bits)>\n"
usage_msg = usage_msg + " matchSrcTcpUdpPort <source TCP/UDP port>\n"
usage_msg = usage_msg + " matchDstTcpUdpPort <destination TCP/UDP port>\n"
usage_msg = usage_msg + "\n"
usage_msg = usage_msg + " Actions:\n"
usage_msg = usage_msg + " actionOutput <True|False> (default to True)\n"
+ usage_msg = usage_msg + " actionSetVlanId <VLAN ID>\n"
+ usage_msg = usage_msg + " actionSetVlanPriority <VLAN priority>\n"
+ usage_msg = usage_msg + " actionStripVlan <True|False>\n"
usage_msg = usage_msg + " actionSetEthernetSrcAddr <source MAC address>\n"
usage_msg = usage_msg + " actionSetEthernetDstAddr <destination MAC address>\n"
usage_msg = usage_msg + " actionSetIPv4SrcAddr <source IPv4 address>\n"
usage_msg = usage_msg + " actionSetIPv4DstAddr <destination IPv4 address>\n"
- usage_msg = usage_msg + "\n"
- usage_msg = usage_msg + " Actions (not implemented yet):\n"
- usage_msg = usage_msg + " actionSetVlanId <VLAN ID>\n"
- usage_msg = usage_msg + " actionSetVlanPriority <VLAN priority>\n"
usage_msg = usage_msg + " actionSetIpToS <IP ToS (DSCP field, 6 bits)>\n"
usage_msg = usage_msg + " actionSetTcpUdpSrcPort <source TCP/UDP port>\n"
usage_msg = usage_msg + " actionSetTcpUdpDstPort <destination TCP/UDP port>\n"
- usage_msg = usage_msg + " actionStripVlan <True|False>\n"
usage_msg = usage_msg + " actionEnqueue <dummy argument>\n"
# app.debug = False;