aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-02-18 13:05:06 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-18 13:05:06 +0000
commit36baada47134d2e6915baad5627d14d26e4c35ef (patch)
treef9175c70a9be28ddfc589dcfabc66ab00b9554b4
parent2cfbe3407713a48fb81783ae2a560c5fe6face5e (diff)
parente3f8c6d9b3ff4b9c9b82c795a791ea9b5a014c98 (diff)
Merge "Introduced mocked SO workflows in VID FE"
-rwxr-xr-xdeliveries/src/main/docker/docker-files/docker-compose.yml5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java31
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java32
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java33
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java47
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js425
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js33
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js91
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js9
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ExtWorkflowServiceImplTest.java60
-rw-r--r--vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java6
-rw-r--r--vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/workflows.json23
15 files changed, 581 insertions, 241 deletions
diff --git a/deliveries/src/main/docker/docker-files/docker-compose.yml b/deliveries/src/main/docker/docker-files/docker-compose.yml
index eedf7322e..e4bab263b 100755
--- a/deliveries/src/main/docker/docker-files/docker-compose.yml
+++ b/deliveries/src/main/docker/docker-files/docker-compose.yml
@@ -31,4 +31,7 @@ services:
MYSQL_ROOT_PASSWORD: ROOT_PASSWORD
vid-simulator:
- image: onap/vid-simulator:latest \ No newline at end of file
+ image: onap/vid-simulator:latest
+ ports:
+ - "9080:8080"
+ - "1080:1080"
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
index 7f90d6a43..efe6c206a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java
@@ -29,6 +29,7 @@ import org.onap.vid.mso.MsoBusinessLogic;
import org.onap.vid.mso.MsoBusinessLogicImpl;
import org.onap.vid.mso.MsoInterface;
import org.onap.vid.mso.MsoProperties;
+import org.onap.vid.mso.rest.MockedWorkflowsRestClient;
import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.services.CloudOwnerService;
import org.onap.vid.services.CloudOwnerServiceImpl;
@@ -53,6 +54,11 @@ public class MsoConfig {
}
@Bean
+ public MockedWorkflowsRestClient mockedWorkflowsClient(ObjectMapper unirestObjectMapper){
+ return new MockedWorkflowsRestClient(new SyncRestClient(unirestObjectMapper), "http://vid-simulator:1080/");
+ }
+
+ @Bean
public MsoBusinessLogic getMsoBusinessLogic(MsoInterface msoClient, FeatureManager featureManager){
return new MsoBusinessLogicImpl(msoClient, featureManager);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
new file mode 100644
index 000000000..be1976a48
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
@@ -0,0 +1,31 @@
+package org.onap.vid.controller;
+
+import java.util.List;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.vid.model.SOWorkflow;
+import org.onap.vid.services.ExtWorkflowsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping(WorkflowsController.WORKFLOWS_MANAGEMENT)
+public class WorkflowsController extends RestrictedBaseController {
+ static final String WORKFLOWS_MANAGEMENT = "workflows-management";
+
+ private ExtWorkflowsService extWorkflowsService;
+
+ @Autowired
+ public WorkflowsController(ExtWorkflowsService extWorkflowsService) {
+ this.extWorkflowsService = extWorkflowsService;
+ }
+
+ @RequestMapping(value = "workflows", method = RequestMethod.GET)
+ public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfName") String vnfName){
+ return extWorkflowsService.getWorkflows(vnfName);
+ }
+
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
new file mode 100644
index 000000000..c85bfd7d4
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
@@ -0,0 +1,13 @@
+package org.onap.vid.model
+
+data class SOWorkflow @JvmOverloads constructor(var id: Long? = null, var name: String? = null) {
+ fun clone(): SOWorkflow {
+ return copy()
+ }
+}
+
+data class SOWorkflows @JvmOverloads constructor(var workflows: List<SOWorkflow>? = emptyList()) {
+ fun clone(): SOWorkflows {
+ return copy(workflows?.toMutableList())
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
index fff14ebc3..3bda76406 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java
@@ -28,8 +28,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.joshworks.restclient.http.HttpResponse;
@JsonPropertyOrder({
- "status",
- "entity"
+ "status",
+ "entity"
})
/*
@@ -41,8 +41,8 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {
static final ObjectMapper objectMapper = new ObjectMapper();
- private final int status;
- private final T entity;
+ private final int status;
+ private T entity;
private final String raw;
public MsoResponseWrapper2(RestObject<T> msoResponse) {
@@ -51,23 +51,23 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {
this.raw = msoResponse.getRaw();
}
- public MsoResponseWrapper2(HttpResponse<T> msoResponse) {
- this.status = msoResponse.getStatus();
- this.entity = msoResponse.getBody();
- this.raw = msoResponse.getBody().toString();
- }
+ public MsoResponseWrapper2(HttpResponse<T> msoResponse) {
+ this.status = msoResponse.getStatus();
+ this.entity = msoResponse.getBody();
+ this.raw = msoResponse.getBody().toString();
+ }
public MsoResponseWrapper2(
- @JsonProperty(value = "status", required = true) int status,
- @JsonProperty(value = "entity", required = true) T entity) {
+ @JsonProperty(value = "status", required = true) int status,
+ @JsonProperty(value = "entity", required = true) T entity) {
this.status = status;
this.entity = entity;
this.raw = null;
}
public int getStatus() {
- return status;
- }
+ return status;
+ }
@Override
@JsonIgnore
@@ -80,8 +80,8 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {
}
@JsonProperty
- public Object getEntity() {
- return entity != null ? entity : raw;
- }
+ public Object getEntity() {
+ return entity != null ? entity : raw;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java
new file mode 100644
index 000000000..313710ebd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java
@@ -0,0 +1,33 @@
+package org.onap.vid.mso.rest;
+
+import java.util.Collections;
+import org.jetbrains.annotations.NotNull;
+import org.onap.vid.client.SyncRestClient;
+import org.onap.vid.model.SOWorkflows;
+import org.onap.vid.mso.MsoResponseWrapper2;
+
+public class MockedWorkflowsRestClient {
+
+ private SyncRestClient syncRestClient;
+ private String baseUrl;
+
+ public MockedWorkflowsRestClient(SyncRestClient syncRestClient, String baseUrl) {
+ this.syncRestClient = syncRestClient;
+ this.baseUrl = baseUrl;
+ }
+
+ public MsoResponseWrapper2<SOWorkflows> getWorkflows(String vnfName) {
+ // Temporary skip vnfName and call mocked service
+ return new MsoResponseWrapper2<>(syncRestClient
+ .get(getWorkflowsUrl(),
+ Collections.emptyMap(),
+ Collections.emptyMap(),
+ SOWorkflows.class));
+ }
+
+ @NotNull
+ private String getWorkflowsUrl() {
+ return baseUrl + "so/workflows";
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java b/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java
new file mode 100644
index 000000000..4ed26a14a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java
@@ -0,0 +1,8 @@
+package org.onap.vid.services;
+
+import java.util.List;
+import org.onap.vid.model.SOWorkflow;
+
+public interface ExtWorkflowsService {
+ List<SOWorkflow> getWorkflows(String vnfName);
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java
new file mode 100644
index 000000000..d5170b6e5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java
@@ -0,0 +1,47 @@
+package org.onap.vid.services;
+
+import java.util.List;
+import org.onap.vid.model.SOWorkflow;
+import org.onap.vid.model.SOWorkflows;
+import org.onap.vid.mso.MsoResponseWrapper2;
+import org.onap.vid.mso.rest.MockedWorkflowsRestClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExtWorkflowsServiceImpl implements ExtWorkflowsService {
+
+ private MockedWorkflowsRestClient mockedWorkflowsRestClient;
+
+ @Autowired
+ public ExtWorkflowsServiceImpl(MockedWorkflowsRestClient mockedWorkflowsRestClient) {
+ this.mockedWorkflowsRestClient = mockedWorkflowsRestClient;
+ }
+
+ @Override
+ public List<SOWorkflow> getWorkflows(String vnfName) {
+ MsoResponseWrapper2<SOWorkflows> msoResponse = mockedWorkflowsRestClient.getWorkflows(vnfName);
+ if (msoResponse.getStatus() >= 400 || msoResponse.getEntity() == null) {
+ throw new BadResponseFromMso(msoResponse);
+ }
+ return convertMsoResponseToWorkflowList(msoResponse);
+ }
+
+ private List<SOWorkflow> convertMsoResponseToWorkflowList(MsoResponseWrapper2<SOWorkflows> msoResponse) {
+ SOWorkflows soWorkflows = (SOWorkflows) msoResponse.getEntity();
+ return soWorkflows.getWorkflows();
+ }
+
+ public static class BadResponseFromMso extends RuntimeException {
+ private final MsoResponseWrapper2<SOWorkflows> msoResponse;
+
+ public BadResponseFromMso(MsoResponseWrapper2<SOWorkflows> msoResponse) {
+ this.msoResponse = msoResponse;
+ }
+
+ public MsoResponseWrapper2<SOWorkflows> getMsoResponse() {
+ return msoResponse;
+ }
+ }
+
+}
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index 077a78405..8ee2d062c 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -21,239 +21,242 @@
"use strict";
appDS2
- .constant("_", window._)
- .constant("COMPONENT", (function() {
- return {
- A_LA_CARTE : "a la carte",
- CLOUD_REGION_ID : "cloudRegionID",
- CLOUD_OWNER : "cloudOwner",
- COMPONENT_STATUS : "ComponentStatus",
- CREATE_COMPONENT : "createComponent",
- IFRAME_DIALOG : "iframeDialog",
- DELETE_RESUME_COMPONENT : "deleteResumeComponent",
- DELETE:"Delete",
- RESUME:"Resume",
- ENTITY : "entity",
- GET_COMPONENT_LIST : "getComponentList",
- GET_SUBS : "getSubs",
- GET_SUB_DETAILS : "getSubDetails",
- GLOBAL_CUSTOMER_ID : "globalCustomerId",
- MACRO : "Macro",
- MODEL_NAME_IISBC : "Intercarrier Interconnect Session Border Controller",
- MODEL_NAME_VISBCOAMNETWORK : "vIsbcOamNetwork",
- MODEL_NAME_VISBCRTPEXPANSIONMODULE : "vIsbcRtpExpansionModule",
- MODEL_NAME_VISBC : "vIsbc",
- MODEL_NAME_WANBONDING : "WanBonding",
- MODEL_VERSION_1 : "1",
- MSO_CREATE_REQ : "createInstance",
- MSO_DELETE_REQ : "deleteInstance",
- MSO_CREATE_CONFIGURATION_REQ : 'createConfiguration',
- MSO_DELETE_CONFIGURATION_REQ : 'deleteConfiguration',
- MSO_CHANGE_CONFIG_STATUS_REQ: "changeConfigurationStatus",
- MSO_CHANGE_PORT_STATUS_REQ: "changePortStatus",
- MSO_CREATE_ENVIRONMENT: "createEnvironmentInstance",
- MSO_DEACTIVATE_ENVIRONMENT: "deactivateEnvironmentInstance",
- MSO_ACTIVATE_ENVIRONMENT: "activateEnvironmentInstance",
- MSO_ACTIVATE_SERVICE_REQ: "activateServiceInstance",
- MSO_DEACTIVATE_SERVICE_REQ: "deactivateServiceInstance",
+.constant("_", window._)
+.constant("COMPONENT", (function () {
+ return {
+ A_LA_CARTE: "a la carte",
+ CLOUD_REGION_ID: "cloudRegionID",
+ CLOUD_OWNER: "cloudOwner",
+ COMPONENT_STATUS: "ComponentStatus",
+ CREATE_COMPONENT: "createComponent",
+ IFRAME_DIALOG: "iframeDialog",
+ DELETE_RESUME_COMPONENT: "deleteResumeComponent",
+ DELETE: "Delete",
+ RESUME: "Resume",
+ ENTITY: "entity",
+ GET_COMPONENT_LIST: "getComponentList",
+ GET_SUBS: "getSubs",
+ GET_SUB_DETAILS: "getSubDetails",
+ GLOBAL_CUSTOMER_ID: "globalCustomerId",
+ MACRO: "Macro",
+ MODEL_NAME_IISBC: "Intercarrier Interconnect Session Border Controller",
+ MODEL_NAME_VISBCOAMNETWORK: "vIsbcOamNetwork",
+ MODEL_NAME_VISBCRTPEXPANSIONMODULE: "vIsbcRtpExpansionModule",
+ MODEL_NAME_VISBC: "vIsbc",
+ MODEL_NAME_WANBONDING: "WanBonding",
+ MODEL_VERSION_1: "1",
+ MSO_CREATE_REQ: "createInstance",
+ MSO_DELETE_REQ: "deleteInstance",
+ MSO_CREATE_CONFIGURATION_REQ: 'createConfiguration',
+ MSO_DELETE_CONFIGURATION_REQ: 'deleteConfiguration',
+ MSO_CHANGE_CONFIG_STATUS_REQ: "changeConfigurationStatus",
+ MSO_CHANGE_PORT_STATUS_REQ: "changePortStatus",
+ MSO_CREATE_ENVIRONMENT: "createEnvironmentInstance",
+ MSO_DEACTIVATE_ENVIRONMENT: "deactivateEnvironmentInstance",
+ MSO_ACTIVATE_ENVIRONMENT: "activateEnvironmentInstance",
+ MSO_ACTIVATE_SERVICE_REQ: "activateServiceInstance",
+ MSO_DEACTIVATE_SERVICE_REQ: "deactivateServiceInstance",
MSO_ACTIVATE_FABRIC_CONFIGURATION_REQ: "activateFabricConfigurationInstance",
MSO_DEACTIVATE_AND_CLOUD_DELETE: "deactivateAndCloudDelete",
- NAME : "name",
- NETWORK : "network",
- CONFIGURATION : "configuration",
- PORT: "port",
- NETWORKS : "networks",
- PRODUCT_NAME_TRINITY : "Trinity",
- QUERY_SERVICE_INSTANCE : "queryServiceInstance",
- REFRESH_PROPERTIES : "refreshProperties",
- SDN_L3_BONDING : "SDN-L3-BONDING",
- SDN_ETHERNET_INTERNET : "SDN-ETHERNET-INTERNET",
- SERVICE : "service",
- OLDVERSION : 'oldversion',
- SERVICE_TYPE : "serviceType",
- SHOW_COMPONENT_DETAILS : "showComponentDetails",
- STATUS : "status",
- SUBSCRIBER_NAME : "subscriberName",
- TENANT_ID : "tenantID",
- TENANT_NAME : "tenantName",
- TRUE : "true",
- UCPE_VMS : "uCPE-VMS",
- VF_MODULE : "vfModule",
- VNF : "vnf",
- VNF_CODE : "vnfCode",
- VNF_FUNCTION : "vnfFunction",
- VNF_ROLE : "vnfRole",
- VNF_TYPE : "vnfType",
- VOLUME_GROUP : "volumeGroup",
+ NAME: "name",
+ NETWORK: "network",
+ CONFIGURATION: "configuration",
+ PORT: "port",
+ NETWORKS: "networks",
+ PRODUCT_NAME_TRINITY: "Trinity",
+ QUERY_SERVICE_INSTANCE: "queryServiceInstance",
+ REFRESH_PROPERTIES: "refreshProperties",
+ SDN_L3_BONDING: "SDN-L3-BONDING",
+ SDN_ETHERNET_INTERNET: "SDN-ETHERNET-INTERNET",
+ SERVICE: "service",
+ OLDVERSION: 'oldversion',
+ SERVICE_TYPE: "serviceType",
+ SHOW_COMPONENT_DETAILS: "showComponentDetails",
+ STATUS: "status",
+ SUBSCRIBER_NAME: "subscriberName",
+ TENANT_ID: "tenantID",
+ TENANT_NAME: "tenantName",
+ TRUE: "true",
+ UCPE_VMS: "uCPE-VMS",
+ VF_MODULE: "vfModule",
+ VNF: "vnf",
+ VNF_CODE: "vnfCode",
+ VNF_FUNCTION: "vnfFunction",
+ VNF_ROLE: "vnfRole",
+ VNF_TYPE: "vnfType",
+ VOLUME_GROUP: "volumeGroup",
IS_PERMITTED: "is-permitted",
- PNF : "pnf",
- // IDs
- CIDR_MASK_1 : "255.255.255.000",
- //COMPONENT_LIST_NAMED_QUERY_ID : "ed0a0f5b-cf79-4784-88b2-911cd726cd3d",
- CUSTOMER_ID_1 : "icore9883749",
- DELETE_INSTANCE_ID_1 : "ff305d54-75b4-ff1b-fff1-eb6b9e5460ff",
- GATEWAY_ADDRESS_1 : "10.10.125.1",
- GLOBAL_SUBSCRIBER_ID_1 : "C12345",
- INSTANCE_ID_1 : "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
- INSTANCE_ID_2 : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
- INSTANCE_ID_3 : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
- MODEL_ID_1 : "sn5256d1-5a33-55df-13ab-12abad84e764",
- MODEL_ID_2 : "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
- MODEL_ID_3 : "ff3514e3-5a33-55df-13ab-12abad84e7ff",
- MODEL_ID_4 : "ff5256d1-5a33-55df-13ab-12abad84e7ff",
- MODEL_ID_5 : "ff5256d1-5a33-55df-13ab-22abad84e7ff",
- MODEL_NAME_VERSION_ID_1 : "ab6478e4-ea33-3346-ac12-ab121484a333",
- MODEL_NAME_VERSION_ID_2 : "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
- MODEL_NAME_VERSION_ID_3 : "fe6985cd-ea33-3346-ac12-ab121484a3fe",
- MODEL_NAME_VERSION_ID_4 : "fe6478e4-ea33-3346-ac12-ab121484a3fe",
- MODEL_NAME_VERSION_ID_5 : "fe6478e4-ea33-3346-bc12-ab121484a3fe",
- SERVICE_INSTANCE_ID_1 : "bc305d54-75b4-431b-adb2-eb6b9e546014",
- SUBSCRIBER_NAME_GED12 : "General Electric Division 12",
- VNF_INSTANCE_ID : "VNF_INSTANCE_ID_12345",
- VPN_ID_1 : "1a2b3c4d5e6f",
+ PNF: "pnf",
+ // IDs
+ CIDR_MASK_1: "255.255.255.000",
+ //COMPONENT_LIST_NAMED_QUERY_ID : "ed0a0f5b-cf79-4784-88b2-911cd726cd3d",
+ CUSTOMER_ID_1: "icore9883749",
+ DELETE_INSTANCE_ID_1: "ff305d54-75b4-ff1b-fff1-eb6b9e5460ff",
+ GATEWAY_ADDRESS_1: "10.10.125.1",
+ GLOBAL_SUBSCRIBER_ID_1: "C12345",
+ INSTANCE_ID_1: "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ INSTANCE_ID_2: "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
+ INSTANCE_ID_3: "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
+ MODEL_ID_1: "sn5256d1-5a33-55df-13ab-12abad84e764",
+ MODEL_ID_2: "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
+ MODEL_ID_3: "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ MODEL_ID_4: "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ MODEL_ID_5: "ff5256d1-5a33-55df-13ab-22abad84e7ff",
+ MODEL_NAME_VERSION_ID_1: "ab6478e4-ea33-3346-ac12-ab121484a333",
+ MODEL_NAME_VERSION_ID_2: "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_3: "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_4: "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_5: "fe6478e4-ea33-3346-bc12-ab121484a3fe",
+ SERVICE_INSTANCE_ID_1: "bc305d54-75b4-431b-adb2-eb6b9e546014",
+ SUBSCRIBER_NAME_GED12: "General Electric Division 12",
+ VNF_INSTANCE_ID: "VNF_INSTANCE_ID_12345",
+ VPN_ID_1: "1a2b3c4d5e6f",
- // PATHS
- CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER: "change-management/workflow/@vnfName",
- GET_WORKFLOW: "change-management/get_vnf_workflow_relation",
- GET_MSO_WORKFLOWS: "change-management/mso",
- GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler",
- CANCEL_SCHEDULE_REQUEST: "change-management/scheduler/schedules",
- ASSIGN : "?r=",
- AAI_GET_SERVICE_INSTANCE_PATH : "aai_get_service_instance/",
- AAI_GET_SERVICES : "aai_get_services",
- AAI_GET_AIC_ZONES :"aai_get_aic_zones",
- AAI_GET_AIC_ZONE_FOR_PNF :"aai_get_aic_zone_for_pnf/@globalCustomerId/@serviceType/@serviceInstanceId",
- AAI_GET_SERVICES_BY_TYPE : "aai_get_models_by_service_type",
- AAI_GET_TENANTS : "aai_get_tenants/",
- AAI_SUB_DETAILS_PATH : "aai_sub_details/",
- AAI_GET_VERSION_BY_INVARIANT_ID:"aai_get_version_by_invariant_id/",
- AAI_GET_PORT_MIRRORING_CONFIGS_DATA : "aai_getPortMirroringConfigsData",
- AAI_GET_PORT_MIRRORING_SOURCE_PORTS : "aai_getPortMirroringSourcePorts",
- AAI_GET_PROVIDER_NETWORKS_ASSOCIATIONS : "aai/standardQuery/vlansByNetworks",
- SEARCH_SERVICE_INSTANCES:"search_service_instances",
+ // PATHS
+ CHANGE_MANAGEMENT_OPERATION_NO_SCHEDULER: "change-management/workflow/@vnfName",
+ GET_WORKFLOW: "change-management/get_vnf_workflow_relation",
+ GET_SO_WORKFLOWS: "workflows-management/workflows",
+ GET_MSO_WORKFLOWS: "change-management/mso",
+ GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler",
+ CANCEL_SCHEDULE_REQUEST: "change-management/scheduler/schedules",
+ ASSIGN: "?r=",
+ AAI_GET_SERVICE_INSTANCE_PATH: "aai_get_service_instance/",
+ AAI_GET_SERVICES: "aai_get_services",
+ AAI_GET_AIC_ZONES: "aai_get_aic_zones",
+ AAI_GET_AIC_ZONE_FOR_PNF: "aai_get_aic_zone_for_pnf/@globalCustomerId/@serviceType/@serviceInstanceId",
+ AAI_GET_SERVICES_BY_TYPE: "aai_get_models_by_service_type",
+ AAI_GET_TENANTS: "aai_get_tenants/",
+ AAI_SUB_DETAILS_PATH: "aai_sub_details/",
+ AAI_GET_VERSION_BY_INVARIANT_ID: "aai_get_version_by_invariant_id/",
+ AAI_GET_PORT_MIRRORING_CONFIGS_DATA: "aai_getPortMirroringConfigsData",
+ AAI_GET_PORT_MIRRORING_SOURCE_PORTS: "aai_getPortMirroringSourcePorts",
+ AAI_GET_PROVIDER_NETWORKS_ASSOCIATIONS: "aai/standardQuery/vlansByNetworks",
+ SEARCH_SERVICE_INSTANCES: "search_service_instances",
AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE: "get_vnf_data_by_globalid_and_service_type/",
AAI_GET_SERVICES_BY_OWNING_ENTITY_ID: 'aai_get_services_by_owning_entity_id',
- AAI_SUB_VIEWEDIT_PATH : "aai_sub_viewedit",
- AAI_GET_VNF_INFO : "aai_get_vnf_information",
- AAI_GET_PNF_INSTANCE: "aai_get_service_instance_pnfs",
- AAI_GET_CR_INSTANCE: "aai_get_network_collection_details",
- AAI_GET_VNF_INSTANCES_LIST: "aai_get_vnf_instances",
- AAI_GET_PNF_INSTANCES_LIST: "aai_get_pnf_instances",
- AAI_GET_BY_URI: "aai_get_by_uri/",
- AAI_GET_CONFIGURATION: "aai_get_configuration/",
- AAI_GET_HOMING_DATA: "aai_get_homing_by_vfmodule/@vnfInstanceId/@vfModuleId",
+ AAI_SUB_VIEWEDIT_PATH: "aai_sub_viewedit",
+ AAI_GET_VNF_INFO: "aai_get_vnf_information",
+ AAI_GET_PNF_INSTANCE: "aai_get_service_instance_pnfs",
+ AAI_GET_CR_INSTANCE: "aai_get_network_collection_details",
+ AAI_GET_VNF_INSTANCES_LIST: "aai_get_vnf_instances",
+ AAI_GET_PNF_INSTANCES_LIST: "aai_get_pnf_instances",
+ AAI_GET_BY_URI: "aai_get_by_uri/",
+ AAI_GET_CONFIGURATION: "aai_get_configuration/",
+ AAI_GET_HOMING_DATA: "aai_get_homing_by_vfmodule/@vnfInstanceId/@vfModuleId",
AAI_GET_TEST_ENVIRONMENTS: "get_operational_environments?operationalEnvironmentType=",
- GET_CATEGORY_PARAMETERS : "category_parameter",
- PARAMETER_STANDARDIZATION_FAMILY: "PARAMETER_STANDARDIZATION",
+ GET_CATEGORY_PARAMETERS: "category_parameter",
+ PARAMETER_STANDARDIZATION_FAMILY: "PARAMETER_STANDARDIZATION",
TENANT_ISOLATION_FAMILY: "TENANT_ISOLATION",
- ASDC_GETMODEL_PATH : "asdc/getModel/",
- CREATE_INSTANCE_PATH : "/models/services/createInstance", AAI_GET_PNF_BY_NAME : "aai_get_pnfs/pnf/",
- //1710 scheduler contants
- POST_CREATE_NEW_VNF_CHANGE:"post_create_new_vnf_change",
- WORKFLOW: "workflow",
- GET_TIME_SLOTS:"get_time_slots",
- SUBMIT_VNF_CHANGE_TIMESLOTS:"submit_vnf_change_timeslots",
- AAI_GET_INSTANCE_GROUPS_BY_VNF_INSTANCE_ID_PATH: 'aai_get_instance_groups_by_vnf_instance_id',
+ ASDC_GETMODEL_PATH: "asdc/getModel/",
+ CREATE_INSTANCE_PATH: "/models/services/createInstance",
+ AAI_GET_PNF_BY_NAME: "aai_get_pnfs/pnf/",
+ //1710 scheduler contants
+ POST_CREATE_NEW_VNF_CHANGE: "post_create_new_vnf_change",
+ WORKFLOW: "workflow",
+ GET_TIME_SLOTS: "get_time_slots",
+ SUBMIT_VNF_CHANGE_TIMESLOTS: "submit_vnf_change_timeslots",
+ AAI_GET_INSTANCE_GROUPS_BY_VNF_INSTANCE_ID_PATH: 'aai_get_instance_groups_by_vnf_instance_id',
- FORWARD_SLASH : "/",
- GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH : "get_system_prop_vnf_prov_status",
- GET_USER_ID : "getuserID",
- INSTANTIATE_ROOT_PATH : "#/instantiate?subscriberId=",
- INSTANTIATE_PATH : "/instantiate",
- INVALID_STRING : "/INVALID_STRING/",
- INVALID_STRING_MSO_CREATE_SVC_INSTANCE : "INVALID_STRING_mso_create_svc_instance",
- MSO: "mso",
- MSO_CREATE_NW_INSTANCE : "mso_create_nw_instance",
- MSO_CREATE_NW_INSTANCE_PATH : "mso_create_nw_instance/",
- MSO_CREATE_SVC_INSTANCE : "mso_create_svc_instance",
- MSO_DELETE_SVC_INSTANCE_PATH : "mso_delete_svc_instance/",
+ FORWARD_SLASH: "/",
+ GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH: "get_system_prop_vnf_prov_status",
+ GET_USER_ID: "getuserID",
+ INSTANTIATE_ROOT_PATH: "#/instantiate?subscriberId=",
+ INSTANTIATE_PATH: "/instantiate",
+ INVALID_STRING: "/INVALID_STRING/",
+ INVALID_STRING_MSO_CREATE_SVC_INSTANCE: "INVALID_STRING_mso_create_svc_instance",
+ MSO: "mso",
+ MSO_CREATE_NW_INSTANCE: "mso_create_nw_instance",
+ MSO_CREATE_NW_INSTANCE_PATH: "mso_create_nw_instance/",
+ MSO_CREATE_SVC_INSTANCE: "mso_create_svc_instance",
+ MSO_DELETE_SVC_INSTANCE_PATH: "mso_delete_svc_instance/",
MSO_ACTIVATE_INSTANCE: "mso/mso_activate_service_instance/@serviceInstanceId",
MSO_DEACTIVATE_INSTANCE: "mso/mso_deactivate_service_instance/@serviceInstanceId",
MSO_ACTIVATE_FABRIC_CONFIGURATION_INSTANCE: "mso/mso_activate_fabric_configuration/@serviceInstanceId",
- MSO_DEACTIVATE_AND_CLOUD_DELETE_INSTANCE: "mso/mso_vfmodule_soft_delete/@serviceInstanceId/@vnfInstanceId/@vfModuleInstanceId",
- MSO_CREATE_REALATIONSHIP : "mso_add_relationship",
- MSO_REMOVE_RELATIONSHIP: "mso_remove_relationship",
- SELECTED_SERVICE_SUB_PATH : "#/instances/subdetails?",
- SELECTED_SERVICE_INSTANCE_SUB_PATH : "serviceInstanceIdentifier=",
- SELECTED_SUBSCRIBER_SUB_PATH : "subscriberId=",
- OWNING_ENTITY_SUB_PATH : "owningEntity=",
- PROJECT_SUB_PATH : "project=",
- SERVICE_TYPE_LIST_PATH : "#/instances/serviceTypes?serviceTypeList=",
- SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH : 'serviceModels.htm#/instances/subscribers',
- SERVICES_DIST_STATUS_PATH : "rest/models/services?distributionStatus=",
- SERVICES_PATH : "rest/models/services/",
- SERVICETYPE_SUB_PATH : "&serviceType=",
- SERVICEINSTANCEID_SUB_PATH : "&serviceInstanceId=",
- MODELVERSIONID_SUB_PATH : "&aaiModelVersionId=",
- SERVICEMODELS_INSTANCES_SERVICES_PATH : "serviceModels.htm#/instances/services",
- SERVICEMODELS_MODELS_SERVICES_PATH : "serviceModels.htm#/models/services",
- SUBDETAILS_SELECTEDSUBSCRIBER : "#subdetails?selectedSubscriber=",
- SUBSCRIBERNAME_SUB_PATH : "&subscriberName=",
- WELCOME_PATH : "welcome.htm",
+ MSO_DEACTIVATE_AND_CLOUD_DELETE_INSTANCE: "mso/mso_vfmodule_soft_delete/@serviceInstanceId/@vnfInstanceId/@vfModuleInstanceId",
+ MSO_CREATE_REALATIONSHIP: "mso_add_relationship",
+ MSO_REMOVE_RELATIONSHIP: "mso_remove_relationship",
+ SELECTED_SERVICE_SUB_PATH: "#/instances/subdetails?",
+ SELECTED_SERVICE_INSTANCE_SUB_PATH: "serviceInstanceIdentifier=",
+ SELECTED_SUBSCRIBER_SUB_PATH: "subscriberId=",
+ OWNING_ENTITY_SUB_PATH: "owningEntity=",
+ PROJECT_SUB_PATH: "project=",
+ SERVICE_TYPE_LIST_PATH: "#/instances/serviceTypes?serviceTypeList=",
+ SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH: 'serviceModels.htm#/instances/subscribers',
+ SERVICES_DIST_STATUS_PATH: "rest/models/services?distributionStatus=",
+ SERVICES_PATH: "rest/models/services/",
+ SERVICETYPE_SUB_PATH: "&serviceType=",
+ SERVICEINSTANCEID_SUB_PATH: "&serviceInstanceId=",
+ MODELVERSIONID_SUB_PATH: "&aaiModelVersionId=",
+ SERVICEMODELS_INSTANCES_SERVICES_PATH: "serviceModels.htm#/instances/services",
+ SERVICEMODELS_MODELS_SERVICES_PATH: "serviceModels.htm#/models/services",
+ SUBDETAILS_SELECTEDSUBSCRIBER: "#subdetails?selectedSubscriber=",
+ SUBSCRIBERNAME_SUB_PATH: "&subscriberName=",
+ WELCOME_PATH: "welcome.htm",
IS_PERMITTED_SUB_PATH: "&isPermitted=",
- SERVICE_POPUP_IFRAME_URL: "app/ui/#/servicePopup?serviceModelId=",
- SUB_INTERFACE_POPUP_IFRAME_URL: "app/ui/#/vlan?",
+ SERVICE_POPUP_IFRAME_URL: "app/ui/#/servicePopup?serviceModelId=",
+ SUB_INTERFACE_POPUP_IFRAME_URL: "app/ui/#/vlan?",
VERIFY_SERVICE_URL: "rest/models/services/verifyService",
- //Test Environment Urls:
- OPERATIONAL_ENVIRONMENT_CREATE : "operationalEnvironment/create",
- OPERATIONAL_ENVIRONMENT_DEACTIVATE : "operationalEnvironment/deactivate?operationalEnvironment=",
- OPERATIONAL_ENVIRONMENT_ACTIVATE : "operationalEnvironment/activate?operationalEnvironment=",
- OPERATIONAL_ENVIRONMENT_STATUS : "operationalEnvironment/requestStatus?requestId=",
+ //Test Environment Urls:
+ OPERATIONAL_ENVIRONMENT_CREATE: "operationalEnvironment/create",
+ OPERATIONAL_ENVIRONMENT_DEACTIVATE: "operationalEnvironment/deactivate?operationalEnvironment=",
+ OPERATIONAL_ENVIRONMENT_ACTIVATE: "operationalEnvironment/activate?operationalEnvironment=",
+ OPERATIONAL_ENVIRONMENT_STATUS: "operationalEnvironment/requestStatus?requestId=",
//Template Urls
- AAI_GET_SUBS_URL : "app/vid/scripts/view-models/aaiGetSubs.htm",
- AAI_GET_SUBSCRIBER_URL : "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
- AAI_SERVICE_TYPES_URL : "app/vid/scripts/view-models/aaiServiceTypes.htm",
- AAI_SUB_DETAILS_URL : "app/vid/scripts/view-models/aaiSubDetails.htm",
- CREATE_INSTANCE_SERVICE_MODELS_URL : "app/vid/scripts/view-models/createInstanceServiceModels.htm",
- INSTANTIATE_URL : "app/vid/scripts/view-models/instantiate.htm",
- SERVICE_MODELS : "app/vid/scripts/view-models/serviceModels.htm",
+ AAI_GET_SUBS_URL: "app/vid/scripts/view-models/aaiGetSubs.htm",
+ AAI_GET_SUBSCRIBER_URL: "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
+ AAI_SERVICE_TYPES_URL: "app/vid/scripts/view-models/aaiServiceTypes.htm",
+ AAI_SUB_DETAILS_URL: "app/vid/scripts/view-models/aaiSubDetails.htm",
+ CREATE_INSTANCE_SERVICE_MODELS_URL: "app/vid/scripts/view-models/createInstanceServiceModels.htm",
+ INSTANTIATE_URL: "app/vid/scripts/view-models/instantiate.htm",
+ SERVICE_MODELS: "app/vid/scripts/view-models/serviceModels.htm",
- ACTIVATE_SERVICE_STATUSES: ['created', 'pendingdelete', 'pending-delete', 'assigned'],
+ ACTIVATE_SERVICE_STATUSES: ['created', 'pendingdelete', 'pending-delete',
+ 'assigned'],
- FULL_NAME_MAP : {
- "model-invariant-id" : "Model ID",
- "model-version-id" : "Model Version ID"
- },
- PARTIAL_NAME_MAP : {
- "id" : "ID",
- "uuid" : "UUID",
- "vfmodule" : "VF Module",
- "vnf" : "VNF",
- "volumegroup" : "Volume Group"
- },
+ FULL_NAME_MAP: {
+ "model-invariant-id": "Model ID",
+ "model-version-id": "Model Version ID"
+ },
+ PARTIAL_NAME_MAP: {
+ "id": "ID",
+ "uuid": "UUID",
+ "vfmodule": "VF Module",
+ "vnf": "VNF",
+ "volumegroup": "Volume Group"
+ },
- MANUAL_TASKS: {
- "retry": "retry",
- "rollback": "rollback",
- "abort": "abort",
- "skip": "skip"
- },
+ MANUAL_TASKS: {
+ "retry": "retry",
+ "rollback": "rollback",
+ "abort": "abort",
+ "skip": "skip"
+ },
- WORKFLOWS: {
- vnfConfigUpdate: "VNF Config Update",
- vnfInPlace: "VNF In Place Software Update",
- update: "update",
- replace: "replace",
- vnfScaleOut: "VNF Scale Out"
- },
+ WORKFLOWS: {
+ vnfConfigUpdate: "VNF Config Update",
+ vnfInPlace: "VNF In Place Software Update",
+ update: "update",
+ replace: "replace",
+ vnfScaleOut: "VNF Scale Out"
+ },
- FEATURE_FLAGS:{
- FLAG_ASYNC_INSTANTIATION : "FLAG_ASYNC_INSTANTIATION",
- FLAG_NETWORK_TO_ASYNC_INSTANTIATION : "FLAG_NETWORK_TO_ASYNC_INSTANTIATION",
- FLAG_ADD_MSO_TESTAPI_FIELD : "FLAG_ADD_MSO_TESTAPI_FIELD",
- FLAG_COLLECTION_RESOURCE_SUPPORT : "FLAG_COLLECTION_RESOURCE_SUPPORT",
- FLAG_SHOW_ASSIGNMENTS: "FLAG_SHOW_ASSIGNMENTS",
- FLAG_SHOW_VERIFY_SERVICE: "FLAG_SHOW_VERIFY_SERVICE",
- FLAG_PNP_INSTANTIATION: "FLAG_PNP_INSTANTIATION",
- FLAG_DUPLICATE_VNF : "FLAG_DUPLICATE_VNF",
- FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS: "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS",
- FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS: "FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS",
- FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST: "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST",
- FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY: "FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY",
- FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE: "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE"
+ FEATURE_FLAGS: {
+ FLAG_ASYNC_INSTANTIATION: "FLAG_ASYNC_INSTANTIATION",
+ FLAG_NETWORK_TO_ASYNC_INSTANTIATION: "FLAG_NETWORK_TO_ASYNC_INSTANTIATION",
+ FLAG_ADD_MSO_TESTAPI_FIELD: "FLAG_ADD_MSO_TESTAPI_FIELD",
+ FLAG_COLLECTION_RESOURCE_SUPPORT: "FLAG_COLLECTION_RESOURCE_SUPPORT",
+ FLAG_SHOW_ASSIGNMENTS: "FLAG_SHOW_ASSIGNMENTS",
+ FLAG_SHOW_VERIFY_SERVICE: "FLAG_SHOW_VERIFY_SERVICE",
+ FLAG_PNP_INSTANTIATION: "FLAG_PNP_INSTANTIATION",
+ FLAG_DUPLICATE_VNF: "FLAG_DUPLICATE_VNF",
+ FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS: "FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS",
+ FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS: "FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS",
+ FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST: "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST",
+ FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY: "FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY",
+ FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE: "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE"
}
- };
+ };
})());
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
index 9a758cc73..11f5cd6e5 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
@@ -617,13 +617,32 @@
};
vm.loadWorkFlows = function () {
- changeManagementService.getWorkflows(vm.changeManagement.vnfNames)
- .then(function(response) {
- vm.workflows = response.data.workflows;
- })
- .catch(function(error) {
- $log.error(error);
- });
+ // Should be corrected when VID-397 will be closed. At the moment there is a need
+ // to merge local and remote workflows not to broke current functionality.
+ return vm.loadLocalWorkFlows()
+ .then(vm.loadRemoteWorkFlows)
+ .then(function () {
+ vm.workflows = vm.localWorkflows.concat(vm.remoteWorkflows.map(item => item.name));
+ });
+ };
+
+ vm.loadLocalWorkFlows = function () {
+ return changeManagementService.getWorkflows(vm.changeManagement.vnfNames)
+ .then(function (response) {
+ vm.localWorkflows = response.data.workflows || [];
+ }).catch(function (error) {
+ $log.error(error);
+ });
+ };
+
+ vm.loadRemoteWorkFlows = function () {
+ let vnfNames = vm.changeManagement.vnfNames.map(vnfName => vnfName.name);
+ return changeManagementService.getSOWorkflows(vnfNames)
+ .then(function (response) {
+ vm.remoteWorkflows = response.data || [];
+ }).catch(function (error) {
+ $log.error(error);
+ });
};
//Must be $scope because we bind to the onchange of the html (cannot attached to vm variable).
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js
new file mode 100644
index 000000000..c4b940641
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js
@@ -0,0 +1,91 @@
+require('./new-change-management.controller');
+const jestMock = require('jest-mock');
+
+describe('Testing workFlows from SO', () => {
+ let $notNeeded;
+ let $controller;
+ let $changeManagementService;
+ beforeEach(
+ angular.mock.module('app')
+ );
+
+ beforeEach(inject(function (_$controller_) {
+ $notNeeded = jestMock.fn();
+ // mock ChangeManagementService
+ $changeManagementService = jestMock.fn();
+ $changeManagementService.getAllSDCServices = jestMock.fn(() => Promise.resolve([]));
+
+ // mock q
+ $q = jestMock.fn();
+ $defer = jestMock.fn();
+ $q.defer = jestMock.fn(() => $defer);
+ $defer.promise = Promise.resolve({});
+ // mock AaiService
+ $aaiService = jestMock.fn();
+ $aaiService.getLoggedInUserID = jestMock.fn();
+ $aaiService.getSubscribers = jestMock.fn();
+ $controller = _$controller_('newChangeManagementModalController', {
+ $uibModalInstance: $notNeeded,
+ $uibModal: $notNeeded,
+ $q: $q,
+ AaiService: $aaiService,
+ changeManagementService: $changeManagementService,
+ Upload: $notNeeded,
+ $log: $notNeeded,
+ _: $notNeeded,
+ COMPONENT: $notNeeded,
+ VIDCONFIGURATION: $notNeeded,
+ DataService: $notNeeded,
+ featureFlags: $notNeeded,
+ $scope: $notNeeded,
+ });
+ }));
+
+ test('Verify load workflows from SO will call getSOWorkflow and return only names of workflows', () => {
+ // given
+ $controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
+ let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 1"}, {"id": "2", "name": "workflow 2"}]});
+ $changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
+ $controller.workflows = [];
+ // when
+ return $controller.loadRemoteWorkFlows()
+ .then(() => {
+ remoteWorkflows = $controller.remoteWorkflows.map(item => item.name)
+ expect(remoteWorkflows).toContain('workflow 1');
+ expect(remoteWorkflows).toContain('workflow 2');
+ }
+ );
+ });
+
+ test('Verify load workflows will call load from SO and join workflow lists', () => {
+ // given
+ let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
+ let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 1"}, {"id": "2", "name": "workflow 2"}]});
+
+ $controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
+ $changeManagementService.getWorkflows = () => getWorkflowsStub;
+ $changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
+ // when
+ return $controller.loadWorkFlows().then(() => {
+ expect($controller.workflows).toContain('workflow 0');
+ expect($controller.workflows).toContain('workflow 1');
+ expect($controller.workflows).toContain('workflow 2');
+ });
+ });
+
+ test('Verify broken SO workflows wont change content of local workflows', () => {
+ // given
+ let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
+ let getSOWorkflowsPromiseStub = Promise.reject(new Error("Broken SO workflows service."));
+
+ $controller.changeManagement.vnfNames = "any";
+ $changeManagementService.getWorkflows = () => getWorkflowsStub;
+ $changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
+ // when
+ $controller.loadWorkFlows()
+ .then(() => {
+ expect($controller.workflows).toEqual(['workflow 0']);
+ });
+ });
+});
+
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
index 03e41b2c1..699868477 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js
@@ -21,6 +21,15 @@
});
};
+ this.getSOWorkflows = function (vnfNames) {
+ return $http.get(COMPONENT.GET_SO_WORKFLOWS, {params: {vnfName: vnfNames}})
+ .success(function (response) {
+ return {data: response};
+ }).catch(function () {
+ return {data: []};
+ });
+ };
+
this.getMSOChangeManagements = function() {
var deferred = $q.defer();
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ExtWorkflowServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ExtWorkflowServiceImplTest.java
new file mode 100644
index 000000000..1509637bb
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/services/ExtWorkflowServiceImplTest.java
@@ -0,0 +1,60 @@
+package org.onap.vid.services;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import io.joshworks.restclient.http.HttpResponse;
+import java.util.Collections;
+import java.util.List;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.model.SOWorkflow;
+import org.onap.vid.model.SOWorkflows;
+import org.onap.vid.mso.MsoResponseWrapper2;
+import org.onap.vid.mso.rest.MockedWorkflowsRestClient;
+import org.onap.vid.services.ExtWorkflowsServiceImpl.BadResponseFromMso;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ExtWorkflowServiceImplTest {
+
+ @Mock
+ private MockedWorkflowsRestClient client;
+ @Mock
+ private HttpResponse<SOWorkflows> response;
+
+ @BeforeMethod
+ public void init(){
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void shouldReturnWorkflowsOnValidResponse(){
+ // given
+ ExtWorkflowsService extWorkflowsService = new ExtWorkflowsServiceImpl(client);
+ Mockito.when(response.getStatus()).thenReturn(200);
+ Mockito.when(response.getBody()).thenReturn(new SOWorkflows(Collections.singletonList(new SOWorkflow(1L, "xyz"))));
+ MsoResponseWrapper2<SOWorkflows> msoResponseStub = new MsoResponseWrapper2<>(response);
+ Mockito.when(client.getWorkflows("test")).thenReturn(msoResponseStub);
+ // when
+ List<SOWorkflow> workflows = extWorkflowsService.getWorkflows("test");
+ // then
+ Mockito.verify(client).getWorkflows("test");
+ assertThat(workflows.get(0).getName(), is("xyz"));
+ }
+
+ @Test(expectedExceptions = BadResponseFromMso.class)
+ public void shouldThrowBadResponseOnInvalidResponse(){
+ // given
+ ExtWorkflowsService extWorkflowsService = new ExtWorkflowsServiceImpl(client);
+ Mockito.when(response.getStatus()).thenReturn(500);
+ Mockito.when(response.getBody()).thenReturn(new SOWorkflows(Collections.singletonList(new SOWorkflow(1L, "xyz"))));
+ MsoResponseWrapper2<SOWorkflows> msoResponseStub = new MsoResponseWrapper2<>(response);
+ Mockito.when(client.getWorkflows("test")).thenReturn(msoResponseStub);
+ // when
+ extWorkflowsService.getWorkflows("test");
+ // then throw exception
+ }
+
+}
diff --git a/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java b/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
index b67c98ee9..3c193cdb9 100644
--- a/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
+++ b/vid-ext-services-simulator/src/main/java/org/onap/simulator/controller/SimulatorController.java
@@ -6,8 +6,6 @@ import org.mockserver.integration.ClientAndServer;
import org.mockserver.matchers.Times;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
-import static org.mockserver.model.HttpRequest.request;
-import static org.mockserver.model.HttpResponse.response;
import org.mockserver.model.JsonBody;
import org.onap.simulator.errorHandling.VidSimulatorException;
@@ -35,8 +33,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import java.util.stream.Collectors;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;
@@ -54,7 +50,6 @@ public class SimulatorController {
private Boolean enablePresetRegistration;
private volatile boolean isInitialized = false;
-
Logger logger = LoggerFactory.getLogger(SimulatorController.class);
@PostConstruct
@@ -181,7 +176,6 @@ public class SimulatorController {
}
}
-
@RequestMapping(value = {"/**"})
public String redirectToMockServer(HttpServletRequest request, HttpServletResponse response) {
//Currently, the easiest logic is redirecting
diff --git a/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/workflows.json b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/workflows.json
new file mode 100644
index 000000000..f79651be4
--- /dev/null
+++ b/vid-ext-services-simulator/src/main/resources/preset_registration/changeManagement/workflows.json
@@ -0,0 +1,23 @@
+{
+ "simulatorRequest": {
+ "method": "GET",
+ "path": "/so/workflows"
+ } ,
+ "simulatorResponse": {
+ "responseCode": 200,
+ "body": {
+ "workflows":
+ [{
+ "id": 1,
+ "name": "workflow 1"
+ },{
+ "id": 2,
+ "name": "workflow 2"
+ },{
+ "id": 3,
+ "name": "workflow 3"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file