Skip to content
Snippets Groups Projects
Commit 56efbe06 authored by Ryan Izard's avatar Ryan Izard
Browse files

Added support for multiple flow tables in Static Flow Pusher.

parent 4007d057
No related branches found
No related tags found
No related merge requests found
...@@ -154,6 +154,11 @@ public class StaticFlowEntries { ...@@ -154,6 +154,11 @@ public class StaticFlowEntries {
case OF_12: case OF_12:
case OF_13: case OF_13:
default: default:
// should have a table ID present
if (fm.getTableId() != null) { // if not set, then don't worry about it. Default will be set when built and sent to switch
entry.put(StaticFlowEntryPusher.COLUMN_TABLE_ID, Short.toString(fm.getTableId().getValue()));
}
// should have a list of instructions, of which apply and write actions could have sublists of actions
if (fm.getInstructions() != null) { if (fm.getInstructions() != null) {
List<OFInstruction> instructions = fm.getInstructions(); List<OFInstruction> instructions = fm.getInstructions();
for (OFInstruction inst : instructions) { for (OFInstruction inst : instructions) {
...@@ -297,6 +302,7 @@ public class StaticFlowEntries { ...@@ -297,6 +302,7 @@ public class StaticFlowEntries {
break; break;
} // end switch-case } // end switch-case
} // end while } // end while
return entry; return entry;
} }
...@@ -360,10 +366,13 @@ public class StaticFlowEntries { ...@@ -360,10 +366,13 @@ public class StaticFlowEntries {
case StaticFlowEntryPusher.COLUMN_SWITCH: case StaticFlowEntryPusher.COLUMN_SWITCH:
entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, jp.getText()); entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, jp.getText());
break; break;
case StaticFlowEntryPusher.COLUMN_TABLE_ID:
entry.put(StaticFlowEntryPusher.COLUMN_TABLE_ID, jp.getText());
break;
case StaticFlowEntryPusher.COLUMN_ACTIVE: case StaticFlowEntryPusher.COLUMN_ACTIVE:
entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, jp.getText()); entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, jp.getText());
break; break;
case StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT: // store TO's, but conditionally push them case StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT: // TODO @Ryan always store TO's, but conditionally push them (the conditional push hasn't been done yet)
entry.put(StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT, jp.getText()); entry.put(StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT, jp.getText());
break; break;
case StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT: case StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT:
...@@ -512,10 +521,7 @@ public class StaticFlowEntries { ...@@ -512,10 +521,7 @@ public class StaticFlowEntries {
} else { } else {
log.debug("Got IP protocol of '{}' and tp-src of '{}' and tp-dst of '" + tpDstPort + "' via SFP REST API", ipProto, tpSrcPort); log.debug("Got IP protocol of '{}' and tp-src of '{}' and tp-dst of '" + tpDstPort + "' via SFP REST API", ipProto, tpSrcPort);
} }
return entry; return entry;
} }
} }
......
...@@ -65,6 +65,7 @@ import org.projectfloodlight.openflow.protocol.OFPortDesc; ...@@ -65,6 +65,7 @@ import org.projectfloodlight.openflow.protocol.OFPortDesc;
import org.projectfloodlight.openflow.protocol.OFMessage; import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFType; import org.projectfloodlight.openflow.protocol.OFType;
import org.projectfloodlight.openflow.types.DatapathId; import org.projectfloodlight.openflow.types.DatapathId;
import org.projectfloodlight.openflow.types.TableId;
import org.projectfloodlight.openflow.types.U16; import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U64; import org.projectfloodlight.openflow.types.U64;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -89,6 +90,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -89,6 +90,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
public static final String TABLE_NAME = "controller_staticflowtableentry"; public static final String TABLE_NAME = "controller_staticflowtableentry";
public static final String COLUMN_NAME = "name"; public static final String COLUMN_NAME = "name";
public static final String COLUMN_SWITCH = "switch"; public static final String COLUMN_SWITCH = "switch";
public static final String COLUMN_TABLE_ID = "table_id";
public static final String COLUMN_ACTIVE = "active"; public static final String COLUMN_ACTIVE = "active";
public static final String COLUMN_IDLE_TIMEOUT = "idle_timeout"; public static final String COLUMN_IDLE_TIMEOUT = "idle_timeout";
public static final String COLUMN_HARD_TIMEOUT = "hard_timeout"; public static final String COLUMN_HARD_TIMEOUT = "hard_timeout";
...@@ -149,7 +151,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -149,7 +151,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
public static final String COLUMN_INSTR_EXPERIMENTER = InstructionUtils.STR_EXPERIMENTER; public static final String COLUMN_INSTR_EXPERIMENTER = InstructionUtils.STR_EXPERIMENTER;
public static String ColumnNames[] = { COLUMN_NAME, COLUMN_SWITCH, public static String ColumnNames[] = { COLUMN_NAME, COLUMN_SWITCH,
COLUMN_ACTIVE, COLUMN_IDLE_TIMEOUT, COLUMN_HARD_TIMEOUT, COLUMN_TABLE_ID, COLUMN_ACTIVE, COLUMN_IDLE_TIMEOUT, COLUMN_HARD_TIMEOUT, // table id is new for OF1.3 as well
COLUMN_PRIORITY, COLUMN_COOKIE, COLUMN_IN_PORT, COLUMN_PRIORITY, COLUMN_COOKIE, COLUMN_IN_PORT,
COLUMN_DL_SRC, COLUMN_DL_DST, COLUMN_DL_VLAN, COLUMN_DL_VLAN_PCP, COLUMN_DL_SRC, COLUMN_DL_DST, COLUMN_DL_VLAN, COLUMN_DL_VLAN_PCP,
COLUMN_DL_TYPE, COLUMN_NW_TOS, COLUMN_NW_PROTO, COLUMN_NW_SRC, COLUMN_DL_TYPE, COLUMN_NW_TOS, COLUMN_NW_PROTO, COLUMN_NW_SRC,
...@@ -360,6 +362,8 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -360,6 +362,8 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
entries.get(switchName).put(entryName, null); // mark this an inactive entries.get(switchName).put(entryName, null); // mark this an inactive
return; return;
} }
} else if (key.equals(COLUMN_TABLE_ID)) {
fmb.setTableId(TableId.of(Integer.parseInt((String) row.get(key)))); // support multiple flow tables for OF1.1+
} else if (key.equals(COLUMN_ACTIONS)) { } else if (key.equals(COLUMN_ACTIONS)) {
ActionUtils.fromString(fmb, (String) row.get(COLUMN_ACTIONS), log); ActionUtils.fromString(fmb, (String) row.get(COLUMN_ACTIONS), log);
} else if (key.equals(COLUMN_COOKIE)) { } else if (key.equals(COLUMN_COOKIE)) {
......
...@@ -36,6 +36,7 @@ import org.projectfloodlight.openflow.types.OFMetadata; ...@@ -36,6 +36,7 @@ import org.projectfloodlight.openflow.types.OFMetadata;
import org.projectfloodlight.openflow.types.OFPort; import org.projectfloodlight.openflow.types.OFPort;
import org.projectfloodlight.openflow.types.OFValueType; import org.projectfloodlight.openflow.types.OFValueType;
import org.projectfloodlight.openflow.types.OFVlanVidMatch; import org.projectfloodlight.openflow.types.OFVlanVidMatch;
import org.projectfloodlight.openflow.types.TableId;
import org.projectfloodlight.openflow.types.TransportPort; import org.projectfloodlight.openflow.types.TransportPort;
import org.projectfloodlight.openflow.types.U32; import org.projectfloodlight.openflow.types.U32;
import org.projectfloodlight.openflow.types.U8; import org.projectfloodlight.openflow.types.U8;
...@@ -124,7 +125,7 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener { ...@@ -124,7 +125,7 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener {
//actions.add(factory.actions().setField(factory.oxms().icmpv4Type(ICMPv4Type.ALTERNATE_HOST_ADDRESS))); */ //actions.add(factory.actions().setField(factory.oxms().icmpv4Type(ICMPv4Type.ALTERNATE_HOST_ADDRESS))); */
/* ARP TESTS mb.setExact(MatchField.ETH_TYPE, EthType.ARP); /* ARP TESTS */ mb.setExact(MatchField.ETH_TYPE, EthType.ARP);
mb.setExact(MatchField.ARP_OP, ArpOpcode.REQUEST); mb.setExact(MatchField.ARP_OP, ArpOpcode.REQUEST);
mb.setExact(MatchField.ARP_SHA, MacAddress.BROADCAST); mb.setExact(MatchField.ARP_SHA, MacAddress.BROADCAST);
mb.setExact(MatchField.ARP_SPA, IPv4Address.of("130.127.39.241")); mb.setExact(MatchField.ARP_SPA, IPv4Address.of("130.127.39.241"));
...@@ -136,7 +137,8 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener { ...@@ -136,7 +137,8 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener {
actions.add(factory.actions().setField(factory.oxms().arpSha(MacAddress.BROADCAST))); actions.add(factory.actions().setField(factory.oxms().arpSha(MacAddress.BROADCAST)));
actions.add(factory.actions().setField(factory.oxms().arpTha(MacAddress.BROADCAST))); actions.add(factory.actions().setField(factory.oxms().arpTha(MacAddress.BROADCAST)));
actions.add(factory.actions().setField(factory.oxms().arpSpa(IPv4Address.of("255.255.255.255")))); actions.add(factory.actions().setField(factory.oxms().arpSpa(IPv4Address.of("255.255.255.255"))));
actions.add(factory.actions().setField(factory.oxms().arpTpa(IPv4Address.of("255.255.255.255")))); */ actions.add(factory.actions().setField(factory.oxms().arpTpa(IPv4Address.of("255.255.255.255"))));
fmb.setTableId(TableId.of(16));
/* TP, IP OPT, VLAN TESTS mb.setExact(MatchField.ETH_TYPE, EthType.IPv4); /* TP, IP OPT, VLAN TESTS mb.setExact(MatchField.ETH_TYPE, EthType.IPv4);
mb.setExact(MatchField.VLAN_PCP, VlanPcp.of((byte) 1)); // might as well test these now too mb.setExact(MatchField.VLAN_PCP, VlanPcp.of((byte) 1)); // might as well test these now too
......
...@@ -10,7 +10,7 @@ net.floodlightcontroller.debugevent.DebugEventService,\ ...@@ -10,7 +10,7 @@ net.floodlightcontroller.debugevent.DebugEventService,\
net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\ net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\
net.floodlightcontroller.restserver.RestApiServer,\ net.floodlightcontroller.restserver.RestApiServer,\
net.floodlightcontroller.topology.TopologyManager,\ net.floodlightcontroller.topology.TopologyManager,\
net.floodlightcontroller.forwarding.Forwarding,\ net.floodlightcontroller.testmodule.TestModule,\
net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager,\ net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager,\
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl
org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE
......
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