Prioritisation of assignments via mgmt-API (#895)

* Updating the schema for targetfilterquery and rollout
* Updating the weight validation logic and tests
* Make weight optional
* Fix existing multi assignment tests by adding weight, remove weight from TargetFilterQuery
* Add weight validation tests, fix tests
* Add mgmt api tests for assignment and getting action with weight
* Add management layer validation and tests for creating rollouts with weight
* Fix amqp test, add repo level validation to resource tests
* Add weight to rollout mgmt-api and tests
* Add weight to mgmt api target Filter create and update
* Add target filter auto assign weight. disable enforcement of setting a weight in multiassign mode
* Remove ignored tests, fix api doc
* Fix minor findings
* Fix findings
* Remove hardcoded min weight
* Add docu text, fix findings
* Fix api documentation
* Expose weight via DMF
* Expose actions according to weight via ddi
* Fix documentation
* Add method to get actions ordered by weight to deploymentManagement
* Updating the schema for targetfilterquery and rollout
* Updated the indentation
* Updated the helper class, fixed the randomUID in test factory
* Updated the class name with prefix JPA
* Adding the missing License for WeightValidationHelper class
* Adding documentation to the dmf api on weight
* Removed the merger markers
* Updated the class name
* Removed the redundant method
* Addressed final PR comments
* Updated the missing testcase with latest default weight value
* Reverting the default value of weight back to 1000 and updated tests

Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>
This commit is contained in:
Stefan Klotz
2019-11-08 10:47:35 +01:00
committed by Stefan Behl
parent 09f2d8a481
commit 9cb5d31396
98 changed files with 2425 additions and 875 deletions

View File

@@ -57,9 +57,12 @@ public class MgmtAction extends MgmtBaseEntity {
@JsonProperty
private Long forceTime;
@JsonProperty(value="forceType")
@JsonProperty(value = "forceType")
private MgmtActionType actionType;
@JsonProperty
private Integer weight;
@JsonProperty
private MgmtMaintenanceWindow maintenanceWindow;
@@ -79,6 +82,14 @@ public class MgmtAction extends MgmtBaseEntity {
this.forceTime = forceTime;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public MgmtActionType getActionType() {
return actionType;
}
@@ -110,5 +121,4 @@ public class MgmtAction extends MgmtBaseEntity {
public void setType(final String type) {
this.type = type;
}
}

View File

@@ -25,6 +25,7 @@ public class MgmtTargetAssignmentRequestBody {
private long forcetime;
private MgmtActionType type;
private MgmtMaintenanceWindowRequestBody maintenanceWindow;
private Integer weight;
/**
* JsonCreator Constructor
@@ -61,6 +62,14 @@ public class MgmtTargetAssignmentRequestBody {
this.forcetime = forcetime;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public MgmtMaintenanceWindowRequestBody getMaintenanceWindow() {
return maintenanceWindow;
}
@@ -68,5 +77,4 @@ public class MgmtTargetAssignmentRequestBody {
public void setMaintenanceWindow(final MgmtMaintenanceWindowRequestBody maintenanceWindow) {
this.maintenanceWindow = maintenanceWindow;
}
}

View File

@@ -12,12 +12,12 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.hawkbit.mgmt.json.model.MgmtNamedEntity;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
/**
*
@@ -47,6 +47,9 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity {
@JsonProperty
private MgmtActionType type;
@JsonProperty
private Integer weight;
public boolean isDeleted() {
return deleted;
}
@@ -114,4 +117,12 @@ public class MgmtRolloutResponseBody extends MgmtNamedEntity {
public MgmtActionType getType() {
return type;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
public Integer getWeight() {
return weight;
}
}

View File

@@ -16,6 +16,7 @@ import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroup;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Model for request containing a rollout body e.g. in a POST request of
@@ -34,6 +35,9 @@ public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEnt
private Long startAt;
@JsonProperty(required = false)
private Integer weight;
private MgmtActionType type;
private List<MgmtRolloutGroup> groups;
@@ -124,7 +128,7 @@ public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEnt
* @param groups
* List of {@link MgmtRolloutGroup}
*/
public void setGroups(List<MgmtRolloutGroup> groups) {
public void setGroups(final List<MgmtRolloutGroup> groups) {
this.groups = groups;
}
@@ -139,7 +143,22 @@ public class MgmtRolloutRestRequestBody extends AbstractMgmtRolloutConditionsEnt
* @param startAt
* the start at timestamp in millis or null
*/
public void setStartAt(Long startAt) {
public void setStartAt(final Long startAt) {
this.startAt = startAt;
}
/**
* @return the priority of {@link Rollout}
*/
public Integer getWeight() {
return weight;
}
/**
* @param weight
* the priority of {@link Rollout}
*/
public void setWeight(final Integer weight) {
this.weight = weight;
}
}

View File

@@ -17,6 +17,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class MgmtDistributionSetAssignment extends MgmtId {
private long forcetime;
@JsonProperty(required = false)
private Integer weight;
private MgmtActionType type;
private MgmtMaintenanceWindowRequestBody maintenanceWindow;
@@ -47,6 +49,14 @@ public class MgmtDistributionSetAssignment extends MgmtId {
this.forcetime = forcetime;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final int weight) {
this.weight = weight;
}
/**
* Returns {@link MgmtMaintenanceWindowRequestBody} for distribution set
* assignment.

View File

@@ -22,6 +22,9 @@ public class MgmtDistributionSetAutoAssignment extends MgmtId {
@JsonProperty(required = false)
private MgmtActionType type;
@JsonProperty(required = false)
private Integer weight;
public MgmtActionType getType() {
return type;
}
@@ -29,4 +32,12 @@ public class MgmtDistributionSetAutoAssignment extends MgmtId {
public void setType(final MgmtActionType type) {
this.type = type;
}
public Integer getWeight() {
return weight;
}
public void setWeight(final Integer weight) {
this.weight = weight;
}
}

View File

@@ -40,6 +40,9 @@ public class MgmtTargetFilterQuery extends MgmtBaseEntity {
@JsonProperty
private MgmtActionType autoAssignActionType;
@JsonProperty
private Integer autoAssignWeight;
public Long getFilterId() {
return filterId;
}
@@ -80,4 +83,11 @@ public class MgmtTargetFilterQuery extends MgmtBaseEntity {
this.autoAssignActionType = actionType;
}
public Integer getAutoAssignWeight() {
return autoAssignWeight;
}
public void setAutoAssignWeight(final Integer autoAssignWeight) {
this.autoAssignWeight = autoAssignWeight;
}
}

View File

@@ -33,8 +33,7 @@ public class MgmtTargetFilterQueryRequestBody {
return query;
}
public void setQuery(String query) {
public void setQuery(final String query) {
this.query = query;
}
}