diff options
author | Jim Hahn <jrh3@att.com> | 2019-05-08 14:33:57 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-05-08 16:24:35 -0400 |
commit | 10b21aae2bde224ab7f91f4b5ab1b89369c8fd1c (patch) | |
tree | 0417099e379e8be69f90221e8fd066fc40def62b /controlloop/common/model-impl/events/src/main/java | |
parent | 01841878936986bc80a974977ccdeaceaf7f9a78 (diff) |
Add payload to vFW policy yaml
Added new "streams" payload to vFW policy yaml files.
Removed references to pg-streams.
Also deleted directories that were moved to policy/models.
Also removed references to trafficgenerator.
Updated licenses.
Removed some trailing whitespace.
Change-Id: I6becaa573628eee677f0959fadf86f9a9f032f88
Issue-ID: POLICY-1752
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/model-impl/events/src/main/java')
14 files changed, 0 insertions, 1457 deletions
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java deleted file mode 100644 index 944bef754..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import java.util.UUID; - -public abstract class ControlLoopEvent implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.2"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("closedLoopEventClient") - private String closedLoopEventClient; - - @SerializedName("target_type") - private ControlLoopTargetType targetType; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyScope") - private String policyScope; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("closedLoopEventStatus") - private ControlLoopEventStatus closedLoopEventStatus; - - @SerializedName("payload") - private String payload; - - public ControlLoopEvent() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param event the existing instance - */ - public ControlLoopEvent(ControlLoopEvent event) { - if (event == null) { - return; - } - this.closedLoopControlName = event.closedLoopControlName; - this.requestId = event.requestId; - this.closedLoopEventClient = event.closedLoopEventClient; - this.targetType = event.targetType; - this.target = event.target; - this.from = event.from; - this.policyScope = event.policyScope; - this.policyName = event.policyName; - this.policyVersion = event.policyVersion; - this.closedLoopEventStatus = event.closedLoopEventStatus; - this.payload = event.payload; - } - - public boolean isEventStatusValid() { - return this.closedLoopEventStatus != null; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopEventStatus getClosedLoopEventStatus() { - return closedLoopEventStatus; - } - - public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) { - this.closedLoopEventStatus = closedLoopEventStatus; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java deleted file mode 100644 index f439e70ab..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopEventStatus { - ONSET("ONSET"), ABATED("ABATED"); - - private String status; - - private ControlLoopEventStatus(String status) { - this.status = status; - } - - @Override - public String toString() { - return this.status; - } - - /** - * Convert a String status to a ControlLoopEventStatus. - * - * @param status the String status - * @return the ControlLoopEventStatus - */ - public static ControlLoopEventStatus toStatus(String status) { - if (ONSET.status.equalsIgnoreCase(status)) { - return ONSET; - } - if (ABATED.status.equalsIgnoreCase(status)) { - return ABATED; - } - // - // In case DCAE uses the old abatement - // - if ("abatement".equalsIgnoreCase(status)) { - return ABATED; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java deleted file mode 100644 index 8c670fe9e..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.io.Serializable; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; - -public abstract class ControlLoopNotification implements Serializable { - - private static final long serialVersionUID = 7538596984567127915L; - - private String closedLoopControlName; - private String version = "1.0.2"; - private UUID requestId; - private String closedLoopEventClient; - private ControlLoopTargetType targetType; - private String target; - private String from; - private String policyScope; - private String policyName; - private String policyVersion; - private ControlLoopNotificationType notification; - private String message; - private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC); - private Integer opsClTimer; - private List<ControlLoopOperation> history = new LinkedList<>(); - - public ControlLoopNotification() { - - } - - /** - * Construct an instance. - * - * @param event the event - */ - public ControlLoopNotification(ControlLoopEvent event) { - if (event == null) { - return; - } - - this.setClosedLoopControlName(event.getClosedLoopControlName()); - this.setRequestId(event.getRequestId()); - this.setClosedLoopEventClient(event.getClosedLoopEventClient()); - this.setTargetType(event.getTargetType()); - this.setTarget(event.getTarget()); - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopNotificationType getNotification() { - return notification; - } - - public void setNotification(ControlLoopNotificationType notification) { - this.notification = notification; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public ZonedDateTime getNotificationTime() { - return notificationTime; - } - - public void setNotificationTime(ZonedDateTime notificationTime) { - this.notificationTime = notificationTime; - } - - public Integer getOpsClTimer() { - return opsClTimer; - } - - public void setOpsClTimer(Integer opsClTimer) { - this.opsClTimer = opsClTimer; - } - - public List<ControlLoopOperation> getHistory() { - return history; - } - - public void setHistory(List<ControlLoopOperation> history) { - this.history = history; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java deleted file mode 100644 index 9f5a41d39..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopNotificationType { - ACTIVE("ACTIVE"), REJECTED("REJECTED"), OPERATION("OPERATION"), OPERATION_SUCCESS( - "OPERATION: SUCCESS"), OPERATION_FAILURE("OPERATION: FAILURE"), FINAL_FAILURE( - "FINAL: FAILURE"), FINAL_SUCCESS("FINAL: SUCCESS"), FINAL_OPENLOOP("FINAL: OPENLOOP"); - - private String type; - - private ControlLoopNotificationType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopNotificationType. - * - * @param type the String type - * @return the ControlLoopNotificationType - */ - public static ControlLoopNotificationType toType(String type) { - if (ACTIVE.toString().equals(type)) { - return ACTIVE; - } - if (REJECTED.toString().equals(type)) { - return REJECTED; - } - if (OPERATION.toString().equals(type)) { - return OPERATION; - } - if (OPERATION_SUCCESS.toString().equals(type)) { - return OPERATION_SUCCESS; - } - if (OPERATION_FAILURE.toString().equals(type)) { - return OPERATION_FAILURE; - } - if (FINAL_FAILURE.toString().equals(type)) { - return FINAL_FAILURE; - } - if (FINAL_SUCCESS.toString().equals(type)) { - return FINAL_SUCCESS; - } - if (FINAL_OPENLOOP.toString().equals(type)) { - return FINAL_OPENLOOP; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java deleted file mode 100644 index 3ef731687..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java +++ /dev/null @@ -1,229 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.io.Serializable; -import java.time.Instant; - -public class ControlLoopOperation implements Serializable { - - private static final long serialVersionUID = 8662706581293017099L; - - private String actor; - private String operation; - private String target; - private Instant start = Instant.now(); - private Instant end; - private String subRequestId; - private String outcome; - private String message; - - public ControlLoopOperation() { - - } - - /** - * Construct an instance from an existing instance. - * - * @param op the existing instance - */ - public ControlLoopOperation(ControlLoopOperation op) { - if (op == null) { - return; - } - - this.actor = op.actor; - this.operation = op.operation; - this.target = op.target; - this.start = op.start; - this.end = op.end; - this.subRequestId = op.subRequestId; - this.outcome = op.outcome; - this.message = op.message; - } - - public String toMessage() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",subRequestId=" + subRequestId; - } - - public String toHistory() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",start=" + start + ",end=" + end - + ",subRequestId=" + subRequestId + ",outcome=" + outcome + ",message=" + message; - } - - public String getActor() { - return actor; - } - - public void setActor(String actor) { - this.actor = actor; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Instant getStart() { - return start; - } - - public void setStart(Instant start) { - this.start = start; - } - - public Instant getEnd() { - return end; - } - - public void setEnd(Instant end) { - this.end = end; - } - - public String getSubRequestId() { - return subRequestId; - } - - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - public String getOutcome() { - return outcome; - } - - public void setOutcome(String outcome) { - this.outcome = outcome; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start=" - + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message=" - + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((actor == null) ? 0 : actor.hashCode()); - result = prime * result + ((end == null) ? 0 : end.hashCode()); - result = prime * result + ((message == null) ? 0 : message.hashCode()); - result = prime * result + ((operation == null) ? 0 : operation.hashCode()); - result = prime * result + ((outcome == null) ? 0 : outcome.hashCode()); - result = prime * result + ((start == null) ? 0 : start.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((target == null) ? 0 : target.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ControlLoopOperation other = (ControlLoopOperation) obj; - if (actor == null) { - if (other.actor != null) { - return false; - } - } else if (!actor.equals(other.actor)) { - return false; - } - if (end == null) { - if (other.end != null) { - return false; - } - } else if (!end.equals(other.end)) { - return false; - } - if (message == null) { - if (other.message != null) { - return false; - } - } else if (!message.equals(other.message)) { - return false; - } - if (operation == null) { - if (other.operation != null) { - return false; - } - } else if (!operation.equals(other.operation)) { - return false; - } - if (outcome == null) { - if (other.outcome != null) { - return false; - } - } else if (!outcome.equals(other.outcome)) { - return false; - } - if (start == null) { - if (other.start != null) { - return false; - } - } else if (!start.equals(other.start)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (target == null) { - if (other.target != null) { - return false; - } - } else if (!target.equals(other.target)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java deleted file mode 100644 index 0bdc5cace..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.util.UUID; - -public class ControlLoopOperationWrapper { - - private UUID requestId; - private ControlLoopOperation operation; - - public ControlLoopOperationWrapper() { - - } - - public ControlLoopOperationWrapper(UUID requestId, ControlLoopOperation operation) { - this.requestId = requestId; - this.operation = operation; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public ControlLoopOperation getOperation() { - return operation; - } - - public void setOperation(ControlLoopOperation operation) { - this.operation = operation; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java deleted file mode 100644 index 483aaacfa..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2019 Wipro Limited Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class ControlLoopResponse implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.0"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("payload") - private String payload; - - public ControlLoopResponse() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param response - * the existing instance - */ - public ControlLoopResponse(ControlLoopResponse response) { - if (response == null) { - return; - } - this.closedLoopControlName = response.closedLoopControlName; - this.requestId = response.requestId; - this.target = response.target; - this.from = response.from; - this.policyName = response.policyName; - this.policyVersion = response.policyVersion; - this.payload = response.payload; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java deleted file mode 100644 index 4782654fc..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopTargetType { - VM("VM"), VF("VF"), VFC("VFC"), VNF("VNF"); - - private String type; - - private ControlLoopTargetType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopTargetType. - * - * @param type the String type - * @return the ControlLoopTargetType - */ - public static ControlLoopTargetType toType(String type) { - if (VM.toString().equals(type)) { - return VM; - } - if (VF.toString().equals(type)) { - return VF; - } - if (VFC.toString().equals(type)) { - return VFC; - } - if (VNF.toString().equals(type)) { - return VNF; - } - - return null; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java deleted file mode 100644 index 9cb85ae7f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public class PhysicalControlLoopEvent extends ControlLoopEvent { - private static final long serialVersionUID = -7282930271094849487L; - - public PhysicalControlLoopEvent() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) { - super(event); - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java deleted file mode 100644 index 0b5db3a1f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public class PhysicalControlLoopNotification extends ControlLoopNotification { - private static final long serialVersionUID = 8105197217140032892L; - - public PhysicalControlLoopNotification() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) { - super(event); - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java deleted file mode 100644 index b5ae50ac8..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopEvent extends ControlLoopEvent { - - private static final long serialVersionUID = -5752405682246066226L; - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - @SerializedName("AAI") - private Map<String, String> aai = new HashMap<>(); - - public VirtualControlLoopEvent() {} - - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public VirtualControlLoopEvent(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.aai != null) { - this.aai = new HashMap<>(event.aai); - } - this.closedLoopAlarmStart = event.closedLoopAlarmStart; - this.closedLoopAlarmEnd = event.closedLoopAlarmEnd; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } - - public Map<String, String> getAai() { - return aai; - } - - public void setAai(Map<String, String> aai) { - this.aai = aai; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java deleted file mode 100644 index 71a901505..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopNotification extends ControlLoopNotification { - - private static final long serialVersionUID = 5354756047932144017L; - - @SerializedName("AAI") - private Map<String, String> aai = new HashMap<>(); - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - public VirtualControlLoopNotification() {} - - /** - * Construct an instance. - * - * @param event the event - */ - public VirtualControlLoopNotification(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.getAai() != null) { - this.setAai(new HashMap<>(event.getAai())); - } - this.closedLoopAlarmStart = event.getClosedLoopAlarmStart(); - this.closedLoopAlarmEnd = event.getClosedLoopAlarmEnd(); - } - - public Map<String, String> getAai() { - return aai; - } - - public void setAai(Map<String, String> aai) { - this.aai = aai; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java deleted file mode 100644 index ab93f5e9b..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * AppcLcmActorServiceProvider - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.params; - -import java.io.Serializable; - -public class ControlLoopParams implements Serializable { - - private static final long serialVersionUID = 970755684770982776L; - - private String closedLoopControlName; - private String controlLoopYaml; - private String policyName; - private String policyScope; - private String policyVersion; - - public ControlLoopParams() { - super(); - } - - /** - * Construct an instance from an existing instance. - * - * @param params the existing instance - */ - public ControlLoopParams(ControlLoopParams params) { - this.closedLoopControlName = params.closedLoopControlName; - this.controlLoopYaml = params.controlLoopYaml; - this.policyName = params.policyName; - this.policyScope = params.policyScope; - this.policyVersion = params.policyVersion; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getControlLoopYaml() { - return controlLoopYaml; - } - - public void setControlLoopYaml(String controlLoopYaml) { - this.controlLoopYaml = controlLoopYaml; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java deleted file mode 100644 index 4bbab7a50..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -import org.onap.policy.controlloop.ControlLoopNotificationType; -import org.onap.policy.controlloop.ControlLoopTargetType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class Serialization { - public static final Gson gson = - new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - private Serialization() {} - - public static class NotificationTypeAdapter - implements JsonSerializer<ControlLoopNotificationType>, JsonDeserializer<ControlLoopNotificationType> { - @Override - public JsonElement serialize(ControlLoopNotificationType src, Type typeOfSrc, - JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopNotificationType deserialize(JsonElement json, Type typeOfT, - JsonDeserializationContext context) { - return ControlLoopNotificationType.toType(json.getAsString()); - } - } - - public static class TargetTypeAdapter - implements JsonSerializer<ControlLoopTargetType>, JsonDeserializer<ControlLoopTargetType> { - @Override - public JsonElement serialize(ControlLoopTargetType src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopTargetType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return ControlLoopTargetType.toType(json.getAsString()); - } - } - - public static class GsonUtcAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { - private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class); - public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - - @Override - public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) { - try { - return ZonedDateTime.parse(element.getAsString(), format); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) { - return new JsonPrimitive(datetime.format(format)); - } - } - - public static class GsonInstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} |