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/appclcm/src/main | |
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/appclcm/src/main')
11 files changed, 0 insertions, 1485 deletions
diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java deleted file mode 100644 index dbf8dd0cd..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmCommonHeader.java +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class LcmCommonHeader implements Serializable { - - private static final long serialVersionUID = 6581963539127062114L; - - @SerializedName(value = "timestamp") - private Instant timeStamp = Instant.now(); - - @SerializedName(value = "api-ver") - private String apiVer = "2.00"; - - @SerializedName(value = "originator-id") - private String originatorId; - - @SerializedName(value = "request-id") - private UUID requestId; - - @SerializedName(value = "sub-request-id") - private String subRequestId; - - @SerializedName(value = "flags") - private Map<String, String> flags = new HashMap<>(); - - public LcmCommonHeader() { - - } - - /** - * Used to copy a common header. - * - * @param commonHeader a header that is defined by the lcm api guide that contains information - * about the request (requestId, flags, etc.) - */ - public LcmCommonHeader(LcmCommonHeader commonHeader) { - this.originatorId = commonHeader.originatorId; - this.requestId = commonHeader.requestId; - this.subRequestId = commonHeader.subRequestId; - if (commonHeader.flags != null) { - this.flags.putAll(commonHeader.flags); - } - } - - /** - * Get the timestamp. - * - * @return the timeStamp - */ - public Instant getTimeStamp() { - return timeStamp; - } - - /** - * Set the timestamp. - * - * @param timeStamp the timeStamp to set - */ - public void setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - } - - /** - * Get the API version. - * - * @return the apiVer - */ - public String getApiVer() { - return apiVer; - } - - /** - * Set the API version. - * - * @param apiVer the apiVer to set - */ - public void setApiVer(String apiVer) { - this.apiVer = apiVer; - } - - /** - * Get the originator Id. - * - * @return the originatorId - */ - public String getOriginatorId() { - return originatorId; - } - - /** - * Set the originator Id. - * - * @param originatorId the originatorId to set - */ - public void setOriginatorId(String originatorId) { - this.originatorId = originatorId; - } - - /** - * Get the request Id. - * - * @return the requestId - */ - public UUID getRequestId() { - return requestId; - } - - /** - * Set the request Id. - * - * @param requestId the requestId to set - */ - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - /** - * Get the sub request Id. - * - * @return the subRequestId - */ - public String getSubRequestId() { - return subRequestId; - } - - /** - * Set the sub request Id. - * - * @param subRequestId the subRequestId to set - */ - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - /** - * Get the flags. - * - * @return the flags - */ - public Map<String, String> getFlags() { - return flags; - } - - /** - * Set the flags. - * - * @param flags the flags to set - */ - public void setFlags(Map<String, String> flags) { - this.flags = flags; - } - - @Override - public String toString() { - return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer + ", originatorId=" + originatorId - + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", flags=" + flags + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((apiVer == null) ? 0 : apiVer.hashCode()); - result = prime * result + ((flags == null) ? 0 : flags.hashCode()); - result = prime * result + ((originatorId == null) ? 0 : originatorId.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((timeStamp == null) ? 0 : timeStamp.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; - } - LcmCommonHeader other = (LcmCommonHeader) obj; - if (apiVer == null) { - if (other.apiVer != null) { - return false; - } - } else if (!apiVer.equals(other.apiVer)) { - return false; - } - if (flags == null) { - if (other.flags != null) { - return false; - } - } else if (!flags.equals(other.flags)) { - return false; - } - if (originatorId == null) { - if (other.originatorId != null) { - return false; - } - } else if (!originatorId.equals(other.originatorId)) { - return false; - } - if (requestId == null) { - if (other.requestId != null) { - return false; - } - } else if (!requestId.equals(other.requestId)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (timeStamp == null) { - if (other.timeStamp != null) { - return false; - } - } else if (!timeStamp.equals(other.timeStamp)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java deleted file mode 100644 index afac0dece..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequest.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.Map; - -public class LcmRequest implements Serializable { - - private static final long serialVersionUID = 219375564922846624L; - - @SerializedName(value = "common-header") - private LcmCommonHeader commonHeader; - - @SerializedName(value = "action") - private String action; - - @SerializedName(value = "action-identifiers") - private Map<String, String> actionIdentifiers; - - @SerializedName(value = "payload") - private String payload; - - public LcmRequest() { - // Create a default LCM request - } - - public LcmCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Get the action. - * - * @return the action - */ - public String getAction() { - return action; - } - - /** - * Set the action. - * - * @param action the action to set - */ - public void setAction(String action) { - this.action = action; - } - - /** - * Get the action identifiers. - * - * @return the actionIdentifiers - */ - public Map<String, String> getActionIdentifiers() { - return actionIdentifiers; - } - - /** - * Set the action identifiers. - * - * @param actionIdentifiers the actionIdentifiers to set - */ - public void setActionIdentifiers(Map<String, String> actionIdentifiers) { - this.actionIdentifiers = actionIdentifiers; - } - - /** - * Get the payload. - * - * @return the payload - */ - public String getPayload() { - return payload; - } - - /** - * Set the payload. - * - * @param payload the payload to set - */ - public void setPayload(String payload) { - this.payload = payload; - } - - /** - * Get the common header. - * - * @param commonHeader the commonHeader to set - */ - public void setCommonHeader(LcmCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - @Override - public String toString() { - return "Request [commonHeader=" + commonHeader + ", action=" + action + ", actionIdentifiers=" - + actionIdentifiers + ", payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((actionIdentifiers == null) ? 0 : actionIdentifiers.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.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; - } - LcmRequest other = (LcmRequest) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - if (actionIdentifiers == null) { - if (other.actionIdentifiers != null) { - return false; - } - } else if (!actionIdentifiers.equals(other.actionIdentifiers)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java deleted file mode 100644 index b77303ad0..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmRequestWrapper extends LcmWrapper implements Serializable { - - private static final long serialVersionUID = 424866914715980798L; - - @SerializedName(value = "body") - private LcmRequest body; - - public LcmRequestWrapper() { - super(); - } - - public LcmRequestWrapper(LcmRequest request) { - body = request; - } - - /** - * Get the body. - * - * @return the body - */ - public LcmRequest getBody() { - return body; - } - - /** - * Set the body. - * - * @param body the body to set - */ - public void setBody(LcmRequest body) { - this.body = body; - } - - @Override - public String toString() { - return "RequestWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmRequestWrapper other = (LcmRequestWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java deleted file mode 100644 index 2a65c9a14..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponse implements Serializable { - - private static final long serialVersionUID = 6332508597287669750L; - - @SerializedName(value = "common-header") - private LcmCommonHeader commonHeader; - - @SerializedName(value = "status") - private LcmResponseStatus status = new LcmResponseStatus(); - - @SerializedName(value = "payload") - private String payload; - - public LcmResponse() { - // EMPTY - } - - /** - * Constructs a response using the common header of the request since they will be the same. - * - * @param request an appc lcm request object specified by the lcm api guide - */ - public LcmResponse(LcmRequest request) { - this.commonHeader = new LcmCommonHeader(request.getCommonHeader()); - String requestPayload = request.getPayload(); - if (requestPayload != null) { - this.payload = requestPayload; - } - } - - /** - * Get the common header. - * - * @return the commonHeader - */ - public LcmCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Set the common header. - * - * @param commonHeader the commonHeader to set - */ - public void setCommonHeader(LcmCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - /** - * Get the status. - * - * @return the status - */ - public LcmResponseStatus getStatus() { - return status; - } - - /** - * Set the status. - * - * @param status the status to set - */ - public void setStatus(LcmResponseStatus status) { - this.status = status; - } - - /** - * Get the payload. - * - * @return the payload - */ - public String getPayload() { - return payload; - } - - /** - * Set the payload. - * - * @param payload the payload to set - */ - public void setPayload(String payload) { - this.payload = payload; - } - - @Override - public String toString() { - return "Response [commonHeader=" + commonHeader + ", status=" + status + ", payload=" + payload + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode()); - result = prime * result + ((payload == null) ? 0 : payload.hashCode()); - result = prime * result + ((status == null) ? 0 : status.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; - } - LcmResponse other = (LcmResponse) obj; - if (commonHeader == null) { - if (other.commonHeader != null) { - return false; - } - } else if (!commonHeader.equals(other.commonHeader)) { - return false; - } - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java deleted file mode 100644 index d3c3464ed..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseCode.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. 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.appclcm; - -import java.io.Serializable; -import org.onap.policy.appclcm.util.StatusCodeEnum; - -public class LcmResponseCode implements Serializable { - - /* These fields define the key to the response code value. */ - public static final String ACCEPTED = "ACCEPTED"; - public static final String ERROR = "ERROR"; - public static final String REJECT = "REJECT"; - public static final String SUCCESS = "SUCCESS"; - public static final String FAILURE = "FAILURE"; - public static final String PARTIAL_SUCCESS = "PARTIAL SUCCESS"; - public static final String PARTIAL_FAILURE = "PARTIAL FAILURE"; - private static final long serialVersionUID = 8189456447227022582L; - - private final Integer code; - - protected LcmResponseCode(final int code) { - this.code = code; - } - - public int getCode() { - return this.code; - } - - @Override - public String toString() { - return Integer.toString(this.code); - } - - /** - * Translates the code to a string value that represents the meaning of the code. - * - * @param code the numeric value that is returned by APPC based on success, failure, etc. of the action requested - * @return the string value equivalent of the APPC response code - */ - public static String toResponseValue(int code) { - StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code); - return (statusCodeEnum != null) ? statusCodeEnum.toString() : null; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java deleted file mode 100644 index 4c044a0a8..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponseStatus implements Serializable { - - private static final long serialVersionUID = 974891505135467199L; - - @SerializedName(value = "code") - private int code; - - @SerializedName(value = "message") - private String message; - - public LcmResponseStatus() { - // Create a default LCMResponseStatus instance - } - - /** - * Get the code. - * - * @return the code - */ - public int getCode() { - return code; - } - - /** - * Set the code. - * - * @param code the code to set - */ - public void setCode(int code) { - this.code = code; - } - - /** - * Get the message. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Set the message. - * - * @param message the message to set - */ - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "ResponseStatus [code=" + code + ", message=" + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + code; - result = prime * result + ((message == null) ? 0 : message.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; - } - LcmResponseStatus other = (LcmResponseStatus) obj; - if (code != other.code) { - return false; - } - if (message == null) { - if (other.message != null) { - return false; - } - } else if (!message.equals(other.message)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java deleted file mode 100644 index 43cc32511..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmResponseWrapper extends LcmWrapper implements Serializable { - - private static final long serialVersionUID = 463937813781086802L; - - @SerializedName(value = "body") - private LcmResponse body; - - public LcmResponseWrapper() { - super(); - } - - /** - * Get the body. - * - * @return the body - */ - public LcmResponse getBody() { - return body; - } - - /** - * Set the body. - * - * @param body the body to set - */ - public void setBody(LcmResponse body) { - this.body = body; - } - - @Override - public String toString() { - return "ResponseWrapper [body=" + body + ", toString()=" + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((body == null) ? 0 : body.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - LcmResponseWrapper other = (LcmResponseWrapper) obj; - if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; - } - return true; - } -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java deleted file mode 100644 index 322abb015..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmWrapper.java +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appclcm - * ================================================================================ - * 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.appclcm; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -public class LcmWrapper implements Serializable { - - private static final long serialVersionUID = 753005805432396532L; - - @SerializedName(value = "version") - private String version; - - @SerializedName(value = "cambria-partition") - private String cambriaPartition; - - @SerializedName(value = "rpc-name") - private String rpcName; - - @SerializedName(value = "correlation-id") - private String correlationId; - - @SerializedName(value = "type") - private String type; - - public LcmWrapper() { - // Create a default LCMWrapper instance - } - - /** - * Get the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Set the version. - * - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Get the cambria partition. - * - * @return the cambriaPartition - */ - public String getCambriaPartition() { - return cambriaPartition; - } - - /** - * Set the cambria partition. - * - * @param cambriaPartition the cambriaPartition to set - */ - public void setCambriaPartition(String cambriaPartition) { - this.cambriaPartition = cambriaPartition; - } - - /** - * Get the RPN name. - * - * @return the rpcName - */ - public String getRpcName() { - return rpcName; - } - - /** - * Set the RPC name. - * - * @param rpcName the rpcName to set - */ - public void setRpcName(String rpcName) { - this.rpcName = rpcName; - } - - /** - * Get the correlation Id. - * - * @return the correlationId - */ - public String getCorrelationId() { - return correlationId; - } - - /** - * Set the correclation Id. - * - * @param correlationId the correlationId to set - */ - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - /** - * Get the type. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Set the type. - * - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - @Override - public String toString() { - return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName - + ", correlationId=" + correlationId + ", type=" + type + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cambriaPartition == null) ? 0 : cambriaPartition.hashCode()); - result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); - result = prime * result + ((rpcName == null) ? 0 : rpcName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((version == null) ? 0 : version.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; - } - LcmWrapper other = (LcmWrapper) obj; - if (cambriaPartition == null) { - if (other.cambriaPartition != null) { - return false; - } - } else if (!cambriaPartition.equals(other.cambriaPartition)) { - return false; - } - if (correlationId == null) { - if (other.correlationId != null) { - return false; - } - } else if (!correlationId.equals(other.correlationId)) { - return false; - } - if (rpcName == null) { - if (other.rpcName != null) { - return false; - } - } else if (!rpcName.equals(other.rpcName)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java deleted file mode 100644 index ee2d28094..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.appclcm.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.JsonObject; -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 org.onap.policy.appclcm.LcmRequest; -import org.onap.policy.appclcm.LcmResponse; - -public final class Serialization { - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantAdapter()).create(); - - public static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(LcmRequest.class, new RequestAdapter()) - .registerTypeAdapter(LcmResponse.class, new ResponseAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(Instant.class, new InstantJunitAdapter()).create(); - - private Serialization() {} - - public static class RequestAdapter implements JsonSerializer<LcmRequest>, JsonDeserializer<LcmRequest> { - - @Override - public JsonElement serialize(LcmRequest src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement requestJson = gsonPretty.toJsonTree(src, LcmRequest.class); - JsonObject input = new JsonObject(); - input.add("input", requestJson); - - return input; - } - - @Override - public LcmRequest deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("input"), LcmRequest.class); - } - } - - public static class ResponseAdapter implements JsonSerializer<LcmResponse>, JsonDeserializer<LcmResponse> { - - @Override - public JsonElement serialize(LcmResponse src, Type typeOfSrc, JsonSerializationContext context) { - JsonElement responseJson = gsonPretty.toJsonTree(src, LcmResponse.class); - JsonObject output = new JsonObject(); - output.add("output", responseJson); - return output; - } - - @Override - public LcmResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return gsonPretty.fromJson(json.getAsJsonObject().get("output"), LcmResponse.class); - } - } - - public static class InstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.parse(json.getAsString()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - } - - public static class InstantJunitAdapter 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()); - } - - } - -} diff --git a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java b/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java deleted file mode 100644 index d954789e8..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/StatusCodeEnum.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Samsung Electronics Co., Ltd. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.appclcm.util; - -import java.util.HashMap; -import java.util.Map; - -public enum StatusCodeEnum { - ACCEPTED("ACCEPTED"), ERROR("ERROR"), REJECT("REJECT"), SUCCESS("SUCCESS"), FAILURE("FAILURE"), - PARTIAL_SUCCESS("PARTIAL SUCCESS"), PARTIAL_FAILURE("PARTIAL FAILURE"); - - private String name; - - StatusCodeEnum(final String name) { - this.name = name; - } - - public String toString() { - return this.name; - } - - /** - * Determine status enum from the code. - * - * @param statusCode integer code indicating the status - * @return enum representation of status code - */ - public static StatusCodeEnum fromStatusCode(final int statusCode) { - if (statusCode == 100) { - return ACCEPTED; - } - - if (statusCode == 200) { - return ERROR; - } - - if (isRejectStatusCode(statusCode)) { - return REJECT; - } - - if (statusCode == 400) { - return SUCCESS; - } - - if (isFailureStatusCode(statusCode)) { - return FAILURE; - } - - if (statusCode == 500) { - return PARTIAL_SUCCESS; - } - - if (isPartialFailureStatusCode(statusCode)) { - return PARTIAL_FAILURE; - } - - return null; - } - - private static boolean isRejectStatusCode(final int statusCode) { - return statusCode >= 300 && statusCode <= 313; - } - - private static boolean isFailureStatusCode(final int statusCode) { - return statusCode == 450 || (statusCode >= 401 && statusCode <= 406); - } - - private static boolean isPartialFailureStatusCode(final int statusCode) { - return statusCode >= 501 && statusCode <= 599; - } -}
\ No newline at end of file diff --git a/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml b/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml deleted file mode 100644 index 680a9929c..000000000 --- a/controlloop/common/model-impl/appclcm/src/main/resources/definitions.yaml +++ /dev/null @@ -1,118 +0,0 @@ -### -# ============LICENSE_START======================================================= -# appc -# ================================================================================ -# Copyright (C) 2017 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========================================================= -### - -Request: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - value: '1.01' - OriginatorID: - type: string - RequestID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Action: - type: string - enum: - - Audit - - ActionStatus - - BlockAudits - - Configure - - HealthCheck - - Install - - LiveUpgrade - - Migrate - - ModifyConfig - - Query - - Rebuild - - Reconfigure - - Restart - - Rollback - - Scale - - Start - - Stop - - Sync - - Terminate - - Test - - Upgrade - TargetID: - type: string - ObjectID: - type: string - Payload: - type: object - required: - - CommonHeader - - Action - - TargetID -Response: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - OriginatorID: - type: string - RequestID: - type: string - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Status: - type: object - properties: - Code: - type: integer - Value: - type: string - required: - - Code - - Value - Payload: - type: object - required: - - CommonHeader - - Status - |