diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java index 7a26564353c63a2cf6dae2180db3ee64c0daab7a..97d71ba236e28526a06b2ed4cf9b6453a86431e6 100644 --- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java +++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java @@ -154,6 +154,11 @@ public class StaticFlowEntries { case OF_12: case OF_13: 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) { List<OFInstruction> instructions = fm.getInstructions(); for (OFInstruction inst : instructions) { @@ -297,6 +302,7 @@ public class StaticFlowEntries { break; } // end switch-case } // end while + return entry; } @@ -360,10 +366,13 @@ public class StaticFlowEntries { case StaticFlowEntryPusher.COLUMN_SWITCH: entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, jp.getText()); break; + case StaticFlowEntryPusher.COLUMN_TABLE_ID: + entry.put(StaticFlowEntryPusher.COLUMN_TABLE_ID, jp.getText()); + break; case StaticFlowEntryPusher.COLUMN_ACTIVE: entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, jp.getText()); 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()); break; case StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT: @@ -512,10 +521,7 @@ public class StaticFlowEntries { } else { log.debug("Got IP protocol of '{}' and tp-src of '{}' and tp-dst of '" + tpDstPort + "' via SFP REST API", ipProto, tpSrcPort); } - - - - + return entry; } } diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java index 7e734229ac62650297054ccd7b111efeef1aefe1..00540929f2e1ac22746af481001a9ec864631d78 100644 --- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java +++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java @@ -65,6 +65,7 @@ import org.projectfloodlight.openflow.protocol.OFPortDesc; import org.projectfloodlight.openflow.protocol.OFMessage; import org.projectfloodlight.openflow.protocol.OFType; import org.projectfloodlight.openflow.types.DatapathId; +import org.projectfloodlight.openflow.types.TableId; import org.projectfloodlight.openflow.types.U16; import org.projectfloodlight.openflow.types.U64; import org.slf4j.Logger; @@ -89,6 +90,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, public static final String TABLE_NAME = "controller_staticflowtableentry"; public static final String COLUMN_NAME = "name"; 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_IDLE_TIMEOUT = "idle_timeout"; public static final String COLUMN_HARD_TIMEOUT = "hard_timeout"; @@ -149,7 +151,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, public static final String COLUMN_INSTR_EXPERIMENTER = InstructionUtils.STR_EXPERIMENTER; 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_DL_SRC, COLUMN_DL_DST, COLUMN_DL_VLAN, COLUMN_DL_VLAN_PCP, COLUMN_DL_TYPE, COLUMN_NW_TOS, COLUMN_NW_PROTO, COLUMN_NW_SRC, @@ -360,6 +362,8 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, entries.get(switchName).put(entryName, null); // mark this an inactive 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)) { ActionUtils.fromString(fmb, (String) row.get(COLUMN_ACTIONS), log); } else if (key.equals(COLUMN_COOKIE)) { diff --git a/src/main/java/net/floodlightcontroller/testmodule/TestModule.java b/src/main/java/net/floodlightcontroller/testmodule/TestModule.java index c32afcad0d3c217b880cbb0534f7a12d1fac3ccb..3d131556b95dbffb7e6daba2eca9c259c24ad04b 100644 --- a/src/main/java/net/floodlightcontroller/testmodule/TestModule.java +++ b/src/main/java/net/floodlightcontroller/testmodule/TestModule.java @@ -36,6 +36,7 @@ import org.projectfloodlight.openflow.types.OFMetadata; import org.projectfloodlight.openflow.types.OFPort; import org.projectfloodlight.openflow.types.OFValueType; import org.projectfloodlight.openflow.types.OFVlanVidMatch; +import org.projectfloodlight.openflow.types.TableId; import org.projectfloodlight.openflow.types.TransportPort; import org.projectfloodlight.openflow.types.U32; import org.projectfloodlight.openflow.types.U8; @@ -124,7 +125,7 @@ public class TestModule implements IFloodlightModule, IOFSwitchListener { //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_SHA, MacAddress.BROADCAST); mb.setExact(MatchField.ARP_SPA, IPv4Address.of("130.127.39.241")); @@ -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().arpTha(MacAddress.BROADCAST))); 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); mb.setExact(MatchField.VLAN_PCP, VlanPcp.of((byte) 1)); // might as well test these now too diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties index 3dbacb7bae8f06c048021048013811e26471de85..8c52ea6e66abb8e0d19281be4e9d4f24c766b0c4 100644 --- a/src/main/resources/floodlightdefault.properties +++ b/src/main/resources/floodlightdefault.properties @@ -10,7 +10,7 @@ net.floodlightcontroller.debugevent.DebugEventService,\ net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher,\ net.floodlightcontroller.restserver.RestApiServer,\ net.floodlightcontroller.topology.TopologyManager,\ -net.floodlightcontroller.forwarding.Forwarding,\ +net.floodlightcontroller.testmodule.TestModule,\ net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager,\ net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl org.sdnplatform.sync.internal.SyncManager.authScheme=CHALLENGE_RESPONSE