Skip to content

Commit

Permalink
Merge branch 'release-1.113.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei-durakov committed Jan 25, 2022
2 parents 02e6d83 + 64a5bad commit 6def1bd
Show file tree
Hide file tree
Showing 50 changed files with 1,260 additions and 465 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## v1.113.0 (25/01/2022)

### Features:
- [#4651](https://github.com/telstra/open-kilda/pull/4651) Y Flow Ping: API [**northbound**][**storm-topologies**]
- [#4663](https://github.com/telstra/open-kilda/pull/4663) Y Flow Ping: manual ping [**storm-topologies**]

### Bug Fixes:
- [#4664](https://github.com/telstra/open-kilda/pull/4664) Changed Kafka and Zookeeper ports in unit tests (Issue: [#4529](https://github.com/telstra/open-kilda/issues/4529)) [**tests**]
- [#4669](https://github.com/telstra/open-kilda/pull/4669) Fix `deepCopy` method for YFlow

### Improvements:
- [#4672](https://github.com/telstra/open-kilda/pull/4672) [test] ignore latency related fields in partUpdateSpec [**tests**]
- [#4535](https://github.com/telstra/open-kilda/pull/4535) Cleanup mappers code [**northbound**][**storm-topologies**]
- [#4659](https://github.com/telstra/open-kilda/pull/4659) [test] fix FlowRulesSpec(find sharedRule) [**tests**]
- [#4662](https://github.com/telstra/open-kilda/pull/4662) [test] fix "cleanup" in partialUpdateSpec [**tests**]
- [#4665](https://github.com/telstra/open-kilda/pull/4665) Remove unused classes from Ping topology [**storm-topologies**]
- [#4670](https://github.com/telstra/open-kilda/pull/4670) [test] check that flow is up after updating in swapEndpSpec [**tests**]


For the complete list of changes, check out [the commit log](https://github.com/telstra/open-kilda/compare/v1.112.0...v1.113.0).

### Affected Components:
flow-hs, flow-monitor, nb, ping, nbworker, swmanager

---

## v1.112.0 (12/01/2022)

### Features:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
/**
* Convert {@link Flow} to {@link FlowDto} and back.
*/
@Mapper(uses = {FlowPathMapper.class, DetectConnectedDevicesMapper.class}, imports = {FlowStatusDetails.class})
@Mapper(uses = {FlowPathMapper.class, DetectConnectedDevicesMapper.class})
public abstract class FlowMapper {

public static final FlowMapper INSTANCE = Mappers.getMapper(FlowMapper.class);
Expand All @@ -61,15 +61,12 @@ public abstract class FlowMapper {
@Mapping(source = "destPort", target = "destinationPort")
@Mapping(source = "destVlan", target = "destinationVlan")
@Mapping(source = "destInnerVlan", target = "destinationInnerVlan")
@Mapping(target = "sourceSwitch", expression = "java(flow.getSrcSwitchId())")
@Mapping(target = "destinationSwitch", expression = "java(flow.getDestSwitchId())")
@Mapping(source = "srcSwitchId", target = "sourceSwitch")
@Mapping(source = "destSwitchId", target = "destinationSwitch")
@Mapping(source = "status", target = "state")
@Mapping(source = "timeModify", target = "lastUpdated")
@Mapping(source = "timeCreate", target = "createdTime")
@Mapping(target = "flowStatusDetails",
expression = "java(flow.isAllocateProtectedPath() ? "
+ "new FlowStatusDetails(flow.getMainFlowPrioritizedPathsStatus(), "
+ "flow.getProtectedFlowPrioritizedPathsStatus()) : null)")
@Mapping(target = "flowStatusDetails", source = "flow")
@Mapping(target = "cookie", ignore = true)
@Mapping(target = "meterId", ignore = true)
@Mapping(target = "transitEncapsulationId", ignore = true)
Expand Down Expand Up @@ -274,6 +271,17 @@ private FlowPath buildPath(FlowDto flowDto) {
.build();
}

/**
* Extract {@link FlowStatusDetails} from {@link Flow}.
*/
public FlowStatusDetails buildStatusDetails(Flow flow) {
if (flow != null && flow.isAllocateProtectedPath()) {
return new FlowStatusDetails(
flow.getMainFlowPrioritizedPathsStatus(), flow.getProtectedFlowPrioritizedPathsStatus());
}
return null;
}

/**
* Builds a flow from swap flow dto.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public FlowDumpPayload map(FlowEventDump dump) {
@Mapping(source = "reverse.meterId", target = "reverseMeterId")
@Mapping(source = "forward.status", target = "forwardStatus")
@Mapping(source = "reverse.status", target = "reverseStatus")
@Mapping(target = "forwardPath", expression = "java(mapPath(forward))")
@Mapping(target = "reversePath", expression = "java(mapPath(reverse))")
@Mapping(source = "forward", target = "forwardPath")
@Mapping(source = "reverse", target = "reversePath")
@Mapping(source = "dumpType", target = "dumpType")
public abstract FlowDumpData map(Flow flow, FlowPath forward, FlowPath reverse, DumpType dumpType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
@Key("kafka")
public interface KafkaConfig {
// To be able to run tests in parallel we must use different ports for kafka hosts in each test
int STATS_TOPOLOGY_TEST_KAFKA_PORT = 2182;
int ISL_LATENCY_TOPOLOGY_TEST_KAFKA_PORT = 2183;
int STATS_TOPOLOGY_TEST_KAFKA_PORT = 2188;
int ISL_LATENCY_TOPOLOGY_TEST_KAFKA_PORT = 2189;

@Key("hosts")
String getHosts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
@Key("zookeeper")
public interface ZookeeperConfig {
// To be able to run tests in parallel we must use different ports for zookeeper hosts in each test
int STATS_TOPOLOGY_TEST_ZOOKEEPER_PORT = 9093;
int ISL_LATENCY_TOPOLOGY_TEST_ZOOKEEPER_PORT = 9094;
int STATS_TOPOLOGY_TEST_ZOOKEEPER_PORT = 9098;
int ISL_LATENCY_TOPOLOGY_TEST_ZOOKEEPER_PORT = 9099;

@Key("hosts")
String getHosts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package org.openkilda.wfm.topology.flowhs.mapper;

import org.openkilda.adapter.FlowDestAdapter;
import org.openkilda.adapter.FlowSourceAdapter;
import org.openkilda.messaging.command.flow.FlowRequest;
import org.openkilda.messaging.model.DetectConnectedDevicesDto;
import org.openkilda.messaging.model.SwapFlowDto;
Expand All @@ -23,10 +25,12 @@
import org.openkilda.model.FlowEncapsulationType;
import org.openkilda.model.FlowEndpoint;
import org.openkilda.model.PathComputationStrategy;
import org.openkilda.model.Switch;
import org.openkilda.model.SwitchId;
import org.openkilda.server42.control.messaging.flowrtt.ActivateFlowMonitoringInfoData;
import org.openkilda.wfm.topology.flowhs.model.RequestedFlow;

import lombok.NonNull;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
Expand All @@ -51,23 +55,16 @@ public RequestedFlow toRequestedFlow(FlowRequest request) {
/**
* Convert {@link Flow} to {@link RequestedFlow}.
*/
@Mapping(source = "flowId", target = "flowId")
@Mapping(target = "srcSwitch", expression = "java(flow.getSrcSwitchId())")
@Mapping(source = "srcPort", target = "srcPort")
@Mapping(source = "srcVlan", target = "srcVlan")
@Mapping(target = "destSwitch", expression = "java(flow.getDestSwitchId())")
@Mapping(source = "destPort", target = "destPort")
@Mapping(source = "destVlan", target = "destVlan")
@Mapping(source = "srcSwitchId", target = "srcSwitch")
@Mapping(source = "destSwitchId", target = "destSwitch")
@Mapping(source = "encapsulationType", target = "flowEncapsulationType")
@Mapping(target = "diverseFlowId", ignore = true)
@Mapping(target = "affinityFlowId", ignore = true)
@Mapping(target = "loopSwitchId", source = "loopSwitchId")
public abstract RequestedFlow toRequestedFlow(Flow flow);

/**
* Convert {@link SwapFlowDto} to {@link RequestedFlow}.
*/
@Mapping(source = "flowId", target = "flowId")
@Mapping(source = "sourceSwitch", target = "srcSwitch")
@Mapping(source = "sourcePort", target = "srcPort")
@Mapping(source = "sourceVlan", target = "srcVlan")
Expand Down Expand Up @@ -97,26 +94,29 @@ public RequestedFlow toRequestedFlow(FlowRequest request) {
/**
* Convert {@link RequestedFlow} to {@link Flow}.
*/
@Mapping(source = "flowId", target = "flowId")
@Mapping(target = "srcSwitch",
expression = "java(org.openkilda.model.Switch.builder().switchId(requestedFlow.getSrcSwitch()).build())")
@Mapping(source = "srcPort", target = "srcPort")
@Mapping(source = "srcVlan", target = "srcVlan")
@Mapping(target = "destSwitch",
expression = "java(org.openkilda.model.Switch.builder().switchId(requestedFlow.getDestSwitch()).build())")
@Mapping(source = "destPort", target = "destPort")
@Mapping(source = "destVlan", target = "destVlan")
@Mapping(source = "flowEncapsulationType", target = "encapsulationType")
@Mapping(target = "diverseGroupId", ignore = true)
@Mapping(target = "affinityGroupId", ignore = true)
@Mapping(target = "status", ignore = true)
@Mapping(target = "statusInfo", ignore = true)
@Mapping(target = "targetPathComputationStrategy", ignore = true)
@Mapping(target = "loopSwitchId", source = "loopSwitchId")
@Mapping(target = "yFlowId", ignore = true)
@Mapping(target = "yFlow", ignore = true)
public abstract Flow toFlow(RequestedFlow requestedFlow);

/**
* Convert {@link Flow} to {@link FlowRequest}.
*/
public FlowRequest toFlowRequest(@NonNull Flow flow) {
FlowRequest request = generatedMap(flow);
request.setSource(new FlowSourceAdapter(flow).getEndpoint());
request.setDestination(new FlowDestAdapter(flow).getEndpoint());
if (flow.getPathComputationStrategy() != null) {
request.setPathComputationStrategy(flow.getPathComputationStrategy().toString().toLowerCase());
}
return request;
}

@Mapping(source = "encapsulationType", target = "flowEncapsulationType")
@Mapping(target = "srcSwitch", ignore = true)
@Mapping(target = "srcPort", ignore = true)
Expand All @@ -126,9 +126,22 @@ public RequestedFlow toRequestedFlow(FlowRequest request) {
@Mapping(target = "destPort", ignore = true)
@Mapping(target = "destVlan", ignore = true)
@Mapping(target = "destInnerVlan", ignore = true)
@Mapping(target = "loopSwitchId", source = "loopSwitchId")
protected abstract RequestedFlow generatedMap(FlowRequest request);

/**
* Convert {@link Flow} to {@link FlowRequest}.
*/
@Mapping(target = "pathComputationStrategy", ignore = true)
@Mapping(target = "source", ignore = true)
@Mapping(target = "destination", ignore = true)
@Mapping(target = "transitEncapsulationId", ignore = true)
@Mapping(target = "diverseFlowId", ignore = true)
@Mapping(target = "affinityFlowId", ignore = true)
@Mapping(target = "type", ignore = true)
@Mapping(target = "bulkUpdateFlowIds", ignore = true)
@Mapping(target = "doNotRevert", ignore = true)
protected abstract FlowRequest generatedMap(Flow flow);

public abstract FlowEncapsulationType map(org.openkilda.messaging.payload.flow.FlowEncapsulationType source);

/**
Expand Down Expand Up @@ -165,37 +178,6 @@ public PathComputationStrategy mapComputationStrategy(String raw) {
return PathComputationStrategy.valueOf(raw.toUpperCase());
}

/**
* Convert {@link Flow} to {@link FlowRequest}.
*/
@Mapping(target = "flowId", source = "flowId")
@Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), "
+ "flow.getSrcPort(), flow.getSrcVlan(), flow.getSrcInnerVlan()))")
@Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), "
+ "flow.getDestPort(), flow.getDestVlan(), flow.getDestInnerVlan()))")
@Mapping(target = "encapsulationType", source = "encapsulationType")
@Mapping(target = "pathComputationStrategy",
expression = "java(java.util.Optional.ofNullable(flow.getPathComputationStrategy())"
+ ".map(pcs -> pcs.toString().toLowerCase())"
+ ".orElse(null))")
@Mapping(target = "bandwidth", source = "bandwidth")
@Mapping(target = "ignoreBandwidth", source = "ignoreBandwidth")
@Mapping(target = "periodicPings", source = "periodicPings")
@Mapping(target = "allocateProtectedPath", source = "allocateProtectedPath")
@Mapping(target = "description", source = "description")
@Mapping(target = "maxLatency", source = "maxLatency")
@Mapping(target = "priority", source = "priority")
@Mapping(target = "pinned", source = "pinned")
@Mapping(target = "detectConnectedDevices", source = "detectConnectedDevices")
@Mapping(target = "loopSwitchId", source = "loopSwitchId")
@Mapping(target = "transitEncapsulationId", ignore = true)
@Mapping(target = "diverseFlowId", ignore = true)
@Mapping(target = "affinityFlowId", ignore = true)
@Mapping(target = "type", ignore = true)
@Mapping(target = "bulkUpdateFlowIds", ignore = true)
@Mapping(target = "doNotRevert", ignore = true)
public abstract FlowRequest toFlowRequest(Flow flow);

/**
* Convert {@link DetectConnectedDevices} to {@link DetectConnectedDevicesDto}.
*/
Expand All @@ -204,7 +186,6 @@ public PathComputationStrategy mapComputationStrategy(String raw) {
/**
* Convert {@link RequestedFlow} to {@link ActivateFlowMonitoringInfoData}.
*/
@Mapping(target = "flowId", source = "flowId")
@Mapping(target = "source.datapath", source = "srcSwitch")
@Mapping(target = "source.portNumber", source = "srcPort")
@Mapping(target = "source.vlanId", source = "srcVlan")
Expand All @@ -215,6 +196,10 @@ public PathComputationStrategy mapComputationStrategy(String raw) {
@Mapping(target = "destination.innerVlanId", source = "destInnerVlan")
public abstract ActivateFlowMonitoringInfoData toActivateFlowMonitoringInfoData(RequestedFlow flow);

protected Switch newSwitch(SwitchId switchId) {
return Switch.builder().switchId(switchId).build();
}

public SwitchId mapSwitchId(String value) {
return value == null ? null : new SwitchId(value);
}
Expand Down
Loading

0 comments on commit 6def1bd

Please sign in to comment.