diff options
author | 2020-02-12 18:20:06 -0600 | |
---|---|---|
committer | 2020-02-17 20:25:22 +0000 | |
commit | 6dfab64262ea5816c761042192c84e498a3177ab (patch) | |
tree | 665dd3e68a9fc4303898fc9d7fe34d4c404ef7a4 /controlloop/common/domains/src/main/java | |
parent | 43b12b12c0c427bc89ab88f4d4034821d4c9835d (diff) |
tosca compliant op policy support + vcpe test
Tosca Compliant and Toscal Legacy Operational policies are
both supported for backwards compatibility.
vCPE usecase junits to support 2 equivalent policies,
one tosca compliant and the other one legacy.
Issue-ID: POLICY-2360
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Iafbfc92bbec42e6a3fe4ceb4a9a17c85e636ea14
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'controlloop/common/domains/src/main/java')
7 files changed, 401 insertions, 0 deletions
diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyPolicy.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyPolicy.java new file mode 100644 index 000000000..6f33ec43a --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyPolicy.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.legacy; + +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; +import org.onap.policy.drools.domain.models.DroolsPolicy; + + +/** + * Operational Domain Policy. + */ + +@Data +@SuperBuilder +public class LegacyPolicy extends DroolsPolicy implements Serializable { + private static final long serialVersionUID = 4100092564657497713L; + + private LegacyProperties properties; + +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyProperties.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyProperties.java new file mode 100644 index 000000000..7d07f85bd --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/legacy/LegacyProperties.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.legacy; + +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + + +/** + * Legacy Operational Policy Properties. + */ + +@Data +@Builder +public class LegacyProperties implements Serializable { + private static final long serialVersionUID = 2455300363502597721L; + + /** + * Content (Operational Policy URL encoded yaml). + */ + private String content; +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/ActorOperation.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/ActorOperation.java new file mode 100644 index 000000000..0f159275d --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/ActorOperation.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.operational; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import lombok.Builder; +import lombok.Data; + + +/** + * Actor Operation. + */ + +@Data +@Builder +public class ActorOperation implements Serializable { + private static final long serialVersionUID = -534488831693359530L; + + /** + * Actor. + */ + private String actor; + + /** + * Operation Name. + */ + private String operation; + + /** + * Target. + */ + private OperationalTarget target; + + /** + * Payload. + */ + @Builder.Default + private Map<String, String> payload = new HashMap<>(); +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/Operation.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/Operation.java new file mode 100644 index 000000000..68eec88fb --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/Operation.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.operational; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + +/** + * Policy Operation. + */ + +@Data +@Builder +public class Operation implements Serializable { + private static final long serialVersionUID = 6175229119078195110L; + + /** + * Operation Identifier. + */ + private String id; + + /** + * Description. + */ + private String description; + + /** + * Actor Operation. + */ + @SerializedName("operation") + private ActorOperation actorOperation; + + /** + * Operation Timeout in seconds. + */ + @Builder.Default + private int timeout = 10; + + /** + * Number of Retries. + */ + @Builder.Default + private int retries = 0; + + /** + * Success Treatment. + */ + @Builder.Default + private String success = "final_success"; + + /** + * Failure Treatment. + */ + @Builder.Default + private String failure = "final_failure"; + + /** + * Failure Timeout Treatment. + */ + @SerializedName("failure_timeout") + @Builder.Default + private String failureTimeout = "final_failure_timeout"; + + /** + * Failure Retry Treatment. + */ + @SerializedName("failure_retries") + @Builder.Default + private String failureRetries = "final_failure_retries"; + + /** + * Failure Exception Treatment. + */ + @SerializedName("failure_exception") + @Builder.Default + private String failureException = "final_failure_exception"; + + /** + * Failure Guard Treatment. + */ + @SerializedName("failure_guard") + @Builder.Default + private String failureGuard = "final_failure_guard"; +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalPolicy.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalPolicy.java new file mode 100644 index 000000000..e746d33e6 --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalPolicy.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.operational; + +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; +import org.onap.policy.drools.domain.models.DroolsPolicy; + + +/** + * Operational Domain Policy. + */ + +@Data +@SuperBuilder +public class OperationalPolicy extends DroolsPolicy implements Serializable { + private static final long serialVersionUID = 4100092564657497713L; + + private OperationalProperties properties; + +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalProperties.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalProperties.java new file mode 100644 index 000000000..a1563168c --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalProperties.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.operational; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import lombok.Builder; +import lombok.Data; + + +/** + * Operational Policy Properties. + */ + +@Data +@Builder +public class OperationalProperties implements Serializable { + private static final long serialVersionUID = 2455300363502597721L; + + /** + * Control Loop Name. + */ + private String id; + + /** + * Timeout in seconds. + */ + private int timeout = 30; + + /** + * Abatement. + */ + private boolean abatement = false; + + /** + * Trigger Operation. + */ + private String trigger; + + /** + * Operations. + */ + @Builder.Default + private List<Operation> operations = new ArrayList<>(); + + /** + * Controller Name. + */ + private String controllerName; +} diff --git a/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalTarget.java b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalTarget.java new file mode 100644 index 000000000..9e570ba7d --- /dev/null +++ b/controlloop/common/domains/src/main/java/org/onap/policy/drools/models/domain/operational/OperationalTarget.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 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.drools.models.domain.operational; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + + +/** + * Operational Target. + */ + +@Data +@Builder +public class OperationalTarget implements Serializable { + private static final long serialVersionUID = -3557887855401250181L; + + /** + * Target Type. + */ + private String type; + + /** + * Resource ID. + */ + @SerializedName("resourceID") + private String resourceId; +} |