Skip to content
Snippets Groups Projects
Commit 96060548 authored by sanjivininaikar's avatar sanjivininaikar
Browse files

Update StaticFlowEntryPusher.java

Support for IPv6
parent 4aaa9178
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,7 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -90,7 +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"; 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";
...@@ -131,7 +131,19 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -131,7 +131,19 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
public static final String COLUMN_ARP_DHA = MatchUtils.STR_ARP_DHA; public static final String COLUMN_ARP_DHA = MatchUtils.STR_ARP_DHA;
public static final String COLUMN_ARP_SPA = MatchUtils.STR_ARP_SPA; public static final String COLUMN_ARP_SPA = MatchUtils.STR_ARP_SPA;
public static final String COLUMN_ARP_DPA = MatchUtils.STR_ARP_DPA; public static final String COLUMN_ARP_DPA = MatchUtils.STR_ARP_DPA;
//san
//IPv6 related columns
public static final String COLUMN_NW6_SRC = MatchUtils.STR_IPV6_SRC;
public static final String COLUMN_NW6_DST = MatchUtils.STR_IPV6_DST;
public static final String COLUMN_IPV6_FLOW_LABEL = MatchUtils.STR_IPV6_FLOW_LABEL;
public static final String COLUMN_ICMP6_TYPE = MatchUtils.STR_ICMPV6_TYPE;
public static final String COLUMN_ICMP6_CODE = MatchUtils.STR_ICMPV6_CODE;
public static final String COLUMN_ND_SLL = MatchUtils.STR_IPV6_ND_SLL;
public static final String COLUMN_ND_TLL = MatchUtils.STR_IPV6_ND_TLL;
public static final String COLUMN_ND_TARGET = MatchUtils.STR_IPV6_ND_TARGET;
//san
public static final String COLUMN_MPLS_LABEL = MatchUtils.STR_MPLS_LABEL; public static final String COLUMN_MPLS_LABEL = MatchUtils.STR_MPLS_LABEL;
public static final String COLUMN_MPLS_TC = MatchUtils.STR_MPLS_TC; public static final String COLUMN_MPLS_TC = MatchUtils.STR_MPLS_TC;
public static final String COLUMN_MPLS_BOS = MatchUtils.STR_MPLS_BOS; public static final String COLUMN_MPLS_BOS = MatchUtils.STR_MPLS_BOS;
...@@ -164,6 +176,11 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -164,6 +176,11 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
COLUMN_ICMP_TYPE, COLUMN_ICMP_CODE, COLUMN_ICMP_TYPE, COLUMN_ICMP_CODE,
COLUMN_ARP_OPCODE, COLUMN_ARP_SHA, COLUMN_ARP_DHA, COLUMN_ARP_OPCODE, COLUMN_ARP_SHA, COLUMN_ARP_DHA,
COLUMN_ARP_SPA, COLUMN_ARP_DPA, COLUMN_ARP_SPA, COLUMN_ARP_DPA,
//san
//IPv6 related matches
COLUMN_NW6_SRC, COLUMN_NW6_DST, COLUMN_ICMP6_TYPE, COLUMN_ICMP6_CODE,
COLUMN_IPV6_FLOW_LABEL, COLUMN_ND_SLL, COLUMN_ND_TLL, COLUMN_ND_TARGET,
//san
COLUMN_MPLS_LABEL, COLUMN_MPLS_TC, COLUMN_MPLS_BOS, COLUMN_MPLS_LABEL, COLUMN_MPLS_TC, COLUMN_MPLS_BOS,
COLUMN_METADATA, COLUMN_TUNNEL_ID, COLUMN_PBB_ISID, COLUMN_METADATA, COLUMN_TUNNEL_ID, COLUMN_PBB_ISID,
/* end newly added matches */ /* end newly added matches */
...@@ -343,6 +360,9 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -343,6 +360,9 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
// get the correct builder for the OF version supported by the switch // get the correct builder for the OF version supported by the switch
fmb = OFFactories.getFactory(switchService.getSwitch(DatapathId.of(switchName)).getOFFactory().getVersion()).buildFlowModify(); fmb = OFFactories.getFactory(switchService.getSwitch(DatapathId.of(switchName)).getOFFactory().getVersion()).buildFlowModify();
//HashSet<OFFlowModFlags> flags = new HashSet<OFFlowModFlags>();
//flags.add(OFFlowModFlags.CHECK_OVERLAP);
//fmb.setFlags(flags);
StaticFlowEntries.initDefaultFlowMod(fmb, entryName); StaticFlowEntries.initDefaultFlowMod(fmb, entryName);
...@@ -408,7 +428,13 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -408,7 +428,13 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
log.debug("ignoring flow entry {} on switch {} with illegal OFMatch() key: " + match, entryName, switchName); log.debug("ignoring flow entry {} on switch {} with illegal OFMatch() key: " + match, entryName, switchName);
return; return;
} }
//san
catch (HeaderFieldsException e) {
log.error("OF version incompatible for the match: " + match);
e.printStackTrace();
return;
}
//san
entries.get(switchName).put(entryName, fmb.build()); // add the FlowMod message to the table entries.get(switchName).put(entryName, fmb.build()); // add the FlowMod message to the table
} }
...@@ -505,7 +531,6 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -505,7 +531,6 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
} else if (newFlowMod != null && oldFlowMod == null) { } else if (newFlowMod != null && oldFlowMod == null) {
OFFlowAdd addTmp = FlowModUtils.toFlowAdd(newFlowMod); OFFlowAdd addTmp = FlowModUtils.toFlowAdd(newFlowMod);
entriesFromStorage.get(dpid).put(entry, addTmp); entriesFromStorage.get(dpid).put(entry, addTmp);
entry2dpid.put(entry, dpid);
outQueue.add(addTmp); outQueue.add(addTmp);
/* Something strange happened, so remove the flow */ /* Something strange happened, so remove the flow */
} else if (newFlowMod == null) { } else if (newFlowMod == null) {
...@@ -753,9 +778,15 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, ...@@ -753,9 +778,15 @@ implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService,
// IStaticFlowEntryPusherService methods // IStaticFlowEntryPusherService methods
@Override @Override
public void addFlow(String name, OFFlowMod fm, DatapathId swDpid) { public void addFlow(String name, OFFlowMod fm, DatapathId swDpid) {
Map<String, Object> fmMap = StaticFlowEntries.flowModToStorageEntry(fm, swDpid.toString(), name); try {
storageSourceService.insertRowAsync(TABLE_NAME, fmMap); Map<String, Object> fmMap = StaticFlowEntries.flowModToStorageEntry(fm, swDpid.toString(), name);
storageSourceService.insertRowAsync(TABLE_NAME, fmMap);
} catch (HeaderFieldsException e) {
log.error("Error! Check the fields specified for the flow.Make sure IPv4 fields are not mixed with IPv6 fields or all "
+ "mandatory fields are specified. ");
}
} }
@Override @Override
......
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