From 4639a66f22d841bd4b44bdd554e62c311c4c1a37 Mon Sep 17 00:00:00 2001 From: "RamaPrasad Amaranarayana (ra5425)" Date: Wed, 19 Sep 2018 18:42:58 -0400 Subject: Change Management Schedule Optimization Adding CMSO Service Code for Change Management Schedule Optimization Change-Id: I11d98eb24544bc5fda0be64d196433cf67917a7a Issue-ID: OPTFRA-353 Signed-off-by: RamaPrasad Amaranarayana (ra5425) --- README.md | 1 + .../loopback/SchedulerTestLoopbackService.java | 87 ++++++++ .../loopback/SchedulerTestLoopbackServiceImpl.java | 215 +++++++++++++++++++ .../test/loopback/TicketMgtLoopbackService.java | 93 ++++++++ .../loopback/TicketMgtLoopbackServiceImpl.java | 93 ++++++++ .../src/test/java/org/onap/optf/cmso/JpaInit.java | 57 +++++ .../test/java/org/onap/optf/cmso/JtestHelper.java | 61 ++++++ .../java/org/onap/optf/cmso/service/H2Test.java | 47 +++++ .../optf/cmso/service/rs/CMSOServiceImplTest.java | 158 ++++++++++++++ .../cmso/service/rs/MockHttpServletRequest.java | 49 +++++ .../onap/optf/cmso/utilities/PropertiesAdmin.java | 52 +++++ .../src/test/resources/application-test.properties | 47 +++++ .../src/test/resources/application.properties | 144 +++++++++++++ cmso-service/src/test/resources/data-h2.sql | 8 + cmso-service/src/test/resources/schema-h2.sql | 233 +++++++++++++++++++++ cmso-service/src/test/resources/testConfig.xml | 92 ++++++++ .../OneVnfOneChangeWindowEmptyDomain.json.template | 30 +++ ...VnfOneChangeWindowEmptyScheduleID.json.template | 30 +++ ...fOneChangeWindowEmptyScheduleName.json.template | 30 +++ .../OneVnfOneChangeWindowEmptyUserID.json.template | 30 +++ ...fOneChangeWindowIncorrectPolicyId.json.template | 30 +++ ...fOneChangeWindowIncorrectWorkflow.json.template | 30 +++ ...owNegativeNormalDurationInSeconds.json.template | 30 +++ .../OneVnfOneChangeWindowNoEndTime.json.template | 30 +++ .../OneVnfOneChangeWindowNoNodeName.json.template | 30 +++ .../OneVnfOneChangeWindowNoStartTime.json.template | 30 +++ ...OneVnfOneChangeWindowSwitchedTime.json.template | 30 +++ ...fImmediateEmptyAdditionalDuration.json.template | 23 ++ .../MultipleVnfImmediateEmptyDomain.json.template | 23 ++ ...ltipleVnfImmediateEmptyScheduleId.json.template | 23 ++ .../MultipleVnfImmediateEmptyUserId.json.template | 23 ++ .../OneVnfImmediateEmptyDomain.json.template | 20 ++ .../OneVnfImmediateEmptyScheduleId.json.template | 20 ++ .../OneVnfImmediateEmptyScheduleName.json.template | 23 ++ ...neVnfImmediateEmptySchedulingInfo.json.template | 14 ++ .../OneVnfImmediateEmptyUserId.json.template | 14 ++ .../MultipleVnfImmediate.json.template | 24 +++ ...eGroupMultipleVNFsOneChangeWindow.json.template | 32 +++ ...GroupMultipleVNSsTwoChangeWindows.json.template | 37 ++++ .../changemanagement/OneVnfImmediate.json.template | 25 +++ .../OneVnfImmediateIncorrectWorkflow.json.template | 20 ++ .../OneVnfImmediateReplaceVNFInfra.json.template | 22 ++ .../OneVnfOneChangeWindow.json.template | 30 +++ ...fOneChangeWindowEmptyCallbackData.json.template | 25 +++ ...nfOneChangeWindowEmptyCallbackURL.json.template | 30 +++ ...VnfOneChangeWindowReplaceVNFInfra.json.template | 30 +++ .../changemanagement/VidCallbackData.json.template | 40 ++++ pom.xml | 63 ++++++ 48 files changed, 2328 insertions(+) create mode 100644 README.md create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java create mode 100644 cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackServiceImpl.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/JpaInit.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/JtestHelper.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/service/H2Test.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java create mode 100644 cmso-service/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java create mode 100644 cmso-service/src/test/resources/application-test.properties create mode 100644 cmso-service/src/test/resources/application.properties create mode 100644 cmso-service/src/test/resources/data-h2.sql create mode 100644 cmso-service/src/test/resources/schema-h2.sql create mode 100644 cmso-service/src/test/resources/testConfig.xml create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyDomain.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleID.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleName.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyUserID.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectPolicyId.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectWorkflow.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNegativeNormalDurationInSeconds.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoEndTime.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoNodeName.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoStartTime.json.template create mode 100644 cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowSwitchedTime.json.template create mode 100644 cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyAdditionalDuration.json.template create mode 100644 cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyDomain.json.template create mode 100644 cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyScheduleId.json.template create mode 100644 cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyUserId.json.template create mode 100644 cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyDomain.json.template create mode 100644 cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleId.json.template create mode 100644 cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleName.json.template create mode 100644 cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptySchedulingInfo.json.template create mode 100644 cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyUserId.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/MultipleVnfImmediate.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNFsOneChangeWindow.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNSsTwoChangeWindows.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfImmediate.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfImmediateIncorrectWorkflow.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfImmediateReplaceVNFInfra.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindow.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackData.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackURL.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowReplaceVNFInfra.json.template create mode 100644 cmso-service/src/test/templates/changemanagement/VidCallbackData.json.template create mode 100644 pom.xml diff --git a/README.md b/README.md new file mode 100644 index 0000000..b0425b6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Change Management Schedule Optimization \ No newline at end of file diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java new file mode 100644 index 0000000..f75365a --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackService.java @@ -0,0 +1,87 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.test.loopback; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import org.onap.optf.cmso.optimizer.bean.CMOptimizerRequest; +import org.onap.optf.cmso.so.bean.MsoOrchestrationQueryResponse; +import org.onap.optf.cmso.wf.bean.WfChangeManagementResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +@Api +@Path("/v1/loopbacktest") +@Produces({MediaType.APPLICATION_JSON}) +public interface SchedulerTestLoopbackService { + // ****************************************************************** + @POST + @Path("/optimizer") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Test Optimizer connection in loopback mode.") + @ApiResponses(value = {@ApiResponse(code = 202, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response putToOptimizer(@ApiParam(value = "SNIRO request message") CMOptimizerRequest request, + @Context UriInfo uri); + + // ****************************************************************** + @POST + @Path("/onap/so/infra/orchestrationRequests/v7/schedule/{vnfName}") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Test SO sheduling in loopback mode.", + response = WfChangeManagementResponse.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response soScheduleLoopback(@ApiParam(value = "vnfName") @PathParam("vnfName") String vnfName, + @ApiParam(value = "SO request message") String request, @Context UriInfo uri); + + // ****************************************************************** + @GET + @Path("/onap/so/infra/orchestrationRequests/v7/{requestId}") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Test SO Status query loopback.", response = MsoOrchestrationQueryResponse.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response soQueryLoopback(@ApiParam(value = "MSO request ID") @PathParam("requestId") String requestId, + @Context UriInfo uri); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java new file mode 100644 index 0000000..b240b61 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/SchedulerTestLoopbackServiceImpl.java @@ -0,0 +1,215 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.test.loopback; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.ws.rs.ProcessingException; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.ResponseProcessingException; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import org.joda.time.DateTime; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; +import org.onap.optf.cmso.common.BasicAuthenticatorFilter; +import org.onap.optf.cmso.common.LogMessages; +import org.onap.optf.cmso.common.PropertiesManagement; +import org.onap.optf.cmso.optimizer.bean.CMOptimizerRequest; +import org.onap.optf.cmso.optimizer.bean.CMOptimizerResponse; +import org.onap.optf.cmso.optimizer.bean.CMRequestInfo; +import org.onap.optf.cmso.optimizer.bean.CMSchedule; +import org.onap.optf.cmso.optimizer.bean.CMSchedulingInfo; +import org.onap.optf.cmso.optimizer.bean.CMVnfDetails; +import org.onap.optf.cmso.service.rs.CMSCallbackImpl; +import org.onap.optf.cmso.wf.bean.WfCmResponse200; +import org.onap.optf.cmso.wf.bean.WfMsoRequestReferences; +import org.onap.optf.cmso.wf.bean.WfMsoResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Controller; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +@Controller +public class SchedulerTestLoopbackServiceImpl implements SchedulerTestLoopbackService { + private static EELFLogger log = EELFManager.getInstance().getLogger(SchedulerTestLoopbackServiceImpl.class); + private static EELFLogger debug = EELFManager.getInstance().getDebugLogger(); + private static EELFLogger errors = EELFManager.getInstance().getErrorLogger(); + + @Autowired + Environment env; + + @Autowired + PropertiesManagement pm; + + @Override + public Response putToOptimizer(CMOptimizerRequest request, UriInfo uri) { + // + try { + CMOptimizerResponse r = new CMOptimizerResponse(); + CMRequestInfo ri = request.getRequestInfo(); + CMSchedulingInfo si = request.getSchedulingInfo(); + r.setTransactionId(ri.getTransactionId()); + r.setRequestState("Done."); + r.setScheduleId(ri.getRequestId()); + String callback = ri.getCallbackUrl(); + + // This is a dumb opt. WIll not make sense for multiple groups + // Use the code in the callback to help + List nodes = new ArrayList(); + // get total number of nodes across all groups. + for (CMVnfDetails sr : si.getVnfDetails()) { + nodes.add(sr.getNode()); + } + + DateTime startTime = CMSCallbackImpl.convertISODate(si.getStartTime(), "startTime"); + + // Ignore the finish time for now in the calc. Just accept what they + // gave + DateTime finishTime = CMSCallbackImpl.convertISODate(si.getEndTime(), "endTime"); + DateTimeFormatter sniroFmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").withZoneUTC(); + + int add = si.getAdditionalDurationInSecs(); + int normal = si.getNormalDurationInSecs(); + int concurrencyLimit = si.getConcurrencyLimit(); + long totalDuration = (long) add + normal; + long serialized = 0; + if (nodes.size() > concurrencyLimit) { + serialized = (nodes.size() / concurrencyLimit); + serialized = (serialized * totalDuration) * 1000; + } + DateTime latestInstanceStartTime = startTime.plus(serialized); + finishTime = latestInstanceStartTime.plus(totalDuration * 1000); + // Reformat request into a response setting the groups start finish + // time based upon + Map map = new HashMap(); + for (CMVnfDetails sr : si.getVnfDetails()) { + String groupId = sr.getGroupId(); + CMSchedule cms = map.get(groupId); + if (cms == null) { + cms = new CMSchedule(); + cms.setGroupId(groupId); + cms.setFinishTime(groupId); + map.put(groupId, cms); + cms.setStartTime(sniroFmt.print(startTime)); + cms.setFinishTime(sniroFmt.print(finishTime)); + cms.setLatestInstanceStartTime(sniroFmt.print(latestInstanceStartTime)); + } + cms.getNode().add(sr.getNode()); + } + r.setSchedule(map.values().toArray(new CMSchedule[map.values().size()])); + + Thread responseThread = new Thread(new Runnable() { + public void run() { + sendAsyncResponse(r, callback); + } + }); + responseThread.start(); + + return Response.accepted().build(); + } catch (Exception e) { + log.error("Unexpected exception", e); + } + return Response.serverError().build(); + } + + private void sendAsyncResponse(CMOptimizerResponse r, String url) { + try { + Client client = ClientBuilder.newClient(); + String user = env.getProperty("mechid.user", ""); + String pass = pm.getProperty("mechid.pass", ""); + client.register(new BasicAuthenticatorFilter(user, pass)); + WebTarget target = client.target(url); + Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON); + try { + Response response = invocationBuilder.post(Entity.json(r)); + switch (response.getStatus()) { + case 202: + // Scheduled with SNIRO + break; + case 400: // Bad request + case 500: + default: { + } + } + } catch (ResponseProcessingException e) { + errors.error(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage()); + debug.debug(LogMessages.OPTIMIZER_EXCEPTION, e, e.getMessage()); + + } catch (ProcessingException e) { + log.error(LogMessages.OPTIMIZER_EXCEPTION.toString(), e); + log.error(LogMessages.OPTIMIZER_EXCEPTION, e.getMessage()); + } + } catch (Exception e) { + errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); + debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage()); + + } + } + + public Response soScheduleLoopback(String vnfName, String request, UriInfo uri) { + String msoRequestId = env.getProperty("loopback.mso.requestId", "4ccbfb85-1d05-442e"); + String r = UUID.randomUUID().toString(); + WfMsoRequestReferences rr = new WfMsoRequestReferences(); + rr.setInstanceId(r); + rr.setRequestId(msoRequestId); + WfMsoResponse mso = new WfMsoResponse(); + mso.setRequestReferences(rr); + WfCmResponse200 cmResponse = new WfCmResponse200(); + cmResponse.setEntity(mso); + cmResponse.setStatus(202);; + return Response.status(Status.OK).entity(cmResponse).build(); + } + + @Override + public Response soQueryLoopback(String requestId, UriInfo uri) { + // Abbreviated response. Only interested in requestStatus.... + String response = "{\"request\" : {" + "\"requestId\" : \"dummy-request-id\"," + + "\"startTime\" : \"Wed, 26 Aug 2017 06:36:07 GMT\"," + "\"requestScope\" : \"vfModule\"," + + "\"requestType\" : \"createInstance\"," + "\"requestDetails\" : {}," + "\"instanceReferences\" : {}," + + "\"requestStatus\" : { " + "\"requestState\" : \"COMPLETE\"," + + "\"statusMessage\" : \"Vf Module has been created successfully.\"," + "\"percentProgress\" : 100," + + "\"finishTime\" : \"Crap so cmso uses current time\"}}}"; + return Response.ok().entity(response).build(); + } + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java new file mode 100644 index 0000000..d2953b6 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackService.java @@ -0,0 +1,93 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.test.loopback; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +@Api +@Path("/v1/tm") +@Produces({MediaType.APPLICATION_JSON}) +public interface TicketMgtLoopbackService { + + // ****************************************************************** + @POST + @Path("/getChangeRecord") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Dummy out ticket management check status call.", response = JsonNode.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response tmGetChangeRecord(@ApiParam(value = "TM request message") JsonNode request, @Context UriInfo uri); + + // ****************************************************************** + @POST + @Path("/createChangeRecord") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Dummy out ticket management create call.", response = JsonNode.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response tmCreateChangeRecord(@ApiParam(value = "TM request message") JsonNode request, + @Context UriInfo uri); + + // ****************************************************************** + @POST + @Path("/closeCancelChangeRecord") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Dummy out ticket management close call.", response = JsonNode.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response tmCloseCancelChangeRecord(@ApiParam(value = "TM request message") JsonNode request, + @Context UriInfo uri); + + // ****************************************************************** + @POST + @Path("/updateChangeRecord") + @Produces({MediaType.APPLICATION_JSON}) + @ApiOperation(value = "", notes = "Dummy out ticket management update to in progress call.", + response = JsonNode.class) + @ApiResponses(value = {@ApiResponse(code = 200, message = "OK"), + @ApiResponse(code = 500, message = "Unexpected Runtime error", response = Exception.class)}) + public Response tmUpdateChangeRecord(@ApiParam(value = "TM request message") JsonNode request, + @Context UriInfo uri); + +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackServiceImpl.java new file mode 100644 index 0000000..1c87f66 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/test/loopback/TicketMgtLoopbackServiceImpl.java @@ -0,0 +1,93 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.test.loopback; + +import java.util.HashMap; +import java.util.Map; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; +import org.onap.optf.cmso.common.PropertiesManagement; +import org.onap.optf.cmso.ticketmgt.bean.TmApprovalStatusEnum; +import org.onap.optf.cmso.ticketmgt.bean.TmChangeInfo; +import org.onap.optf.cmso.ticketmgt.bean.TmStatusEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Controller; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +@Controller +public class TicketMgtLoopbackServiceImpl implements TicketMgtLoopbackService { + private static EELFLogger log = EELFManager.getInstance().getLogger(TicketMgtLoopbackServiceImpl.class); + private static EELFLogger debug = EELFManager.getInstance().getDebugLogger(); + private static EELFLogger errors = EELFManager.getInstance().getErrorLogger(); + + @Autowired + Environment env; + + PropertiesManagement pm; + + @Override + public Response tmGetChangeRecord(JsonNode request, UriInfo uri) { + TmChangeInfo changeInfo = new TmChangeInfo(); + changeInfo.setChangeId("CHG000000000001"); + changeInfo.setStatus(TmStatusEnum.Scheduled.toString()); + changeInfo.setApprovalStatus(TmApprovalStatusEnum.Approved.toString()); + return Response.ok().entity(changeInfo).build(); + } + + @Override + public Response tmCreateChangeRecord(JsonNode request, UriInfo uri) { + Map response = new HashMap(); + response.put("changeId", "CHG000000000001"); + return Response.ok().entity(response).build(); + } + + @Override + public Response tmCloseCancelChangeRecord(JsonNode request, UriInfo uri) { + ObjectNode req = (ObjectNode) request; + String changeId = req.get("changeId").asText(); + String resp = changeId + " was update successfully."; + return Response.ok().entity(resp).build(); + } + + @Override + public Response tmUpdateChangeRecord(JsonNode request, UriInfo uri) { + ObjectNode req = (ObjectNode) request; + String changeId = req.get("changeId").asText(); + String resp = changeId + " was updated successfully."; + return Response.ok().entity(resp).build(); + } + +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/JpaInit.java b/cmso-service/src/test/java/org/onap/optf/cmso/JpaInit.java new file mode 100644 index 0000000..8a3aa58 --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/JpaInit.java @@ -0,0 +1,57 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso; + +import java.util.concurrent.atomic.AtomicBoolean; +import org.onap.optf.cmso.model.ApprovalType; +import org.onap.optf.cmso.model.Domain; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; + +public class JpaInit { + + private static AtomicBoolean initialized = new AtomicBoolean(false); + + public static void init(TestEntityManager entityManager) { + if (initialized.compareAndSet(true, true)) + return; + Domain d = new Domain(); + d.setDomain("ChangeManagement"); + entityManager.persist(d); + ApprovalType at = new ApprovalType(); + at.setApprovalCount(1); + at.setDomain("ChangeManagement"); + at.setApprovalType("Tier 2"); + entityManager.persist(at); + entityManager.flush(); + + } +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/JtestHelper.java b/cmso-service/src/test/java/org/onap/optf/cmso/JtestHelper.java new file mode 100644 index 0000000..d0b03e5 --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/JtestHelper.java @@ -0,0 +1,61 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Map; +import java.util.Scanner; +import org.apache.commons.lang3.text.StrSubstitutor; + +public class JtestHelper { + private static String templatefolder = "src/test/templates" + File.separator; + + public static String template(String filename, Map values) { + String data = ""; + Scanner s = null; + try { + File t = new File(templatefolder + filename); + s = new Scanner(t); + s.useDelimiter("\\Z"); + data = s.next(); + StrSubstitutor ss = new StrSubstitutor(values); + data = ss.replace(data); + } catch (FileNotFoundException e) { + data = ""; + } finally { + if (s != null) + s.close(); + } + return data; + } +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/service/H2Test.java b/cmso-service/src/test/java/org/onap/optf/cmso/service/H2Test.java new file mode 100644 index 0000000..8a586a9 --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/service/H2Test.java @@ -0,0 +1,47 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.service; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:testConfig.xml"}) +public class H2Test { + + @Test + public void h2Test() { + + } +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java b/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java new file mode 100644 index 0000000..c8039ad --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/CMSOServiceImplTest.java @@ -0,0 +1,158 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.service.rs; + +import static org.junit.Assert.assertEquals; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import javax.ws.rs.core.Response; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.optf.cmso.JpaInit; +import org.onap.optf.cmso.JtestHelper; +import org.onap.optf.cmso.common.CMSRequestError; +import org.onap.optf.cmso.service.rs.models.CMSMessage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; +import org.springframework.test.context.junit4.SpringRunner; +import com.fasterxml.jackson.databind.ObjectMapper; +import scala.collection.mutable.StringBuilder; + +@RunWith(SpringRunner.class) +@DataJpaTest +public class CMSOServiceImplTest { + + @Autowired + CMSOServiceImpl cMSOServiceImpl; + + @Autowired + private TestEntityManager entityManager; + + @Before + public void setUp() throws Exception { + JpaInit.init(entityManager); + } + + @Test + public void test_createScheduleRequest() { + String[] templates = {"changemanagement/MultipleVnfImmediate.json.template",}; + String[] domains = {"ChangeManagement",}; + String[] userIds = {"jf9860",}; + String[] callbackUrls = {"http://localhost:8089/",}; + String[] callbackDatum = {"sdafafadfdasfdsafdsa",}; + String[] workflows = {"Replace", "Update", "NewOne",}; + Integer[] normalDurationInSeeconds = {10,}; + Integer[] additionalDurationInSeeconds = {10,}; + String[] results = {"500:", // {additionalDurationInSeconds=10, workflow=Replace, + // domain=ChangeManagement, + // callbackData=sdafafadfdasfdsafdsa, testid=79e1, + // callbackUrl=http://localhost:8089/, + // uuid=a36b45b9-dff4-45b4-ac6b-2a4f35e179e1, userId=jf9860, + // normalDurationInSeconds=10} + "500:", // {additionalDurationInSeconds=10, workflow=Update, + // domain=ChangeManagement, + // callbackData=sdafafadfdasfdsafdsa, testid=c525, + // callbackUrl=http://localhost:8089/, + // uuid=26b189f7-b075-4013-b487-d938b895c525, userId=jf9860, + // normalDurationInSeconds=10} + "500:", // {additionalDurationInSeconds=10, workflow=NewOne, + // domain=ChangeManagement, + // callbackData=sdafafadfdasfdsafdsa, testid=8e87, + // callbackUrl=http://localhost:8089/, + // uuid=4f59b14a-8040-4257-8981-defcb8f38e87, userId=jf9860, + // normalDurationInSeconds=10} + }; + + int i = 0; + for (String template : templates) { + for (String domain : domains) { + for (String userId : userIds) { + for (String callbackUrl : callbackUrls) { + for (String callbackData : callbackDatum) { + for (String workflow : workflows) { + for (Integer normalDuration : normalDurationInSeeconds) { + for (Integer additionalDuration : additionalDurationInSeeconds) { + Map values = new HashMap(); + String scheduleId = UUID.randomUUID().toString(); + values.put("uuid", scheduleId); + values.put("testid", scheduleId.substring(scheduleId.length() - 4)); + values.put("domain", domain); + values.put("userId", userId); + values.put("callbackUrl", callbackUrl); + values.put("callbackData", callbackData); + values.put("workflow", workflow); + values.put("normalDurationInSeconds", normalDuration.toString()); + values.put("additionalDurationInSeconds", additionalDuration.toString()); + String json = JtestHelper.template(template, values); + ObjectMapper om = new ObjectMapper(); + CMSMessage scheduleMessage; + try { + scheduleMessage = om.readValue(json, CMSMessage.class); + MockHttpServletRequest mrequest = new MockHttpServletRequest(); + mrequest.url.append(scheduleId); + + Response response = cMSOServiceImpl.createScheduleRequest("v2", scheduleId, + scheduleMessage, mrequest.request); + + Object result = response.getEntity(); + StringBuilder sb = new StringBuilder(); + sb.append(response.getStatus()).append(":"); + if (result instanceof CMSRequestError) { + String r = result.toString().replaceAll(" : Reason :.*$", ""); + sb.append(r.replaceAll(scheduleId, "")); + } + // Generate results[] entry + System.out.println("\"" + sb.toString() + "\", //" + values.toString()); + + // Debug an assertion + System.out.println(results[i] + ":" + sb.toString()); + assertEquals(results[i].equals(sb.toString()), true); + i++; + + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + } + + } + } + } + } + } + } +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java b/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java new file mode 100644 index 0000000..aace25e --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/service/rs/MockHttpServletRequest.java @@ -0,0 +1,49 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.service.rs; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import javax.servlet.http.HttpServletRequest; + +public class MockHttpServletRequest { + public StringBuffer url = new StringBuffer("http://localhost:8089/cmso/v1/ChangeManagement/schedules/"); + public HttpServletRequest request = mock(HttpServletRequest.class); + + MockHttpServletRequest() { + + when(request.getRequestURL()).thenReturn(url); + when(request.getHeader("Authorization")).thenReturn("BasicbTEzODc3OnNjaGVkdWxlci1SMTgwMiE="); + + } + +} diff --git a/cmso-service/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java b/cmso-service/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java new file mode 100644 index 0000000..faf408b --- /dev/null +++ b/cmso-service/src/test/java/org/onap/optf/cmso/utilities/PropertiesAdmin.java @@ -0,0 +1,52 @@ +/* + * Copyright 2017-2018 AT&T Intellectual Property. + * Modifications Copyright 2018 IBM. + * + * 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. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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. +*/ + +package org.onap.optf.cmso.utilities; + +import org.onap.optf.cmso.common.PropertiesManagement; + +public class PropertiesAdmin { + public static void main(String[] args) { + PropertiesManagement pm = new PropertiesManagement(); + if (args.length < 1) { + System.out.println("Missing argument"); + return; + } + String value = ""; + if (args[0].startsWith("dec:")) { + value = PropertiesManagement.getDecryptedValue(args[0].substring(4)); + } else { + value = pm.getEncryptedValue(args[0]); + } + System.out.println(args[0] + " : " + value); + } + +} diff --git a/cmso-service/src/test/resources/application-test.properties b/cmso-service/src/test/resources/application-test.properties new file mode 100644 index 0000000..e32b8db --- /dev/null +++ b/cmso-service/src/test/resources/application-test.properties @@ -0,0 +1,47 @@ +#------------------------------------------------------------------------------- +# Copyright 2017-2018 AT&T Intellectual Property. +# Modifications Copyright 2018 IBM. +# +# 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. +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# 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. +#------------------------------------------------------------------------------- + +info.build.artifact=@project.artifactId@ +info.build.name=@project.name@ +info.build.description=@project.description@ +info.build.version=@project.version@ + +spring.jersey.type=filter + +logging.level.root=info +logging.level.org.glassfish=info +logging.level.org.glassfish.jersey=info + +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + +logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + +cmso.aaf.enabled=false diff --git a/cmso-service/src/test/resources/application.properties b/cmso-service/src/test/resources/application.properties new file mode 100644 index 0000000..1ddf6c8 --- /dev/null +++ b/cmso-service/src/test/resources/application.properties @@ -0,0 +1,144 @@ +#------------------------------------------------------------------------------- +# Copyright 2017-2018 AT&T Intellectual Property. +# Modifications Copyright 2018 IBM. +# +# 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. +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the ??License?); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# 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. +#------------------------------------------------------------------------------- + +info.build.artifact=@project.artifactId@ +info.build.name=@project.name@ +info.build.description=@project.description@ +info.build.version=@project.version@ + +spring.jersey.type=filter + +logging.level.root=info +logging.level.org.glassfish=info +logging.level.org.glassfish.jersey=info + +spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + +test.datasource.url=jdbc:h2:file:./h2db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=true;MODE=MYSQL +test.datasource.driver-class-name=org.h2.Driver +test.datasource.username=sa +test.datasource.password=sa + +test.datasource.initialize=false +test.datasource.tomcat.max-wait=10000 +test.datasource.tomcat.initialSize=5 +test.datasource.tomcat.max-active=25 +test.datasource.tomcat.test-on-borrow=true + +test.jpa.show-sql=false +test.jpa.hibernate.ddl-auto=none +test.jpa.hibernate.naming.strategy=org.hibernate.cfg.EJB3NamingStrategy +test.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect +test.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + +logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex + +cmso.aaf.enabled=false + +# Enable swagger - Enable in development and test only +cmso.swagger.enabled=true + +# Do not validate workflow name. Best effort will be used to create ticket +# Expectation is that missing attributes will be provided in the DomainData +cmso.allowUnknownWorkflowNames = true + +# Enable schedule immediate to be dispatched without ticket approvals +# Has no effect when in vTM loopback mode as always approved. +cmso.cm.dispatch.immediate.enabled = true + +# NUmber of seconds between sniro dispatch jobs +cmso.sniro.job.interval.ms=10000 + +# NUmber of seconds between change management cmso polling jobs +# Controls frequenct of polling to the ChangeManagementScheduler table... +cmso.cm.polling.job.interval.ms=10000 +# How many management cmso polling intervals to look ahead to dispatch +# (To account for possible latency of the polling job) +cmso.cm.polling.job.lookahead.intervals=5 +# Lead time before event time to enable dispatcher to +# test that it is safe to dispatch (i.e. meeting reminder lead time) +cmso.cm.dispatcher.lead.time.ms=5000 +# Lead time to prepare and call VID to dispatch work to MSO +# Includes latency from VID call to the start of the workflow +cmso.cm.dispatch.lead.time.ms=1000 + +# sniro info +cmso.sniro.maxAttempts=20 +#cmso.sniro.url=https://zldcmtc1njcoll01.homer.att.com:14699/sniro/api/v2/cmso +#cmso.sniroCMSchedulerUsername=test1 +#cmso.sniroCMSchedulerPassword=enc:zZAbyhJhxJjqIrXNiXRl2g== +#cmso.sniro.callbackurl=http://mtanjv9sdlg10.aic.cip.att.com:8089/cmso/v1/ChangeManagement/sniroCallback + +## loopback settings +cmso.sniro.url=http://localhost:8089/cmso/v1/loopbacktest/sniro +cmso.sniroCMSchedulerUsername=cmso@onap.org +cmso.sniroCMSchedulerPassword=enc:bfodXf8qRfCqMvlxVBYNWQ== +cmso.sniro.callbackurl=http://localhost:8089/cmso/v1/ChangeManagement/sniroCallback + +org.quartz.jobStore.class=org.quartz.simpl.RAMJobStore + +vid.loopback.mso.requestId=dummy123 + +mso.polling.interval.ms=10000 +#mso.user=cmso@onap.org +#mso.pass=enc:bfodXf8qRfCqMvlxVBYNWQ== + +## loopback settings +mso.url=http://localhost:8089/cmso/v1/loopbacktest/mso +mso.user=cmso@onap.org +mso.pass=enc:bfodXf8qRfCqMvlxVBYNWQ== + +vtm.vnfs.per.ticket=1 + +vtm.url=http://localhost:8089/cmso/v1/loopbacktest/ +vtm.listPath=30673/vtm/searchChangeRecord/v1/listChangeRecords +vtm.fetchQuestionnairePath=30673/vtm/searchChangeRecord/v1/getCheckListQuestionnaires +vtm.createPath=31219/vtm/createChangeRecord/v1/createChangeRecord +vtm.closePath=31127/vtm/manageChangeRecord/v1/closeCancelChangeRecord +vtm.updatePath=31127/vtm/manageChangeRecord/v1/updateChangeRecord +vtm.updateQuestionnairePath=31127/vtm/manageChangeRecord/v1/updateCheckListQuestionnaires + +vtm.user=cmso@onap.org +vtm.pass=enc:bfodXf8qRfCqMvlxVBYNWQ== +vtm.template.folder=data/templates/vtm + +#### +# configure the vTM ticket states that will allow a schedule to be dispatched +# FOrmat: +# |,| +# Approval Required|Assigned is the state of a ticket when it is created by Scheduler +vtm.approvalStatus=Approved|Scheduled,Approved|Assigned + +mechid.user=cmso@onap.org +mechid.pass=enc:bfodXf8qRfCqMvlxVBYNWQ== + +vid.user=cmso@onap.org +vid.pass=enc:bfodXf8qRfCqMvlxVBYNWQ== diff --git a/cmso-service/src/test/resources/data-h2.sql b/cmso-service/src/test/resources/data-h2.sql new file mode 100644 index 0000000..6c52d3b --- /dev/null +++ b/cmso-service/src/test/resources/data-h2.sql @@ -0,0 +1,8 @@ + +DELETE FROM DOMAINS; + +INSERT INTO DOMAINS (`domain`) VALUES ('ChangeManagement'); + +DELETE FROM APPROVAL_TYPES; + +INSERT INTO APPROVAL_TYPES (`domain`, `approval_type`, `approval_count`) VALUES ('ChangeManagement', 'Tier 2', '1'); \ No newline at end of file diff --git a/cmso-service/src/test/resources/schema-h2.sql b/cmso-service/src/test/resources/schema-h2.sql new file mode 100644 index 0000000..a9e5a04 --- /dev/null +++ b/cmso-service/src/test/resources/schema-h2.sql @@ -0,0 +1,233 @@ +DROP TABLE IF EXISTS CHANGE_MANAGEMENT_CHANGE_WINDOWS; +DROP TABLE IF EXISTS DOMAIN_DATA; +DROP TABLE IF EXISTS SCHEDULE_APPROVALS; +DROP TABLE IF EXISTS CHANGE_MANAGEMENT_RELATED_ASSETS; +DROP TABLE IF EXISTS CHANGE_MANAGEMENT_SCHEDULES; +DROP TABLE IF EXISTS CHANGE_MANAGEMENT_GROUPS; +DROP TABLE IF EXISTS SCHEDULE_EVENTS; +DROP TABLE IF EXISTS SCHEDULES; +DROP TABLE IF EXISTS APPROVAL_TYPES; +DROP TABLE IF EXISTS DOMAINS; + +-- ----------------------------------------------------- +-- Table DOMAINS +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS DOMAINS ( + domain VARCHAR(256) NOT NULL, + CONSTRAINT PK_DOMAINS PRIMARY KEY (domain) +) ENGINE=INNODB; + +CREATE UNIQUE INDEX DOMAIN_UNIQUE ON DOMAINS (domain ASC); + + +-- ----------------------------------------------------- +-- Table SCHEDULES +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS SCHEDULES ( + id INT NOT NULL AUTO_INCREMENT, + domain VARCHAR(256) NOT NULL, + schedule_id VARCHAR(256) NULL, + schedule_name VARCHAR(256) NULL, + user_id VARCHAR(45) NULL, + status VARCHAR(45) NOT NULL, + create_date_time BIGINT NULL, + schedule_info MEDIUMTEXT NOT NULL, + schedule MEDIUMTEXT NULL, + optimizer_status VARCHAR(45) NULL, + optimizer_message MEDIUMTEXT NULL, + optimizer_date_time BIGINT NULL, + optimizer_return_date_time BIGINT NULL, + optimizer_attempts_to_schedule INT NOT NULL DEFAULT 0, + optimizer_transaction_id VARCHAR(128) NULL, + delete_date_time BIGINT NULL, + CONSTRAINT PK_SCHEDULES PRIMARY KEY (id), + CONSTRAINT FK_SCHEDULES_DOMAIN FOREIGN KEY (domain) + REFERENCES DOMAINS (domain) + ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=INNODB; +CREATE UNIQUE INDEX SCHEDULE_KEY ON SCHEDULES (domain ASC, schedule_id ASC); + +CREATE UNIQUE INDEX OPTIMIZER_TRANSACTION_ID_UNIQUE ON SCHEDULES (optimizer_transaction_id ASC); + + +-- ----------------------------------------------------- +-- Table SCHEDULE_EVENTS +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS SCHEDULE_EVENTS ( + id INT(11) NOT NULL AUTO_INCREMENT, + schedules_id INT(11) NOT NULL, + event_time BIGINT(20) NOT NULL, + reminder_time BIGINT(20) NOT NULL, + domain VARCHAR(45) NULL DEFAULT NULL, + event_text MEDIUMTEXT NULL DEFAULT NULL, + status VARCHAR(45) NULL DEFAULT NULL, + CONSTRAINT PK_SCHEDULE_EVENTS PRIMARY KEY (id), + CONSTRAINT FK_SCHEDULE_EVENTS_SCHEDULES FOREIGN KEY (schedules_id) + REFERENCES SCHEDULES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_SCHEDULE_EVENTS_SCHEDULES_IDX ON SCHEDULE_EVENTS (schedules_id ASC); + +CREATE INDEX SEQ_SVENTS ON SCHEDULE_EVENTS (reminder_time ASC); + + + +-- ----------------------------------------------------- +-- Table DOMAIN_DATA +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS DOMAIN_DATA ( + id INT NOT NULL AUTO_INCREMENT, + schedules_id INT NOT NULL, + name VARCHAR(128) NULL, + value MEDIUMTEXT NULL, + CONSTRAINT PK_DOMAIN_DATA PRIMARY KEY (id), + CONSTRAINT FK_DOMAIN_DATA_SCHEDULES FOREIGN KEY (schedules_id) + REFERENCES SCHEDULES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE UNIQUE INDEX ID_UNIQUE ON DOMAIN_DATA (id ASC); + +CREATE INDEX FK_DOMAIN_DATA_SCHEDULES_IDX ON DOMAIN_DATA (schedules_id ASC); + + +-- ----------------------------------------------------- +-- Table APPROVAL_TYPES +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS APPROVAL_TYPES ( + id INT NOT NULL AUTO_INCREMENT, + domain VARCHAR(256) NOT NULL, + approval_type VARCHAR(45) NOT NULL, + approval_count INT NOT NULL DEFAULT 1, + CONSTRAINT PK_APPROVAL_TYPES PRIMARY KEY (id), + CONSTRAINT FK_APPROVAL_TYPES_DOMAIN FOREIGN KEY (domain) + REFERENCES DOMAINS (domain) + ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=INNODB; CREATE INDEX FK_DOMAIN_IDX ON APPROVAL_TYPES (domain ASC); + + +-- ----------------------------------------------------- +-- Table SCHEDULE_APPROVALS +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS SCHEDULE_APPROVALS ( + id INT NOT NULL AUTO_INCREMENT, + schedules_id INT NOT NULL, + user_id VARCHAR(45) NOT NULL, + approval_type_id INT NOT NULL, + status VARCHAR(45) NOT NULL DEFAULT 'Pending Approval', + approval_date_time BIGINT NULL, + CONSTRAINT PK_SCHEDULE_APPROVALS PRIMARY KEY (id), + CONSTRAINT FK_SCHEDULE_APPROVALS_SCHEDULES FOREIGN KEY (schedules_id) + REFERENCES SCHEDULES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT FK_SCHEDULE_APPROVALS_APPROVAL_TYPES FOREIGN KEY (approval_type_id) + REFERENCES APPROVAL_TYPES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_SCHEDULE_APPROVALS_SCHEDULES_IDX ON SCHEDULE_APPROVALS (schedules_id ASC); + +CREATE INDEX FK_APPROVAL_TYPES_IDX ON SCHEDULE_APPROVALS (approval_type_id ASC); + + +-- ----------------------------------------------------- +-- Table CHANGE_MANAGEMENT_GROUPS +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS CHANGE_MANAGEMENT_GROUPS ( + id INT NOT NULL AUTO_INCREMENT, + group_id VARCHAR(45) NULL, + schedules_id INT NULL, + start_time BIGINT NULL, + finish_time BIGINT NULL, + last_instance_start_time BIGINT NULL, + normal_duration_in_secs INT NULL, + additional_duration_in_secs INT NULL, + concurrency_limit INT NULL, + policy_id VARCHAR(256) NULL, + CONSTRAINT PK_CHANGE_MANAGEMENT_GROUPS PRIMARY KEY (id), + CONSTRAINT FK_CHANGE_MANAGEMENT_GROUPS_SCHEDULES FOREIGN KEY (schedules_id) + REFERENCES SCHEDULES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_SCHEDULES_IDX ON CHANGE_MANAGEMENT_GROUPS (schedules_id ASC); + +CREATE UNIQUE INDEX CHANGE_MANAGEMENT_GROUP_ID_UNIQUE ON CHANGE_MANAGEMENT_GROUPS (schedules_id ASC, group_id ASC); + + +-- ----------------------------------------------------- +-- Table CHANGE_MANAGEMENT_SCHEDULES +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS CHANGE_MANAGEMENT_SCHEDULES ( + id INT NOT NULL AUTO_INCREMENT, + change_management_groups_id INT NULL, + vnf_name VARCHAR(256) NOT NULL, + vnf_id VARCHAR(256) NULL, + status VARCHAR(45) NOT NULL, + start_time BIGINT NULL, + finish_time BIGINT NULL, + mso_request_id VARCHAR(45) NULL, + mso_status VARCHAR(45) NULL, + mso_message MEDIUMTEXT NULL, + mso_time BIGINT NULL, + dispatcher_instance VARCHAR(128) NULL, + dispatch_time BIGINT NULL, + execution_completed_time BIGINT NULL, + status_message MEDIUMTEXT NULL, + tm_change_id VARCHAR(15) NULL, + tm_approval_status VARCHAR(45) NULL, + tm_status VARCHAR(45) NULL, + CONSTRAINT PK_CHANGE_MANAGEMENT_SCHEDULES PRIMARY KEY (id), + CONSTRAINT FK_CHANGE_MANAGEMENT_SCHEDULES_CHANGE_MANAGEMENT_GROUP FOREIGN KEY (change_management_groups_id) + REFERENCES CHANGE_MANAGEMENT_GROUPS (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_CHANGE_MANAGEMENT_GROUP_CHANGE_MANAGEMENT_SCHEDULES_IDX ON CHANGE_MANAGEMENT_SCHEDULES (change_management_groups_id ASC); + +CREATE UNIQUE INDEX CHANGE_MANAGEMENT_SCHEDULES_VNF_NAME_UNIQUE ON CHANGE_MANAGEMENT_SCHEDULES (change_management_groups_id ASC, vnf_name ASC); + + +-- ----------------------------------------------------- +-- Table CHANGE_MANAGEMENT_CHANGE_WINDOWS +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS CHANGE_MANAGEMENT_CHANGE_WINDOWS ( + id INT NOT NULL AUTO_INCREMENT, + change_management_groups_id INT NOT NULL, + start_time BIGINT NULL, + finish_time BIGINT NULL, + CONSTRAINT PK_CHANGE_MANAGEMENT_CHANGE_WINDOWS PRIMARY KEY (id), + CONSTRAINT FK_CHANGE_WINDOWS_CHANGE_MANAGEMENT_GROUPS1 FOREIGN KEY (change_management_groups_id) + REFERENCES CHANGE_MANAGEMENT_GROUPS (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_CHANGE_WINDOWS_CHANGE_MANAGEMENT_GROUPS1_IDX on CHANGE_MANAGEMENT_CHANGE_WINDOWS (change_management_groups_id ASC); + + +-- ----------------------------------------------------- +-- Table CHANGE_MANAGEMENT_RELATED_ASSETS +-- ----------------------------------------------------- + +CREATE TABLE IF NOT EXISTS CHANGE_MANAGEMENT_RELATED_ASSETS ( + id INT NOT NULL AUTO_INCREMENT, + change_management_schedule_id INT NULL, + asset_id VARCHAR(256) NULL, + asset_type VARCHAR(128) NULL, + CONSTRAINT PK_CHANGE_MANAGEMENT_RELATED_ASSETS PRIMARY KEY (id), + CONSTRAINT FK_CHANGE_MANAGEMENT_RELATED_ASSETS_CHANGE_MANAGEMENT_SCHEDULES FOREIGN KEY (change_management_schedule_id) + REFERENCES CHANGE_MANAGEMENT_SCHEDULES (id) + ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=INNODB; + +CREATE INDEX FK_CHANGE_MANAGEMENT_RELATED_ASSETS_CHANGE_MANAGEMENT_SCHED_IDX ON CHANGE_MANAGEMENT_RELATED_ASSETS (change_management_schedule_id ASC); + diff --git a/cmso-service/src/test/resources/testConfig.xml b/cmso-service/src/test/resources/testConfig.xml new file mode 100644 index 0000000..b1e930c --- /dev/null +++ b/cmso-service/src/test/resources/testConfig.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyDomain.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyDomain.json.template new file mode 100644 index 0000000..6187711 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyDomain.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleID.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleID.json.template new file mode 100644 index 0000000..b17350a --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleID.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleName.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleName.json.template new file mode 100644 index 0000000..c15f472 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyScheduleName.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyUserID.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyUserID.json.template new file mode 100644 index 0000000..7b0d539 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowEmptyUserID.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectPolicyId.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectPolicyId.json.template new file mode 100644 index 0000000..c17f7c5 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectPolicyId.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "string", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectWorkflow.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectWorkflow.json.template new file mode 100644 index 0000000..e1f9f9e --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowIncorrectWorkflow.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Not A Workflow" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNegativeNormalDurationInSeconds.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNegativeNormalDurationInSeconds.json.template new file mode 100644 index 0000000..bb36b51 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNegativeNormalDurationInSeconds.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : -5, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoEndTime.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoEndTime.json.template new file mode 100644 index 0000000..9a0e703 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoEndTime.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoNodeName.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoNodeName.json.template new file mode 100644 index 0000000..22fc89a --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoNodeName.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoStartTime.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoStartTime.json.template new file mode 100644 index 0000000..71144c5 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowNoStartTime.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowSwitchedTime.json.template b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowSwitchedTime.json.template new file mode 100644 index 0000000..4bb2b07 --- /dev/null +++ b/cmso-service/src/test/templates/FailureCasesChangeManagement/OneVnfOneChangeWindowSwitchedTime.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO.TimeLimitAndVerticalTopology", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${end_time1}", + "endTime" : "${start_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyAdditionalDuration.json.template b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyAdditionalDuration.json.template new file mode 100644 index 0000000..5c9e0a3 --- /dev/null +++ b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyAdditionalDuration.json.template @@ -0,0 +1,23 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyDomain.json.template b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyDomain.json.template new file mode 100644 index 0000000..19c1d87 --- /dev/null +++ b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyDomain.json.template @@ -0,0 +1,23 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyScheduleId.json.template b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyScheduleId.json.template new file mode 100644 index 0000000..ab92d18 --- /dev/null +++ b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyScheduleId.json.template @@ -0,0 +1,23 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyUserId.json.template b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyUserId.json.template new file mode 100644 index 0000000..9de749c --- /dev/null +++ b/cmso-service/src/test/templates/MutipleVNFImmediateFailureCases/MultipleVnfImmediateEmptyUserId.json.template @@ -0,0 +1,23 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyDomain.json.template b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyDomain.json.template new file mode 100644 index 0000000..c323b2c --- /dev/null +++ b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyDomain.json.template @@ -0,0 +1,20 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "node" : [ + "dummy${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleId.json.template b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleId.json.template new file mode 100644 index 0000000..e1b5ea3 --- /dev/null +++ b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleId.json.template @@ -0,0 +1,20 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "node" : [ + "dummy${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleName.json.template b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleName.json.template new file mode 100644 index 0000000..0db2141 --- /dev/null +++ b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyScheduleName.json.template @@ -0,0 +1,23 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + + "vnfDetails" : [{ + "node" : [ + "dummy${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptySchedulingInfo.json.template b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptySchedulingInfo.json.template new file mode 100644 index 0000000..461f166 --- /dev/null +++ b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptySchedulingInfo.json.template @@ -0,0 +1,14 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + } +} diff --git a/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyUserId.json.template b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyUserId.json.template new file mode 100644 index 0000000..a2a4ba4 --- /dev/null +++ b/cmso-service/src/test/templates/OneVNFImmediateFailureCases/OneVnfImmediateEmptyUserId.json.template @@ -0,0 +1,14 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + } +} diff --git a/cmso-service/src/test/templates/changemanagement/MultipleVnfImmediate.json.template b/cmso-service/src/test/templates/changemanagement/MultipleVnfImmediate.json.template new file mode 100644 index 0000000..632d874 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/MultipleVnfImmediate.json.template @@ -0,0 +1,24 @@ +{ + "domain" : "${domain}", + "scheduleId" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "${workflow}" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : ${normalDurationInSeconds}, + "additionalDurationInSeconds" : ${additionalDurationInSeconds}, + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNFsOneChangeWindow.json.template b/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNFsOneChangeWindow.json.template new file mode 100644 index 0000000..e08f33b --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNFsOneChangeWindow.json.template @@ -0,0 +1,32 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "${workflow}" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_pserver", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNSsTwoChangeWindows.json.template b/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNSsTwoChangeWindows.json.template new file mode 100644 index 0000000..64d8613 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneGroupMultipleVNSsTwoChangeWindows.json.template @@ -0,0 +1,37 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "${workflow}" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_pserver", + "vnfDetails" : [{ + "groupId" : "Group1", + "node" : [ + "VNFName1${testid}", + "VNFName2${testid}", + "VNFName3${testid}", + "VNFName4${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + },{ + "startTime" : "${start_time2}", + "endTime" : "${end_time2}" + } + ] + } + ] + } +} + diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfImmediate.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfImmediate.json.template new file mode 100644 index 0000000..1ca387b --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfImmediate.json.template @@ -0,0 +1,25 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "${workflow}", + "plans" : "Run ${workflow}", + "question.000000000000001" : "Yes" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "vnfDetails" : [{ + "groupId" : "group1", + "node" : [ + "dummy_node" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfImmediateIncorrectWorkflow.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfImmediateIncorrectWorkflow.json.template new file mode 100644 index 0000000..ec14a91 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfImmediateIncorrectWorkflow.json.template @@ -0,0 +1,20 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Not A Workflow" + } + ], + "schedulingInfo" : { + "vnfDetails" : [{ + "node" : [ + "dummy${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfImmediateReplaceVNFInfra.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfImmediateReplaceVNFInfra.json.template new file mode 100644 index 0000000..5f8e1de --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfImmediateReplaceVNFInfra.json.template @@ -0,0 +1,22 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "ReplaceVnfInfra" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "vnfDetails" : [{ + "node" : [ + "dummynode" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindow.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindow.json.template new file mode 100644 index 0000000..e1f21d3 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindow.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "${workflow}" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_pserver", + "vnfDetails" : [{ + "groupId" : "group", + "node" : [ + "dlltx43gvbc" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackData.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackData.json.template new file mode 100644 index 0000000..b6d7e72 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackData.json.template @@ -0,0 +1,25 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "", + "WorkflowName" : "Build Software Upgrade for vNFs" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_v2_split_1", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackURL.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackURL.json.template new file mode 100644 index 0000000..92e5b4b --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowEmptyCallbackURL.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Build Software Upgrade for vNFs" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_v2_split_1", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowReplaceVNFInfra.json.template b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowReplaceVNFInfra.json.template new file mode 100644 index 0000000..3e463a8 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/OneVnfOneChangeWindowReplaceVNFInfra.json.template @@ -0,0 +1,30 @@ +{ + "domain" : "ChangeManagement", + "scheduleId" : "${uuid}", + "scheduleName" : "${uuid}", + "userId" : "${userId}", + "domainData" : [{ + "CallbackUrl" : "${callbackUrl}", + "CallbackData" : "${callbackData}", + "WorkflowName" : "Replace" + } + ], + "schedulingInfo" : { + "normalDurationInSeconds" : 100, + "additionalDurationInSeconds" : 10, + "concurrencyLimit" : 10, + "policyId" : "SNIRO_CM.TimeLimitAndVerticalTopology_v2_split_1", + "vnfDetails" : [{ + "groupId" : "", + "node" : [ + "dummy${testid}" + ], + "changeWindow" : [{ + "startTime" : "${start_time1}", + "endTime" : "${end_time1}" + } + ] + } + ] + } +} diff --git a/cmso-service/src/test/templates/changemanagement/VidCallbackData.json.template b/cmso-service/src/test/templates/changemanagement/VidCallbackData.json.template new file mode 100644 index 0000000..f523714 --- /dev/null +++ b/cmso-service/src/test/templates/changemanagement/VidCallbackData.json.template @@ -0,0 +1,40 @@ +{ + "requestType" : "Update", + "requestDetails" : [{ + "vnfName" : "dummynode", + "vnfInstanceId" : "dummy-vnf-id", + "modelInfo" : { + "modelType" : "vnf", + "modelInvariantId" : "dummy-model-id", + "modelVersionId" : "dummy-model-version-id", + "modelName" : "dummy-model-name", + "modelCustomizationId" : "dummy-model-cust-id" + }, + "cloudConfiguration" : { + "lcpCloudRegionId" : "dummy-region-id", + "tenantId" : "dummy-tenent-id" + }, + "requestInfo" : { + "source" : "VID", + "suppressRollback" : false, + "requestorId" : "onap" + }, + "relatedInstanceList" : [{ + "relatedInstance" : { + "instanceId" : "dummy-instance-id", + "modelInfo" : { + "modelType" : "service", + "modelInvariantId" : "dummy-model-id", + "modelVersionId" : "dummy-model-version-id", + "modelName" : "dummy-model-name", + "modelVersion" : "4.0" + } + } + } + ], + "requestParameters" : { + "usePreload" : true + } + } + ] +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..f789f41 --- /dev/null +++ b/pom.xml @@ -0,0 +1,63 @@ + + + + + 4.0.0 + + org.onap.optf.cmso + cmso + 0.1.0-SNAPSHOT + pom + + optf-cmso + https://wiki.onap.org + + + JIRA + https://jira.onap.org/ + + + + scm:git:ssh://git@${onap.git.host}/ccsdk/sli/adaptors + scm:git:ssh://${onap.git.host}:${onap.git.port}/optf/cmso + ${onap.git.protocol}://${onap.git.host}/optf/cmso + optf-cmso-${project.version} + + + + cmso-service + cmso-database + + + -- cgit 1.2.3-korg