Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE=10563 FSFW conflict detection logs will now report what exactly caused the conflict, opposed to just reporting a conflict. #106

Open
wants to merge 1 commit into
base: 1.0.5-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FlowSpaceFirewall</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ private static boolean isValidConfig(List<HashMap<Long, Slicer>> slices){
if(otherSlice.containsKey(dpid)){
Slicer otherConfig = otherSlice.get(dpid);
if(otherConfig.getSliceName() != config.getSliceName()){
if(config.hasOverlap(otherConfig)){
if(config.hasOverlap(otherConfig) != null){
log.warn("Overlap detected between slice "+config.getSliceName()+" and slice "
+otherConfig.getSliceName()+" will not load this configuration");
log.warn(config.hasOverlap(otherConfig)); //hasOverlap returns the details of the overlap.
return false;
}
}
Expand Down Expand Up @@ -199,8 +200,7 @@ public static ArrayList<HashMap<Long, Slicer>> parseConfig(String xmlFile) throw
}
if(tag_management && Short.parseShort(range.getAttributes().getNamedItem("start").getTextContent()) != Short.parseShort(range.getAttributes().getNamedItem("end").getTextContent())){
log.error("Tag Mangement can only be used on a single VLAN, please fix config and try again");
newSlices.clear();
return newSlices;
throw new InvalidConfigException("Configuration is not valid!");
}
for(short m = Short.parseShort(range.getAttributes().getNamedItem("start").getTextContent());
m <= Short.parseShort(range.getAttributes().getNamedItem("end").getTextContent()); m++){
Expand All @@ -213,8 +213,7 @@ public static ArrayList<HashMap<Long, Slicer>> parseConfig(String xmlFile) throw
slicer.setPortConfig(pConfig.getPortName(), pConfig);
if(tag_management == true && myRange.getAvailableTags().length > 1){
log.error("Tag Management can only be used on a single VLAN, please fix config and try again");
newSlices.clear();
return newSlices;
throw new InvalidConfigException("Configuration is not valid!");
}
}
//add the slicer to the whole slice container (all switches)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/iu/grnoc/flowspace_firewall/Slicer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface Slicer {
PortConfig getPortConfig(String portName);
PortConfig getPortConfig(short portId);
boolean isOkToProcessMessage();
boolean hasOverlap(Slicer otherSlicer);
String hasOverlap(Slicer otherSlicer);
String getSliceName();
void setSliceName(String name);
double getRate();
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/edu/iu/grnoc/flowspace_firewall/VLANSlicer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1106,16 +1106,17 @@ public void setSliceName(String name){
this.name = name;
}

public boolean hasOverlap(Slicer otherSlicer){
public String hasOverlap(Slicer otherSlicer){
String error_detail = null;
for(String portName : this.portList.keySet()){
if(otherSlicer.isPortPartOfSlice(portName)){
if(this.getPortConfig(portName).getVlanRange().rangeOverlap(otherSlicer.getPortConfig(portName).getVlanRange())){
log.error(""+this.name+" "+this.getSliceName()+"port range: "+this.getPortConfig(portName).getVlanRange().toString()+ "overlaps with slice: "+otherSlicer.getSliceName()+" port-range: "+otherSlicer.getPortConfig(portName).getVlanRange().toString());
return true;
return ""+this.name+" "+this.getSliceName()+"port range: "+this.getPortConfig(portName).getVlanRange().toString()+ "overlaps with slice: "+otherSlicer.getSliceName()+" port-range: "+otherSlicer.getPortConfig(portName).getVlanRange().toString();
}
}
}
return false;
return error_detail;
}

public IOFSwitch getSwitch(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ public void testHasOverlap(){
pConfig6.setVLANRange(range);
otherSlicer.setPortConfig("foo6", pConfig6);

assertFalse(slicer.hasOverlap(otherSlicer));
assertNull(slicer.hasOverlap(otherSlicer));

pConfig = new PortConfig();
pConfig.setPortName("foo");
Expand All @@ -611,7 +611,7 @@ public void testHasOverlap(){
range.setVlanAvail((short)1000,true);
pConfig.setVLANRange(range);
otherSlicer.setPortConfig("foo", pConfig);
assertTrue(slicer.hasOverlap(otherSlicer));
assertNotNull(slicer.hasOverlap(otherSlicer));
}

/*
Expand Down