Skip to content

Commit

Permalink
Merge branch 'release-1.145.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
niksv committed Oct 12, 2023
2 parents 41a644d + d23ee40 commit 78ab944
Show file tree
Hide file tree
Showing 148 changed files with 1,317 additions and 1,566 deletions.
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
# Changelog
## v1.145.0 (16/10/2023)

## v1.144.0 (04/10/2023)
### Bug Fixes:
- [#5427](https://github.com/telstra/open-kilda/pull/5427) 5424 GUI: enable to get flow path if flow name contains a dot (Issue: [#5424](https://github.com/telstra/open-kilda/issues/5424)) [**gui**]

### Improvements:
- [#5414](https://github.com/telstra/open-kilda/pull/5414) [TEST]: 5357: Improvement: Remove Tidy annotation [**tests**]
- [#5416](https://github.com/telstra/open-kilda/pull/5416) [TEST]: Fix victoria metrics key(query_path) [**tests**]
- [#5421](https://github.com/telstra/open-kilda/pull/5421) #5390: [TEST] Fix flaky VXLAN flow test (Issue: [#5390](https://github.com/telstra/open-kilda/issues/5390)) [**tests**]
- [#5433](https://github.com/telstra/open-kilda/pull/5433) Update requirements of changelog generator

### Other changes:
- [#4667](https://github.com/telstra/open-kilda/pull/4667) Feature/create lag port (Issue: [#4666](https://github.com/telstra/open-kilda/issues/4666)) [**gui**]
- [#5404](https://github.com/telstra/open-kilda/pull/5404) [TEST] Wait for lab to become operational between test runs [**tests**]
- [#5407](https://github.com/telstra/open-kilda/pull/5407) [TEST]: 5303: Y-Flow: Reroute [**tests**]

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

### Affected Components:
gui

---

## v1.144.0 (09/10/2023)

### Features:
- [#5340](https://github.com/telstra/open-kilda/pull/5340) Add ability to save history on flow PATCH operation. (Issues: [#5237](https://github.com/telstra/open-kilda/issues/5237) [#5385](https://github.com/telstra/open-kilda/issues/5385))
Expand Down Expand Up @@ -31,7 +53,7 @@ For the complete list of changes, check out [the commit log](https://github.com/
### Affected Components:
history

## v1.143.0 (28/09/2023)
## v1.143.0 (02/10/2023)

### Features:
- [#5355](https://github.com/telstra/open-kilda/pull/5355) Update Flow graph in GUI for VictoriaMetrics #5295 (Issues: [#5295](https://github.com/telstra/open-kilda/issues/5295) [#5295](https://github.com/telstra/open-kilda/issues/5295))
Expand Down
2 changes: 1 addition & 1 deletion confd/templates/functional-tests/kilda.properties.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hibernate.url = {{ getv "/kilda_hibernate_url" }}
elasticsearch.endpoint={{ getv "/kilda_logging_elasticsearch_proto" }}://{{ getv "/kilda_logging_elasticsearch_hosts" }}
zookeeper.connect_string = {{ getv "/kilda_zookeeper_hosts"}}/{{ getv "/kilda_zookeeper_state_root" }}
legacy.tsdb.endpoint=http://{{ getv "/kilda_opentsdb_hosts" }}:{{ getv "/kilda_opentsdb_port" }}
tsdb.endpoint=http://{{ getv "/kilda_victoriametrics_host" }}:{{ getv "/kilda_victoriametrics_read_port" }}{{ getv "kilda_tests_victoriametrics_query_path" }}
tsdb.endpoint=http://{{ getv "/kilda_victoriametrics_host" }}:{{ getv "/kilda_victoriametrics_read_port" }}{{ getv "/kilda_tests_victoriametrics_query_path" }}
kafka.bootstrap.server={{ getv "/kilda_kafka_hosts" }}
kafka.bootstrap.server.internal={{ getv "/kilda_kafka_hosts" }}
grpc.endpoint={{ getv "/kilda_grpc_endpoint" }}:{{ getv "/kilda_grpc_rest_port" }}
Expand Down
7 changes: 7 additions & 0 deletions src-gui/src/main/java/org/openkilda/constants/IConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ private NorthBoundUrl() {
public static final String UPDATE_SWITCH_LOCATION = VERSION_TWO + "/switches/{switch_id}";
public static final String GET_LINK_BFD_PROPERTIES = VERSION_TWO
+ "/links/{src-switch}_{src-port}/{dst-switch}_{dst-port}/bfd";
public static final String SWITCH_LOGICAL_PORT = VERSION_TWO + "/switches/{switch_id}/lags";
public static final String DELETE_SWITCH_LOGICAL_PORT = VERSION_TWO
+ "/switches/{switch_id}/lags/{logical_port_number}";
}

public static final class OpenTsDbUrl {
Expand Down Expand Up @@ -315,6 +318,10 @@ private Permission() {
public static final String ISL_UPDATE_BFD_PROPERTIES = "isl_update_bfd_properties";

public static final String ISL_DELETE_BFD = "isl_delete_bfd";

public static final String SW_CREATE_LOGICAL_PORT = "sw_create_logical_port";

public static final String SW_DELETE_LOGICAL_PORT = "sw_delete_logical_port";
}

public static final class Settings {
Expand Down
24 changes: 15 additions & 9 deletions src-gui/src/main/java/org/openkilda/constants/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

package org.openkilda.constants;

import lombok.AccessLevel;
import lombok.Getter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -90,6 +91,7 @@ public enum Metrics {

private final String tag;

@Getter(AccessLevel.NONE)
private final String metricName;

private static final Map<String, List<Metrics>> TAG_TO_METRICS_MAP = new HashMap<>();
Expand Down Expand Up @@ -117,6 +119,10 @@ public enum Metrics {
this.metricName = metricName;
}

public final String getMetricName(String prefix) {
return prefix + this.metricName;
}

/**
* Flow value.
*
Expand All @@ -131,9 +137,9 @@ public static List<String> flowValue(String tag, boolean uniDirectional, String
return metricNames;
}
metrics.forEach(metric -> {
metricNames.add(prefix + metric.getMetricName());
metricNames.add(metric.getMetricName(prefix));
if (uniDirectional) {
metricNames.add(prefix + metric.getMetricName());
metricNames.add(metric.getMetricName(prefix));
}
});
return metricNames;
Expand All @@ -150,7 +156,7 @@ public static String flowMetricName(String metricPart, String prefix) {
return StringUtils.EMPTY;
}
Optional<Metrics> metric = TAG_TO_METRICS_MAP.get("Flow_" + metricPart.toLowerCase()).stream().findFirst();
return metric.map(metrics -> prefix + metrics.getMetricName()).orElse(StringUtils.EMPTY);
return metric.map(metrics -> metrics.getMetricName(prefix)).orElse(StringUtils.EMPTY);
}

/**
Expand All @@ -164,7 +170,7 @@ public static String meterMetricName(String metricPart, String prefix) {
return StringUtils.EMPTY;
}
Optional<Metrics> metric = TAG_TO_METRICS_MAP.get("Meter_" + metricPart.toLowerCase()).stream().findFirst();
return metric.map(metrics -> prefix + metrics.getMetricName()).orElse(StringUtils.EMPTY);
return metric.map(metrics -> metrics.getMetricName(prefix)).orElse(StringUtils.EMPTY);
}

/**
Expand All @@ -178,7 +184,7 @@ public static List<String> flowRawValue(String tag, String prefix) {
tag = "Flow_raw_" + tag;
for (Metrics metric : values()) {
if (metric.getTag().equalsIgnoreCase(tag)) {
list.add(prefix + metric.getMetricName());
list.add(metric.getMetricName(prefix));
}
}
return list;
Expand All @@ -202,7 +208,7 @@ public static List<String> switchValue(String tag, String prefix) {
}
for (Metrics metric : values()) {
if (metric.getTag().equalsIgnoreCase(tag)) {
list.add(prefix + metric.getMetricName());
list.add(metric.getMetricName(prefix));
}
}
return list;
Expand All @@ -218,7 +224,7 @@ public static List<String> getStartsWith(String tag, String prefix) {
List<String> list = new ArrayList<>();
for (Metrics metric : values()) {
if (metric.getTag().startsWith(tag)) {
list.add(prefix + metric.getMetricName());
list.add(metric.getMetricName(prefix));
}
}
return list;
Expand All @@ -236,7 +242,7 @@ public static List<String> meterValue(String tag, String prefix) {
if (CollectionUtils.isEmpty(metrics)) {
return metricNames;
}
metrics.forEach(metric -> metricNames.add(prefix + metric.getMetricName()));
metrics.forEach(metric -> metricNames.add(metric.getMetricName(prefix)));
return metricNames;
}

Expand All @@ -246,7 +252,7 @@ public static List<String> meterValue(String tag, String prefix) {
* @return the list
*/
public static List<String> list(String prefix) {
return Arrays.stream(values()).map(metric -> prefix + metric.getMetricName()).collect(Collectors.toList());
return Arrays.stream(values()).map(metric -> metric.getMetricName(prefix)).collect(Collectors.toList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ContractController {
/**
* Returns delete contract exists in the system.
*/
@RequestMapping(value = "/delete/{flowId}/{contractid:.+}", method = RequestMethod.DELETE)
@RequestMapping(value = "/delete/{flowId:.+}/{contractid:.+}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public boolean deleteContract(@PathVariable(name = "flowId", required = false) String flowId,
Expand Down
22 changes: 11 additions & 11 deletions src-gui/src/main/java/org/openkilda/controller/FlowController.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class FlowController extends BaseController {
* id of flow path requested.
* @return flow path with all nodes/switches exists in provided flow
*/
@RequestMapping(value = "/path/{flowId}", method = RequestMethod.GET)
@RequestMapping(value = "/path/{flowId:.+}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody FlowPayload getFlowPath(@PathVariable final String flowId) {
LOGGER.info("Get flow path. Flow id: '" + flowId + "'");
Expand All @@ -124,7 +124,7 @@ public class FlowController extends BaseController {
* id of reroute requested.
* @return reroute flow of new flow path with all nodes/switches exist
*/
@RequestMapping(value = "/{flowId}/reroute", method = RequestMethod.GET)
@RequestMapping(value = "/{flowId:.+}/reroute", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody FlowPath rerouteFlow(@PathVariable final String flowId) {
activityLogger.log(ActivityType.FLOW_REROUTE, flowId);
Expand All @@ -139,7 +139,7 @@ public class FlowController extends BaseController {
* id of validate flow requested.
* @return validate flow
*/
@RequestMapping(value = "/{flowId}/validate", method = RequestMethod.GET)
@RequestMapping(value = "/{flowId:.+}/validate", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody String validateFlow(@PathVariable final String flowId) {
activityLogger.log(ActivityType.FLOW_VALIDATE, flowId);
Expand All @@ -155,7 +155,7 @@ public class FlowController extends BaseController {
* @return flowInfo
* @throws AccessDeniedException the access denied exception
*/
@RequestMapping(value = "/{flowId}", method = RequestMethod.GET)
@RequestMapping(value = "/{flowId:.+}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.MENU_FLOWS })
public @ResponseBody FlowInfo getFlowById(@PathVariable final String flowId,
Expand All @@ -172,7 +172,7 @@ public class FlowController extends BaseController {
* id of flow requested.
* @return flow
*/
@RequestMapping(value = "/{flowId}/status", method = RequestMethod.GET)
@RequestMapping(value = "/{flowId:.+}/status", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody FlowStatus getFlowStatusById(@PathVariable final String flowId) {
LOGGER.info("Get flow status by id. Flow id: '" + flowId + "'");
Expand Down Expand Up @@ -203,7 +203,7 @@ public class FlowController extends BaseController {
* the flow
* @return the flow
*/
@RequestMapping(value = "/{flowId}", method = RequestMethod.PUT)
@RequestMapping(value = "/{flowId:.+}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.CREATED)
@Permissions(values = { IConstants.Permission.FW_FLOW_UPDATE })
public @ResponseBody FlowV2 updateFlow(@PathVariable("flowId") final String flowId,
Expand All @@ -221,7 +221,7 @@ public class FlowController extends BaseController {
* the flow id
* @return the flow
*/
@RequestMapping(value = "/{flowId}", method = RequestMethod.DELETE)
@RequestMapping(value = "/{flowId:.+}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.FW_FLOW_DELETE })
@ResponseBody
Expand All @@ -240,7 +240,7 @@ public FlowV2 deleteFlow(@RequestBody final UserInfo userInfo, @PathVariable("fl
* id of validate flow requested.
* @return validate flow
*/
@RequestMapping(value = "/{flowId}/sync", method = RequestMethod.PATCH)
@RequestMapping(value = "/{flowId:.+}/sync", method = RequestMethod.PATCH)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.FW_FLOW_RESYNC })
public @ResponseBody String resyncFlow(@PathVariable final String flowId) {
Expand Down Expand Up @@ -277,7 +277,7 @@ public void getAllStatusWithCron() {
* @param flow the flow
* @return the string
*/
@RequestMapping(value = "/{flowId}/ping", method = RequestMethod.PUT)
@RequestMapping(value = "/{flowId:.+}/ping", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.FW_FLOW_PING })
public @ResponseBody String flowPing(@PathVariable final String flowId, @RequestBody final FlowV2 flow) {
Expand All @@ -291,7 +291,7 @@ public void getAllStatusWithCron() {
*
* @return the flow history.
*/
@RequestMapping(value = "/all/history/{flowId}", method = RequestMethod.GET)
@RequestMapping(value = "/all/history/{flowId:.+}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = { IConstants.Permission.FW_FLOW_HISTORY })
public @ResponseBody List<FlowHistory> getFlowHistory(@PathVariable final String flowId,
Expand All @@ -306,7 +306,7 @@ public void getAllStatusWithCron() {
* id of flow.
* @return FlowConnectedDevice
*/
@RequestMapping(value = "/connected/devices/{flowId}", method = RequestMethod.GET)
@RequestMapping(value = "/connected/devices/{flowId:.+}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public @ResponseBody FlowConnectedDevice getFlowConnectedDevice(@PathVariable final String flowId,
@RequestParam(name = "since", required = false) String timeLastSeen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public String getPortStats(@PathVariable String switchid, @PathVariable String p
* @param downsample the downsample
* @return the flow stats
*/
@RequestMapping(value = "flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}",
@RequestMapping(value = "flowid/{flowid:.+}/{startDate}/{endDate}/{downsample}/{metric}",
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = {IConstants.Permission.MENU_FLOWS})
Expand Down Expand Up @@ -263,7 +263,7 @@ public String getIslLossPacketStats(@PathVariable String srcSwitch, @PathVariabl
* @param direction the direction
* @return the flow loss packet stats
*/
@RequestMapping(value = "flow/losspackets/{flowid}/{startDate}/{endDate}/{downsample}/{direction}",
@RequestMapping(value = "flow/losspackets/{flowid:.+}/{startDate}/{endDate}/{downsample}/{direction}",
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = {IConstants.Permission.MENU_FLOWS})
Expand Down Expand Up @@ -325,7 +325,7 @@ public List<PortInfo> getSwitchPortsStats(@PathVariable String switchid, @PathVa
* @param metric the metric
* @return the meter stats
*/
@RequestMapping(value = "meter/{flowid}/{startDate}/{endDate}/{downsample}/{metric}/{direction}",
@RequestMapping(value = "meter/{flowid:.+}/{startDate}/{endDate}/{downsample}/{metric}/{direction}",
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = {IConstants.Permission.MENU_FLOWS})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.openkilda.model.SwitchFlowsInfoPerPort;
import org.openkilda.model.SwitchInfo;
import org.openkilda.model.SwitchLocation;
import org.openkilda.model.SwitchLogicalPort;
import org.openkilda.model.SwitchMeter;
import org.openkilda.model.SwitchProperty;
import org.openkilda.service.SwitchService;
Expand Down Expand Up @@ -491,4 +492,38 @@ public class SwitchController {
+ srcPort + "\nDst_SW_" + dstSwitch + "\nDst_PORT_" + dstPort);
return serviceSwitch.deleteLinkBfd(srcSwitch, srcPort, dstSwitch, dstPort);
}

/**
* Creates switch logical port.
*
* @param switchId the switch id
* @param switchLogicalPort the switch logical port
* @return the SwitchLogicalPort
*/
@RequestMapping(value = "/{switch_id}/lags", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = IConstants.Permission.SW_CREATE_LOGICAL_PORT)
public @ResponseBody SwitchLogicalPort createLogicalPort(@PathVariable("switch_id") final String switchId,
@RequestBody(required = true) SwitchLogicalPort switchLogicalPort) {
activityLogger.log(ActivityType.CREATE_LOGICAL_PORT, "SW_" + switchId + ", "
+ "PORT_" + switchLogicalPort.getPortNumbers());
return serviceSwitch.createLogicalPort(switchId, switchLogicalPort);
}

/**
* Deletes switch logical port.
*
* @param switchId the switch id
* @param logicalPortNumber the switch logical port
* @return the SwitchLogicalPort
*/
@RequestMapping(value = "/{switch_id}/lags/{logical_port_number}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
@Permissions(values = IConstants.Permission.SW_DELETE_LOGICAL_PORT)
public @ResponseBody SwitchLogicalPort deleteLogicalPort(@PathVariable("switch_id") final String switchId,
@PathVariable("logical_port_number") final String logicalPortNumber) {
activityLogger.log(ActivityType.DELETE_LOGICAL_PORT, "SW_" + switchId + ", "
+ "L-PORT_" + logicalPortNumber);
return serviceSwitch.deleteLogicalPort(switchId, logicalPortNumber);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ private Query getQuery(final String downsample, final String metric, final Map<S
if (!statsType.equals(StatsType.ISL)) {
query.setRate(OpenTsDb.RATE);
}
if (statsType.equals(StatsType.SWITCH_PORT) && Metrics.SWITCH_STATE.getMetricName().equals(metric)) {
if (statsType.equals(StatsType.SWITCH_PORT)
&& Metrics.SWITCH_STATE.getMetricName(appProps.getMetricPrefix()).equals(metric)) {
query.setRate(false);
} else {
if (validateDownSample(paramDownSample)) {
Expand Down
Loading

0 comments on commit 78ab944

Please sign in to comment.