-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4964: add information about LACP connection tests
* Added new test for LACP connection * New class LAG representing LAG business entity * New experimental approach to switches picking * Implemented new methods for new traffgen feature
- Loading branch information
Showing
9 changed files
with
216 additions
and
36 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
...g/functional-tests/src/main/groovy/org/openkilda/functionaltests/helpers/model/LAG.groovy
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,85 @@ | ||
package org.openkilda.functionaltests.helpers.model | ||
|
||
import org.openkilda.northbound.dto.v2.switches.LagPortRequest | ||
import org.openkilda.testing.model.topology.TopologyDefinition | ||
import org.openkilda.testing.service.northbound.NorthboundServiceV2 | ||
import org.openkilda.testing.service.traffexam.model.LacpData | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.beans.factory.annotation.Qualifier | ||
import org.springframework.stereotype.Component | ||
|
||
/* This class represents Link Aggregation Group */ | ||
class LAG { | ||
NorthboundServiceV2 northboundServiceV2 | ||
TopologyDefinition.Switch aSwitch | ||
Integer physicalPort1 | ||
Integer physicalPort2 | ||
Integer logicalPort = null | ||
Boolean lacpReply | ||
|
||
LAG(NorthboundServiceV2 northboundServiceV2, | ||
TopologyDefinition.Switch aSwitch, | ||
Integer physicalPort1, | ||
Integer physicalPort2, | ||
Boolean lacpReply) { | ||
this.northboundServiceV2 = northboundServiceV2 | ||
this.aSwitch = aSwitch | ||
this.physicalPort1 = physicalPort1 | ||
this.physicalPort2 = physicalPort2 | ||
this.lacpReply = lacpReply | ||
} | ||
|
||
void create() { | ||
def payload = new LagPortRequest([physicalPort1, physicalPort2] as Set<Integer>, lacpReply) | ||
def response = northboundServiceV2.createLagLogicalPort(aSwitch.getDpId(), payload) | ||
logicalPort = response.getLogicalPortNumber() | ||
} | ||
|
||
void delete() { | ||
northboundServiceV2.deleteLagLogicalPort(aSwitch.getDpId(), logicalPort) | ||
} | ||
|
||
LacpData getLacpData() { | ||
def data = northboundServiceV2.getLacpPortStatus(aSwitch.getDpId(), logicalPort).getData() | ||
|
||
return LacpData.builder() | ||
.expired(data.stateExpired) | ||
.defaulted(data.stateDefaulted) | ||
.distributing(data.stateDistributing) | ||
.collecting(data.stateCollecting) | ||
.synchronization(data.stateSynchronised) | ||
.aggregation(data.stateAggregatable) | ||
.lacpTimeout(data.stateShortTimeout) | ||
.lacpActivity(data.stateActive) | ||
.build() | ||
} | ||
} | ||
|
||
|
||
@Component | ||
class LAGFactory { | ||
@Autowired @Qualifier("islandNbV2") | ||
NorthboundServiceV2 northboundServiceV2 | ||
@Autowired | ||
TopologyDefinition toplogy | ||
|
||
LAG get(TopologyDefinition.Switch aSwitch, | ||
Integer physicalPort1, | ||
Integer physicalPort2, | ||
Boolean lacpReply=false) { | ||
return new LAG(northboundServiceV2, aSwitch, physicalPort1, physicalPort2, lacpReply) | ||
} | ||
|
||
LAG get(TopologyDefinition.Switch aSwitch) { | ||
def ports = this.toplogy.getAllowedPortsForSwitch(aSwitch).shuffled()[0, 1] | ||
return this.get(aSwitch, ports[0], ports[1]) | ||
} | ||
|
||
LAG get(TopologyDefinition.Switch aSwitch, Integer mandatoryPhysicalPort, Boolean lacpReply) { | ||
def freePorts = toplogy.getAllowedPortsForSwitch(aSwitch) | ||
freePorts.removeAll([mandatoryPhysicalPort]) | ||
def additionalPort = freePorts.shuffled().first() | ||
return this.get(aSwitch, mandatoryPhysicalPort, additionalPort, lacpReply) | ||
} | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
...nal-tests/src/main/groovy/org/openkilda/functionaltests/helpers/model/SwitchFilter.groovy
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,7 @@ | ||
package org.openkilda.functionaltests.helpers.model; | ||
|
||
import org.openkilda.testing.model.topology.TopologyDefinition.Switch | ||
|
||
class SwitchFilter { | ||
static final Closure<List<Switch>> HAS_CONNECTED_TRAFFGENS = { Switch sw -> !sw.getTraffGens().empty} | ||
} |
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
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
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
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
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
46 changes: 46 additions & 0 deletions
46
...ng/test-library/src/main/java/org/openkilda/testing/service/traffexam/model/LacpData.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,46 @@ | ||
/* Copyright 2019 Telstra Open Source | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openkilda.testing.service.traffexam.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
|
||
@Data | ||
@Builder | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
public class LacpData { | ||
@NonNull | ||
Boolean expired; | ||
@NonNull | ||
Boolean defaulted; | ||
@NonNull | ||
Boolean distributing; | ||
@NonNull | ||
Boolean collecting; | ||
@NonNull | ||
Boolean synchronization; | ||
@NonNull | ||
Boolean aggregation; | ||
@NonNull | ||
Boolean lacpTimeout; | ||
@NonNull | ||
Boolean lacpActivity; | ||
} |
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