diff options
202 files changed, 5548 insertions, 614 deletions
diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml new file mode 100644 index 000000000..c50861148 --- /dev/null +++ b/models-interactions/model-actors/actor.appc/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.appc</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>appc</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>trafficgenerator</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java new file mode 100644 index 000000000..e90ca400a --- /dev/null +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * APPCActorServiceProvider + * ================================================================================ + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appc; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; + +import org.onap.policy.appc.CommonHeader; +import org.onap.policy.appc.Request; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.vnf.trafficgenerator.PgRequest; +import org.onap.policy.vnf.trafficgenerator.PgStream; +import org.onap.policy.vnf.trafficgenerator.PgStreams; + + +public class AppcActorServiceProvider implements Actor { + // Strings for targets + private static final String TARGET_VM = "VM"; + private static final String TARGET_VNF = "VNF"; + + // Strings for recipes + private static final String RECIPE_RESTART = "Restart"; + private static final String RECIPE_REBUILD = "Rebuild"; + private static final String RECIPE_MIGRATE = "Migrate"; + private static final String RECIPE_MODIFY = "ModifyConfig"; + + private static final ImmutableList<String> recipes = + ImmutableList.of(RECIPE_RESTART, RECIPE_REBUILD, RECIPE_MIGRATE, RECIPE_MODIFY); + private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).put(RECIPE_REBUILD, ImmutableList.of(TARGET_VM)) + .put(RECIPE_MIGRATE, ImmutableList.of(TARGET_VM)).put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build(); + private static final ImmutableMap<String, List<String>> payloads = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_MODIFY, ImmutableList.of("generic-vnf.vnf-id")).build(); + + @Override + public String actor() { + return "APPC"; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList())); + } + + /** + * Constructs an APPC request conforming to the legacy API. The legacy API will be deprecated in + * future releases as all legacy functionality is moved into the LCM API. + * + * @param onset the event that is reporting the alert for policy to perform an action + * @param operation the control loop operation specifying the actor, operation, target, etc. + * @param policy the policy the was specified from the yaml generated by CLAMP or through the + * Policy GUI/API + * @return an APPC request conforming to the legacy API + */ + public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy, + String targetVnf) { + /* + * Construct an APPC request + */ + Request request = new Request(); + request.setCommonHeader(new CommonHeader()); + request.getCommonHeader().setRequestId(onset.getRequestId()); + request.getCommonHeader().setSubRequestId(operation.getSubRequestId()); + request.setAction(policy.getRecipe().substring(0, 1).toUpperCase() + policy.getRecipe().substring(1)); + + /* + * For now Policy generates the PG Streams as a demo, in the future the payload can be + * provided by CLAMP + */ + request.getPayload().put("generic-vnf.vnf-id", targetVnf); + + PgRequest pgRequest = new PgRequest(); + pgRequest.pgStreams = new PgStreams(); + + PgStream pgStream; + for (int i = 0; i < 5; i++) { + pgStream = new PgStream(); + pgStream.streamId = "fw_udp" + (i + 1); + pgStream.isEnabled = "true"; + pgRequest.pgStreams.pgStream.add(pgStream); + } + request.getPayload().put("pg-streams", pgRequest.pgStreams); + + /* + * Return the request + */ + + return request; + } + + +} diff --git a/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..f1002a301 --- /dev/null +++ b/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.appc.AppcActorServiceProvider
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java new file mode 100644 index 000000000..e1fdd395a --- /dev/null +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java @@ -0,0 +1,179 @@ +/*- + * ============LICENSE_START======================================================= + * AppcServiceProviderTest + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.time.Instant; +import java.util.HashMap; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.appc.Request; +import org.onap.policy.appc.Response; +import org.onap.policy.appc.ResponseCode; +import org.onap.policy.appc.util.Serialization; +import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.controlloop.ControlLoopEventStatus; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.ControlLoopTargetType; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.controlloop.policy.Target; +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.simulators.Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AppcServiceProviderTest { + + private static final Logger logger = LoggerFactory.getLogger(AppcServiceProviderTest.class); + + private static final VirtualControlLoopEvent onsetEvent; + private static final ControlLoopOperation operation; + private static final Policy policy; + + static { + /* + * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of + * VM. + */ + onsetEvent = new VirtualControlLoopEvent(); + onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); + onsetEvent.setRequestId(UUID.randomUUID()); + onsetEvent.setClosedLoopEventClient("tca.instance00001"); + onsetEvent.setTargetType(ControlLoopTargetType.VNF); + onsetEvent.setTarget("generic-vnf.vnf-name"); + onsetEvent.setFrom("DCAE"); + onsetEvent.setClosedLoopAlarmStart(Instant.now()); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "fw0001vm001fw001"); + onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); + + /* Construct an operation with an APPC actor and ModifyConfig operation. */ + operation = new ControlLoopOperation(); + operation.setActor("APPC"); + operation.setOperation("ModifyConfig"); + operation.setTarget("VNF"); + operation.setEnd(Instant.now()); + operation.setSubRequestId("1"); + + /* Construct a policy specifying to modify configuration. */ + policy = new Policy(); + policy.setName("Modify Packet Generation Config"); + policy.setDescription("Upon getting the trigger event, modify packet gen config"); + policy.setActor("APPC"); + policy.setTarget(new Target(TargetType.VNF)); + policy.getTarget().setResourceID("Eace933104d443b496b8.nodes.heat.vpg"); + policy.setRecipe("ModifyConfig"); + policy.setPayload(null); + policy.setRetry(2); + policy.setTimeout(300); + + /* Set environment properties */ + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + + } + + /** + * Set up before test class. + */ + @BeforeClass + public static void setUpSimulator() { + try { + Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + /** + * Tear down after test class. + */ + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + @Test + public void constructModifyConfigRequestTest() { + + Request appcRequest; + appcRequest = AppcActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01"); + + /* The service provider must return a non null APPC request */ + assertNotNull(appcRequest); + + /* A common header is required and cannot be null */ + assertNotNull(appcRequest.getCommonHeader()); + assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId()); + + /* An action is required and cannot be null */ + assertNotNull(appcRequest.getAction()); + assertEquals("ModifyConfig", appcRequest.getAction()); + + /* A payload is required and cannot be null */ + assertNotNull(appcRequest.getPayload()); + assertTrue(appcRequest.getPayload().containsKey("generic-vnf.vnf-id")); + assertNotNull(appcRequest.getPayload().get("generic-vnf.vnf-id")); + assertTrue(appcRequest.getPayload().containsKey("pg-streams")); + + logger.debug("APPC Request: \n" + appcRequest.toString()); + + /* Print out request as json to make sure serialization works */ + String jsonRequest = Serialization.gsonPretty.toJson(appcRequest); + logger.debug("JSON Output: \n" + jsonRequest); + + /* The JSON string must contain the following fields */ + assertTrue(jsonRequest.contains("CommonHeader")); + assertTrue(jsonRequest.contains("Action")); + assertTrue(jsonRequest.contains("ModifyConfig")); + assertTrue(jsonRequest.contains("Payload")); + assertTrue(jsonRequest.contains("generic-vnf.vnf-id")); + assertTrue(jsonRequest.contains("pg-streams")); + + Response appcResponse = new Response(appcRequest); + appcResponse.getStatus().setCode(ResponseCode.SUCCESS.getValue()); + appcResponse.getStatus().setDescription("AppC success"); + /* Print out request as json to make sure serialization works */ + String jsonResponse = Serialization.gsonPretty.toJson(appcResponse); + logger.debug("JSON Output: \n" + jsonResponse); + } + + @Test + public void testMethods() { + AppcActorServiceProvider sp = new AppcActorServiceProvider(); + + assertEquals("APPC", sp.actor()); + assertEquals(4, sp.recipes().size()); + assertEquals("VM", sp.recipeTargets("Restart").get(0)); + assertEquals(0, sp.recipePayloads("Restart").size()); + } +} diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml new file mode 100644 index 000000000..871dfc21a --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/pom.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.appclcm</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>appclcm</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java new file mode 100644 index 000000000..5768cd12a --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java @@ -0,0 +1,360 @@ +/*- + * ============LICENSE_START======================================================= + * AppcLcmActorServiceProvider + * ================================================================================ + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications copyright (c) 2018 Nokia + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appclcm; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.AbstractMap; +import java.util.AbstractMap.SimpleEntry; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.onap.policy.aai.AaiManager; +import org.onap.policy.aai.AaiNqInstanceFilters; +import org.onap.policy.aai.AaiNqInventoryResponseItem; +import org.onap.policy.aai.AaiNqNamedQuery; +import org.onap.policy.aai.AaiNqQueryParameters; +import org.onap.policy.aai.AaiNqRequest; +import org.onap.policy.aai.AaiNqResponse; +import org.onap.policy.aai.util.AaiException; +import org.onap.policy.appclcm.LcmCommonHeader; +import org.onap.policy.appclcm.LcmRequest; +import org.onap.policy.appclcm.LcmRequestWrapper; +import org.onap.policy.appclcm.LcmResponse; +import org.onap.policy.appclcm.LcmResponseCode; +import org.onap.policy.appclcm.LcmResponseWrapper; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.controlloop.policy.PolicyResult; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RestManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AppcLcmActorServiceProvider implements Actor { + + private static final Logger logger = LoggerFactory.getLogger(AppcLcmActorServiceProvider.class); + + /* To be used in future releases to restart a single vm */ + private static final String APPC_VM_ID = "vm-id"; + + // Strings for targets + private static final String TARGET_VM = "VM"; + private static final String TARGET_VNF = "VNF"; + + // Strings for recipes + private static final String RECIPE_RESTART = "Restart"; + private static final String RECIPE_REBUILD = "Rebuild"; + private static final String RECIPE_MIGRATE = "Migrate"; + private static final String RECIPE_MODIFY = "ConfigModify"; + + /* To be used in future releases when LCM ConfigModify is used */ + private static final String APPC_REQUEST_PARAMS = "request-parameters"; + private static final String APPC_CONFIG_PARAMS = "configuration-parameters"; + + private static final ImmutableList<String> recipes = + ImmutableList.of(RECIPE_RESTART, RECIPE_REBUILD, RECIPE_MIGRATE, RECIPE_MODIFY); + private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).put(RECIPE_REBUILD, ImmutableList.of(TARGET_VM)) + .put(RECIPE_MIGRATE, ImmutableList.of(TARGET_VM)).put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build(); + private static final ImmutableMap<String, List<String>> payloads = + new ImmutableMap.Builder<String, List<String>>().put(RECIPE_RESTART, ImmutableList.of(APPC_VM_ID)) + .put(RECIPE_MODIFY, ImmutableList.of(APPC_REQUEST_PARAMS, APPC_CONFIG_PARAMS)).build(); + + @Override + public String actor() { + return "APPC"; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList())); + } + + /** + * This method recursively traverses the A&AI named query response to find the generic-vnf + * object that contains a model-invariant-id that matches the resourceId of the policy. Once + * this match is found the generic-vnf object's vnf-id is returned. + * + * @param items the list of items related to the vnf returned by A&AI + * @param resourceId the id of the target from the sdc catalog + * + * @return the vnf-id of the target vnf to act upon or null if not found + */ + private static String parseAaiResponse(List<AaiNqInventoryResponseItem> items, String resourceId) { + String vnfId = null; + for (AaiNqInventoryResponseItem item : items) { + if ((item.getGenericVnf() != null) && (item.getGenericVnf().getModelInvariantId() != null) + && (resourceId.equals(item.getGenericVnf().getModelInvariantId()))) { + vnfId = item.getGenericVnf().getVnfId(); + break; + } else { + if ((item.getItems() != null) && (item.getItems().getInventoryResponseItems() != null)) { + vnfId = parseAaiResponse(item.getItems().getInventoryResponseItems(), resourceId); + } + } + } + return vnfId; + } + + /** + * Constructs an A&AI Named Query using a source vnf-id to determine the vnf-id of the target + * entity specified in the policy to act upon. + * + * @param resourceId the id of the target from the sdc catalog + * + * @param sourceVnfId the vnf id of the source entity reporting the alert + * + * @return the target entities vnf id to act upon + * @throws AaiException it an error occurs + */ + public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AaiException { + + // TODO: This request id should not be hard coded in future releases + UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087"); + + AaiNqRequest aaiRequest = new AaiNqRequest(); + aaiRequest.setQueryParameters(new AaiNqQueryParameters()); + aaiRequest.getQueryParameters().setNamedQuery(new AaiNqNamedQuery()); + aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUuid(requestId); + + Map<String, Map<String, String>> filter = new HashMap<>(); + Map<String, String> filterItem = new HashMap<>(); + + filterItem.put("vnf-id", sourceVnfId); + filter.put("generic-vnf", filterItem); + + aaiRequest.setInstanceFilters(new AaiNqInstanceFilters()); + aaiRequest.getInstanceFilters().getInstanceFilter().add(filter); + + AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(getPeManagerEnvProperty("aai.url"), + getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiRequest, + requestId); + + if (aaiResponse == null) { + throw new AaiException("The named query response was null"); + } + + String targetVnfId = parseAaiResponse(aaiResponse.getInventoryResponseItems(), resourceId); + if (targetVnfId == null) { + throw new AaiException("Target vnf-id could not be found"); + } + + return targetVnfId; + } + + /** + * Constructs an APPC request conforming to the lcm API. The actual request is constructed and + * then placed in a wrapper object used to send through DMAAP. + * + * @param onset the event that is reporting the alert for policy to perform an action + * @param operation the control loop operation specifying the actor, operation, target, etc. + * @param policy the policy the was specified from the yaml generated by CLAMP or through the + * Policy GUI/API + * @return an APPC request conforming to the lcm API using the DMAAP wrapper + */ + public static LcmRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + Policy policy, String targetVnf) { + + /* Construct an APPC request using LCM Model */ + + /* + * The actual LCM request is placed in a wrapper used to send through dmaap. The current + * version is 2.0 as of R1. + */ + AppcLcmRecipeFormatter lcmRecipeFormatter = new AppcLcmRecipeFormatter(policy.getRecipe()); + + LcmRequestWrapper dmaapRequest = new LcmRequestWrapper(); + dmaapRequest.setVersion("2.0"); + dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + operation.getSubRequestId()); + dmaapRequest.setRpcName(lcmRecipeFormatter.getUrlRecipe()); + dmaapRequest.setType("request"); + + /* This is the actual request that is placed in the dmaap wrapper. */ + final LcmRequest appcRequest = new LcmRequest(); + + /* The common header is a required field for all APPC requests. */ + LcmCommonHeader requestCommonHeader = new LcmCommonHeader(); + requestCommonHeader.setOriginatorId(onset.getRequestId().toString()); + requestCommonHeader.setRequestId(onset.getRequestId()); + requestCommonHeader.setSubRequestId(operation.getSubRequestId()); + + appcRequest.setCommonHeader(requestCommonHeader); + + /* + * Action Identifiers are required for APPC LCM requests. For R1, the recipes supported by + * Policy only require a vnf-id. + */ + HashMap<String, String> requestActionIdentifiers = new HashMap<>(); + requestActionIdentifiers.put("vnf-id", targetVnf); + + appcRequest.setActionIdentifiers(requestActionIdentifiers); + + /* + * An action is required for all APPC requests, this will be the recipe specified in the + * policy. + */ + appcRequest.setAction(lcmRecipeFormatter.getBodyRecipe()); + + /* + * For R1, the payloads will not be required for the Restart, Rebuild, or Migrate recipes. + * APPC will populate the payload based on A&AI look up of the vnd-id provided in the action + * identifiers. + */ + if (recipeSupportsPayload(policy.getRecipe()) && payloadSupplied(policy.getPayload())) { + appcRequest.setPayload(parsePayload(policy.getPayload())); + } else { + appcRequest.setPayload(null); + } + + /* + * Once the LCM request is constructed, add it into the body of the dmaap wrapper. + */ + dmaapRequest.setBody(appcRequest); + + /* Return the request to be sent through dmaap. */ + return dmaapRequest; + } + + private static boolean payloadSupplied(Map<String, String> payload) { + return payload != null && !payload.isEmpty(); + } + + private static boolean recipeSupportsPayload(String recipe) { + return !RECIPE_RESTART.equalsIgnoreCase(recipe) && !RECIPE_REBUILD.equalsIgnoreCase(recipe) + && !RECIPE_MIGRATE.equalsIgnoreCase(recipe); + } + + private static String parsePayload(Map<String, String> payload) { + StringBuilder payloadString = new StringBuilder("{"); + payload + .forEach((key, value) -> payloadString.append("\"").append(key).append("\": ").append(value).append(",")); + return payloadString.substring(0, payloadString.length() - 1) + "}"; + } + + /** + * Parses the operation attempt using the subRequestId of APPC response. + * + * @param subRequestId the sub id used to send to APPC, Policy sets this using the operation + * attempt + * + * @return the current operation attempt + */ + public static Integer parseOperationAttempt(String subRequestId) { + Integer operationAttempt; + try { + operationAttempt = Integer.parseInt(subRequestId); + } catch (NumberFormatException e) { + logger.debug("A NumberFormatException was thrown due to error in parsing the operation attempt"); + return null; + } + return operationAttempt; + } + + /** + * Processes the APPC LCM response sent from APPC. Determines if the APPC operation was + * successful/unsuccessful and maps this to the corresponding Policy result. + * + * @param dmaapResponse the dmaap wrapper message that contains the actual APPC reponse inside + * the body field + * + * @return an key-value pair that contains the Policy result and APPC response message + */ + public static SimpleEntry<PolicyResult, String> processResponse(LcmResponseWrapper dmaapResponse) { + /* The actual APPC response is inside the wrapper's body field. */ + LcmResponse appcResponse = dmaapResponse.getBody(); + + /* The message returned in the APPC response. */ + String message; + + /* The Policy result determined from the APPC Response. */ + PolicyResult result; + + /* If there is no status, Policy cannot determine if the request was successful. */ + if (appcResponse.getStatus() == null) { + message = "Policy was unable to parse APP-C response status field (it was null)."; + return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message); + } + + /* If there is no code, Policy cannot determine if the request was successful. */ + String responseValue = LcmResponseCode.toResponseValue(appcResponse.getStatus().getCode()); + if (responseValue == null) { + message = "Policy was unable to parse APP-C response status code field."; + return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message); + } + + /* Save the APPC response's message for Policy notification message. */ + message = appcResponse.getStatus().getMessage(); + + /* Maps the APPC response result to a Policy result. */ + switch (responseValue) { + case LcmResponseCode.ACCEPTED: + /* Nothing to do if code is accept, continue processing */ + result = null; + break; + case LcmResponseCode.SUCCESS: + result = PolicyResult.SUCCESS; + break; + case LcmResponseCode.FAILURE: + result = PolicyResult.FAILURE; + break; + case LcmResponseCode.REJECT: + case LcmResponseCode.ERROR: + default: + result = PolicyResult.FAILURE_EXCEPTION; + } + return new AbstractMap.SimpleEntry<>(result, message); + } + + /** + * This method reads and validates environmental properties coming from the policy engine. Null + * properties cause an {@link IllegalArgumentException} runtime exception to be thrown + * + * @param enginePropertyName the name of the parameter to retrieve + * @return the property value + */ + private static String getPeManagerEnvProperty(String enginePropertyName) { + String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); + if (enginePropertyValue == null) { + throw new IllegalArgumentException("The value of policy engine manager environment property \"" + + enginePropertyName + "\" may not be null"); + } + return enginePropertyValue; + } +} diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java new file mode 100644 index 000000000..daf1af711 --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START======================================================= + * + * ================================================================================ + * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appclcm; + +import com.google.common.collect.Lists; +import java.util.stream.Collectors; +import org.apache.commons.lang.StringUtils; + +class AppcLcmRecipeFormatter { + + private final String dashCasedRecipe; + + AppcLcmRecipeFormatter(String dashCasedRecipe) { + this.dashCasedRecipe = dashCasedRecipe; + } + + String getUrlRecipe() { + return dashCasedRecipe.toLowerCase(); + } + + String getBodyRecipe() { + return Lists.newArrayList(dashCasedRecipe.split("-")) + .stream() + .map(String::toLowerCase) + .map(StringUtils::capitalize) + .collect(Collectors.joining("")); + } +} diff --git a/models-interactions/model-actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..403ad9859 --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java new file mode 100644 index 000000000..39cdc43ab --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java @@ -0,0 +1,443 @@ +/*- + * ============LICENSE_START======================================================= + * AppcServiceProviderTest + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appclcm; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.time.Instant; +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.AaiException; +import org.onap.policy.appclcm.LcmCommonHeader; +import org.onap.policy.appclcm.LcmRequest; +import org.onap.policy.appclcm.LcmRequestWrapper; +import org.onap.policy.appclcm.LcmResponse; +import org.onap.policy.appclcm.LcmResponseWrapper; +import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.controlloop.ControlLoopEventStatus; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.ControlLoopTargetType; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.controlloop.policy.PolicyResult; +import org.onap.policy.controlloop.policy.Target; +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.simulators.Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class AppcLcmActorServiceProviderTest { + + private static final Logger logger = LoggerFactory.getLogger(AppcLcmActorServiceProviderTest.class); + + private static final VirtualControlLoopEvent onsetEvent; + private static final ControlLoopOperation operation; + private static final Policy policy; + private static final LcmResponseWrapper dmaapResponse; + + private static final String RECIPE_RESTART = "Restart"; + private static final String RECIPE_REBUILD = "Rebuild"; + private static final String RECIPE_MIGRATE = "Migrate"; + + static { + /* + * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of + * VM. + */ + onsetEvent = new VirtualControlLoopEvent(); + onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); + onsetEvent.setRequestId(UUID.randomUUID()); + onsetEvent.setClosedLoopEventClient("tca.instance00001"); + onsetEvent.setTargetType(ControlLoopTargetType.VM); + onsetEvent.setTarget("generic-vnf.vnf-name"); + onsetEvent.setFrom("DCAE"); + onsetEvent.setClosedLoopAlarmStart(Instant.now()); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "fw0001vm001fw001"); + onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); + + /* Construct an operation with an APPC actor and restart operation. */ + operation = new ControlLoopOperation(); + operation.setActor("APPC"); + operation.setOperation("Restart"); + operation.setTarget("VM"); + operation.setEnd(Instant.now()); + operation.setSubRequestId("1"); + + /* Construct a policy specifying to restart vm. */ + policy = new Policy(); + policy.setName("Restart the VM"); + policy.setDescription("Upon getting the trigger event, restart the VM"); + policy.setActor("APPC"); + policy.setTarget(new Target(TargetType.VNF)); + policy.setRecipe("Restart"); + policy.setPayload(null); + policy.setRetry(2); + policy.setTimeout(300); + + /* A sample DMAAP request wrapper. */ + LcmRequestWrapper dmaapRequest = new LcmRequestWrapper(); + dmaapRequest.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1"); + dmaapRequest.setRpcName(policy.getRecipe().toLowerCase()); + dmaapRequest.setType("request"); + + /* A sample DMAAP response wrapper */ + dmaapResponse = new LcmResponseWrapper(); + dmaapResponse.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1"); + dmaapResponse.setRpcName(policy.getRecipe().toLowerCase()); + dmaapResponse.setType("response"); + + /* Set environment properties */ + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + + /* A sample APPC LCM request. */ + LcmRequest appcRequest = new LcmRequest(); + + /* The following code constructs a sample APPC LCM Request */ + appcRequest.setAction("restart"); + + HashMap<String, String> actionIdentifiers = new HashMap<>(); + actionIdentifiers.put("vnf-id", "trial-vnf-003"); + + appcRequest.setActionIdentifiers(actionIdentifiers); + + LcmCommonHeader commonHeader = new LcmCommonHeader(); + commonHeader.setRequestId(onsetEvent.getRequestId()); + commonHeader.setSubRequestId("1"); + commonHeader.setOriginatorId(onsetEvent.getRequestId().toString()); + + appcRequest.setCommonHeader(commonHeader); + + appcRequest.setPayload(null); + + dmaapRequest.setBody(appcRequest); + + /* The following code constructs a sample APPC LCM Response */ + LcmResponse appcResponse = new LcmResponse(appcRequest); + appcResponse.getStatus().setCode(400); + appcResponse.getStatus().setMessage("Restart Successful"); + + dmaapResponse.setBody(appcResponse); + } + + /** + * Set up before test class. + */ + @BeforeClass + public static void setUpSimulator() { + try { + Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + /** + * Tear down after test class. + */ + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + /** + * A test to construct an APPC LCM restart request. + */ + @Test + public void constructRestartRequestTest() { + + LcmRequestWrapper dmaapRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01"); + + /* The service provider must return a non null DMAAP request wrapper */ + assertNotNull(dmaapRequest); + + /* The DMAAP wrapper's type field must be request */ + assertEquals("request", dmaapRequest.getType()); + + /* The DMAAP wrapper's body field cannot be null */ + assertNotNull(dmaapRequest.getBody()); + + LcmRequest appcRequest = dmaapRequest.getBody(); + + /* A common header is required and cannot be null */ + assertNotNull(appcRequest.getCommonHeader()); + assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId()); + + /* An action is required and cannot be null */ + assertNotNull(appcRequest.getAction()); + assertEquals("Restart", appcRequest.getAction()); + + /* Action Identifiers are required and cannot be null */ + assertNotNull(appcRequest.getActionIdentifiers()); + assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id")); + assertEquals("vnf01", appcRequest.getActionIdentifiers().get("vnf-id")); + + logger.debug("APPC Request: \n" + appcRequest.toString()); + } + + /** + * A test to process a successful APPC restart response. + */ + @Test + public void processRestartResponseSuccessTest() { + AbstractMap.SimpleEntry<PolicyResult, String> result = + AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.SUCCESS, result.getKey()); + assertEquals("Restart Successful", result.getValue()); + } + + /** + * A test to map APPC response results to corresponding Policy results. + */ + @Test + public void appcToPolicyResultTest() { + + AbstractMap.SimpleEntry<PolicyResult, String> result; + + /* If APPC accepts, PolicyResult is null */ + dmaapResponse.getBody().getStatus().setCode(100); + dmaapResponse.getBody().getStatus().setMessage("ACCEPTED"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertNull(result.getKey()); + + /* If APPC is successful, PolicyResult is success */ + dmaapResponse.getBody().getStatus().setCode(400); + dmaapResponse.getBody().getStatus().setMessage("SUCCESS"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.SUCCESS, result.getKey()); + + /* If APPC returns an error, PolicyResult is failure exception */ + dmaapResponse.getBody().getStatus().setCode(200); + dmaapResponse.getBody().getStatus().setMessage("ERROR"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* If APPC rejects, PolicyResult is failure exception */ + dmaapResponse.getBody().getStatus().setCode(300); + dmaapResponse.getBody().getStatus().setMessage("REJECT"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* Test multiple reject codes */ + dmaapResponse.getBody().getStatus().setCode(306); + dmaapResponse.getBody().getStatus().setMessage("REJECT"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + dmaapResponse.getBody().getStatus().setCode(313); + dmaapResponse.getBody().getStatus().setMessage("REJECT"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* If APPC returns failure, PolicyResult is failure */ + dmaapResponse.getBody().getStatus().setCode(401); + dmaapResponse.getBody().getStatus().setMessage("FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE, result.getKey()); + + /* Test multiple failure codes */ + dmaapResponse.getBody().getStatus().setCode(406); + dmaapResponse.getBody().getStatus().setMessage("FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE, result.getKey()); + + dmaapResponse.getBody().getStatus().setCode(450); + dmaapResponse.getBody().getStatus().setMessage("FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE, result.getKey()); + + /* If APPC returns partial success, PolicyResult is failure exception */ + dmaapResponse.getBody().getStatus().setCode(500); + dmaapResponse.getBody().getStatus().setMessage("PARTIAL SUCCESS"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* If APPC returns partial failure, PolicyResult is failure exception */ + dmaapResponse.getBody().getStatus().setCode(501); + dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* Test multiple partial failure codes */ + dmaapResponse.getBody().getStatus().setCode(599); + dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + dmaapResponse.getBody().getStatus().setCode(550); + dmaapResponse.getBody().getStatus().setMessage("PARTIAL FAILURE"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + + /* If APPC code is unknown to Policy, PolicyResult is failure exception */ + dmaapResponse.getBody().getStatus().setCode(700); + dmaapResponse.getBody().getStatus().setMessage("UNKNOWN"); + result = AppcLcmActorServiceProvider.processResponse(dmaapResponse); + assertEquals(PolicyResult.FAILURE_EXCEPTION, result.getKey()); + } + + /** + * This test ensures that that if the the source entity is also the target entity, the source + * will be used for the APPC request. + */ + @Test + public void sourceIsTargetTest() { + String resourceId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + String targetVnfId = null; + try { + targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01"); + } catch (AaiException e) { + logger.warn(e.toString()); + fail("no vnf-id found"); + } + assertNotNull(targetVnfId); + assertEquals("vnf01", targetVnfId); + } + + /** + * THis test exercises getters not exercised in other tests. + */ + @Test + public void testMethods() { + AppcLcmActorServiceProvider sp = new AppcLcmActorServiceProvider(); + + assertEquals("APPC", sp.actor()); + assertEquals(4, sp.recipes().size()); + assertEquals("VM", sp.recipeTargets("Restart").get(0)); + assertEquals("vm-id", sp.recipePayloads("Restart").get(0)); + } + + @Test + public void payloadNotPassedWhenNotSupportedByRecipe() { + //given + Policy migratePolicy = constructPolicyWithRecipe(RECIPE_MIGRATE); + Policy rebuildPolicy = constructPolicyWithRecipe(RECIPE_REBUILD); + Policy restartPolicy = constructPolicyWithRecipe(RECIPE_RESTART); + + // when + LcmRequestWrapper migrateRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, "vnf01"); + LcmRequestWrapper rebuildRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, "vnf01"); + LcmRequestWrapper restartRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, "vnf01"); + + // then + assertNull(migrateRequest.getBody().getPayload()); + assertNull(rebuildRequest.getBody().getPayload()); + assertNull(restartRequest.getBody().getPayload()); + } + + @Test + public void payloadNotPassedWhenNotSuppliedOrEmpty() { + //given + Policy noPayloadPolicy = constructHealthCheckPolicyWithPayload(null); + Policy emptyPayloadPolicy = constructHealthCheckPolicyWithPayload(new HashMap<>()); + + // when + LcmRequestWrapper noPayloadRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, "vnf01"); + LcmRequestWrapper emptyPayloadRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, "vnf01"); + + + // then + assertNull(noPayloadRequest.getBody().getPayload()); + assertNull(emptyPayloadRequest.getBody().getPayload()); + } + + @Test + public void payloadParsedProperlyForSinglePayloadParameter() { + // given + HashMap<String, String> payload = new HashMap<>(); + payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}"); + Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload); + + // when + LcmRequestWrapper dmaapRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, "vnf01"); + + // then + assertEquals(dmaapRequest.getBody().getPayload(), + "{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}"); + } + + + @Test + public void payloadParsedProperlyForMultiplePayloadParameters() { + // given + HashMap<String, String> payload = new HashMap<>(); + payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}"); + payload.put("configurationParameters", "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," + + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," + + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"); + Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload); + + // when + LcmRequestWrapper dmaapRequest = + AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, "vnf01"); + + // then + assertEquals(dmaapRequest.getBody().getPayload(), + "{\"requestParameters\": " + + "{\"host-ip-address\":\"10.183.37.25\"}," + + "\"configurationParameters\": " + + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\"," + + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\"," + + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" + + "}"); + } + + private Policy constructHealthCheckPolicyWithPayload(HashMap<String, String> payload) { + return constructHealthCheckPolicyWithPayloadAndRecipe(payload, "Health-Check"); + } + + private Policy constructPolicyWithRecipe(String recipe) { + return constructHealthCheckPolicyWithPayloadAndRecipe(null, recipe); + } + + private Policy constructHealthCheckPolicyWithPayloadAndRecipe(HashMap<String, String> payload, String recipe) { + Policy otherPolicy = new Policy(); + otherPolicy.setName("Perform health check"); + otherPolicy.setDescription("Upon getting the trigger event, perform health check"); + otherPolicy.setActor("APPC"); + otherPolicy.setTarget(new Target(TargetType.VNF)); + otherPolicy.setRecipe(recipe); + otherPolicy.setPayload(payload); + otherPolicy.setRetry(2); + otherPolicy.setTimeout(300); + return otherPolicy; + } +} diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java new file mode 100644 index 000000000..8e9a4c30c --- /dev/null +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java @@ -0,0 +1,99 @@ +/* + * ============LICENSE_START======================================================= + * + * ================================================================================ + * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.appclcm; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + + + +public class AppcLcmRecipeFormatterTest { + + @Test + public void shouldCorrectlyFormatRestartRequestWhenRestartGiven() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart"); + String expectedUrlRecipe = "restart"; + String expectedBodyRecipe = "Restart"; + + //when + String actualUrlRecipe = recipeFormatter.getUrlRecipe(); + String actualBodyRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedUrlRecipe, actualUrlRecipe); + assertEquals(expectedBodyRecipe, actualBodyRecipe); + } + + @Test + public void shouldReturnCapitalizedBodySingleWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify"); + String expectedRecipe = "Modify"; + + //when + String actualRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify"); + String expectedRecipe = "ConfigModify"; + + //when + String actualRecipe = recipeFormatter.getBodyRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnLowercasedUrlSingleWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy"); + String expectedRecipe = "modify"; + + //when + String actualRecipe = recipeFormatter.getUrlRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } + + @Test + public void shouldReturnLowercasedDashJoinedUrlMultiWordRecipe() { + //given + AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify"); + String expectedRecipe = "config-modify"; + + //when + String actualRecipe = recipeFormatter.getUrlRecipe(); + + //then + assertEquals(expectedRecipe, actualRecipe); + } +}
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml new file mode 100644 index 000000000..9a451a105 --- /dev/null +++ b/models-interactions/model-actors/actor.sdnc/pom.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.sdnc</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>sdnc</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java new file mode 100644 index 000000000..423839188 --- /dev/null +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProvider.java @@ -0,0 +1,135 @@ +/*- + * ============LICENSE_START======================================================= + * SdncActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.sdnc; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.onap.policy.aai.AaiGetVnfResponse; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.sdnc.SdncHealNetworkInfo; +import org.onap.policy.sdnc.SdncHealRequest; +import org.onap.policy.sdnc.SdncHealRequestHeaderInfo; +import org.onap.policy.sdnc.SdncHealRequestInfo; +import org.onap.policy.sdnc.SdncHealServiceInfo; +import org.onap.policy.sdnc.SdncRequest; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class SdncActorServiceProvider implements Actor { + private static final Logger logger = LoggerFactory.getLogger(SdncActorServiceProvider.class); + + // Strings for Sdnc Actor + private static final String SDNC_ACTOR = "SDNC"; + + // Strings for targets + private static final String TARGET_VM = "VM"; + + // Strings for recipes + private static final String RECIPE_REROUTE = "Reroute"; + + private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_REROUTE); + private static final ImmutableMap<String, List<String>> targets = + new ImmutableMap.Builder<String, List<String>>().put(RECIPE_REROUTE, ImmutableList.of(TARGET_VM)).build(); + + @Override + public String actor() { + return SDNC_ACTOR; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return Collections.emptyList(); + } + + /** + * Construct a request. + * + * @param onset the onset event + * @param operation the control loop operation + * @param policy the policy + * @return the constructed request + */ + public static SdncRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + Policy policy) { + + if (!policy.getRecipe().equalsIgnoreCase(RECIPE_REROUTE)) { + return null; + } + + // Construct an Sdnc request + String serviceInstance = onset.getAai().get("service-instance.service-instance-id"); + if (serviceInstance == null || serviceInstance.isEmpty()) { + // This indicates that AAI Enrichment needs to be done by event producer. + return null; + } + SdncHealServiceInfo serviceInfo = new SdncHealServiceInfo(); + serviceInfo.setServiceInstanceId(serviceInstance); + + String networkId = onset.getAai().get("network-information.network-id"); + if (networkId == null || networkId.isEmpty()) { + // This indicates that AAI Enrichment needs to be done by event producer. + return null; + } + SdncHealNetworkInfo networkInfo = new SdncHealNetworkInfo(); + networkInfo.setNetworkId(networkId); + + SdncHealRequestInfo requestInfo = new SdncHealRequestInfo(); + requestInfo.setRequestAction("ReoptimizeSOTNInstance"); + + SdncHealRequestHeaderInfo headerInfo = new SdncHealRequestHeaderInfo(); + headerInfo.setSvcAction("reoptimize"); + headerInfo.setSvcRequestId(UUID.randomUUID().toString()); + + SdncRequest request = new SdncRequest(); + request.setNsInstanceId(serviceInstance); + request.setRequestId(onset.getRequestId()); + + SdncHealRequest healRequest = new SdncHealRequest(); + healRequest.setRequestHeaderInfo(headerInfo); + healRequest.setNetworkInfo(networkInfo); + healRequest.setRequestInfo(requestInfo); + healRequest.setServiceInfo(serviceInfo); + request.setHealRequest(healRequest); + + return request; + } +}
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..f4d1e975e --- /dev/null +++ b/models-interactions/model-actors/actor.sdnc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.sdnc.SdncActorServiceProvider
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java new file mode 100644 index 000000000..7b64b87d2 --- /dev/null +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/SdncActorServiceProviderTest.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * TestSdncActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2018 AT&T Corp. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.sdnc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Objects; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.AaiGetVnfResponse; +import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.sdnc.SdncRequest; +import org.onap.policy.simulators.Util; + +public class SdncActorServiceProviderTest { + + /** + * Set up for test class. + */ + @BeforeClass + public static void setUpSimulator() { + try { + Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + @Test + public void testConstructRequest() { + VirtualControlLoopEvent onset = new VirtualControlLoopEvent(); + ControlLoopOperation operation = new ControlLoopOperation(); + + Policy policy = new Policy(); + policy.setRecipe("Reroute"); + + assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + onset.getAai().put("network-information.network-id", "network-5555"); + assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + UUID requestId = UUID.randomUUID(); + onset.setRequestId(requestId); + assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + assertNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + onset.getAai().put("service-instance.service-instance-id", "service-instance-01"); + assertNotNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + policy.setRecipe("Reroute"); + assertNotNull(SdncActorServiceProvider.constructRequest(onset, operation, policy)); + + SdncRequest request = + SdncActorServiceProvider.constructRequest(onset, operation, policy); + + assertEquals(requestId, Objects.requireNonNull(request).getRequestId()); + assertEquals("reoptimize", request.getHealRequest().getRequestHeaderInfo().getSvcAction()); + assertEquals("ReoptimizeSOTNInstance", request.getHealRequest().getRequestInfo().getRequestAction()); + assertEquals("network-5555", request.getHealRequest().getNetworkInfo().getNetworkId()); + assertEquals("service-instance-01", request.getHealRequest().getServiceInfo().getServiceInstanceId()); + } + + @Test + public void testMethods() { + SdncActorServiceProvider sp = new SdncActorServiceProvider(); + + assertEquals("SDNC", sp.actor()); + assertEquals(1, sp.recipes().size()); + assertEquals("Reroute", sp.recipes().get(0)); + assertEquals("VM", sp.recipeTargets("Reroute").get(0)); + assertEquals(0, sp.recipePayloads("Reroute").size()); + } +} diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml new file mode 100644 index 000000000..ebf1f3e8e --- /dev/null +++ b/models-interactions/model-actors/actor.sdnr/pom.xml @@ -0,0 +1,80 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.sdnr</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>sdnr</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java new file mode 100644 index 000000000..24db0bd3e --- /dev/null +++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java @@ -0,0 +1,256 @@ +/*- + * ============LICENSE_START======================================================= + * SdnrActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.sdnr; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; + +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.controlloop.policy.PolicyResult; +import org.onap.policy.sdnr.PciCommonHeader; +import org.onap.policy.sdnr.PciRequest; +import org.onap.policy.sdnr.PciRequestWrapper; +import org.onap.policy.sdnr.PciResponse; +import org.onap.policy.sdnr.PciResponseCode; +import org.onap.policy.sdnr.PciResponseWrapper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdnrActorServiceProvider implements Actor { + + public static class Pair<A, B> { + public final A result; + public final B message; + + public Pair(A result, B message) { + this.result = result; + this.message = message; + } + + public A getResult() { + return this.result; + } + + public B getMessage() { + return this.message; + } + } + + private static final Logger logger = LoggerFactory.getLogger(SdnrActorServiceProvider.class); + + // Strings for targets + private static final String TARGET_VNF = "VNF"; + + // Strings for recipes + private static final String RECIPE_MODIFY = "ModifyConfig"; + + /* To be used in future releases when pci ModifyConfig is used */ + private static final String SDNR_REQUEST_PARAMS = "request-parameters"; + private static final String SDNR_CONFIG_PARAMS = "configuration-parameters"; + + private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_MODIFY); + private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_MODIFY, ImmutableList.of(TARGET_VNF)).build(); + private static final ImmutableMap<String, List<String>> payloads = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_MODIFY, ImmutableList.of(SDNR_REQUEST_PARAMS, SDNR_CONFIG_PARAMS)).build(); + + @Override + public String actor() { + return "SDNR"; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return ImmutableList.copyOf(payloads.getOrDefault(recipe, Collections.emptyList())); + } + + /** + * Constructs an SDNR request conforming to the pci API. The actual request is + * constructed and then placed in a wrapper object used to send through DMAAP. + * + * @param onset + * the event that is reporting the alert for policy to perform an + * action + * @param operation + * the control loop operation specifying the actor, operation, + * target, etc. + * @param policy + * the policy the was specified from the yaml generated by CLAMP or + * through the Policy GUI/API + * @return an SDNR request conforming to the pci API using the DMAAP wrapper + */ + + public static PciRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + Policy policy) { + + /* Construct an SDNR request using pci Model */ + + /* + * The actual pci request is placed in a wrapper used to send through dmaap. The + * current version is 2.0 as of R1. + */ + PciRequestWrapper dmaapRequest = new PciRequestWrapper(); + dmaapRequest.setVersion("1.0"); + dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + operation.getSubRequestId()); + dmaapRequest.setRpcName(policy.getRecipe().toLowerCase()); + dmaapRequest.setType("request"); + + /* This is the actual request that is placed in the dmaap wrapper. */ + final PciRequest sdnrRequest = new PciRequest(); + + /* The common header is a required field for all SDNR requests. */ + PciCommonHeader requestCommonHeader = new PciCommonHeader(); + requestCommonHeader.setRequestId(onset.getRequestId()); + requestCommonHeader.setSubRequestId(operation.getSubRequestId()); + + sdnrRequest.setCommonHeader(requestCommonHeader); + sdnrRequest.setPayload(onset.getPayload()); + + /* + * An action is required for all SDNR requests, this will be the recipe + * specified in the policy. + */ + sdnrRequest.setAction(policy.getRecipe()); + + /* + * Once the pci request is constructed, add it into the body of the dmaap + * wrapper. + */ + dmaapRequest.setBody(sdnrRequest); + logger.info("SDNR Request to be sent is {}", dmaapRequest); + + /* Return the request to be sent through dmaap. */ + return dmaapRequest; + } + + /** + * Parses the operation attempt using the subRequestId of SDNR response. + * + * @param subRequestId + * the sub id used to send to SDNR, Policy sets this using the + * operation attempt + * + * @return the current operation attempt + */ + public static Integer parseOperationAttempt(String subRequestId) { + Integer operationAttempt; + try { + operationAttempt = Integer.parseInt(subRequestId); + } catch (NumberFormatException e) { + logger.debug("A NumberFormatException was thrown in parsing the operation attempt {}", subRequestId); + return null; + } + return operationAttempt; + } + + /** + * Processes the SDNR pci response sent from SDNR. Determines if the SDNR + * operation was successful/unsuccessful and maps this to the corresponding + * Policy result. + * + * @param dmaapResponse + * the dmaap wrapper message that contains the actual SDNR reponse + * inside the body field + * + * @return an key-value pair that contains the Policy result and SDNR response + * message + */ + public static SdnrActorServiceProvider.Pair<PolicyResult, String> processResponse( + PciResponseWrapper dmaapResponse) { + + logger.info("SDNR processResponse called : {}", dmaapResponse); + + /* The actual SDNR response is inside the wrapper's body field. */ + PciResponse sdnrResponse = dmaapResponse.getBody(); + + /* The message returned in the SDNR response. */ + String message; + + /* The Policy result determined from the SDNR Response. */ + PolicyResult result; + + /* + * If there is no status, Policy cannot determine if the request was successful. + */ + if (sdnrResponse.getStatus() == null) { + message = "Policy was unable to parse SDN-R response status field (it was null)."; + return new SdnrActorServiceProvider.Pair<>(PolicyResult.FAILURE_EXCEPTION, message); + } + + /* + * If there is no code, Policy cannot determine if the request was successful. + */ + String responseValue = PciResponseCode.toResponseValue(sdnrResponse.getStatus().getCode()); + if (responseValue == null) { + message = "Policy was unable to parse SDN-R response status code field."; + return new SdnrActorServiceProvider.Pair<>(PolicyResult.FAILURE_EXCEPTION, message); + } + logger.info("SDNR Response Code is {}", responseValue); + + /* Save the SDNR response's message for Policy notification message. */ + message = sdnrResponse.getStatus().getValue(); + logger.info("SDNR Response Message is {}", message); + + /* + * Response and Payload are just printed and no further action needed in + * casablanca release + */ + String rspPayload = sdnrResponse.getPayload(); + logger.info("SDNR Response Payload is {}", rspPayload); + + /* Maps the SDNR response result to a Policy result. */ + switch (responseValue) { + case PciResponseCode.ACCEPTED: + /* Nothing to do if code is accept, continue processing */ + result = null; + break; + case PciResponseCode.SUCCESS: + result = PolicyResult.SUCCESS; + break; + case PciResponseCode.FAILURE: + result = PolicyResult.FAILURE; + break; + case PciResponseCode.REJECT: + case PciResponseCode.ERROR: + default: + result = PolicyResult.FAILURE_EXCEPTION; + } + return new SdnrActorServiceProvider.Pair<>(result, message); + } +} diff --git a/models-interactions/model-actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..c8d5e4c41 --- /dev/null +++ b/models-interactions/model-actors/actor.sdnr/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.sdnr.SdnrActorServiceProvider diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java new file mode 100644 index 000000000..a6212d3ab --- /dev/null +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java @@ -0,0 +1,148 @@ +/*- + * SdnrActorServiceProviderTest + * ================================================================================ + * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.sdnr; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.time.Instant; +import java.util.HashMap; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.controlloop.ControlLoopEventStatus; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.ControlLoopTargetType; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.controlloop.policy.Target; +import org.onap.policy.controlloop.policy.TargetType; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.sdnr.PciRequest; +import org.onap.policy.sdnr.PciResponse; +import org.onap.policy.sdnr.util.Serialization; +import org.onap.policy.simulators.Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdnrActorServiceProviderTest { + + private static final Logger logger = LoggerFactory.getLogger(SdnrActorServiceProviderTest.class); + + private static final VirtualControlLoopEvent onsetEvent; + private static final ControlLoopOperation operation; + private static final Policy policy; + + static { + /* + * Construct an onset. Using dummy AAI details since the code mandates AAI + * details. + */ + onsetEvent = new VirtualControlLoopEvent(); + onsetEvent.setClosedLoopControlName("closedLoopControlName-Test"); + onsetEvent.setRequestId(UUID.randomUUID()); + onsetEvent.setClosedLoopEventClient("tca.instance00001"); + onsetEvent.setTargetType(ControlLoopTargetType.VNF); + onsetEvent.setTarget("generic-vnf.vnf-name"); + onsetEvent.setFrom("DCAE"); + onsetEvent.setClosedLoopAlarmStart(Instant.now()); + onsetEvent.setAai(new HashMap<>()); + onsetEvent.getAai().put("generic-vnf.vnf-name", "notused"); + onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); + onsetEvent.setPayload("some payload"); + + /* Construct an operation with an SDNR actor and ModifyConfig operation. */ + operation = new ControlLoopOperation(); + operation.setActor("SDNR"); + operation.setOperation("ModifyConfig"); + operation.setTarget("VNF"); + operation.setEnd(Instant.now()); + operation.setSubRequestId("1"); + + /* Construct a policy specifying to modify configuration. */ + policy = new Policy(); + policy.setName("Modify PCI Config"); + policy.setDescription("Upon getting the trigger event, modify pci config"); + policy.setActor("SDNR"); + policy.setTarget(new Target(TargetType.VNF)); + policy.getTarget().setResourceID("Eace933104d443b496b8.nodes.heat.vpg"); + policy.setRecipe("ModifyConfig"); + policy.setPayload(null); + policy.setRetry(2); + policy.setTimeout(300); + } + + @Test + public void constructModifyConfigRequestTest() { + + PciRequest sdnrRequest; + sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody(); + + /* The service provider must return a non null SDNR request */ + assertNotNull(sdnrRequest); + + /* A common header is required and cannot be null */ + assertNotNull(sdnrRequest.getCommonHeader()); + assertEquals(sdnrRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId()); + + /* An action is required and cannot be null */ + assertNotNull(sdnrRequest.getAction()); + assertEquals("ModifyConfig", sdnrRequest.getAction()); + + /* A payload is required and cannot be null */ + assertNotNull(sdnrRequest.getPayload()); + assertEquals("some payload", sdnrRequest.getPayload()); + + logger.debug("SDNR Request: \n" + sdnrRequest.toString()); + + /* Print out request as json to make sure serialization works */ + String jsonRequest = Serialization.gsonPretty.toJson(sdnrRequest); + logger.debug("JSON Output: \n" + jsonRequest); + + /* The JSON string must contain the following fields */ + assertTrue(jsonRequest.contains("CommonHeader")); + assertTrue(jsonRequest.contains("Action")); + assertTrue(jsonRequest.contains("ModifyConfig")); + assertTrue(jsonRequest.contains("payload")); + + PciResponse sdnrResponse = new PciResponse(sdnrRequest); + sdnrResponse.getStatus().setCode(200); + sdnrResponse.getStatus().setValue("SDNR success"); + /* Print out request as json to make sure serialization works */ + String jsonResponse = Serialization.gsonPretty.toJson(sdnrResponse); + logger.debug("JSON Output: \n" + jsonResponse); + } + + @Test + public void testMethods() { + SdnrActorServiceProvider sp = new SdnrActorServiceProvider(); + + assertEquals("SDNR", sp.actor()); + assertEquals(1, sp.recipes().size()); + assertEquals("VNF", sp.recipeTargets("ModifyConfig").get(0)); + assertEquals(2, sp.recipePayloads("ModifyConfig").size()); + } +} diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml new file mode 100644 index 000000000..a634fb9f0 --- /dev/null +++ b/models-interactions/model-actors/actor.so/pom.xml @@ -0,0 +1,92 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.so</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>so</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.drools</groupId> + <artifactId>drools-core</artifactId> + <version>6.5.0.Final</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java new file mode 100644 index 000000000..eef6e7c12 --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SoActorServiceProvider.java @@ -0,0 +1,458 @@ +/* + * ============LICENSE_START======================================================= + * SOActorServiceProvider + * ================================================================================ + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.so; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.drools.core.WorkingMemory; +import org.onap.policy.aai.AaiNqExtraProperty; +import org.onap.policy.aai.AaiNqInventoryResponseItem; +import org.onap.policy.aai.AaiNqResponseWrapper; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.so.SoCloudConfiguration; +import org.onap.policy.so.SoManager; +import org.onap.policy.so.SoModelInfo; +import org.onap.policy.so.SoOperationType; +import org.onap.policy.so.SoRelatedInstance; +import org.onap.policy.so.SoRelatedInstanceListElement; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestDetails; +import org.onap.policy.so.SoRequestInfo; +import org.onap.policy.so.SoRequestParameters; +import org.onap.policy.so.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SoActorServiceProvider implements Actor { + private static final Logger logger = LoggerFactory.getLogger(SoActorServiceProvider.class); + + // Strings for SO Actor + private static final String SO_ACTOR = "SO"; + + // Strings for targets + private static final String TARGET_VFC = "VFC"; + + // Strings for recipes + private static final String RECIPE_VF_MODULE_CREATE = "VF Module Create"; + private static final String RECIPE_VF_MODULE_DELETE = "VF Module Delete"; + + private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_VF_MODULE_CREATE, + RECIPE_VF_MODULE_DELETE); + private static final ImmutableMap<String, List<String>> targets = new ImmutableMap.Builder<String, List<String>>() + .put(RECIPE_VF_MODULE_CREATE, ImmutableList.of(TARGET_VFC)) + .put(RECIPE_VF_MODULE_DELETE, ImmutableList.of(TARGET_VFC)).build(); + + // name of request parameters within policy payload + public static final String REQ_PARAM_NM = "requestParameters"; + + // name of configuration parameters within policy payload + public static final String CONFIG_PARAM_NM = "configurationParameters"; + + private static final String MODEL_NAME_PROPERTY_KEY = "model-ver.model-name"; + private static final String MODEL_VERSION_PROPERTY_KEY = "model-ver.model-version"; + private static final String MODEL_VERSION_ID_PROPERTY_KEY = "model-ver.model-version-id"; + + // used to decode configuration parameters via gson + private static final Type CONFIG_TYPE = new TypeToken<List<Map<String, String>>>() {}.getType(); + + // Static variables required to hold the IDs of the last service item, VNF item and VF Module. + // Note that in + // a multithreaded deployment this WILL break + private static String lastVNFItemVnfId; + private static String lastServiceItemServiceInstanceId; + private static String lastVfModuleItemVfModuleInstanceId; + + @Override + public String actor() { + return SO_ACTOR; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return Collections.emptyList(); + } + + /** + * Constructs a SO request conforming to the lcm API. The actual request is + * constructed and then placed in a wrapper object used to send through DMAAP. + * + * @param onset the event that is reporting the alert for policy to perform an action + * @param operation the control loop operation specifying the actor, operation, + * target, etc. + * @param policy the policy the was specified from the yaml generated by CLAMP or + * through the Policy GUI/API + * @param aaiResponseWrapper wrapper for AAI vserver named-query response + * @return a SO request conforming to the lcm API using the DMAAP wrapper + */ + public SoRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy, + AaiNqResponseWrapper aaiResponseWrapper) { + if (!SO_ACTOR.equals(policy.getActor()) || !recipes().contains(policy.getRecipe())) { + return null; + } + + // A&AI named query should have been performed by now. If not, return null + if (aaiResponseWrapper == null) { + return null; + } + + AaiNqInventoryResponseItem vnfItem; + AaiNqInventoryResponseItem vnfServiceItem; + AaiNqInventoryResponseItem tenantItem; + + // Extract the items we're interested in from the response + try { + vnfItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems() + .getInventoryResponseItems().get(0); + } catch (Exception e) { + logger.error("VNF Item not found in AAI response {}", Serialization.gsonPretty.toJson(aaiResponseWrapper), + e); + return null; + } + + try { + vnfServiceItem = vnfItem.getItems().getInventoryResponseItems().get(0); + } catch (Exception e) { + logger.error("VNF Service Item not found in AAI response {}", + Serialization.gsonPretty.toJson(aaiResponseWrapper), e); + return null; + } + + try { + tenantItem = aaiResponseWrapper.getAaiNqResponse().getInventoryResponseItems().get(0).getItems() + .getInventoryResponseItems().get(1); + } catch (Exception e) { + logger.error("Tenant Item not found in AAI response {}", + Serialization.gsonPretty.toJson(aaiResponseWrapper), e); + return null; + } + + // Find the index for base vf module and non-base vf module + AaiNqInventoryResponseItem baseItem = findVfModule(aaiResponseWrapper, true); + AaiNqInventoryResponseItem vfModuleItem = findVfModule(aaiResponseWrapper, false); + + // Report the error if either base vf module or non-base vf module is not found + if (baseItem == null || vfModuleItem == null) { + logger.error("Either base or non-base vf module is not found from AAI response."); + return null; + } + + // Construct SO Request for a policy's recipe + if (RECIPE_VF_MODULE_CREATE.equals(policy.getRecipe())) { + return constructCreateRequest(aaiResponseWrapper, policy, tenantItem, vnfItem, vnfServiceItem, + vfModuleItem); + } else if (RECIPE_VF_MODULE_DELETE.equals(policy.getRecipe())) { + return constructDeleteRequest(tenantItem, vnfItem, vnfServiceItem, vfModuleItem); + } else { + return null; + } + } + + /** + * Construct SO request to create vf-module. + * + * @param aaiResponseWrapper the AAI response containing the VF modules + * @param policy the policy + * @param tenantItem tenant item from A&AI named-query response + * @param vnfItem vnf item from A&AI named-query response + * @param vnfServiceItem vnf service item from A&AI named-query response + * @param vfModuleItem vf module item from A&AI named-query response + * @return SO create vf-module request + */ + private SoRequest constructCreateRequest(AaiNqResponseWrapper aaiResponseWrapper, Policy policy, + AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem vnfItem, + AaiNqInventoryResponseItem vnfServiceItem, + AaiNqInventoryResponseItem vfModuleItem) { + SoRequest request = new SoRequest(); + request.setOperationType(SoOperationType.SCALE_OUT); + // + // + // Do NOT send So the requestId, they do not support this field + // + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setRequestParameters(new SoRequestParameters()); + request.getRequestDetails().getRequestParameters().setUserParams(null); + + // cloudConfiguration + request.getRequestDetails().setCloudConfiguration(constructCloudConfiguration(tenantItem)); + // modelInfo + request.getRequestDetails().setModelInfo(constructVfModuleModelInfo(vfModuleItem)); + request.getRequestDetails().getModelInfo().setModelVersionId(vfModuleItem.getVfModule().getModelVersionId()); + + // requestInfo + request.getRequestDetails().setRequestInfo(constructRequestInfo()); + String vfModuleName = aaiResponseWrapper.genVfModuleName(); + request.getRequestDetails().getRequestInfo().setInstanceName(vfModuleName); + + // relatedInstanceList + SoRelatedInstanceListElement relatedInstanceListElement1 = new SoRelatedInstanceListElement(); + SoRelatedInstanceListElement relatedInstanceListElement2 = new SoRelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SoRelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SoRelatedInstance()); + + // Service Item + relatedInstanceListElement1.getRelatedInstance() + .setInstanceId(vnfServiceItem.getServiceInstance().getServiceInstanceId()); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SoModelInfo()); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo() + .setModelInvariantId(vnfServiceItem.getServiceInstance().getModelInvariantId()); + for (AaiNqExtraProperty prop : vnfServiceItem.getExtraProperties().getExtraProperty()) { + if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) { + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue()); + } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) { + relatedInstanceListElement1.getRelatedInstance().getModelInfo() + .setModelVersion(prop.getPropertyValue()); + } else if (prop.getPropertyName().equals(MODEL_VERSION_ID_PROPERTY_KEY)) { + relatedInstanceListElement1.getRelatedInstance().getModelInfo() + .setModelVersionId(prop.getPropertyValue()); + } + } + + // VNF Item + relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfItem.getGenericVnf().getVnfId()); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SoModelInfo()); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelInvariantId(vnfItem.getGenericVnf().getModelInvariantId()); + for (AaiNqExtraProperty prop : vnfItem.getExtraProperties().getExtraProperty()) { + if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) { + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName(prop.getPropertyValue()); + } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) { + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelVersion(prop.getPropertyValue()); + } else if (prop.getPropertyName().equals(MODEL_VERSION_ID_PROPERTY_KEY)) { + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelVersionId(prop.getPropertyValue()); + } + } + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelCustomizationName(vnfItem.getGenericVnf().getVnfType() + .substring(vnfItem.getGenericVnf().getVnfType().lastIndexOf('/') + 1)); + relatedInstanceListElement2.getRelatedInstance().getModelInfo() + .setModelCustomizationId(vnfItem.getGenericVnf().getModelCustomizationId()); + + // Insert the Service Item and VNF Item + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); + + // Request Parameters + buildRequestParameters(policy, request.getRequestDetails()); + + // Configuration Parameters + buildConfigurationParameters(policy, request.getRequestDetails()); + // Save the instance IDs for the VNF and service to static fields + // vfModuleId is not required for the create vf-module + preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(), vnfServiceItem.getServiceInstance() + .getServiceInstanceId(), null); + if (logger.isDebugEnabled()) { + logger.debug("Constructed SO request: {}", Serialization.gsonPretty.toJson(request)); + } + return request; + } + + /** + * Construct SO request to delete vf-module. + * + * @param tenantItem tenant item from A&AI named-query response + * @param vnfItem vnf item from A&AI named-query response + * @param vnfServiceItem vnf service item from A&AI named-query response + * @param vfModuleItem vf module item from A&AI named-query response + * @return SO delete vf-module request + */ + private SoRequest constructDeleteRequest(AaiNqInventoryResponseItem tenantItem, AaiNqInventoryResponseItem + vnfItem, AaiNqInventoryResponseItem vnfServiceItem, AaiNqInventoryResponseItem vfModuleItem) { + SoRequest request = new SoRequest(); + request.setOperationType(SoOperationType.DELETE_VF_MODULE); + request.setRequestDetails(new SoRequestDetails()); + request.getRequestDetails().setRelatedInstanceList(null); + request.getRequestDetails().setConfigurationParameters(null); + + // cloudConfiguration + request.getRequestDetails().setCloudConfiguration(constructCloudConfiguration(tenantItem)); + // modelInfo + request.getRequestDetails().setModelInfo(constructVfModuleModelInfo(vfModuleItem)); + // requestInfo + request.getRequestDetails().setRequestInfo(constructRequestInfo()); + // Save the instance IDs for the VNF, service and vfModule to static fields + preserveInstanceIds(vnfItem.getGenericVnf().getVnfId(), vnfServiceItem.getServiceInstance() + .getServiceInstanceId(), vfModuleItem.getVfModule().getVfModuleId()); + + if (logger.isDebugEnabled()) { + logger.debug("Constructed SO request: {}", Serialization.gsonPretty.toJson(request)); + } + return request; + } + + /** + * Construct requestInfo for the SO requestDetails. + * + * @return SO request information + */ + private SoRequestInfo constructRequestInfo() { + SoRequestInfo soRequestInfo = new SoRequestInfo(); + soRequestInfo.setSource("POLICY"); + soRequestInfo.setSuppressRollback(false); + soRequestInfo.setRequestorId("policy"); + return soRequestInfo; + } + + /** + * Construct modelInfo of the vfModule for the SO requestDetails. + * + * @param vfModuleItem vf module item from A&AI named-query response + * @return SO Model info for the vfModule + */ + private SoModelInfo constructVfModuleModelInfo(AaiNqInventoryResponseItem vfModuleItem) { + SoModelInfo soModelInfo = new SoModelInfo(); + soModelInfo.setModelType("vfModule"); + soModelInfo.setModelInvariantId(vfModuleItem.getVfModule().getModelInvariantId()); + soModelInfo.setModelCustomizationId(vfModuleItem.getVfModule().getModelCustomizationId()); + + for (AaiNqExtraProperty prop : vfModuleItem.getExtraProperties().getExtraProperty()) { + if (prop.getPropertyName().equals(MODEL_NAME_PROPERTY_KEY)) { + soModelInfo.setModelName(prop.getPropertyValue()); + } else if (prop.getPropertyName().equals(MODEL_VERSION_PROPERTY_KEY)) { + soModelInfo.setModelVersion(prop.getPropertyValue()); + } + } + return soModelInfo; + } + + /** + * Construct cloudConfiguration for the SO requestDetails. + * + * @param tenantItem tenant item from A&AI named-query response + * @return SO cloud configuration + */ + private SoCloudConfiguration constructCloudConfiguration(AaiNqInventoryResponseItem tenantItem) { + SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration(); + cloudConfiguration.setTenantId(tenantItem.getTenant().getTenantId()); + cloudConfiguration.setLcpCloudRegionId(tenantItem.getItems().getInventoryResponseItems().get(0) + .getCloudRegion().getCloudRegionId()); + return cloudConfiguration; + } + + /** + * This method is needed to get the serviceInstanceId and vnfInstanceId which is used + * in the asyncSORestCall. + * + * @param requestId the request Id + * @param wm the working memory + * @param request the request + */ + public static void sendRequest(String requestId, WorkingMemory wm, Object request) { + SoManager soManager = new SoManager(); + soManager.asyncSoRestCall(requestId, wm, lastServiceItemServiceInstanceId, lastVNFItemVnfId, + lastVfModuleItemVfModuleInstanceId, (SoRequest) request); + } + + /** + * Find the base or non base VF module item in an AAI response. + * If there is more than one item, then the <i>last</i> item is returned + * + * @param aaiResponseWrapper the AAI response containing the VF modules + * @param baseFlag true if we are searching for the base, false if we are searching + * for the non base + * @return the base or non base VF module item or null if the module was not found + */ + private AaiNqInventoryResponseItem findVfModule(AaiNqResponseWrapper aaiResponseWrapper, boolean baseFlag) { + List<AaiNqInventoryResponseItem> lst = aaiResponseWrapper.getVfModuleItems(baseFlag); + return (lst.isEmpty() ? null : lst.get(lst.size() - 1)); + } + + /** + * Builds the request parameters from the policy payload. + * + * @param policy the policy + * @param request request into which to stick the request parameters + */ + private void buildRequestParameters(Policy policy, SoRequestDetails request) { + // assume null until proven otherwise + request.setRequestParameters(null); + + if (policy.getPayload() == null) { + return; + } + + String json = policy.getPayload().get(REQ_PARAM_NM); + if (json == null) { + return; + } + + request.setRequestParameters(Serialization.gsonPretty.fromJson(json, SoRequestParameters.class)); + } + + /** + * Builds the configuration parameters from the policy payload. + * + * @param policy the policy + * @param request request into which to stick the configuration parameters + */ + private void buildConfigurationParameters(Policy policy, SoRequestDetails request) { + // assume null until proven otherwise + request.setConfigurationParameters(null); + + if (policy.getPayload() == null) { + return; + } + + String json = policy.getPayload().get(CONFIG_PARAM_NM); + if (json == null) { + return; + } + + request.setConfigurationParameters(Serialization.gsonPretty.fromJson(json, CONFIG_TYPE)); + } + + /** + * This method is called to remember the last service instance ID, VNF Item VNF ID and vf module ID. + * Note these fields are static, beware for multithreaded deployments + * + * @param vnfInstanceId update the last VNF instance ID to this value + * @param serviceInstanceId update the last service instance ID to this value + * @param vfModuleId update the vfModule instance ID to this value + */ + private static void preserveInstanceIds(final String vnfInstanceId, final String serviceInstanceId, + final String vfModuleId) { + lastVNFItemVnfId = vnfInstanceId; + lastServiceItemServiceInstanceId = serviceInstanceId; + lastVfModuleItemVfModuleInstanceId = vfModuleId; + } +} diff --git a/models-interactions/model-actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..a955eb71c --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.so.SoActorServiceProvider
\ No newline at end of file diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java new file mode 100644 index 000000000..d0eab120c --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoActorServiceProviderTest.java @@ -0,0 +1,231 @@ +/* + * ============LICENSE_START======================================================= + * TestSOActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Ericsson. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018-2019 AT&T. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.so; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.UUID; +import org.apache.commons.io.IOUtils; +import org.junit.Test; +import org.onap.policy.aai.AaiNqResponse; +import org.onap.policy.aai.AaiNqResponseWrapper; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.so.SoOperationType; +import org.onap.policy.so.SoRequest; +import org.onap.policy.so.SoRequestParameters; +import org.onap.policy.so.util.Serialization; + +public class SoActorServiceProviderTest { + + private static final String VF_MODULE_CREATE = "VF Module Create"; + private static final String VF_MODULE_DELETE = "VF Module Delete"; + + @Test + public void testConstructRequest() throws Exception { + VirtualControlLoopEvent onset = new VirtualControlLoopEvent(); + final ControlLoopOperation operation = new ControlLoopOperation(); + final AaiNqResponseWrapper aaiNqResp = loadAaiResponse(onset, "aai/AaiNqResponse-Full.json"); + + final UUID requestId = UUID.randomUUID(); + onset.setRequestId(requestId); + + Policy policy = new Policy(); + policy.setActor("Dorothy"); + policy.setRecipe("GoToOz"); + + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + + policy.setActor("SO"); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + + policy.setRecipe(VF_MODULE_CREATE); + + // empty policy payload + SoRequest request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + assertNotNull(request); + + assertEquals("my_module_3", request.getRequestDetails().getRequestInfo().getInstanceName()); + assertEquals("policy", request.getRequestDetails().getRequestInfo().getRequestorId()); + assertEquals("RegionOne", request.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId()); + + // non-empty policy payload + policy.setPayload(makePayload()); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + assertNotNull(request); + assertEquals(true, request.getRequestDetails().getRequestParameters().isUsePreload()); + assertEquals("avalue", request.getRequestDetails().getRequestParameters().getUserParams().get(0).get("akey")); + assertEquals(1, request.getRequestDetails().getConfigurationParameters().size()); + assertEquals("cvalue", request.getRequestDetails().getConfigurationParameters().get(0).get("ckey")); + + // payload with config, but no request params + policy.setPayload(makePayload()); + policy.getPayload().remove(SoActorServiceProvider.REQ_PARAM_NM); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + assertNotNull(request); + assertNull(request.getRequestDetails().getRequestParameters()); + assertNotNull(request.getRequestDetails().getConfigurationParameters()); + + // payload with request, but no config params + policy.setPayload(makePayload()); + policy.getPayload().remove(SoActorServiceProvider.CONFIG_PARAM_NM); + request = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + assertNotNull(request); + assertNotNull(request.getRequestDetails().getRequestParameters()); + assertNull(request.getRequestDetails().getConfigurationParameters()); + + // null response + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, null)); + + // response has no base VF module + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, + loadAaiResponse(onset, "aai/AaiNqResponse-NoBase.json"))); + + // response has no non-base VF modules (other than the "dummy") + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, + loadAaiResponse(onset, "aai/AaiNqResponse-NoNonBase.json"))); + + policy.setRecipe(VF_MODULE_DELETE); + SoRequest deleteRequest = new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp); + assertNotNull(deleteRequest); + assertEquals(SoOperationType.DELETE_VF_MODULE, deleteRequest.getOperationType()); + + /* + * NOTE: The remaining tests must be done in order + */ + + policy.setRecipe(VF_MODULE_CREATE); + + // null tenant + aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems() + .remove(1); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + + // null service item + aaiNqResp.getAaiNqResponse().getInventoryResponseItems().get(0).getItems().getInventoryResponseItems().get(0) + .setItems(null); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + + // null response + aaiNqResp.setAaiNqResponse(null); + assertNull(new SoActorServiceProvider().constructRequest(onset, operation, policy, aaiNqResp)); + } + + @Test + public void testSendRequest() { + try { + SoActorServiceProvider.sendRequest(UUID.randomUUID().toString(), null, null); + } catch (Exception e) { + fail("Test should not throw an exception"); + } + } + + @Test + public void testMethods() { + SoActorServiceProvider sp = new SoActorServiceProvider(); + + assertEquals("SO", sp.actor()); + assertEquals(2, sp.recipes().size()); + assertEquals(VF_MODULE_CREATE, sp.recipes().get(0)); + assertEquals(VF_MODULE_DELETE, sp.recipes().get(1)); + assertEquals(0, sp.recipePayloads(VF_MODULE_CREATE).size()); + assertEquals(0, sp.recipeTargets("unknown recipe").size()); + assertEquals(1, sp.recipeTargets(VF_MODULE_CREATE).size()); + } + + /** + * Creates a policy payload containing request & configuration parameters. + * + * @return the payload + */ + private Map<String, String> makePayload() { + Map<String, String> payload = new TreeMap<>(); + + payload.put(SoActorServiceProvider.REQ_PARAM_NM, makeReqParams()); + payload.put(SoActorServiceProvider.CONFIG_PARAM_NM, makeConfigParams()); + + return payload; + } + + /** + * Creates request parameters. + * + * @return request parameters, encoded as JSON + */ + private String makeReqParams() { + SoRequestParameters params = new SoRequestParameters(); + + params.setUsePreload(true); + + Map<String, String> map = new TreeMap<>(); + map.put("akey", "avalue"); + + List<Map<String, String>> lst = new LinkedList<>(); + lst.add(map); + + params.setUserParams(lst); + + return Serialization.gsonPretty.toJson(params); + } + + /** + * Creates configuration parameters. + * + * @return configuration parameters, encoded as JSON + */ + private String makeConfigParams() { + Map<String, String> map = new TreeMap<>(); + map.put("ckey", "cvalue"); + + List<Map<String, String>> lst = new LinkedList<>(); + lst.add(map); + + return Serialization.gsonPretty.toJson(lst); + } + + /** + * Reads an AAI vserver named-query response from a file. + * + * @param onset the ONSET event + * @param fileName name of the file containing the JSON response + * @return output from the AAI vserver named-query + * @throws IOException if the file cannot be read + */ + private AaiNqResponseWrapper loadAaiResponse(VirtualControlLoopEvent onset, String fileName) throws IOException { + String resp = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8); + AaiNqResponse aaiNqResponse = Serialization.gsonPretty.fromJson(resp, AaiNqResponse.class); + + return new AaiNqResponseWrapper(onset.getRequestId(), aaiNqResponse); + } +} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json new file mode 100644 index 000000000..af40be948 --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-Full.json @@ -0,0 +1,267 @@ +{ + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "vserver-name": "zdfw1lb01lb02", + "vserver-name2": "zdfw1lb01lb02", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510606403522" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer", + "generic-vnf": { + "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vnf-name": "Vfmodule_vLB1113", + "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", + "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", + "prov-status": "PREPROV", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510604011851", + "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", + "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer-1106", + "service-instance": { + "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", + "service-instance-name": "vLoadBalancer-1113", + "resource-version": "1510603936425", + "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", + "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer-1106" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + }, + { + "model-name": "Vloadbalancer..base_vlb..module-0", + "vf-module": { + "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", + "vf-module-name": "Vfmodule_vLB1113-1", + "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1510604612557", + "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", + "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..base_vlb..module-0" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "my_module_1", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "my_module_2", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + } + ] + } + }, + { + "tenant": { + "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenant-name": "Integration-SB-00", + "resource-version": "1509587770200" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "CloudOwner", + "cloud-region-id": "RegionOne", + "cloud-region-version": "v1", + "resource-version": "1509587770092" + }, + "extra-properties": { + "extra-property": [] + } + } + ] + } + } + ] + } + } + ] +} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json new file mode 100644 index 000000000..7101f60f2 --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoBase.json @@ -0,0 +1,230 @@ +{ + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "vserver-name": "zdfw1lb01lb02", + "vserver-name2": "zdfw1lb01lb02", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510606403522" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer", + "generic-vnf": { + "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vnf-name": "Vfmodule_vLB1113", + "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", + "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", + "prov-status": "PREPROV", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510604011851", + "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", + "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer-1106", + "service-instance": { + "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", + "service-instance-name": "vLoadBalancer-1113", + "resource-version": "1510603936425", + "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", + "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer-1106" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "my_module_1", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "my_module_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "my_module_2", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + } + ] + } + }, + { + "tenant": { + "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenant-name": "Integration-SB-00", + "resource-version": "1509587770200" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "CloudOwner", + "cloud-region-id": "RegionOne", + "cloud-region-version": "v1", + "resource-version": "1509587770092" + }, + "extra-properties": { + "extra-property": [] + } + } + ] + } + } + ] + } + } + ] +} diff --git a/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json new file mode 100644 index 000000000..a58100bc5 --- /dev/null +++ b/models-interactions/model-actors/actor.so/src/test/resources/org/onap/policy/controlloop/actor/so/aai/AaiNqResponse-NoNonBase.json @@ -0,0 +1,197 @@ +{ + "inventory-response-item": [ + { + "vserver": { + "vserver-id": "6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "vserver-name": "zdfw1lb01lb02", + "vserver-name2": "zdfw1lb01lb02", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/41d6d38489bd40b09ea8a6b6b852dcbd/servers/6ed3642c-f7a1-4a7c-9290-3d51fe1531eb", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510606403522" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer", + "generic-vnf": { + "vnf-id": "db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vnf-name": "Vfmodule_vLB1113", + "vnf-type": "vLoadBalancer-1106/vLoadBalancer 0", + "service-id": "66f157fc-4148-4880-95f5-e120677e98d1", + "prov-status": "PREPROV", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1510604011851", + "model-invariant-id": "cee050ed-92a5-494f-ab04-234307a846dc", + "model-version-id": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "fd65becc-6b2c-4fe8-ace9-cc29db9a3da2" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "cee050ed-92a5-494f-ab04-234307a846dc" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "model-name": "vLoadBalancer-1106", + "service-instance": { + "service-instance-id": "3b12f31f-8f2d-4f5c-b875-61ff1194b941", + "service-instance-name": "vLoadBalancer-1113", + "resource-version": "1510603936425", + "model-invariant-id": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a", + "model-version-id": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "732d4692-4b97-46f9-a996-0b3339e88c50" + }, + { + "property-name": "model-ver.model-name", + "property-value": "vLoadBalancer-1106" + }, + { + "property-name": "model.model-type", + "property-value": "service" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "1321d60d-f7ff-4300-96c2-6bf0b3268b7a" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1.0" + } + ] + } + }, + { + "model-name": "Vloadbalancer..base_vlb..module-0", + "vf-module": { + "vf-module-id": "e6b3e3eb-34e1-4c00-b8c1-2a4fbe479b12", + "vf-module-name": "Vfmodule_vLB1113-1", + "heat-stack-id": "Vfmodule_vLB1113-1/3dd6d900-772f-4fcc-a0cb-e250ab2bb4db", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1510604612557", + "model-invariant-id": "6d760188-9a24-451a-b05b-e08b86cb94f2", + "model-version-id": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "93facad9-55f2-4fe0-9574-814c2bc2d071" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..base_vlb..module-0" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "6d760188-9a24-451a-b05b-e08b86cb94f2" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + }, + { + "model-name": "Vloadbalancer..dnsscaling..module-1", + "vf-module": { + "vf-module-id": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "vf-module-name": "dummy_db373a8d-f7be-4d02-8ac8-6ca4c305d144", + "is-base-vf-module": false, + "resource-version": "1510610079687", + "model-invariant-id": "356a1cff-71f2-4086-9980-a2927ce11c1c", + "model-version-id": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + "extra-properties": { + "extra-property": [ + { + "property-name": "model-ver.model-version-id", + "property-value": "6b93d804-cfc8-4be3-92cc-9336d135859a" + }, + { + "property-name": "model-ver.model-name", + "property-value": "Vloadbalancer..dnsscaling..module-1" + }, + { + "property-name": "model.model-type", + "property-value": "resource" + }, + { + "property-name": "model.model-invariant-id", + "property-value": "356a1cff-71f2-4086-9980-a2927ce11c1c" + }, + { + "property-name": "model-ver.model-version", + "property-value": "1" + } + ] + } + } + ] + } + }, + { + "tenant": { + "tenant-id": "41d6d38489bd40b09ea8a6b6b852dcbd", + "tenant-name": "Integration-SB-00", + "resource-version": "1509587770200" + }, + "extra-properties": { + "extra-property": [] + }, + "inventory-response-items": { + "inventory-response-item": [ + { + "cloud-region": { + "cloud-owner": "CloudOwner", + "cloud-region-id": "RegionOne", + "cloud-region-version": "v1", + "resource-version": "1509587770092" + }, + "extra-properties": { + "extra-property": [] + } + } + ] + } + } + ] + } + } + ] +} diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml new file mode 100644 index 000000000..acef88940 --- /dev/null +++ b/models-interactions/model-actors/actor.test/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.test</artifactId> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.appc</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.so</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.appclcm</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.vfc</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml new file mode 100644 index 000000000..5f0b8ea0f --- /dev/null +++ b/models-interactions/model-actors/actor.vfc/pom.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actor.vfc</artifactId> + + <dependencies> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>vfc</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>policy-management</artifactId> + <version>${policy.drools-pdp.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>simulators</artifactId> + <version>${policy.drools-applications.version}</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java new file mode 100644 index 000000000..52902cb61 --- /dev/null +++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2017-2018 Intel Corp. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.vfc; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.onap.policy.aai.AaiGetVnfResponse; +import org.onap.policy.aai.AaiManager; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RestManager; +import org.onap.policy.vfc.VfcHealActionVmInfo; +import org.onap.policy.vfc.VfcHealAdditionalParams; +import org.onap.policy.vfc.VfcHealRequest; +import org.onap.policy.vfc.VfcRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class VfcActorServiceProvider implements Actor { + private static final Logger logger = LoggerFactory.getLogger(VfcActorServiceProvider.class); + + // Strings for VFC Actor + private static final String VFC_ACTOR = "VFC"; + + // Strings for targets + private static final String TARGET_VM = "VM"; + + // Strings for recipes + private static final String RECIPE_RESTART = "Restart"; + + private static final ImmutableList<String> recipes = ImmutableList.of(RECIPE_RESTART); + private static final ImmutableMap<String, List<String>> targets = + new ImmutableMap.Builder<String, List<String>>().put(RECIPE_RESTART, ImmutableList.of(TARGET_VM)).build(); + + @Override + public String actor() { + return VFC_ACTOR; + } + + @Override + public List<String> recipes() { + return ImmutableList.copyOf(recipes); + } + + @Override + public List<String> recipeTargets(String recipe) { + return ImmutableList.copyOf(targets.getOrDefault(recipe, Collections.emptyList())); + } + + @Override + public List<String> recipePayloads(String recipe) { + return Collections.emptyList(); + } + + /** + * Construct a request. + * + * @param onset the onset event + * @param operation the control loop operation + * @param policy the policy + * @param vnfResponse the VNF response + * @return the constructed request + */ + public static VfcRequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + Policy policy, AaiGetVnfResponse vnfResponse) { + + // Construct an VFC request + VfcRequest request = new VfcRequest(); + String serviceInstance = onset.getAai().get("service-instance.service-instance-id"); + if (serviceInstance == null || "".equals(serviceInstance)) { + AaiGetVnfResponse tempVnfResp = vnfResponse; + if (tempVnfResp == null) { // if the response is null, we haven't queried + // This does the AAI query since we haven't already + tempVnfResp = getAaiServiceInstance(onset); + if (tempVnfResp == null) { + return null; + } + } + serviceInstance = tempVnfResp.getServiceId(); + } + request.setNsInstanceId(serviceInstance); + request.setRequestId(onset.getRequestId()); + request.setHealRequest(new VfcHealRequest()); + request.getHealRequest().setVnfInstanceId(onset.getAai().get("generic-vnf.vnf-id")); + request.getHealRequest().setCause(operation.getMessage()); + request.getHealRequest().setAdditionalParams(new VfcHealAdditionalParams()); + + if (policy.getRecipe().toLowerCase().equalsIgnoreCase(RECIPE_RESTART)) { + request.getHealRequest().getAdditionalParams().setAction("restartvm"); + request.getHealRequest().getAdditionalParams().setActionInfo(new VfcHealActionVmInfo()); + request.getHealRequest().getAdditionalParams().getActionInfo() + .setVmid(onset.getAai().get("vserver.vserver-id")); + request.getHealRequest().getAdditionalParams().getActionInfo() + .setVmname(onset.getAai().get("vserver.vserver-name")); + } else { + return null; + } + return request; + } + + private static AaiGetVnfResponse getAaiServiceInstance(VirtualControlLoopEvent event) { + AaiGetVnfResponse response = null; + UUID requestId = event.getRequestId(); + String vnfName = event.getAai().get("generic-vnf.vnf-name"); + String vnfId = event.getAai().get("generic-vnf.vnf-id"); + String aaiUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url"); + String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username"); + String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); + try { + if (vnfName != null) { + String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; + response = new AaiManager(new RestManager()).getQueryByVnfName(url, aaiUsername, aaiPassword, requestId, + vnfName); + } else if (vnfId != null) { + String url = aaiUrl + "/aai/v11/network/generic-vnfs/generic-vnf/"; + response = new AaiManager(new RestManager()).getQueryByVnfId(url, aaiUsername, aaiPassword, requestId, + vnfId); + } else { + logger.error("getAAIServiceInstance failed"); + } + } catch (Exception e) { + logger.error("getAAIServiceInstance exception: ", e); + } + return response; + } +} diff --git a/models-interactions/model-actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor new file mode 100644 index 000000000..e43c726cf --- /dev/null +++ b/models-interactions/model-actors/actor.vfc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actor.vfc.VfcActorServiceProvider diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java new file mode 100644 index 000000000..5d4447b8b --- /dev/null +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - Policy Drools Applications + * ================================================================================ + * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T Corp. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actor.vfc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import java.util.Objects; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.AaiGetVnfResponse; +import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.VirtualControlLoopEvent; +import org.onap.policy.controlloop.policy.Policy; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.simulators.Util; +import org.onap.policy.vfc.VfcRequest; + +public class VfcActorServiceProviderTest { + + /** + * Set up for test class. + */ + @BeforeClass + public static void setUpSimulator() { + try { + Util.buildAaiSim(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @AfterClass + public static void tearDownSimulator() { + HttpServletServer.factory.destroy(); + } + + @Test + public void testConstructRequest() { + VirtualControlLoopEvent onset = new VirtualControlLoopEvent(); + ControlLoopOperation operation = new ControlLoopOperation(); + + Policy policy = new Policy(); + policy.setRecipe("GoToOz"); + + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAai().put("generic-vnf.vnf-id", "dorothy.gale.1939"); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666"); + PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI"); + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + UUID requestId = UUID.randomUUID(); + onset.setRequestId(requestId); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAai().put("generic-vnf.vnf-name", "Dorothy"); + PolicyEngine.manager.getEnvironment().remove("aai.password"); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI"); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + onset.getAai().put("service-instance.service-instance-id", ""); + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, null)); + + assertNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + + policy.setRecipe("Restart"); + assertNotNull(VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse())); + + VfcRequest request = + VfcActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse()); + + assertEquals(requestId, Objects.requireNonNull(request).getRequestId()); + assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId()); + assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction()); + } + + @Test + public void testMethods() { + VfcActorServiceProvider sp = new VfcActorServiceProvider(); + + assertEquals("VFC", sp.actor()); + assertEquals(1, sp.recipes().size()); + assertEquals("Restart", sp.recipes().get(0)); + assertEquals("VM", sp.recipeTargets("Restart").get(0)); + assertEquals(0, sp.recipePayloads("Restart").size()); + } +} diff --git a/models-interactions/model-actors/actorServiceProvider/pom.xml b/models-interactions/model-actors/actorServiceProvider/pom.xml new file mode 100644 index 000000000..9318e8ac8 --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <artifactId>actorServiceProvider</artifactId> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java new file mode 100644 index 000000000..809936146 --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ActorService + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actorserviceprovider; + +import com.google.common.collect.ImmutableList; + +import java.util.Iterator; +import java.util.ServiceLoader; + +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ActorService { + + private static final Logger logger = LoggerFactory.getLogger(ActorService.class); + private static ActorService service; + + // USed to load actors + private final ServiceLoader<Actor> loader; + + private ActorService() { + loader = ServiceLoader.load(Actor.class); + } + + /** + * Get the single instance. + * + * @return the instance + */ + public static synchronized ActorService getInstance() { + if (service == null) { + service = new ActorService(); + } + return service; + } + + /** + * Get the actors. + * + * @return the actors + */ + public ImmutableList<Actor> actors() { + Iterator<Actor> iter = loader.iterator(); + logger.debug("returning actors"); + while (iter.hasNext()) { + if (logger.isDebugEnabled()) { + logger.debug("Got {}", iter.next().actor()); + } + } + + return ImmutableList.copyOf(loader.iterator()); + } +} diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java new file mode 100644 index 000000000..88f3c16eb --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Actor + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actorserviceprovider.spi; + +import java.util.List; + +public interface Actor { + + String actor(); + + List<String> recipes(); + + List<String> recipeTargets(String recipe); + + List<String> recipePayloads(String recipe); + +} diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java new file mode 100644 index 000000000..3354a2268 --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/ActorServiceProviderTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * TestActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actorserviceprovider; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; + +public class ActorServiceProviderTest { + + @Test + public void testActorServiceProvider() { + ActorService actorService = ActorService.getInstance(); + assertNotNull(actorService); + + assertEquals(1, actorService.actors().size()); + + actorService = ActorService.getInstance(); + assertNotNull(actorService); + + Actor dummyActor = ActorService.getInstance().actors().get(0); + assertNotNull(dummyActor); + + assertEquals("DummyActor", dummyActor.actor()); + + assertEquals(2, dummyActor.recipes().size()); + assertEquals("Dorothy", dummyActor.recipes().get(0)); + assertEquals("Wizard", dummyActor.recipes().get(1)); + + assertEquals(2, dummyActor.recipeTargets("Dorothy").size()); + assertEquals(2, dummyActor.recipePayloads("Dorothy").size()); + } +} diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java new file mode 100644 index 000000000..e9cf238e2 --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/DummyActor.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * TestActorServiceProvider + * ================================================================================ + * Copyright (C) 2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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.actorserviceprovider; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.policy.controlloop.actorserviceprovider.spi.Actor; + +public class DummyActor implements Actor { + @Override + public String actor() { + return this.getClass().getSimpleName(); + } + + @Override + public List<String> recipes() { + List<String> recipeList = new ArrayList<>(); + recipeList.add("Dorothy"); + recipeList.add("Wizard"); + + return recipeList; + } + + @Override + public List<String> recipeTargets(String recipe) { + List<String> recipeTargetList = new ArrayList<>(); + recipeTargetList.add("Wicked Witch"); + recipeTargetList.add("Wizard of Oz"); + + return recipeTargetList; + } + + @Override + public List<String> recipePayloads(String recipe) { + List<String> recipePayloadList = new ArrayList<>(); + recipePayloadList.add("Dorothy"); + recipePayloadList.add("Toto"); + + return recipePayloadList; + } +} diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor b/models-interactions/model-actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor new file mode 100644 index 000000000..2a4bb5749 --- /dev/null +++ b/models-interactions/model-actors/actorServiceProvider/src/test/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor @@ -0,0 +1 @@ +org.onap.policy.controlloop.actorserviceprovider.DummyActor
\ No newline at end of file diff --git a/models-interactions/model-actors/pom.xml b/models-interactions/model-actors/pom.xml new file mode 100644 index 000000000..1144d8d45 --- /dev/null +++ b/models-interactions/model-actors/pom.xml @@ -0,0 +1,54 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + + <parent> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models-interactions</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>model-actors</artifactId> + + <modules> + <module>actorServiceProvider</module> + <module>actor.appc</module> + <module>actor.vfc</module> + <module>actor.sdnc</module> + <module>actor.appclcm</module> + <module>actor.sdnr</module> + <module>actor.so</module> + <module>actor.test</module> + </modules> + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.onap.policy.drools-applications.controlloop.common</groupId> + <artifactId>policy-yaml</artifactId> + <version>${policy.drools-applications.version}</version> + </dependency> + </dependencies> +</project> diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java index 72adb9d02..0b68d5bee 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiGetVserverResponse.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java index ad910dcf3..faaca5d04 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqCloudRegion.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java index c3139a342..7cf43cd3c 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperties.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java index 045e8fac9..29a687a4d 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqExtraProperty.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java index 8719f6ff2..ae313723d 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInstanceFilters.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java index 4ba9091fb..ef8f38e37 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItem.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java index 7d2a07787..0bcffc4fd 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqInventoryResponseItems.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java index fc6442847..fa56efae6 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqNamedQuery.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java index 9173fcdd5..59ec77338 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqQueryParameters.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java index 643754f9d..cdea359a8 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java index 6ae437232..aaad2bdf7 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqRequestError.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java index b823ceafb..00904ee37 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqResponse.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java index 7b6c50257..86c565261 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceExcept.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java index 2f48ad85d..cdc0658cb 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqServiceInstance.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java index 129c05933..e409d990f 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqTenant.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java index a7286ce8a..2ccdabd8a 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiNqVServer.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java index f992d886d..1757e9237 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Pnf.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java index 1a9d75efa..74e69be99 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfInstance.java @@ -8,9 +8,9 @@ * 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. @@ -38,7 +38,7 @@ public class PnfInstance implements Serializable { /** * Create an instance from a given instance. - * + * * @param instance the instance */ public PnfInstance(PnfInstance instance) { diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java index 1e2484441..a549d7b9d 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/PnfType.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java index 34f82e803..cc0e34c9c 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java index d9c55cc30..e4c6bcce4 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java index fc6b65f6c..848897f87 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java index 0215e1601..89c5f320a 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java index ef7c017df..1fe23cfde 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/AaiException.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java index 0ca0bb033..75cafd1b4 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java index ab31f5c27..8c2cd5fb6 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java index eb05be3cd..d74308d26 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java index ed68aeba0..6f063ecf9 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java index 20aac23f6..111042f6d 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java index 70f04dfee..6932031db 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java index a4410c9c0..e1ac2379c 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java index 09c8cc310..ebc64efc9 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java index adafa1b5f..0c487d437 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInstanceFiltersTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java index eefe80703..97384db76 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java index 796e69226..f43d7c777 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java index a62046681..2986f6db6 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqNamedQueryTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java index 2c1c0bf74..22c1b4bbf 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqQueryParametersTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java index 6aff8bc55..029cc59f3 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestErrorTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java index 982258a29..a8863197e 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java index 42979a45d..9b3a4afee 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseTest.java @@ -8,9 +8,9 @@ * 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. @@ -38,7 +38,7 @@ public class AaiNqResponseTest { /** * Get A&AI NQ response. - * + * * @return the A&AI NG response */ public AaiNqResponse getAaiNqResponse() { diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java index 574ee8670..459454e3a 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java @@ -8,9 +8,9 @@ * 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. @@ -250,7 +250,7 @@ public class AaiNqResponseWrapperTest { /** * Loads a response from a JSON file. - * + * * @param fileName name of the file containing the JSON response * @return the response * @throws IOException if the file cannot be read diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java index 946372cc9..4dc9b15e4 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java index 18e2de40f..4e03f57fc 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqTenantTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java index e1b612370..c6a04a5eb 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java index 9771d47d1..ab397cd95 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java index 6efbb76c6..b5b152089 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java index e34c0e1c1..3a24d8c46 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTypeTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java index 20697d832..4d40a1eb7 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java index def353fee..d5c11d9e4 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java index 2c5538057..2104c1898 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java index ee40d1fdf..acc6243d6 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java index f424385fe..4be8a53f6 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/util/AaiExceptionTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java index 48f5182bd..c57581b55 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseCode.java @@ -8,9 +8,9 @@ * 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. @@ -44,7 +44,7 @@ public enum ResponseCode { /** * Convert an integer code to a ResponseCode. - * + * * @param code the integer code * @return the ResponseCode */ diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java index 566115081..68c059ca8 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseStatus.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java index ef93fd2c8..1bb7e1f7d 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/ResponseValue.java @@ -8,9 +8,9 @@ * 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. @@ -40,7 +40,7 @@ public enum ResponseValue { /** * Convert a String value to a ResponseValue. - * + * * @param value the String value * @return the ResponseValue */ diff --git a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java index 473c5df20..735fb6234 100644 --- a/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java +++ b/models-interactions/model-impl/appc/src/main/java/org/onap/policy/appc/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java index c76a46ebb..5ff71e03a 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/CommonHeaderTest.java @@ -8,9 +8,9 @@ * 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. @@ -29,9 +29,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java index 6d9ea5221..bc4429f02 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/EnumsTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java index a6ef4a1d2..0f461d221 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/RequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java index b3176774d..561c9494b 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseStatusTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java index b0806fa25..68d3e00bc 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/ResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java index e47df424d..5d0d4c538 100644 --- a/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java +++ b/models-interactions/model-impl/appc/src/test/java/org/onap/policy/appc/util/SerializationTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java index 7b9bcda25..4e23bfe2c 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmRequestWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -42,7 +42,7 @@ public class LcmRequestWrapper extends LcmWrapper implements Serializable { /** * Get the body. - * + * * @return the body */ public LcmRequest getBody() { @@ -51,7 +51,7 @@ public class LcmRequestWrapper extends LcmWrapper implements Serializable { /** * Set the body. - * + * * @param body the body to set */ public void setBody(LcmRequest body) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java index e40e5e4b1..ac214aa75 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponse.java @@ -8,9 +8,9 @@ * 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. @@ -44,7 +44,7 @@ public class LcmResponse implements Serializable { /** * 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) { @@ -57,7 +57,7 @@ public class LcmResponse implements Serializable { /** * Get the common header. - * + * * @return the commonHeader */ public LcmCommonHeader getCommonHeader() { @@ -66,7 +66,7 @@ public class LcmResponse implements Serializable { /** * Set the common header. - * + * * @param commonHeader the commonHeader to set */ public void setCommonHeader(LcmCommonHeader commonHeader) { @@ -75,7 +75,7 @@ public class LcmResponse implements Serializable { /** * Get the status. - * + * * @return the status */ public LcmResponseStatus getStatus() { @@ -84,7 +84,7 @@ public class LcmResponse implements Serializable { /** * Set the status. - * + * * @param status the status to set */ public void setStatus(LcmResponseStatus status) { @@ -93,7 +93,7 @@ public class LcmResponse implements Serializable { /** * Get the payload. - * + * * @return the payload */ public String getPayload() { @@ -102,7 +102,7 @@ public class LcmResponse implements Serializable { /** * Set the payload. - * + * * @param payload the payload to set */ public void setPayload(String payload) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java index 64fcc8fb2..86ec68aa4 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseStatus.java @@ -8,9 +8,9 @@ * 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. @@ -41,7 +41,7 @@ public class LcmResponseStatus implements Serializable { /** * Get the code. - * + * * @return the code */ public int getCode() { @@ -50,7 +50,7 @@ public class LcmResponseStatus implements Serializable { /** * Set the code. - * + * * @param code the code to set */ public void setCode(int code) { @@ -59,7 +59,7 @@ public class LcmResponseStatus implements Serializable { /** * Get the message. - * + * * @return the message */ public String getMessage() { @@ -68,7 +68,7 @@ public class LcmResponseStatus implements Serializable { /** * Set the message. - * + * * @param message the message to set */ public void setMessage(String message) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java index cc1672a6a..1273017b4 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/LcmResponseWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -38,7 +38,7 @@ public class LcmResponseWrapper extends LcmWrapper implements Serializable { /** * Get the body. - * + * * @return the body */ public LcmResponse getBody() { @@ -47,7 +47,7 @@ public class LcmResponseWrapper extends LcmWrapper implements Serializable { /** * Set the body. - * + * * @param body the body to set */ public void setBody(LcmResponse body) { diff --git a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java index d261c442c..5274db43d 100644 --- a/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java +++ b/models-interactions/model-impl/appclcm/src/main/java/org/onap/policy/appclcm/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java index 88b8a3cad..0ca6239cd 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/AppcLcmTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java index 82a292ee5..7825e7fc1 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmCommonHeaderTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java index e89976c80..4b392f816 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java index e2c7f6279..cd457935e 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmRequestWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java index d5a6a16f6..c22aa6597 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResonseCodeTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java index 4bd7ba48d..b022aa1cb 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseStatusTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java index 06b64f78e..9388d2d2a 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java index 0b2b576a6..09755144b 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmResponseWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java index 40c7fc648..18fdc8ca2 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/LcmWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java index c855bc50a..7c0ca0aaf 100644 --- a/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java +++ b/models-interactions/model-impl/appclcm/src/test/java/org/onap/policy/appclcm/util/SerializationTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java index 37d7538c6..43cd640c0 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java @@ -8,9 +8,9 @@ * 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. @@ -71,7 +71,7 @@ public abstract class ControlLoopEvent implements Serializable { /** * Construct an instace from an existing instance. - * + * * @param event the existing instance */ public ControlLoopEvent(ControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java index 961a4f8f2..d90a66372 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java @@ -8,9 +8,9 @@ * 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. @@ -37,7 +37,7 @@ public enum ControlLoopEventStatus { /** * Convert a String status to a ControlLoopEventStatus. - * + * * @param status the String status * @return the ControlLoopEventStatus */ diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java index a55c65e2f..dd1854a1c 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java @@ -8,9 +8,9 @@ * 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. @@ -54,7 +54,7 @@ public abstract class ControlLoopNotification implements Serializable { /** * Construct an instance. - * + * * @param event the event */ public ControlLoopNotification(ControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java index 51df8749d..36203ff88 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java @@ -8,9 +8,9 @@ * 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. @@ -39,7 +39,7 @@ public enum ControlLoopNotificationType { /** * Convert a String type to a ControlLoopNotificationType. - * + * * @param type the String type * @return the ControlLoopNotificationType */ diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java index 35f482104..1d1a9676a 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java index e1d107be4..fda0d0831 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java @@ -8,9 +8,9 @@ * 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. @@ -37,7 +37,7 @@ public enum ControlLoopTargetType { /** * Convert a String type to a ControlLoopTargetType. - * + * * @param type the String type * @return the ControlLoopTargetType */ diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java index 245e3a6bd..7848d613a 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java @@ -8,9 +8,9 @@ * 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. @@ -28,7 +28,7 @@ public class PhysicalControlLoopEvent extends ControlLoopEvent { /** * Construct an instance from an existing instance. - * + * * @param event the existing instance */ public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java index a76b807f4..168f97c86 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java @@ -8,9 +8,9 @@ * 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. @@ -28,7 +28,7 @@ public class PhysicalControlLoopNotification extends ControlLoopNotification { /** * Construct an instance from an existing instance. - * + * * @param event the existing instance */ public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java index 1223d564c..1a0969189 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java @@ -8,9 +8,9 @@ * 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. @@ -45,7 +45,7 @@ public class VirtualControlLoopEvent extends ControlLoopEvent { /** * Construct an instance from an existing instance. - * + * * @param event the existing instance */ public VirtualControlLoopEvent(VirtualControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java index 0a7436520..857bdf0c0 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java @@ -8,9 +8,9 @@ * 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. @@ -44,7 +44,7 @@ public class VirtualControlLoopNotification extends ControlLoopNotification { /** * Construct an instance. - * + * * @param event the event */ public VirtualControlLoopNotification(VirtualControlLoopEvent event) { diff --git a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java index b36ee7f6b..df7dc54d3 100644 --- a/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ b/models-interactions/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java index 452c3fa7f..a14d86941 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/GetTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java index 5169468a2..9cda5f03f 100644 --- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java +++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/PostTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java index e90ab6def..c055cbb50 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java index 428f357aa..cfaa46fd0 100644 --- a/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java @@ -6,9 +6,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java index e7decbc15..8cd10eb56 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealAdditionalParamsTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java index c1ff45bec..1412bbb6e 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealRequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java index b65e45fc3..770feb4bb 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncHealServiceInfoTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java index 305fcebd6..ca6df0d0b 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncManagerTest.java @@ -10,9 +10,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java index 55fece751..ce3f30559 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncRequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java index 89d694e65..09591639f 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseDescriptorTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java index 06e3da81b..18c64aa0b 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/SdncResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java index b65efb36d..5ac910a17 100644 --- a/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java +++ b/models-interactions/model-impl/sdnc/src/test/java/org/onap/policy/sdnc/util/SerializationTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java index d7f979bc0..73ee4c65d 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java @@ -8,9 +8,9 @@ * 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. @@ -52,7 +52,7 @@ public class PciRequest implements Serializable { /** * Get the action. - * + * * @return the action */ public String getAction() { @@ -61,7 +61,7 @@ public class PciRequest implements Serializable { /** * Set the action. - * + * * @param action * the action to set */ @@ -71,7 +71,7 @@ public class PciRequest implements Serializable { /** * Get the payload. - * + * * @return the payload */ @@ -81,7 +81,7 @@ public class PciRequest implements Serializable { /** * Set the payload. - * + * * @param action * the action to set */ diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java index b8ce925f2..b762b5032 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -42,7 +42,7 @@ public class PciRequestWrapper extends PciWrapper implements Serializable { /** * Get the body. - * + * * @return the body */ public PciRequest getBody() { @@ -51,7 +51,7 @@ public class PciRequestWrapper extends PciWrapper implements Serializable { /** * Set the body. - * + * * @param body * the body to set */ diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java index 3cb4e8af6..b9b8f9b44 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java @@ -8,9 +8,9 @@ * 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. @@ -45,7 +45,7 @@ public class PciResponse implements Serializable { /** * Constructs a response using the common header of the request since they will * be the same. - * + * * @param request * an sdnr Pci request object specified by the Pci api guide */ @@ -56,7 +56,7 @@ public class PciResponse implements Serializable { /** * Get the common header. - * + * * @return the commonHeader */ public PciCommonHeader getCommonHeader() { @@ -65,7 +65,7 @@ public class PciResponse implements Serializable { /** * Set the common header. - * + * * @param commonHeader * the commonHeader to set */ @@ -75,7 +75,7 @@ public class PciResponse implements Serializable { /** * Get the status. - * + * * @return the status */ public Status getStatus() { @@ -84,7 +84,7 @@ public class PciResponse implements Serializable { /** * Set the status. - * + * * @param status * the status to set */ @@ -94,7 +94,7 @@ public class PciResponse implements Serializable { /** * Get the payload. - * + * * @return the payload */ diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java index 98eeed221..cf2e1e32b 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java @@ -8,9 +8,9 @@ * 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. @@ -38,7 +38,7 @@ public class PciResponseWrapper extends PciWrapper implements Serializable { /** * Get the body. - * + * * @return the body */ public PciResponse getBody() { @@ -47,7 +47,7 @@ public class PciResponseWrapper extends PciWrapper implements Serializable { /** * Set the body. - * + * * @param body * the body to set */ diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java index b4fead1d3..7b975cf65 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java @@ -8,9 +8,9 @@ * 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. @@ -41,7 +41,7 @@ public class Status implements Serializable { /** * Constructor for the class Status. - * + * */ public Status(int code, String value) { super(); diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java index 2acb6e8b2..31af9468a 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/Serialization.java @@ -9,9 +9,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java index c31e9461e..f0cc246b9 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java index e73d1973d..023dd18ca 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java index 0b839a861..897c57d8c 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java index e7667ddf7..7f102759e 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseCodeTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java index b9ecec33c..27f4c23cf 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java index 0673fc036..166c3aa61 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java index 594f9620d..f8f5820dc 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java index e9d1cd673..151d3343a 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java index 8a32f0a25..8317482cc 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java index e71dadc28..80b39890b 100644 --- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java +++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/util/SerializationTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java index cd4922dbd..e3139667c 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoAsyncRequestStatus.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java index e6512685b..8e51bc7f4 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoCloudConfiguration.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java index 751f560c0..06415d56e 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoInstanceReferences.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java index 42e477b6b..06080faad 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoModelInfo.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java index 1b80898cc..69861fb28 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoPolicyExceptionHolder.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java index b55ce27e8..083e73805 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstance.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java index 7fa2d638f..bb8efa89f 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRelatedInstanceListElement.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java index 9c4cc0f81..b33db457e 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java index 06dea0549..8b6e2169d 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestError.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java index 06f456a8d..148e68097 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestInfo.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java index 92ec1fe2e..82372e57a 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestReferences.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java index 95df506f9..4636a7502 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoRequestStatus.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java index 5feeb415e..7d9a0a969 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponse.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java index 2a74f38b5..1ecba5f83 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java index 79c162b4e..12747d373 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoServiceExceptionHolder.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java index 19f279dbb..61bb900fa 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/SoSubscriberInfo.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java index b23ccc993..7224e665a 100644 --- a/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java +++ b/models-interactions/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java index d64b70b51..daa6c865a 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/DemoTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java index 39aa2da6c..2b2205942 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoAsyncRequestStatusTest.java @@ -2,16 +2,16 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * + * * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java index b81643886..58b3943e4 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoCloudConfigurationTest.java @@ -2,16 +2,16 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * + * * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java index 51dd5cdc1..60b86bf01 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoModelInfoTest.java @@ -2,16 +2,16 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * + * * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java index e8899dd9d..3511d1349 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoPolicyExceptionHolderTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java index 82b11e03a..bad45ebc8 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceListElementTest.java @@ -2,16 +2,16 @@ * ============LICENSE_START======================================================= * so * ================================================================================ - * + * * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java index 019012f2e..72afdda3f 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRelatedInstanceTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java index 64f6ee594..eea3044ad 100644 --- a/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java +++ b/models-interactions/model-impl/so/src/test/java/org/onap/policy/so/SoRequestDetailsTest.java @@ -10,9 +10,9 @@ * 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. diff --git a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java index 296ed5573..248d23e39 100644 --- a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java +++ b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgRequest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java index 1b5069524..9034f08db 100644 --- a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java +++ b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/PgStream.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java index 77b8e78e0..901fe4076 100644 --- a/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java +++ b/models-interactions/model-impl/trafficgenerator/src/main/java/org/onap/policy/vnf/trafficgenerator/util/Serialization.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java b/models-interactions/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java index ee3c47631..d4ddd6ee4 100644 --- a/models-interactions/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java +++ b/models-interactions/model-impl/trafficgenerator/src/test/java/org/onap/policy/vnf/trafficgenerator/DemoTest.java @@ -8,9 +8,9 @@ * 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. diff --git a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java index a0eaad037..6e352d235 100644 --- a/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java +++ b/models-interactions/model-impl/vfc/src/main/java/org/onap/policy/vfc/util/Serialization.java @@ -7,9 +7,9 @@ * 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. diff --git a/models-interactions/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java b/models-interactions/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java index 504af4db4..f8a5c5287 100644 --- a/models-interactions/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java +++ b/models-interactions/model-impl/vfc/src/test/java/org/onap/policy/vfc/VfcManagerTest.java @@ -9,9 +9,9 @@ * 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. diff --git a/models-interactions/pom.xml b/models-interactions/pom.xml index 9bcd9f626..c928ce122 100644 --- a/models-interactions/pom.xml +++ b/models-interactions/pom.xml @@ -30,5 +30,6 @@ <name>${project.artifactId}</name> <modules> <module>model-impl</module> + <module>model-actors</module> </modules> </project>
\ No newline at end of file diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdent.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdent.java index 6d6b6fedd..a62d90090 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdent.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdent.java @@ -20,31 +20,31 @@ package org.onap.policy.models.pdp.concepts; +import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.base.Validated; /** * Identifies a policy. Both the name and version must be non-null. */ -@NonNull +@Data @NoArgsConstructor -public class PolicyIdent extends PfConceptKey { - private static final long serialVersionUID = 1L; - private static final Validated validator = new Validated(); +public class PolicyIdent { - public PolicyIdent(String name, String version) { - super(name, version); - } + @NonNull + private String name; - public PolicyIdent(PolicyIdent source) { - super(source); + @NonNull + private String version; + + + public PolicyIdent(@NonNull String name, @NonNull String version) { + this.name = name; + this.version = version; } - @Override - public PfValidationResult validate(PfValidationResult result) { - return super.validate(validator.validateNotNull(this, result)); + public PolicyIdent(PolicyIdent source) { + this.name = source.name; + this.version = source.version; } } diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdentOptVersion.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdentOptVersion.java index a68a271f2..f86a3c46d 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdentOptVersion.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyIdentOptVersion.java @@ -20,42 +20,39 @@ package org.onap.policy.models.pdp.concepts; +import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.base.PfKey; -import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.base.Validated; /** * Policy identifier with an optional version; only the "name" is required. */ -@NonNull +@Data @NoArgsConstructor -public class PolicyIdentOptVersion extends PfConceptKey { - private static final long serialVersionUID = 1L; - private static final Validated validator = new Validated(); +public class PolicyIdentOptVersion { + @NonNull + private String name; + + private String version; + + + public PolicyIdentOptVersion(@NonNull String name, String version) { + this.name = name; + this.version = version; + } public PolicyIdentOptVersion(PolicyIdentOptVersion source) { - super(source); + this.name = source.name; + this.version = source.version; } /** - * Validates the object. + * Determines if the version is null/missing. * - * @param resultIn where to place any errors - * @return a validation result + * @return {@code true} if the version is null/missing, {@code false} */ - public PfValidationResult validate(@NonNull final PfValidationResult resultIn) { - PfValidationResult result = resultIn; - - String name = getName(); - if (PfConceptKey.NULL_KEY_NAME.equals(name)) { - validator.addError(this, "name", result, "null"); - } - result = validator.validateText(this, "name", name, PfKey.NAME_REGEXP, result); - - return validator.validateText(this, "version", getVersion(), PfKey.VERSION_REGEXP, result); + public boolean isNullVersion() { + return (version == null); } } diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyTypeIdent.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyTypeIdent.java index ef67de86e..44ca168f5 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyTypeIdent.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PolicyTypeIdent.java @@ -20,31 +20,31 @@ package org.onap.policy.models.pdp.concepts; +import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.base.Validated; /** * Identifies a policy type. Both the name and version must be non-null. */ -@NonNull +@Data @NoArgsConstructor -public class PolicyTypeIdent extends PfConceptKey { - private static final long serialVersionUID = 1L; - private static final Validated validator = new Validated(); +public class PolicyTypeIdent { - public PolicyTypeIdent(String name, String version) { - super(name, version); - } + @NonNull + private String name; - public PolicyTypeIdent(PolicyTypeIdent source) { - super(source); + @NonNull + private String version; + + + public PolicyTypeIdent(@NonNull String name, @NonNull String version) { + this.name = name; + this.version = version; } - @Override - public PfValidationResult validate(PfValidationResult result) { - return super.validate(validator.validateNotNull(this, result)); + public PolicyTypeIdent(PolicyTypeIdent source) { + this.name = source.name; + this.version = source.version; } } diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java index fe0576dfe..6af2d211b 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java @@ -20,11 +20,21 @@ package org.onap.policy.models.pdp.persistence.provider; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + import lombok.NonNull; +import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.dao.PfDao; +import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.concepts.PdpSubGroup; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; /** * This class provides the provision of information on PAP concepts in the database to callers. @@ -36,16 +46,42 @@ public class PdpProvider { * Get PDP groups. * * @param dao the DAO to use to access the database - * @param pdpGroupFilter a filter for the get + * @param name the name of the policy to get, null to get all PDP groups + * @param version the version of the policy to get, null to get all versions of a PDP group * @return the PDP groups found * @throws PfModelException on errors getting PDP groups */ - public PdpGroups getPdpGroups(@NonNull final PfDao dao, @NonNull final String pdpGroupFilter) + public PdpGroups getPdpGroups(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { return new PdpGroups(); } /** + * Get latest PDP Groups. + * + * @param dao the DAO to use to access the database + * @param name the name of the PDP group to get, null to get all PDP groups + * @return the PDP groups found + * @throws PfModelException on errors getting policies + */ + public PdpGroups getLatestPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { + return new PdpGroups(); + } + + /** + * Get a filtered list of PDP groups. + * + * @param dao the DAO to use to access the database + * @param pdpType The PDP type filter for the returned PDP groups + * @param supportedPolicyTypes a list of policy type name/version pairs that the PDP groups must support. + * @return the PDP groups found + */ + public PdpGroups getFilteredPdpGroups(@NonNull final PfDao dao, @NonNull final String pdpType, + @NonNull final List<Pair<String, String>> supportedPolicyTypes) { + return new PdpGroups(); + } + + /** * Creates PDP groups. * * @param dao the DAO to use to access the database @@ -71,16 +107,76 @@ public class PdpProvider { return new PdpGroups(); } + + /** + * Update a PDP subgroup. + * + * @param dao the DAO to use to access the database + * @param pdpGroupName the name of the PDP group of the PDP subgroup + * @param pdpGroupVersion the version of the PDP group of the PDP subgroup + * @param pdpSubGroup the PDP subgroup to be updated + * @throws PfModelException on errors updating PDP subgroups + */ + public void updatePdpSubGroup(@NonNull final PfDao dao, @NonNull final String pdpGroupName, + @NonNull final String pdpGroupVersion, @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + // Not implemented yet + } + /** - * Delete PDP groups. + * Delete a PDP group. * * @param dao the DAO to use to access the database - * @param pdpGroupFilter a filter for the get - * @return the PDP groups deleted + * @param name the name of the policy to get, null to get all PDP groups + * @param version the version of the policy to get, null to get all versions of a PDP group + * @return the PDP group deleted * @throws PfModelException on errors deleting PDP groups */ - public PdpGroups deletePdpGroups(@NonNull final PfDao dao, @NonNull final String pdpGroupFilter) + public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name, @NonNull final String version) throws PfModelException { - return new PdpGroups(); + return new PdpGroup(); + + } + + /** + * Get PDP statistics. + * + * @param dao the DAO to use to access the database + * @param name the name of the PDP group to get statistics for, null to get all PDP groups + * @param version the version of the PDP group to get statistics for, null to get all versions of a PDP group + * @return the statistics found + * @throws PfModelException on errors getting statistics + */ + public List<PdpStatistics> getPdpStatistics(@NonNull final PfDao dao, final String name, final String version) + throws PfModelException { + return new ArrayList<>(); + } + + /** + * Update PDP statistics for a PDP. + * + * @param dao the DAO to use to access the database + * @param pdpGroupName the name of the PDP group containing the PDP that the statistics are for + * @param pdpGroupVersion the version of the PDP group containing the PDP that the statistics are for + * @param pdpType the PDP type of the subgroup containing the PDP that the statistics are for + * @param pdpInstanceId the instance ID of the PDP to update statistics for + * @throws PfModelException on errors updating statistics + */ + public void updatePdpStatistics(@NonNull final PfDao dao, @NonNull final String pdpGroupName, + @NonNull final String pdpGroupVersion, @NonNull final String pdpType, @NonNull final String pdpInstanceId, + @NonNull final PdpStatistics pdppStatistics) throws PfModelException { + // Not implemented yet + } + + /** + * Get deployed policies. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy to get, null to get all policies + * @return the policies deployed as a map of policy lists keyed by PDP group + * @throws PfModelException on errors getting policies + */ + public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(@NonNull final PfDao dao, final String name) + throws PfModelException { + return new LinkedHashMap<>(); } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdent.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdent.java index 4cd5570e2..da942468a 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdent.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdent.java @@ -22,11 +22,8 @@ package org.onap.policy.models.pdp.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.onap.policy.models.base.PfValidationResult; /** * Test the other constructors, as {@link TestModels} tests the other methods. @@ -62,29 +59,4 @@ public class TestPolicyIdent extends IdentTestBase<PolicyIdent> { orig = new PolicyIdent(NAME, VERSION); assertEquals(orig.toString(), new PolicyIdent(orig).toString()); } - - @Test - public void testValidate() throws Exception { - assertTrue(makeIdent(NAME, VERSION).validate(new PfValidationResult()).isValid()); - - // everything is null - PfValidationResult result = makeIdent(null, null).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(2, result.getMessageList().size()); - - // name is null - result = makeIdent(null, VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // version is null - result = makeIdent(NAME, null).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // version is invalid - result = makeIdent(NAME, "!!!" + VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdentOptVersion.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdentOptVersion.java index 3428ac1be..6ae7ad32b 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdentOptVersion.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyIdentOptVersion.java @@ -26,7 +26,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.onap.policy.models.base.PfValidationResult; /** * Test the other constructors, as {@link TestModels} tests the other methods. @@ -40,6 +39,22 @@ public class TestPolicyIdentOptVersion extends IdentTestBase<PolicyIdentOptVersi } @Test + public void testAllArgsConstructor_testIsNullVersion() { + assertThatThrownBy(() -> new PolicyIdentOptVersion(null, VERSION)).isInstanceOf(NullPointerException.class); + + // with null version + PolicyIdentOptVersion orig = new PolicyIdentOptVersion(NAME, null); + assertEquals(NAME, orig.getName()); + assertEquals(null, orig.getVersion()); + assertTrue(orig.isNullVersion()); + + orig = new PolicyIdentOptVersion(NAME, VERSION); + assertEquals(NAME, orig.getName()); + assertEquals(VERSION, orig.getVersion()); + assertFalse(orig.isNullVersion()); + } + + @Test public void testCopyConstructor() throws Exception { assertThatThrownBy(() -> new PolicyIdentOptVersion(null)).isInstanceOf(NullPointerException.class); @@ -52,36 +67,4 @@ public class TestPolicyIdentOptVersion extends IdentTestBase<PolicyIdentOptVersi orig = makeIdent(NAME, VERSION); assertEquals(orig.toString(), new PolicyIdentOptVersion(orig).toString()); } - - @Test - public void testValidate() throws Exception { - assertThatThrownBy(() -> makeIdent(NAME, VERSION).validate(null)).isInstanceOf(NullPointerException.class); - assertTrue(makeIdent(NAME, VERSION).validate(new PfValidationResult()).isValid()); - assertTrue(makeIdent(NAME, null).validate(new PfValidationResult()).isValid()); - - // everything is null - PfValidationResult result = makeIdent(null, null).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // name is null - result = makeIdent(null, VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // name is null, version is invalid - result = makeIdent(null, "$$$" + VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(2, result.getMessageList().size()); - - // name is invalid - result = makeIdent("!!!invalid name$$$", VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // version is invalid - result = makeIdent(NAME, "!!!" + VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyTypeIdent.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyTypeIdent.java index 5b7494ebf..9247544fd 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyTypeIdent.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/TestPolicyTypeIdent.java @@ -22,11 +22,8 @@ package org.onap.policy.models.pdp.concepts; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.onap.policy.models.base.PfValidationResult; /** * Test the other constructors, as {@link TestModels} tests the other methods. @@ -63,29 +60,4 @@ public class TestPolicyTypeIdent extends IdentTestBase<PolicyTypeIdent> { assertEquals(orig.toString(), new PolicyTypeIdent(orig).toString()); } - @Test - public void testValidate() throws Exception { - assertTrue(makeIdent(NAME, VERSION).validate(new PfValidationResult()).isValid()); - - // everything is null - PfValidationResult result = makeIdent(null, null).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(2, result.getMessageList().size()); - - // name is null - result = makeIdent(null, VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // version is null - result = makeIdent(NAME, null).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - - // version is invalid - result = makeIdent(NAME, "!!!" + VERSION).validate(new PfValidationResult()); - assertFalse(result.isValid()); - assertEquals(1, result.getMessageList().size()); - } - } diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java index a8d8483e3..b0494ff60 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java @@ -20,12 +20,19 @@ package org.onap.policy.models.provider; +import java.util.List; import java.util.Map; import lombok.NonNull; +import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.concepts.PdpSubGroup; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; @@ -48,13 +55,40 @@ public interface PolicyModelsProvider extends AutoCloseable { /** * Get policy types. * - * @param name the name of the policy type to get. - * @param version the version of the policy type to get. + * @param name the name of the policy type to get, set to null to get all policy types + * @param version the version of the policy type to get, set to null to get all versions * @return the policy types found * @throws PfModelException on errors getting policy types */ - public ToscaServiceTemplate getPolicyTypes(@NonNull final String name, @NonNull final String version) - throws PfModelException; + public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException; + + /** + * Get policy types. + * + * @param name the name of the policy type to get, set to null to get all policy types + * @param version the version of the policy type to get, set to null to get all versions + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public List<ToscaPolicyType> getPolicyTypeList(final String name, final String version) throws PfModelException; + + /** + * Get latest policy types. + * + * @param name the name of the policy type to get, set to null to get all policy types + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public ToscaServiceTemplate getLatestPolicyTypes(final String name) throws PfModelException; + + /** + * Get latest policy types. + * + * @param name the name of the policy type to get, set to null to get all policy types + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public List<ToscaPolicyType> getLatestPolicyTypeList(final String name) throws PfModelException; /** * Create policy types. @@ -77,26 +111,62 @@ public interface PolicyModelsProvider extends AutoCloseable { throws PfModelException; /** - * Delete policy types. + * Delete policy type. * * @param name the name of the policy type to delete. * @param version the version of the policy type to delete. - * @return the TOSCA service template containing the policy types that were deleted + * @return the TOSCA service template containing the policy type that was deleted * @throws PfModelException on errors deleting policy types */ - public ToscaServiceTemplate deletePolicyTypes(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicyType(@NonNull final String name, @NonNull final String version) throws PfModelException; /** * Get policies. * - * @param name the name of the policy to get. - * @param version the version of the policy to get. + * @param name the name of the policy to get, null to get all policies + * @param version the version of the policy to get, null to get all versions of a policy * @return the policies found * @throws PfModelException on errors getting policies */ - public ToscaServiceTemplate getPolicies(@NonNull final String name, @NonNull final String version) - throws PfModelException; + public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException; + + /** + * Get policies. + * + * @param name the name of the policy to get, null to get all policies + * @param version the version of the policy to get, null to get all versions of a policy + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getPolicyList(final String name, final String version) throws PfModelException; + + /** + * Get policies for a policy type name. + * + * @param policyTypeName the name of the policy type for which to get policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException; + + /** + * Get latest policies. + * + * @param name the name of the policy to get, null to get all policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public ToscaServiceTemplate getLatestPolicies(final String name) throws PfModelException; + + /** + * Get latest policies. + * + * @param name the name of the policy to get, null to get all policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getLatestPolicyList(final String name) throws PfModelException; /** * Create policies. @@ -108,7 +178,6 @@ public interface PolicyModelsProvider extends AutoCloseable { public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException; - /** * Update policies. * @@ -120,14 +189,14 @@ public interface PolicyModelsProvider extends AutoCloseable { throws PfModelException; /** - * Delete policies. + * Delete policy. * * @param name the name of the policy to delete. * @param version the version of the policy to delete. - * @return the TOSCA service template containing the policy types that were deleted - * @throws PfModelException on errors deleting policies + * @return the TOSCA service template containing the policy that was deleted + * @throws PfModelException on errors deleting a policy */ - public ToscaServiceTemplate deletePolicies(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicy(@NonNull final String name, @NonNull final String version) throws PfModelException; /** @@ -210,11 +279,31 @@ public interface PolicyModelsProvider extends AutoCloseable { /** * Get PDP groups. * - * @param pdpGroupFilter a filter for the get + * @param name the name of the policy to get, null to get all PDP groups + * @param version the version of the policy to get, null to get all versions of a PDP group * @return the PDP groups found * @throws PfModelException on errors getting PDP groups */ - public PdpGroups getPdpGroups(@NonNull final String pdpGroupFilter) throws PfModelException; + public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException; + + /** + * Get latest PDP Groups. + * + * @param name the name of the PDP group to get, null to get all PDP groups + * @return the PDP groups found + * @throws PfModelException on errors getting policies + */ + public PdpGroups getLatestPdpGroups(final String name) throws PfModelException; + + /** + * Get a filtered list of PDP groups. + * + * @param pdpType The PDP type filter for the returned PDP groups + * @param supportedPolicyTypes a list of policy type name/version pairs that the PDP groups must support. + * @return the PDP groups found + */ + public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType, + @NonNull final List<Pair<String, String>> supportedPolicyTypes); /** * Creates PDP groups. @@ -234,12 +323,57 @@ public interface PolicyModelsProvider extends AutoCloseable { */ public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException; + + /** + * Update a PDP subgroup. + * + * @param pdpGroupName the name of the PDP group of the PDP subgroup + * @param pdpGroupVersion the version of the PDP group of the PDP subgroup + * @param pdpSubGroup the PDP subgroup to be updated + * @throws PfModelException on errors updating PDP subgroups + */ + public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException; + /** - * Delete PDP groups. + * Delete a PDP group. * - * @param pdpGroupFilter a filter for the get - * @return the PDP groups deleted + * @param name the name of the policy to get, null to get all PDP groups + * @param version the version of the policy to get, null to get all versions of a PDP group + * @return the PDP group deleted * @throws PfModelException on errors deleting PDP groups */ - public PdpGroups deletePdpGroups(@NonNull final String pdpGroupFilter) throws PfModelException; + public PdpGroup deletePdpGroup(@NonNull final String name, @NonNull final String version) throws PfModelException; + + /** + * Get PDP statistics. + * + * @param name the name of the PDP group to get statistics for, null to get all PDP groups + * @param version the version of the PDP group to get statistics for, null to get all versions of a PDP group + * @return the statistics found + * @throws PfModelException on errors getting statistics + */ + public List<PdpStatistics> getPdpStatistics(final String name, final String version) throws PfModelException; + + /** + * Update PDP statistics for a PDP. + * + * @param pdpGroupName the name of the PDP group containing the PDP that the statistics are for + * @param pdpGroupVersion the version of the PDP group containing the PDP that the statistics are for + * @param pdpType the PDP type of the subgroup containing the PDP that the statistics are for + * @param pdpInstanceId the instance ID of the PDP to update statistics for + * @throws PfModelException on errors updating statistics + */ + public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final String pdpType, @NonNull final String pdpInstanceId, + @NonNull final PdpStatistics pdppStatistics) throws PfModelException; + + /** + * Get deployed policies. + * + * @param name the name of the policy to get, null to get all policies + * @return the policies deployed as a map of policy lists keyed by PDP group + * @throws PfModelException on errors getting policies + */ + public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException; } diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index 9a32feb65..ee8ed7348 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -23,22 +23,29 @@ package org.onap.policy.models.provider.impl; import java.sql.Connection; import java.sql.DriverManager; import java.util.Base64; +import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import lombok.NonNull; +import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.dao.DaoParameters; import org.onap.policy.models.dao.PfDao; import org.onap.policy.models.dao.PfDaoFactory; import org.onap.policy.models.dao.impl.DefaultPfDao; +import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.persistence.provider.PdpProvider; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderParameters; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.authorative.provider.AuthorativeToscaProvider; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; @@ -137,13 +144,30 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate getPolicyTypes(@NonNull final String name, @NonNull final String version) - throws PfModelException { + public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException { assertInitilized(); return new AuthorativeToscaProvider().getPolicyTypes(pfDao, name, version); } @Override + public List<ToscaPolicyType> getPolicyTypeList(final String name, final String version) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getPolicyTypeList(pfDao, name, version); + } + + @Override + public ToscaServiceTemplate getLatestPolicyTypes(final String name) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getLatestPolicyTypes(pfDao, name); + } + + @Override + public List<ToscaPolicyType> getLatestPolicyTypeList(final String name) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getLatestPolicyTypeList(pfDao, name); + } + + @Override public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { assertInitilized(); @@ -158,20 +182,43 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicyTypes(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicyType(@NonNull final String name, @NonNull final String version) throws PfModelException { assertInitilized(); - return new AuthorativeToscaProvider().deletePolicyTypes(pfDao, name, version); + return new AuthorativeToscaProvider().deletePolicyType(pfDao, name, version); } @Override - public ToscaServiceTemplate getPolicies(@NonNull final String name, @NonNull final String version) - throws PfModelException { + public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException { assertInitilized(); return new AuthorativeToscaProvider().getPolicies(pfDao, name, version); } @Override + public List<ToscaPolicy> getPolicyList(final String name, final String version) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getPolicyList(pfDao, name, version); + } + + @Override + public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getPolicyList4PolicyType(pfDao, policyTypeName); + } + + @Override + public ToscaServiceTemplate getLatestPolicies(final String name) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getLatestPolicies(pfDao, name); + } + + @Override + public List<ToscaPolicy> getLatestPolicyList(final String name) throws PfModelException { + assertInitilized(); + return new AuthorativeToscaProvider().getLatestPolicyList(pfDao, name); + } + + @Override public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { assertInitilized(); @@ -186,10 +233,10 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicies(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicy(@NonNull final String name, @NonNull final String version) throws PfModelException { assertInitilized(); - return new AuthorativeToscaProvider().deletePolicies(pfDao, name, version); + return new AuthorativeToscaProvider().deletePolicy(pfDao, name, version); } @Override @@ -246,27 +293,68 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public PdpGroups getPdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { + public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException { + assertInitilized(); + return new PdpProvider().getPdpGroups(pfDao, name, version); + } + + @Override + public PdpGroups getLatestPdpGroups(final String name) throws PfModelException { assertInitilized(); - return new PdpProvider().getPdpGroups(pfDao, pdpGroupFilter); + return new PdpProvider().getLatestPdpGroups(pfDao, name); } @Override - public PdpGroups createPdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException { + public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType, + @NonNull final List<Pair<String, String>> supportedPolicyTypes) { + assertInitilized(); + return new PdpProvider().getFilteredPdpGroups(pfDao, pdpType, supportedPolicyTypes); + } + + @Override + public PdpGroups createPdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException { assertInitilized(); return new PdpProvider().createPdpGroups(pfDao, pdpGroups); } @Override - public PdpGroups updatePdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException { + public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException { assertInitilized(); return new PdpProvider().updatePdpGroups(pfDao, pdpGroups); } @Override - public PdpGroups deletePdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { + public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + assertInitilized(); + new PdpProvider().updatePdpSubGroup(pfDao, pdpGroupName, pdpGroupVersion, pdpSubGroup); + } + + @Override + public PdpGroup deletePdpGroup(@NonNull final String name, @NonNull final String version) throws PfModelException { + assertInitilized(); + return new PdpProvider().deletePdpGroup(pfDao, name, version); + } + + @Override + public List<PdpStatistics> getPdpStatistics(final String name, final String version) throws PfModelException { + assertInitilized(); + return new PdpProvider().getPdpStatistics(pfDao, name, version); + } + + @Override + public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final String pdpType, @NonNull final String pdpInstanceId, + @NonNull final PdpStatistics pdppStatistics) throws PfModelException { + assertInitilized(); + new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpGroupVersion, pdpType, pdpInstanceId, + pdppStatistics); + } + + @Override + public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException { assertInitilized(); - return new PdpProvider().deletePdpGroups(pfDao, pdpGroupFilter); + return new PdpProvider().getDeployedPolicyList(pfDao, name); } /** diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index 8881ed08e..3db8e5e35 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -21,19 +21,27 @@ package org.onap.policy.models.provider.impl; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import lombok.NonNull; +import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderParameters; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; @@ -64,12 +72,26 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate getPolicyTypes(@NonNull final String name, @NonNull final String version) - throws PfModelException { + public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json"); } @Override + public List<ToscaPolicyType> getPolicyTypeList(final String name, final String version) throws PfModelException { + return new ArrayList<>(); + } + + @Override + public ToscaServiceTemplate getLatestPolicyTypes(final String name) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicyType> getLatestPolicyTypeList(final String name) throws PfModelException { + return new ArrayList<>(); + } + + @Override public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { return serviceTemplate; @@ -82,18 +104,37 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicyTypes(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicyType(@NonNull final String name, @NonNull final String version) throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json"); } @Override - public ToscaServiceTemplate getPolicies(@NonNull final String name, @NonNull final String version) - throws PfModelException { + public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json"); } @Override + public List<ToscaPolicy> getPolicyList(final String name, final String version) throws PfModelException { + return new ArrayList<>(); + } + + @Override + public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException { + return new ArrayList<>(); + } + + @Override + public ToscaServiceTemplate getLatestPolicies(final String name) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicy> getLatestPolicyList(final String name) throws PfModelException { + return new ArrayList<>(); + } + + @Override public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { return serviceTemplate; @@ -106,7 +147,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicies(@NonNull final String name, @NonNull final String version) + public ToscaServiceTemplate deletePolicy(@NonNull final String name, @NonNull final String version) throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json"); } @@ -158,23 +199,57 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public PdpGroups getPdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { - return new PdpGroups(); + public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException { + return null; + } + + @Override + public PdpGroups getLatestPdpGroups(final String name) throws PfModelException { + return null; + } + + @Override + public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType, + @NonNull final List<Pair<String, String>> supportedPolicyTypes) { + return null; + } + + @Override + public PdpGroups createPdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException { + return null; + } + + @Override + public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException { + return null; + } + + @Override + public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + // Not implemented + } + + @Override + public PdpGroup deletePdpGroup(@NonNull final String name, @NonNull final String version) throws PfModelException { + return null; } @Override - public PdpGroups createPdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException { - return new PdpGroups(); + public List<PdpStatistics> getPdpStatistics(final String name, final String version) throws PfModelException { + return new ArrayList<>(); } @Override - public PdpGroups updatePdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException { - return new PdpGroups(); + public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion, + @NonNull final String pdpType, @NonNull final String pdpInstanceId, + @NonNull final PdpStatistics pdppStatistics) throws PfModelException { + // Not implemented } @Override - public PdpGroups deletePdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { - return new PdpGroups(); + public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException { + return null; } /** diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java index 7eb712236..d9253334a 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java @@ -139,15 +139,15 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("serviceTemplate is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicyTypes(null, null); + databaseProvider.deletePolicyType(null, null); }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicyTypes("aaa", null); + databaseProvider.deletePolicyType("aaa", null); }).hasMessage("version is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicyTypes(null, "aaa"); + databaseProvider.deletePolicyType(null, "aaa"); }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { @@ -171,15 +171,15 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("serviceTemplate is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicies(null, null); + databaseProvider.deletePolicy(null, null); }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicies(null, "aaa"); + databaseProvider.deletePolicy(null, "aaa"); }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePolicies("aaa", null); + databaseProvider.deletePolicy("aaa", null); }).hasMessage("version is marked @NonNull but is null"); assertThatThrownBy(() -> { @@ -215,10 +215,6 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("policyId is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.getPdpGroups(null); - }).hasMessage("pdpGroupFilter is marked @NonNull but is null"); - - assertThatThrownBy(() -> { databaseProvider.createPdpGroups(null); }).hasMessage("pdpGroups is marked @NonNull but is null"); @@ -227,8 +223,8 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("pdpGroups is marked @NonNull but is null"); assertThatThrownBy(() -> { - databaseProvider.deletePdpGroups(null); - }).hasMessage("pdpGroupFilter is marked @NonNull but is null"); + databaseProvider.deletePdpGroup(null, null); + }).hasMessage("name is marked @NonNull but is null"); databaseProvider.close(); @@ -263,7 +259,7 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("no policy types specified on service template"); assertThatThrownBy(() -> { - databaseProvider.deletePolicyTypes("name", "version"); + databaseProvider.deletePolicyType("name", "version"); }).hasMessage("policy type not found: name:version"); assertThatThrownBy(() -> { @@ -279,7 +275,7 @@ public class DatabasePolicyModelsProviderTest { }).hasMessage("topology template not specified on service template"); assertThatThrownBy(() -> { - databaseProvider.deletePolicies("name", "version"); + databaseProvider.deletePolicy("name", "version"); }).hasMessage("policy not found: name:version"); assertThatThrownBy(() -> { @@ -314,10 +310,10 @@ public class DatabasePolicyModelsProviderTest { databaseProvider.deleteGuardPolicy("policy_id"); }).hasMessage("no policy found for policy ID: policy_id"); - assertNotNull(databaseProvider.getPdpGroups("filter")); + assertNotNull(databaseProvider.getPdpGroups("name", "version")); assertNotNull(databaseProvider.createPdpGroups(new PdpGroups())); assertNotNull(databaseProvider.updatePdpGroups(new PdpGroups())); - assertNotNull(databaseProvider.deletePdpGroups("filter")); + assertNotNull(databaseProvider.deletePdpGroup("name", "version")); } catch (Exception exc) { LOGGER.warn("test should not throw an exception", exc); diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java index a9a0d13e3..9320df57f 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java @@ -20,16 +20,23 @@ package org.onap.policy.models.provider.impl; +import java.util.List; import java.util.Map; import javax.ws.rs.core.Response; import lombok.NonNull; +import org.apache.commons.lang3.tuple.Pair; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.provider.PolicyModelsProvider; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; @@ -69,7 +76,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicyTypes(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException { return null; } @@ -91,7 +98,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate deletePolicies(final String name, final String version) throws PfModelException { + public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException { return null; } @@ -140,7 +147,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public PdpGroups getPdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { + public PdpGroups getPdpGroups(String name, String version) throws PfModelException { return null; } @@ -155,7 +162,73 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override - public PdpGroups deletePdpGroups(@NonNull String pdpGroupFilter) throws PfModelException { + public PdpGroup deletePdpGroup(@NonNull String name, @NonNull String verison) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException { + return null; + } + + @Override + public ToscaServiceTemplate getLatestPolicyTypes(String name) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicyType> getLatestPolicyTypeList(String name) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName) throws PfModelException { + return null; + } + + @Override + public ToscaServiceTemplate getLatestPolicies(String name) throws PfModelException { + return null; + } + + @Override + public List<ToscaPolicy> getLatestPolicyList(String name) throws PfModelException { + return null; + } + + @Override + public PdpGroups getLatestPdpGroups(String name) throws PfModelException { + return null; + } + + @Override + public PdpGroups getFilteredPdpGroups(@NonNull String pdpType, + @NonNull List<Pair<String, String>> supportedPolicyTypes) { + return null; + } + + @Override + public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion, + @NonNull PdpSubGroup pdpSubGroup) throws PfModelException { + } + + @Override + public List<PdpStatistics> getPdpStatistics(String name, String version) throws PfModelException { + return null; + } + + @Override + public void updatePdpStatistics(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion, + @NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) { + } + + @Override + public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(String name) throws PfModelException { return null; } } diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java index 3e13d854c..a0b4857de 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java @@ -23,6 +23,7 @@ package org.onap.policy.models.provider.impl; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import org.junit.Test; @@ -73,12 +74,12 @@ public class DummyPolicyModelsProviderTest { assertNotNull(dummyProvider.getPolicyTypes("name", "version")); assertNotNull(dummyProvider.createPolicyTypes(new ToscaServiceTemplate())); assertNotNull(dummyProvider.updatePolicyTypes(new ToscaServiceTemplate())); - assertNotNull(dummyProvider.deletePolicyTypes("name", "version")); + assertNotNull(dummyProvider.deletePolicyType("name", "version")); assertNotNull(dummyProvider.getPolicies("name", "version")); assertNotNull(dummyProvider.createPolicies(new ToscaServiceTemplate())); assertNotNull(dummyProvider.updatePolicies(new ToscaServiceTemplate())); - assertNotNull(dummyProvider.deletePolicies("name", "version")); + assertNotNull(dummyProvider.deletePolicy("name", "version")); assertNotNull(dummyProvider.getOperationalPolicy("policy_id")); assertNotNull(dummyProvider.createOperationalPolicy(new LegacyOperationalPolicy())); @@ -90,36 +91,11 @@ public class DummyPolicyModelsProviderTest { assertNotNull(dummyProvider.updateGuardPolicy(new LegacyGuardPolicyInput())); assertNotNull(dummyProvider.deleteGuardPolicy("policy_id")); - assertNotNull(dummyProvider.getPdpGroups("filter")); - assertNotNull(dummyProvider.createPdpGroups(new PdpGroups())); - assertNotNull(dummyProvider.updatePdpGroups(new PdpGroups())); - assertNotNull(dummyProvider.deletePdpGroups("filter")); + assertNull(dummyProvider.getPdpGroups("name", "version")); + assertNull(dummyProvider.createPdpGroups(new PdpGroups())); + assertNull(dummyProvider.updatePdpGroups(new PdpGroups())); + assertNull(dummyProvider.deletePdpGroup("name", "version")); - assertThatThrownBy(() -> { - dummyProvider.getPolicyTypes(null, null); - }).hasMessage("name is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.createPolicyTypes(null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.updatePolicyTypes(null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.deletePolicyTypes(null, null); - }).hasMessage("name is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - dummyProvider.getPolicies(null, null); - }).hasMessage("name is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.createPolicies(null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.updatePolicies(null); - }).hasMessage("serviceTemplate is marked @NonNull but is null"); - assertThatThrownBy(() -> { - dummyProvider.deletePolicies(null, null); - }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { dummyProvider.getOperationalPolicy(null); @@ -148,17 +124,14 @@ public class DummyPolicyModelsProviderTest { }).hasMessage("policyId is marked @NonNull but is null"); assertThatThrownBy(() -> { - dummyProvider.getPdpGroups(null); - }).hasMessage("pdpGroupFilter is marked @NonNull but is null"); - assertThatThrownBy(() -> { dummyProvider.createPdpGroups(null); }).hasMessage("pdpGroups is marked @NonNull but is null"); assertThatThrownBy(() -> { dummyProvider.updatePdpGroups(null); }).hasMessage("pdpGroups is marked @NonNull but is null"); assertThatThrownBy(() -> { - dummyProvider.deletePdpGroups(null); - }).hasMessage("pdpGroupFilter is marked @NonNull but is null"); + dummyProvider.deletePdpGroup(null, null); + }).hasMessage("name is marked @NonNull but is null"); dummyProvider.close(); } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index 0201bbea2..e9e92d361 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -20,11 +20,16 @@ package org.onap.policy.models.tosca.authorative.provider; +import java.util.ArrayList; +import java.util.List; + import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.dao.PfDao; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; @@ -44,13 +49,53 @@ public class AuthorativeToscaProvider { * @return the policy types found * @throws PfModelException on errors getting policy types */ - public ToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, @NonNull final String name, - @NonNull final String version) throws PfModelException { + public ToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, final String name, final String version) + throws PfModelException { return new SimpleToscaProvider().getPolicyTypes(dao, new PfConceptKey(name, version)).toAuthorative(); } /** + * Get policy types. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy type to get, set to null to get all policy types + * @param version the version of the policy type to get, set to null to get all versions + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public List<ToscaPolicyType> getPolicyTypeList(@NonNull final PfDao dao, final String name, final String version) + throws PfModelException { + return new ArrayList<>(); + } + + /** + * Get latest policy types. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy type to get, set to null to get all policy types + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public ToscaServiceTemplate getLatestPolicyTypes(@NonNull final PfDao dao, final String name) + throws PfModelException { + return null; + } + + /** + * Get latest policy types. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy type to get, set to null to get all policy types + * @return the policy types found + * @throws PfModelException on errors getting policy types + */ + public List<ToscaPolicyType> getLatestPolicyTypeList(@NonNull final PfDao dao, final String name) + throws PfModelException { + return new ArrayList<>(); + } + + /** * Create policy types. * * @param dao the DAO to use to access the database @@ -81,18 +126,18 @@ public class AuthorativeToscaProvider { } /** - * Delete policy types. + * Delete policy type. * * @param dao the DAO to use to access the database * @param name the name of the policy type to delete. * @param version the version of the policy type to delete. - * @return the TOSCA service template containing the policy types that were deleted + * @return the TOSCA service template containing the policy type that was deleted * @throws PfModelException on errors deleting policy types */ - public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfDao dao, @NonNull final String name, + public ToscaServiceTemplate deletePolicyType(@NonNull final PfDao dao, @NonNull final String name, @NonNull final String version) throws PfModelException { - return new SimpleToscaProvider().deletePolicyTypes(dao, new PfConceptKey(name, version)).toAuthorative(); + return new SimpleToscaProvider().deletePolicyType(dao, new PfConceptKey(name, version)).toAuthorative(); } /** @@ -111,6 +156,57 @@ public class AuthorativeToscaProvider { } /** + * Get policies. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy to get, null to get all policies + * @param version the version of the policy to get, null to get all versions of a policy + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getPolicyList(@NonNull final PfDao dao, final String name, final String version) + throws PfModelException { + return new ArrayList<>(); + } + + /** + * Get policies for a policy type name. + * + * @param dao the DAO to use to access the database + * @param policyTypeName the name of the policy type for which to get policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final PfDao dao, @NonNull final String policyTypeName) + throws PfModelException { + return new ArrayList<>(); + } + + /** + * Get latest policies. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy to get, null to get all policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public ToscaServiceTemplate getLatestPolicies(@NonNull final PfDao dao, final String name) throws PfModelException { + return null; + } + + /** + * Get latest policies. + * + * @param dao the DAO to use to access the database + * @param name the name of the policy to get, null to get all policies + * @return the policies found + * @throws PfModelException on errors getting policies + */ + public List<ToscaPolicy> getLatestPolicyList(@NonNull final PfDao dao, final String name) throws PfModelException { + return new ArrayList<>(); + } + + /** * Create policies. * * @param dao the DAO to use to access the database @@ -141,17 +237,17 @@ public class AuthorativeToscaProvider { } /** - * Delete policies. + * Delete policy. * * @param dao the DAO to use to access the database * @param name the name of the policy to delete. * @param version the version of the policy to delete. - * @return the TOSCA service template containing the policies that were deleted + * @return the TOSCA service template containing the policy that weas deleted * @throws PfModelException on errors deleting policies */ - public ToscaServiceTemplate deletePolicies(@NonNull final PfDao dao, @NonNull final String name, + public ToscaServiceTemplate deletePolicy(@NonNull final PfDao dao, @NonNull final String name, @NonNull final String version) throws PfModelException { - return new SimpleToscaProvider().deletePolicies(dao, new PfConceptKey(name, version)).toAuthorative(); + return new SimpleToscaProvider().deletePolicy(dao, new PfConceptKey(name, version)).toAuthorative(); } } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java index 6e356d0ab..e7e81603a 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java @@ -143,7 +143,7 @@ public class SimpleToscaProvider { * @return the TOSCA service template containing the policy types that were deleted * @throws PfModelException on errors deleting policy types */ - public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfDao dao, + public JpaToscaServiceTemplate deletePolicyType(@NonNull final PfDao dao, @NonNull final PfConceptKey policyTypeKey) throws PfModelException { @@ -251,7 +251,7 @@ public class SimpleToscaProvider { * @return the TOSCA service template containing the policies that were deleted * @throws PfModelException on errors deleting policies */ - public JpaToscaServiceTemplate deletePolicies(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey) + public JpaToscaServiceTemplate deletePolicy(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey) throws PfModelException { JpaToscaServiceTemplate serviceTemplate = getPolicies(dao, policyKey); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java index ebbebce1c..0d486e3ea 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java @@ -213,21 +213,21 @@ public class SimpleToscaProviderTest { @Test public void testPoliciesDelete() throws Exception { try { - new SimpleToscaProvider().deletePolicies(null, null); + new SimpleToscaProvider().deletePolicy(null, null); fail("test should throw an exception here"); } catch (Exception exc) { assertEquals("dao is marked @NonNull but is null", exc.getMessage()); } try { - new SimpleToscaProvider().deletePolicies(null, new PfConceptKey()); + new SimpleToscaProvider().deletePolicy(null, new PfConceptKey()); fail("test should throw an exception here"); } catch (Exception exc) { assertEquals("dao is marked @NonNull but is null", exc.getMessage()); } try { - new SimpleToscaProvider().deletePolicies(pfDao, null); + new SimpleToscaProvider().deletePolicy(pfDao, null); fail("test should throw an exception here"); } catch (Exception exc) { assertEquals("policyKey is marked @NonNull but is null", exc.getMessage()); @@ -249,7 +249,7 @@ public class SimpleToscaProviderTest { PfConceptKey policyKey = new PfConceptKey("onap.restart.tca:1.0.0"); JpaToscaServiceTemplate deletedServiceTemplate = - new SimpleToscaProvider().deletePolicies(pfDao, new PfConceptKey(policyKey)); + new SimpleToscaProvider().deletePolicy(pfDao, new PfConceptKey(policyKey)); assertEquals(originalServiceTemplate.getTopologyTemplate().getPolicies().get(policyKey), deletedServiceTemplate.getTopologyTemplate().getPolicies().get(policyKey)); @@ -40,6 +40,7 @@ <derby.version>10.13.1.1</derby.version> <javax.ws.rs-api.version>2.0.1</javax.ws.rs-api.version> <policy.common.version>1.4.0-SNAPSHOT</policy.common.version> + <policy.drools-applications.version>1.4.0-SNAPSHOT</policy.drools-applications.version> <policy.drools-pdp.version>1.4.0-SNAPSHOT</policy.drools-pdp.version> <!-- sonar/jacoco overrides --> |