Skip to content

Commit

Permalink
add test for checking that protected path is not marked as DOWN durin…
Browse files Browse the repository at this point in the history
…g intentional reroute
  • Loading branch information
andriidovhan committed Sep 6, 2019
1 parent bdbe7d7 commit 0033e81
Showing 1 changed file with 59 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,10 @@ class ProtectedPathSpec extends HealthCheckSpecification {
@Unroll
def "System reroutes #flowDescription flow to more preferable path and ignores protected path when reroute\
is intentional"() {
given: "Two active neighboring switches with two diverse paths at least"
// 'and ignores protected path' means that the main path won't changed to protected
given: "Two active neighboring switches with four diverse paths at least"
def switchPair = topologyHelper.getAllNeighboringSwitchPairs().find {
it.paths.unique(false) { a, b -> a.intersect(b) == [] ? 1 : 0 }.size() >= 2
it.paths.unique(false) { a, b -> a.intersect(b) == [] ? 1 : 0 }.size() >= 4
} ?: assumeTrue("No suiting switches found", false)

and: "A flow with protected path"
Expand Down Expand Up @@ -288,6 +289,7 @@ class ProtectedPathSpec extends HealthCheckSpecification {
def newCurrentPath = pathHelper.convert(flowPathInfoAfterRerouting)
newCurrentPath != currentPath
newCurrentPath != currentProtectedPath
//protected path is rerouted too, because more preferable path is exist
def newCurrentProtectedPath = pathHelper.convert(flowPathInfoAfterRerouting.protectedPath)
newCurrentProtectedPath != currentPath
newCurrentProtectedPath != currentProtectedPath
Expand All @@ -306,7 +308,7 @@ class ProtectedPathSpec extends HealthCheckSpecification {
@Unroll
def "System is able to switch #flowDescription flow to protected path and ignores more preferable path when reroute\
is automatical"() {
given: "Two active not neighboring switches with two diverse paths at least"
given: "Two active not neighboring switches with three diverse paths at least"
def switchPair = topologyHelper.getAllNotNeighboringSwitchPairs().find {
it.paths.unique(false) { a, b -> a.intersect(b) == [] ? 1 : 0 }.size() >= 3
} ?: assumeTrue("No suiting switches found", false)
Expand Down Expand Up @@ -1105,6 +1107,60 @@ class ProtectedPathSpec extends HealthCheckSpecification {
flowHelper.deleteFlow(flow.id)
}

@Ignore("https://github.com/telstra/open-kilda/issues/2762")
def "System reuses current protected path while intentional rerouting when non overlapping protected path is not \
available"() {
given: "Two active neighboring switches with three diverse paths"
def switchPair = topologyHelper.getAllNeighboringSwitchPairs().find {
it.paths.unique(false) { a, b -> a.intersect(b) == [] ? 1 : 0 }.size() == 3
} ?: assumeTrue("No suiting switches found", false)

and: "A flow with protected path"
def flow = flowHelper.randomFlow(switchPair)
flow.allocateProtectedPath = true
flowHelper.addFlow(flow)

def flowPathInfo = northbound.getFlowPath(flow.id)
assert flowPathInfo.protectedPath

def currentPath = pathHelper.convert(flowPathInfo)
def currentProtectedPath = pathHelper.convert(flowPathInfo.protectedPath)
assert currentPath != currentProtectedPath

when: "Make the current and protected path less preferable than alternatives"
def alternativePaths = switchPair.paths.findAll { it != currentPath && it != currentProtectedPath }
alternativePaths.each { pathHelper.makePathMorePreferable(it, currentPath) }
alternativePaths.each { pathHelper.makePathMorePreferable(it, currentProtectedPath) }

and: "Init intentional reroute"
def rerouteResponse = northbound.rerouteFlow(flow.id)

then: "Flow is rerouted"
rerouteResponse.rerouted

and: "Main path is not changed to protected path"
def flowPathInfoAfterRerouting = northbound.getFlowPath(flow.id)
def newCurrentPath = pathHelper.convert(flowPathInfoAfterRerouting)
newCurrentPath != currentPath
newCurrentPath != currentProtectedPath

and: "Protected path is not changed"
pathHelper.convert(flowPathInfoAfterRerouting.protectedPath) == currentProtectedPath

and: "Protected path is not marked as DOWN"
Wrappers.wait(WAIT_OFFSET) {
verifyAll(northbound.getFlow(flow.id)) {
status == "Up"
flowStatusDetails.mainFlowPathStatus == "Up"
flowStatusDetails.protectedFlowPathStatus == "Up"
}
}

and: "Cleanup: revert system to original state"
flowHelper.deleteFlow(flow.id)
northbound.deleteLinkProps(northbound.getAllLinkProps())
}

List<Integer> getCreatedMeterIds(SwitchId switchId) {
return northbound.getAllMeters(switchId).meterEntries.findAll {
it.meterId > MAX_SYSTEM_RULE_METER_ID
Expand Down

0 comments on commit 0033e81

Please sign in to comment.