-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from Echtzeitsysteme/hotfix/model-affected-paths
Adds tests for affected paths + adds repair/update functionality to all VNE algorithms that operate with paths
- Loading branch information
Showing
19 changed files
with
729 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
test.suite/src/test/algorithms/generic/AVneAlgorithmPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package test.algorithms.generic; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
|
||
/** | ||
* Abstract test class for a VNE algorithm implementation to trigger the minimum | ||
* path/link bandwidth bug. This test is based on a scenario created by Marco | ||
* Volle in his master's thesis. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public abstract class AVneAlgorithmPathBandwidthBugTest extends AAlgorithmTest { | ||
|
||
/** | ||
* Substrate network. | ||
*/ | ||
SubstrateNetwork sNet; | ||
|
||
/** | ||
* Virtual network. | ||
*/ | ||
VirtualNetwork vNet; | ||
|
||
@Override | ||
public abstract void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets); | ||
|
||
@AfterEach | ||
public abstract void resetAlgo(); | ||
|
||
@BeforeEach | ||
public void reset() { | ||
facade.resetAll(); | ||
} | ||
|
||
// | ||
// Tests | ||
// | ||
|
||
@Test | ||
public void testScenario34() { | ||
// Load the model file | ||
facade.loadModel("resources/triggerPathResidualBwBug.xmi"); | ||
assertNotNull(facade.getNetworkById("sub")); | ||
assertFalse(facade.getAllPathsOfNetwork("sub").isEmpty()); | ||
|
||
assertThrows(InternalError.class, () -> { | ||
facade.validateModel(); | ||
}); | ||
|
||
facade.updateAllPathsResidualBandwidth("sub"); | ||
|
||
// validation must not fail before the embedding | ||
facade.validateModel(); | ||
|
||
sNet = (SubstrateNetwork) facade.getNetworkById("sub"); | ||
vNet = (VirtualNetwork) facade.getNetworkById("v4"); | ||
|
||
// Sanity check | ||
assertNotNull(sNet); | ||
assertNotNull(vNet); | ||
assertNull(vNet.getHost()); | ||
|
||
initAlgo(sNet, Set.of(vNet)); | ||
assertTrue(algo.execute()); | ||
|
||
// validation must not fail | ||
facade.validateModel(); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
test.suite/src/test/algorithms/gips/VneGipsAlgorithmPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package test.algorithms.gips; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.AlgorithmConfig; | ||
import algorithms.AlgorithmConfig.Objective; | ||
import algorithms.gips.VneGipsAlgorithm; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class for the VNE GIPS algorithm implementation to trigger the minimum | ||
* path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public class VneGipsAlgorithmPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
// The algorithm is only able to use the total communication objective C because | ||
// it is hard-coded in GIPSL | ||
AlgorithmConfig.obj = Objective.TOTAL_COMMUNICATION_OBJECTIVE_C; | ||
algo = VneGipsAlgorithm.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VneGipsAlgorithm) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...ite/src/test/algorithms/gips/migration/VneGipsMigrationAlgorithmPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package test.algorithms.gips.migration; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.AlgorithmConfig; | ||
import algorithms.AlgorithmConfig.Objective; | ||
import algorithms.gips.VneGipsMigrationAlgorithm; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class for the VNE GIPS migration algorithm implementation to trigger the | ||
* minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public class VneGipsMigrationAlgorithmPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
// The algorithm is only able to use the total communication objective C because | ||
// it is hard-coded in GIPSL | ||
AlgorithmConfig.obj = Objective.TOTAL_COMMUNICATION_OBJECTIVE_C; | ||
algo = VneGipsMigrationAlgorithm.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VneGipsMigrationAlgorithm) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
test.suite/src/test/algorithms/gips/seq/VneGipsSeqAlgorithmPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package test.algorithms.gips.seq; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.AlgorithmConfig; | ||
import algorithms.AlgorithmConfig.Objective; | ||
import algorithms.gips.VneGipsSeqAlgorithm; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class for the VNE GIPS sequence algorithm implementation to trigger the | ||
* minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public class VneGipsSeqAlgorithmPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
// The algorithm is only able to use the total communication objective C because | ||
// it is hard-coded in GIPSL | ||
AlgorithmConfig.obj = Objective.TOTAL_COMMUNICATION_OBJECTIVE_C; | ||
algo = VneGipsSeqAlgorithm.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VneGipsSeqAlgorithm) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
test.suite/src/test/algorithms/pm/VnePmMdvneAlgorithmPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package test.algorithms.pm; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.AlgorithmConfig; | ||
import algorithms.AlgorithmConfig.Objective; | ||
import algorithms.pm.VnePmMdvneAlgorithm; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class to trigger the minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public class VnePmMdvneAlgorithmPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
// The algorithm is only able to use the total communication objective C because | ||
// it is hard-coded in GIPSL | ||
AlgorithmConfig.obj = Objective.TOTAL_COMMUNICATION_OBJECTIVE_C; | ||
algo = VnePmMdvneAlgorithm.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VnePmMdvneAlgorithm) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...te/src/test/algorithms/pm/migration/VnePmMdvneAlgorithmMigrationPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package test.algorithms.pm.migration; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.AlgorithmConfig; | ||
import algorithms.AlgorithmConfig.Objective; | ||
import algorithms.pm.VnePmMdvneAlgorithmMigration; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class to trigger the minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
public class VnePmMdvneAlgorithmMigrationPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
// The algorithm is only able to use the total communication objective C because | ||
// it is hard-coded in GIPSL | ||
AlgorithmConfig.obj = Objective.TOTAL_COMMUNICATION_OBJECTIVE_C; | ||
algo = VnePmMdvneAlgorithmMigration.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VnePmMdvneAlgorithmMigration) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...t/algorithms/pm/pipeline/VnePmMdvneAlgorithmPipelineThreeStagesAPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package test.algorithms.pm.pipeline; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.pm.VnePmMdvneAlgorithmPipelineThreeStagesA; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class to trigger the minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
//@Disabled | ||
public class VnePmMdvneAlgorithmPipelineThreeStagesAPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
algo = VnePmMdvneAlgorithmPipelineThreeStagesA.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VnePmMdvneAlgorithmPipelineThreeStagesA) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...t/algorithms/pm/pipeline/VnePmMdvneAlgorithmPipelineThreeStagesBPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package test.algorithms.pm.pipeline; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.pm.VnePmMdvneAlgorithmPipelineThreeStagesB; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class to trigger the minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
//@Disabled | ||
public class VnePmMdvneAlgorithmPipelineThreeStagesBPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
algo = VnePmMdvneAlgorithmPipelineThreeStagesB.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VnePmMdvneAlgorithmPipelineThreeStagesB) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...algorithms/pm/pipeline/VnePmMdvneAlgorithmPipelineTwoStagesRackAPathBandwidthBugTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package test.algorithms.pm.pipeline; | ||
|
||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
|
||
import algorithms.pm.VnePmMdvneAlgorithmPipelineTwoStagesRackA; | ||
import model.SubstrateNetwork; | ||
import model.VirtualNetwork; | ||
import test.algorithms.generic.AVneAlgorithmPathBandwidthBugTest; | ||
|
||
/** | ||
* Test class to trigger the minimum path/link bandwidth bug. | ||
* | ||
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>} | ||
*/ | ||
//@Disabled | ||
public class VnePmMdvneAlgorithmPipelineTwoStagesRackAPathBandwidthBugTest extends AVneAlgorithmPathBandwidthBugTest { | ||
|
||
@Override | ||
public void initAlgo(final SubstrateNetwork sNet, final Set<VirtualNetwork> vNets) { | ||
algo = VnePmMdvneAlgorithmPipelineTwoStagesRackA.prepare(sNet, vNets); | ||
} | ||
|
||
@AfterEach | ||
public void resetAlgo() { | ||
facade.resetAll(); | ||
if (algo != null) { | ||
((VnePmMdvneAlgorithmPipelineTwoStagesRackA) algo).dispose(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.