Skip to content
Snippets Groups Projects
Commit 3db77024 authored by allewwaly's avatar allewwaly
Browse files

add tcp_flags matching for ovs>=2.1.0

parent 256c34dc
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ import org.projectfloodlight.openflow.types.OFGroup;
import org.projectfloodlight.openflow.types.OFPort;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.TableId;
import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U64;
import org.projectfloodlight.openflow.types.VlanVid;
import org.python.google.common.collect.ImmutableList;
......@@ -593,6 +594,16 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
if (FLOWMOD_DEFAULT_MATCH_TRANSPORT_DST) {
mb.setExact(MatchField.TCP_DST, tcp.getDestinationPort());
}
if(
sw.getSwitchDescription().getHardwareDescription().toLowerCase().contains("open vswitch") && (
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[0]) > 2 || (
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[0]) == 2 &&
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[1]) >= 1 ))
){
if(FLOWMOD_DEFAULT_MATCH_TCP_FLAG){
mb.setExact(MatchField.OVS_TCP_FLAGS, U16.of(tcp.getFlags()));
}
}
} else if (ip.getProtocol().equals(IpProtocol.UDP)) {
UDP udp = (UDP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP);
......@@ -639,6 +650,16 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
if (FLOWMOD_DEFAULT_MATCH_TRANSPORT_DST) {
mb.setExact(MatchField.TCP_DST, tcp.getDestinationPort());
}
if(
sw.getSwitchDescription().getHardwareDescription().toLowerCase().contains("open vswitch") && (
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[0]) > 2 || (
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[0]) == 2 &&
Integer.parseInt(sw.getSwitchDescription().getSoftwareDescription().toLowerCase().split("\\.")[1]) >= 1 ))
){
if(FLOWMOD_DEFAULT_MATCH_TCP_FLAG){
mb.setExact(MatchField.OVS_TCP_FLAGS, U16.of(tcp.getFlags()));
}
}
} else if (ip.getNextHeader().equals(IpProtocol.UDP)) {
UDP udp = (UDP) ip.getPayload();
mb.setExact(MatchField.IP_PROTO, IpProtocol.UDP);
......@@ -775,7 +796,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
tmp = tmp.toLowerCase();
if (!tmp.contains("in-port") && !tmp.contains("vlan")
&& !tmp.contains("mac") && !tmp.contains("ip")
&& !tmp.contains("transport")) {
&& !tmp.contains("transport") && !tmp.contains("flag")) {
/* leave the default configuration -- blank or invalid 'match' value */
} else {
FLOWMOD_DEFAULT_MATCH_IN_PORT = tmp.contains("in-port") ? true : false;
......@@ -783,12 +804,14 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
FLOWMOD_DEFAULT_MATCH_MAC = tmp.contains("mac") ? true : false;
FLOWMOD_DEFAULT_MATCH_IP = tmp.contains("ip") ? true : false;
FLOWMOD_DEFAULT_MATCH_TRANSPORT = tmp.contains("transport") ? true : false;
FLOWMOD_DEFAULT_MATCH_TCP_FLAG = tmp.contains("flag") ? true : false;
}
}
log.info("Default flow matches set to: IN_PORT=" + FLOWMOD_DEFAULT_MATCH_IN_PORT
+ ", VLAN=" + FLOWMOD_DEFAULT_MATCH_VLAN
+ ", MAC=" + FLOWMOD_DEFAULT_MATCH_MAC
+ ", IP=" + FLOWMOD_DEFAULT_MATCH_IP
+ ", FLAG=" + FLOWMOD_DEFAULT_MATCH_TCP_FLAG
+ ", TPPT=" + FLOWMOD_DEFAULT_MATCH_TRANSPORT);
tmp = configParameters.get("detailed-match");
......@@ -1050,4 +1073,4 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
}
}
}
}
\ No newline at end of file
}
......@@ -94,6 +94,7 @@ public abstract class ForwardingBase implements IOFMessageListener {
protected static boolean FLOWMOD_DEFAULT_MATCH_IP_DST = true;
protected static boolean FLOWMOD_DEFAULT_MATCH_TRANSPORT_SRC = true;
protected static boolean FLOWMOD_DEFAULT_MATCH_TRANSPORT_DST = true;
protected static boolean FLOWMOD_DEFAULT_MATCH_TCP_FLAG = true;
protected static boolean FLOOD_ALL_ARP_PACKETS = false;
......@@ -456,4 +457,4 @@ public abstract class ForwardingBase implements IOFMessageListener {
public boolean isCallbackOrderingPostreq(OFType type, String name) {
return false;
}
}
\ No newline at end of file
}
......@@ -136,6 +136,7 @@ public class MatchUtils {
public static final String STR_PBB_UCA = "pbb_uca";
public static final String STR_TCP_FLAGS = "tcp_flags";
public static final String STR_OVS_TCP_FLAGS = "ovs_tcp_flags";
public static final String STR_ACTSET_OUTPUT = "actset_output";
public static final String STR_PACKET_TYPE = "packet_type";
......@@ -361,6 +362,9 @@ public class MatchUtils {
case TCP_FLAGS:
key = STR_TCP_FLAGS;
break;
case OVS_TCP_FLAGS:
key = STR_OVS_TCP_FLAGS;
break;
case ACTSET_OUTPUT:
key = STR_ACTSET_OUTPUT;
break;
......@@ -1015,6 +1019,14 @@ public class MatchUtils {
U16.of(ParseUtils.parseHexOrDecInt(dataMask[1])));
}
break;
case STR_OVS_TCP_FLAGS:
if (dataMask.length == 1) {
mb.setExact(MatchField.OVS_TCP_FLAGS, U16.of(ParseUtils.parseHexOrDecInt(dataMask[0])));
} else {
mb.setMasked(MatchField.OVS_TCP_FLAGS, U16.of(ParseUtils.parseHexOrDecInt(dataMask[0])),
U16.of(ParseUtils.parseHexOrDecInt(dataMask[1])));
}
break;
case STR_ACTSET_OUTPUT:
/* TODO when loxi bug fixed if (!mb.supports(MatchField.ACTSET_OUTPUT)) {
log.warn("Match {} unsupported in OpenFlow version {}", MatchField.ACTSET_OUTPUT, ofVersion);
......@@ -1114,4 +1126,4 @@ public class MatchUtils {
}
return Integer.toString(p.getPortNumber());
}
}
\ No newline at end of file
}
......@@ -29,7 +29,7 @@ org.sdnplatform.sync.internal.SyncManager.nodes=[\
{"nodeId": 1, "domainId": 1, "hostname": "192.168.1.100", "port": 6642},\
{"nodeId": 2, "domainId": 1, "hostname": "192.168.1.100", "port": 6643}\
]
net.floodlightcontroller.forwarding.Forwarding.match=in-port, vlan, mac, ip, transport
net.floodlightcontroller.forwarding.Forwarding.match=in-port, vlan, mac, ip, transport, flag
net.floodlightcontroller.forwarding.Forwarding.detailed-match=src-mac, dst-mac, src-ip, dst-ip, src-transport, dst-transport
net.floodlightcontroller.forwarding.Forwarding.flood-arp=NO
net.floodlightcontroller.forwarding.Forwarding.idle-timeout=5
......@@ -66,4 +66,4 @@ net.floodlightcontroller.restserver.RestApiServer.accessControlAllowAllOrigins=T
net.floodlightcontroller.statistics.StatisticsCollector.enable=FALSE
net.floodlightcontroller.statistics.StatisticsCollector.collectionIntervalPortStatsSeconds=10
net.floodlightcontroller.topology.TopologyManager.pathMetric=latency
net.floodlightcontroller.topology.TopologyManager.maxPathsToCompute=3
\ No newline at end of file
net.floodlightcontroller.topology.TopologyManager.maxPathsToCompute=3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment