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 4, 2019
1 parent bdbe7d7 commit f5195fa
Showing 1 changed file with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ 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"
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 //issue-2762
} ?: assumeTrue("No suiting switches found", false)

and: "A flow with protected path"
Expand Down Expand Up @@ -306,7 +306,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 +1105,60 @@ class ProtectedPathSpec extends HealthCheckSpecification {
flowHelper.deleteFlow(flow.id)
}

@Ignore("https://github.com/telstra/open-kilda/issues/2762")
def "System doesn't mark protected path as DOWN when can't find non overlapping protected path during intentional\
reroute"() {
given: "Two active neighboring switches with three diverse paths at least"
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 f5195fa

Please sign in to comment.