aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/.gitignore6
-rw-r--r--vid-app-common/jest.config.js4
-rwxr-xr-xvid-app-common/pom.xml36
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java11
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java19
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java37
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java35
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java49
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java88
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java44
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoConfig.java10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java11
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java18
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java25
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/open/HealthCheckController.java (renamed from vid-app-common/src/main/java/org/onap/vid/controller/HealthCheckController.java)3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/open/MaintenanceController.java (renamed from vid-app-common/src/main/java/org/onap/vid/controller/MaintenanceController.java)2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/open/RoleGeneratorController.java (renamed from vid-app-common/src/main/java/org/onap/vid/controller/RoleGeneratorController.java)2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/open/VersionController.java (renamed from vid-app-common/src/main/java/org/onap/vid/controller/VersionController.java)2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt60
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java94
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java72
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java71
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java136
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.kt46
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java (renamed from vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java)48
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java15
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java75
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java80
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java72
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/WorkflowServiceImpl.java13
-rw-r--r--vid-app-common/src/main/webapp/app/vid/external/lodash/lodash.min.js258
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html20
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js39
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.test.js201
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html7
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html20
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html20
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js142
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.test.js68
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html2
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js4
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html2
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js1562
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js21
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js2598
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java1
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java88
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java222
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java36
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java86
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java36
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipListTest.java35
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/model/ServicePropertiesTest.java93
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/model/VnfResultTest.java84
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/util/AAIRestInterfaceTest.java302
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java315
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java28
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/changeManagement/RequestParametersTest.java34
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/changeManagement/UIWorkflowsRequestTest.java33
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java33
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java122
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/ControllersUtilsTest.java144
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java16
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/WorkflowsControllerTest.java140
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/open/HealthCheckControllerTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java)3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/open/MaintenanceControllerTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/controller/MaintenanceControllerTest.java)3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/open/RoleGeneratorControllerTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/controller/RoleGeneratorControllerTest.java)3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/open/VersionControllerTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/controller/VersionControllerTest.java)3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java31
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java75
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java17
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java72
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java85
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java29
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/TaskTest.java79
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java)49
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java (renamed from vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java)16
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java98
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java18
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java5
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowServiceImplTest.java116
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowsServiceImplTest.java80
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/WorkflowServiceImplTest.java34
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java34
-rw-r--r--vid-app-common/src/test/resources/WEB-INF/conf/system.properties4
98 files changed, 5176 insertions, 3772 deletions
diff --git a/vid-app-common/.gitignore b/vid-app-common/.gitignore
index 675c1faed..ce72daaf2 100644
--- a/vid-app-common/.gitignore
+++ b/vid-app-common/.gitignore
@@ -5,4 +5,8 @@ debug-logs/
target/
.idea/
.classpath
-.project \ No newline at end of file
+.project
+
+# gulp/jest files #
+node_modules/
+coverage/
diff --git a/vid-app-common/jest.config.js b/vid-app-common/jest.config.js
index e9ca59b11..3f72db3be 100644
--- a/vid-app-common/jest.config.js
+++ b/vid-app-common/jest.config.js
@@ -7,10 +7,10 @@ module.exports = {
"<rootDir>/src/main/webapp/app/vid/external"
],
setupFilesAfterEnv: ["<rootDir>/test-config.js"],
- collectCoverage: true,
+ collectCoverage: false,
collectCoverageFrom: [
"src/**/*.js",
"!**/node_modules/**",
"!**/vendor/**"
]
-}; \ No newline at end of file
+};
diff --git a/vid-app-common/pom.xml b/vid-app-common/pom.xml
index 38b06f1f8..0cc2195e9 100755
--- a/vid-app-common/pom.xml
+++ b/vid-app-common/pom.xml
@@ -26,7 +26,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<epsdk.version>2.4.0</epsdk.version>
- <springframework.version>4.2.9.RELEASE</springframework.version>
+ <springframework.version>4.3.22.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<jackson.version>2.9.8</jackson.version>
<jersey.version>2.27</jersey.version>
@@ -472,6 +472,12 @@
<version>0.9.3</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jeasy</groupId>
+ <artifactId>easy-random-core</artifactId>
+ <version>4.0.0.RC1</version>
+ <scope>test</scope>
+ </dependency>
<!-- Helpers -->
<dependency>
@@ -622,11 +628,8 @@
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.12</version>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${springframework.version}</version>
- </dependency>
+
+ <!-- springframework to override epsdk-app-common's and epsdk-core's versions -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
@@ -659,6 +662,22 @@
<version>${springframework.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
@@ -799,5 +818,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>2.9.2</version>
+ </dependency>
</dependencies>
</project>
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java
index 3938b164c..a62076073 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java
@@ -48,6 +48,14 @@ public class AaiGetVnfResponse {
this.additionalProperties.put(name, value);
}
+ public List<VnfResult> getResults() {
+ return results;
+ }
+
+ public void setResults(List<VnfResult> results) {
+ this.results = results;
+ }
+
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java
index 6059eec74..d03362ba8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java
@@ -34,7 +34,7 @@ public class SubscriberListWithFilterData {
public SubscriberListWithFilterData(SubscriberList subscriberList, RoleValidator roleValidator){
List<Subscriber> subscribers = subscriberList != null ? subscriberList.customer : new ArrayList<>();
- List<SubscriberWithFilter> subscribersWithFilter = new ArrayList<>();
+ customer = new ArrayList<>();
for (Subscriber subscriber :subscribers){
SubscriberWithFilter subscriberWithFilter = new SubscriberWithFilter();
subscriberWithFilter.setIsPermitted(roleValidator.isSubscriberPermitted(subscriber.globalCustomerId));
@@ -42,10 +42,9 @@ public class SubscriberListWithFilterData {
subscriberWithFilter.resourceVersion = subscriber.resourceVersion;
subscriberWithFilter.subscriberName = subscriber.subscriberName;
subscriberWithFilter.globalCustomerId = subscriber.globalCustomerId;
- subscribersWithFilter.add(subscriberWithFilter);
+ customer.add(subscriberWithFilter);
}
- this.customer = subscribersWithFilter;
- }
+ }
public List<SubscriberWithFilter> customer;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java
index c30570d22..d6eb0526f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java
@@ -27,20 +27,17 @@ import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RelationshipList {
-
+
+ public List<Relationship> relationship;
+
@JsonProperty("relationship")
public List<Relationship> getRelationship() {
return relationship;
}
-
+
@JsonProperty("relationship")
public void setRelationship(List<Relationship> relationship) {
this.relationship = relationship;
}
- public List<Relationship> relationship;
-
-
-
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java
index 677602be1..6cbd8cdbf 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -83,4 +84,22 @@ public class VnfResult {
public void setJsonAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ VnfResult vnfResult = (VnfResult) o;
+ return Objects.equals(id, vnfResult.id) &&
+ Objects.equals(nodeType, vnfResult.nodeType) &&
+ Objects.equals(url, vnfResult.url) &&
+ Objects.equals(properties, vnfResult.properties) &&
+ Objects.equals(relatedTo, vnfResult.relatedTo) &&
+ Objects.equals(additionalProperties, vnfResult.additionalProperties);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, nodeType, url, properties, relatedTo, additionalProperties);
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
index 8f53fcdbf..92d8de757 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
@@ -133,7 +133,7 @@ public class AAIRestInterface {
*
* @param baseURL the base URL
*/
- public void SetRestSrvrBaseURL(String baseURL)
+ public void setRestSrvrBaseURL(String baseURL)
{
if (baseURL == null) {
logger.info(EELFLoggerDelegate.errorLogger, "REST Server base URL cannot be null.");
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java
new file mode 100644
index 000000000..dd6923569
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/RequestParameters.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import java.util.List;
+import java.util.Map;
+
+public class RequestParameters {
+
+ private List<Map<String,String>> userParams;
+
+
+ public List<Map<String, String>> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<Map<String, String>> userParams) {
+ this.userParams = userParams;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java
new file mode 100644
index 000000000..97eee3045
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/UIWorkflowsRequest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+public class UIWorkflowsRequest {
+
+ private WorkflowRequestDetail requestDetails;
+
+
+ public WorkflowRequestDetail getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(WorkflowRequestDetail requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java b/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java
new file mode 100644
index 000000000..2ebebdd68
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/changeManagement/WorkflowRequestDetail.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import org.onap.vid.mso.model.CloudConfiguration;
+
+public class WorkflowRequestDetail {
+
+
+ private CloudConfiguration cloudConfiguration;
+
+ private RequestParameters requestParameters;
+
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ public void setRequestParameters(RequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
index a8e1e2b02..3aff7fea7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController.java
@@ -3,6 +3,7 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,19 @@
package org.onap.vid.controller;
+import static org.onap.vid.utils.Logging.getMethodName;
+
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
@@ -41,30 +54,21 @@ import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AaiService;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.onap.vid.utils.Unchecked;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+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;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.ModelAndView;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import static org.onap.vid.utils.Logging.getMethodName;
-
/**
* Controller to handle a&ai requests.
*/
@@ -72,33 +76,25 @@ import static org.onap.vid.utils.Logging.getMethodName;
@RestController
public class AaiController extends RestrictedBaseController {
- /**
- * The from app id.
- */
- private String fromAppId = "VidAaiController";
- /**
- * The logger.
- */
private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AaiController.class);
- /**
- * The model.
- */
- private Map<String, Object> model = new HashMap<>();
- /**
- * The servlet context.
- */
- @Autowired
- private ServletContext servletContext;
- /**
- * aai service
- */
- @Autowired
+ private static final String FROM_APP_ID = "VidAaiController";
+
private AaiService aaiService;
- @Autowired
+ private AAIRestInterface aaiRestInterface;
private RoleProvider roleProvider;
+ private SystemPropertiesWrapper systemPropertiesWrapper;
@Autowired
- private AAIRestInterface aaiRestInterface;
+ public AaiController(AaiService aaiService,
+ AAIRestInterface aaiRestInterface,
+ RoleProvider roleProvider,
+ SystemPropertiesWrapper systemPropertiesWrapper) {
+
+ this.aaiService = aaiService;
+ this.aaiRestInterface = aaiRestInterface;
+ this.roleProvider = roleProvider;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
+ }
/**
* Welcome method.
@@ -140,7 +136,7 @@ public class AaiController extends RestrictedBaseController {
@RequestMapping(value = {"/getuserID"}, method = RequestMethod.GET)
public ResponseEntity<String> getUserID(HttpServletRequest request) {
- String userId = ControllersUtils.extractUserId(request);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
return new ResponseEntity<>(userId, HttpStatus.OK);
}
@@ -153,7 +149,7 @@ public class AaiController extends RestrictedBaseController {
*/
@RequestMapping(value = "/aai_get_services", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> doGetServices(HttpServletRequest request) throws IOException {
- RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request));
+ RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request));
AaiResponse subscriberList = aaiService.getServices(roleValidator);
return aaiResponseToResponseEntity(subscriberList);
@@ -277,7 +273,7 @@ public class AaiController extends RestrictedBaseController {
public ResponseEntity<String> getFullSubscriberList(HttpServletRequest request) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
ResponseEntity<String> responseEntity;
- RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request));
+ RoleValidator roleValidator = RoleValidator.by(roleProvider.getUserRoles(request));
SubscriberFilteredResults subscriberList = aaiService.getFullSubscriberList(roleValidator);
if (subscriberList.getHttpCode() == 200) {
responseEntity = new ResponseEntity<>(objectMapper.writeValueAsString(subscriberList.getSubscriberList()), HttpStatus.OK);
@@ -340,7 +336,7 @@ public class AaiController extends RestrictedBaseController {
ObjectMapper objectMapper = new ObjectMapper();
ResponseEntity responseEntity;
List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = new RoleValidator(roles);
+ RoleValidator roleValidator = RoleValidator.by(roles);
AaiResponse subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator);
String httpMessage = subscriberData.getT() != null ?
objectMapper.writeValueAsString(subscriberData.getT()) :
@@ -369,7 +365,7 @@ public class AaiController extends RestrictedBaseController {
ResponseEntity responseEntity;
List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = new RoleValidator(roles);
+ RoleValidator roleValidator = RoleValidator.by(roles);
AaiResponse<ServiceInstancesSearchResults> searchResult = aaiService.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, owningEntities, projects);
@@ -531,7 +527,7 @@ public class AaiController extends RestrictedBaseController {
try {
ObjectMapper objectMapper = new ObjectMapper();
List<Role> roles = roleProvider.getUserRoles(request);
- RoleValidator roleValidator = new RoleValidator(roles);
+ RoleValidator roleValidator = RoleValidator.by(roles);
AaiResponse<GetTenantsResponse[]> response = aaiService.getTenants(globalCustomerId, serviceType, roleValidator);
if (response.getHttpCode() == 200) {
responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(response.getT()), HttpStatus.OK);
@@ -618,7 +614,7 @@ public class AaiController extends RestrictedBaseController {
try {
- resp = aaiRestInterface.RestGet(fromAppId, transId, Unchecked.toURI(uri), xml).getResponse();
+ resp = aaiRestInterface.RestGet(FROM_APP_ID, transId, Unchecked.toURI(uri), xml).getResponse();
} catch (WebApplicationException e) {
final String message = e.getResponse().readEntity(String.class);
@@ -647,7 +643,7 @@ public class AaiController extends RestrictedBaseController {
Response resp = null;
try {
- resp = aaiRestInterface.RestPost(fromAppId, uri, payload, xml);
+ resp = aaiRestInterface.RestPost(FROM_APP_ID, uri, payload, xml);
} catch (Exception e) {
LOGGER.info(EELFLoggerDelegate.errorLogger, "<== " + "." + methodName + e.toString());
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
index a204d3a9a..081e3c640 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java
@@ -31,6 +31,7 @@ import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.mso.MsoResponseWrapper2;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
import org.onap.vid.services.AuditService;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -48,6 +49,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
public static final String ASYNC_INSTANTIATION = "asyncInstantiation";
protected final AsyncInstantiationBusinessLogic asyncInstantiationBL;
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
protected ObjectMapper objectMapper = new ObjectMapper();
@@ -55,8 +57,9 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
protected AuditService auditService;
@Autowired
- public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL) {
+ public AsyncInstantiationController(AsyncInstantiationBusinessLogic asyncInstantiationBL, SystemPropertiesWrapper systemPropertiesWrapper) {
this.asyncInstantiationBL = asyncInstantiationBL;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
@ExceptionHandler(OperationNotAllowedException.class)
@@ -84,7 +87,7 @@ public class AsyncInstantiationController extends VidRestrictedBaseController {
catch (Exception e) {
LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to log incoming ServiceInstantiation request ", e);
}
- String userId = ControllersUtils.extractUserId(httpServletRequest);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
List<UUID> uuids = asyncInstantiationBL.pushBulkJob(request, userId);
return new MsoResponseWrapper2(200, uuids);
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java b/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java
index 7139b29fb..befbe0320 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/ControllersUtils.java
@@ -3,13 +3,14 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,35 +21,26 @@
package org.onap.vid.controller;
+import static org.onap.vid.utils.Logging.getMethodCallerName;
+
+import java.util.Optional;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.ws.rs.WebApplicationException;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.model.ExceptionResponse;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.http.ResponseEntity;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.ws.rs.WebApplicationException;
-
-import static org.onap.vid.utils.Logging.getMethodCallerName;
+public final class ControllersUtils {
-public class ControllersUtils {
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
-
- public static String extractUserId(HttpServletRequest request) {
- String userId = "";
- HttpSession session = request.getSession();
- if (session != null) {
- User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
- if (user != null) {
- //userId = user.getHrid();
- userId = user.getLoginId();
- if (userId == null)
- userId = user.getOrgUserId();
- }
- }
- return userId;
+ public ControllersUtils(SystemPropertiesWrapper systemPropertiesWrapper) {
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
public static ExceptionResponse handleException(Exception e, EELFLoggerDelegate logger) {
@@ -62,4 +54,12 @@ public class ControllersUtils {
return ResponseEntity.status(e.getResponse().getStatus()).body(ControllersUtils.handleException(e, logger));
}
+ public String extractUserId(HttpServletRequest request) {
+ Optional<User> user = Optional.ofNullable(request.getSession())
+ .map((HttpSession he) -> (User) he
+ .getAttribute(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)));
+
+ return user.map(User::getLoginId).isPresent()
+ ? user.map(User::getLoginId).orElse("") : user.map(User::getOrgUserId).orElse("");
+ }
}
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 a472268a3..8d5fbbdbb 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
@@ -30,10 +30,10 @@ 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;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.togglz.core.manager.FeatureManager;
@@ -48,16 +48,12 @@ public class MsoConfig {
}
@Bean
- public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper, HttpsAuthClient httpsAuthClient){
+ public MsoRestClientNew msoClient(ObjectMapper unirestObjectMapper, HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemPropertiesWrapper){
// Satisfy both interfaces -- MsoInterface and RestMsoImplementation
return new MsoRestClientNew(new SyncRestClient(unirestObjectMapper), SystemProperties.getProperty(
- MsoProperties.MSO_SERVER_URL),httpsAuthClient);
+ MsoProperties.MSO_SERVER_URL),httpsAuthClient, systemPropertiesWrapper);
}
- @Bean
- public MockedWorkflowsRestClient mockedWorkflowsClient(ObjectMapper unirestObjectMapper){
- return new MockedWorkflowsRestClient(new SyncRestClient(unirestObjectMapper), "http://vid-simulator:1080/");
- }
@Bean
public MsoBusinessLogic getMsoBusinessLogic(MsoInterface msoClient, FeatureManager featureManager){
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
index 290400432..00f9db246 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
@@ -74,6 +74,7 @@ public class MsoController extends RestrictedBaseController {
* The Constant VNF_INSTANCE_ID.
*/
public static final String VNF_INSTANCE_ID = "<vnf_instance_id>";
+ public static final String WORKFLOW_ID = "<workflow_UUID>";
public static final String START_LOG = " start";
private final MsoBusinessLogic msoBusinessLogic;
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java
index fe94dfd80..a6778ad0c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/OperationalEnvironmentController.java
@@ -37,6 +37,7 @@ import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
import org.onap.vid.mso.rest.RequestDetails;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.MissingServletRequestParameterException;
@@ -60,20 +61,22 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle
private final MsoInterface restMso;
private final MsoBusinessLogic msoBusinessLogic;
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
private static final Pattern RECOVERY_ACTION_MESSAGE_PATTERN = Pattern.compile("from String \"(.*)\": value not");
@Autowired
- public OperationalEnvironmentController(MsoBusinessLogic msoBusinessLogic, MsoInterface msoClientInterface) {
+ public OperationalEnvironmentController(MsoBusinessLogic msoBusinessLogic, MsoInterface msoClientInterface, SystemPropertiesWrapper systemPropertiesWrapper) {
this.restMso = msoClientInterface;
this.msoBusinessLogic = msoBusinessLogic;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
@RequestMapping(value = "/create", method = RequestMethod.POST)
public MsoResponseWrapper2 createOperationalEnvironment(HttpServletRequest request, @RequestBody OperationalEnvironmentCreateBody operationalEnvironment) {
debugStart(operationalEnvironment);
- String userId = ControllersUtils.extractUserId(request);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
RequestDetailsWrapper<OperationEnvironmentRequestDetails> requestDetailsWrapper = msoBusinessLogic.convertParametersToRequestDetails(operationalEnvironment, userId);
String path = msoBusinessLogic.getOperationalEnvironmentCreationPath();
@@ -94,7 +97,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle
throw new BadManifestException("Manifest structure is wrong");
}
- String userId = ControllersUtils.extractUserId(request);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
OperationalEnvironmentActivateInfo activateInfo = new OperationalEnvironmentActivateInfo(activateRequest, userId, operationalEnvironmentId);
debugStart(activateInfo);
@@ -115,7 +118,7 @@ public class OperationalEnvironmentController extends VidRestrictedBaseControlle
verifyIsNotEmpty(operationalEnvironmentId, "operationalEnvironment");
- String userId = ControllersUtils.extractUserId(request);
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
OperationalEnvironmentDeactivateInfo deactivateInfo = new OperationalEnvironmentDeactivateInfo(userId, operationalEnvironmentId);
debugStart(deactivateInfo);
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index 987bffa34..e00c2d7a5 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -24,6 +24,7 @@ package org.onap.vid.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
import io.joshworks.restclient.http.mapper.ObjectMapper;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.*;
import org.onap.vid.aai.model.PortDetailsTranslator;
import org.onap.vid.aai.util.*;
@@ -41,11 +42,18 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.togglz.core.manager.FeatureManager;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
import javax.servlet.ServletContext;
import java.io.File;
import java.io.IOException;
+@EnableSwagger2
@Configuration
public class WebConfig {
@@ -163,7 +171,7 @@ public class WebConfig {
}
@Bean
- public AaiOverTLSClientInterface aaiOverTLSClient(ObjectMapper unirestObjectMapper){
+ public AaiOverTLSClientInterface aaiOverTLSClient(ObjectMapper unirestObjectMapper, SystemProperties systemProperties){
return new AaiOverTLSClient(new SyncRestClient(unirestObjectMapper), new AaiOverTLSPropertySupplier());
}
@@ -192,4 +200,12 @@ public class WebConfig {
}
+ @Bean
+ public Docket api(){
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(RequestHandlerSelectors.basePackage("org.onap.vid.controller.open"))
+ .paths(PathSelectors.any())
+ .build();
+ }
}
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
index a94481b9e..1d0ff95bc 100644
--- 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
@@ -21,18 +21,26 @@
package org.onap.vid.controller;
import java.util.List;
+import java.util.UUID;
+
+import org.onap.vid.changeManagement.UIWorkflowsRequest;
import org.onap.vid.model.LocalWorkflowParameterDefinitions;
import org.onap.vid.model.SOWorkflow;
import org.onap.vid.model.SOWorkflowParameterDefinitions;
+import org.onap.vid.mso.MsoResponseWrapper;
+import org.onap.vid.services.ChangeManagementService;
import org.onap.vid.services.ExternalWorkflowsService;
import org.onap.vid.services.LocalWorkflowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
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;
+import javax.servlet.http.HttpServletRequest;
+
@RestController
@RequestMapping(WorkflowsController.WORKFLOWS_MANAGEMENT)
public class WorkflowsController extends VidRestrictedBaseController {
@@ -40,27 +48,30 @@ public class WorkflowsController extends VidRestrictedBaseController {
private ExternalWorkflowsService externalWorkflowsService;
private LocalWorkflowsService localWorkflowsService;
+ private ChangeManagementService changeManagementService;
@Autowired
- public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService) {
+ public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService,ChangeManagementService changeManagementService) {
this.externalWorkflowsService = externalWorkflowsService;
this.localWorkflowsService = localWorkflowsService;
+ this.changeManagementService = changeManagementService;
}
@RequestMapping(value = "workflows", method = RequestMethod.GET)
- public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfName") String vnfName){
- return externalWorkflowsService.getWorkflows(vnfName);
+ public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfModelId") String vnfModelId){
+ return externalWorkflowsService.getWorkflows(vnfModelId);
}
- @RequestMapping(value = "remote-workflow-parameters/{id}", method = RequestMethod.GET)
- SOWorkflowParameterDefinitions getParameters(@PathVariable Long id) {
- return externalWorkflowsService.getWorkflowParameterDefinitions(id);
- }
@RequestMapping(value = "local-workflow-parameters/{name}", method = RequestMethod.GET)
LocalWorkflowParameterDefinitions getParameters(@PathVariable String name) {
return localWorkflowsService.getWorkflowParameterDefinitions(name);
}
+ @RequestMapping(value = "{serviceInstanceId}/{vnfInstanceId}/{workflow_UUID}", method = RequestMethod.POST)
+ public MsoResponseWrapper getWorkflowFromUI(HttpServletRequest request, @PathVariable("serviceInstanceId") UUID serviceInstanceId, @PathVariable("vnfInstanceId") UUID vnfInstanceId, @PathVariable("workflow_UUID") UUID workflow_UUID, @RequestBody UIWorkflowsRequest requestBody) {
+ return changeManagementService.invokeVnfWorkflow(request,requestBody.getRequestDetails(), serviceInstanceId, vnfInstanceId, workflow_UUID);
+ }
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/HealthCheckController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/HealthCheckController.java
index 04d5babcc..92e1a1802 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/HealthCheckController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/HealthCheckController.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
import org.onap.portalsdk.core.controller.UnRestrictedBaseController;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.controller.HealthStatus;
import org.onap.vid.dao.FnAppDoaImpl;
import org.onap.vid.model.GitRepositoryState;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MaintenanceController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/MaintenanceController.java
index dfba4e31a..d1004401a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MaintenanceController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/MaintenanceController.java
@@ -1,4 +1,4 @@
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
/*-
* ============LICENSE_START=======================================================
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/RoleGeneratorController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/RoleGeneratorController.java
index 107142d7f..7b57df2c7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/RoleGeneratorController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/RoleGeneratorController.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
import static org.springframework.http.HttpStatus.OK;
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/VersionController.java b/vid-app-common/src/main/java/org/onap/vid/controller/open/VersionController.java
index aa15f0fa3..0a4d6f5ac 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/VersionController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/open/VersionController.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
import com.fasterxml.jackson.core.type.TypeReference;
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
index b88c3f6f6..00cc7b943 100644
--- 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
@@ -20,9 +20,18 @@
package org.onap.vid.model
+import com.google.common.collect.Lists
+
+enum class WorkflowSource(val source: String) {
+ SDC("sdc"), NATIVE("native")
+}
+
data class SOWorkflow constructor(
- val id: Long,
- val name: String) {
+ val id: String,
+ val name: String,
+ val source: WorkflowSource,
+ val workflowInputParameters: List<WorkflowInputParameter>
+) {
fun clone(): SOWorkflow {
return copy()
}
@@ -79,3 +88,50 @@ data class LocalWorkflowParameterDefinitions constructor(
}
}
+
+data class ArtifactInfo constructor(
+ val artifactType: String,
+ val artifactUuid: String,
+ val artifactName: String,
+ val artifactVersion: String,
+ val artifactDescription: String? = null,
+ val workflowName: String,
+ val operationName: String? = null,
+ val workflowSource: String,
+ val workflowResourceTarget: String
+)
+
+data class ActivitySequenceItem constructor(
+ val name: String,
+ val description: String
+)
+
+data class WorkflowInputParameter constructor(
+ val label: String,
+ val inputType: String,
+ val required: Boolean,
+ val validation: List<InputParameterValidation>? = Lists.newArrayList(),
+ val soFieldName: String,
+ val soPayloadLocation: String?,
+ val description: String?
+
+)
+
+data class InputParameterValidation constructor(
+ val maxLength: String?,
+ val allowableChars: String?
+)
+
+data class WorkflowSpecification constructor(
+ val artifactInfo: ArtifactInfo,
+ val activitySequence: List<ActivitySequenceItem>? = Lists.newArrayList(),
+ val workflowInputParameters: List<WorkflowInputParameter>
+)
+
+data class WorkflowSpecificationWrapper constructor(
+ val workflowSpecification: WorkflowSpecification
+)
+
+data class SOWorkflowList constructor(
+ val workflowSpecificationList: List<WorkflowSpecificationWrapper>? = Lists.newArrayList()
+)
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
index 633acbcb8..3b2cdb1bf 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
@@ -3,6 +3,7 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright 2019 Nokia
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +22,9 @@
package org.onap.vid.mso;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.controller.OperationalEnvironmentController;
+import org.onap.vid.model.SOWorkflowList;
import org.onap.vid.model.SoftDeleteRequest;
import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
@@ -31,6 +34,7 @@ import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.mso.rest.Task;
import java.util.List;
+import java.util.UUID;
public interface MsoBusinessLogic {
@@ -51,6 +55,8 @@ public interface MsoBusinessLogic {
MsoResponseWrapper scaleOutVfModuleInstance(org.onap.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);
+ MsoResponseWrapper invokeVnfWorkflow(WorkflowRequestDetail request, String userId, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID);
+
MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId);
MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String serviceInstanceId, String serviceStatus);
@@ -134,4 +140,5 @@ public interface MsoBusinessLogic {
MsoResponseWrapper2 activateFabricConfiguration(String serviceInstanceId, RequestDetails requestDetails);
+ SOWorkflowList getWorkflowListByModelId(String modelVersionId);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index ec1c5479f..64c405a39 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,23 +26,44 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import io.joshworks.restclient.http.HttpResponse;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.ChangeManagementRequest;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.controller.OperationalEnvironmentController;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.RequestReferencesContainer;
+import org.onap.vid.model.SOWorkflowList;
import org.onap.vid.model.SoftDeleteRequest;
-import org.onap.vid.mso.model.*;
+import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
+import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
+import org.onap.vid.mso.model.RequestInfo;
+import org.onap.vid.mso.model.RequestParameters;
import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
-import org.onap.vid.mso.rest.*;
+import org.onap.vid.mso.rest.RelatedInstance;
+import org.onap.vid.mso.rest.Request;
+import org.onap.vid.mso.rest.RequestDetails;
+import org.onap.vid.mso.rest.RequestList;
+import org.onap.vid.mso.rest.RequestWrapper;
+import org.onap.vid.mso.rest.Task;
+import org.onap.vid.mso.rest.TaskList;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
import org.togglz.core.manager.FeatureManager;
import javax.ws.rs.BadRequestException;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -51,8 +72,16 @@ import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toList;
import static org.apache.commons.lang.StringUtils.upperCase;
import static org.onap.vid.changeManagement.ChangeManagementRequest.MsoChangeManagementRequest;
-import static org.onap.vid.controller.MsoController.*;
-import static org.onap.vid.mso.MsoProperties.*;
+import static org.onap.vid.controller.MsoController.CONFIGURATION_ID;
+import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
+import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
+import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
+import static org.onap.vid.controller.MsoController.WORKFLOW_ID;
+import static org.onap.vid.mso.MsoProperties.MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS;
+import static org.onap.vid.mso.MsoProperties.MSO_REST_API_OPERATIONAL_ENVIRONMENT_ACTIVATE;
+import static org.onap.vid.mso.MsoProperties.MSO_REST_API_OPERATIONAL_ENVIRONMENT_CREATE;
+import static org.onap.vid.mso.MsoProperties.MSO_REST_API_OPERATIONAL_ENVIRONMENT_DEACTIVATE;
+import static org.onap.vid.mso.MsoProperties.MSO_REST_API_WORKFLOW_SPECIFICATIONS;
import static org.onap.vid.properties.Features.FLAG_UNASSIGN_SERVICE;
import static org.onap.vid.utils.Logging.debugRequestDetails;
@@ -94,7 +123,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
this.featureManager = featureManager;
}
- public static String validateEndpointPath(String endpointEnvVariable) {
+ public static String validateEndpointPath(String endpointEnvVariable) {
String endpoint = SystemProperties.getProperty(endpointEnvVariable);
if (endpoint == null || endpoint.isEmpty()) {
throw new GenericUncheckedException(endpointEnvVariable + " env variable is not defined");
@@ -181,6 +210,27 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
@Override
+ public MsoResponseWrapper invokeVnfWorkflow(WorkflowRequestDetail request, String userId, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID) {
+ logInvocationInDebug("invokeVnfWorkflow");
+
+ String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_WORKFLOW_INSTANCE);
+
+ String final_endpoint = endpoint
+ .replaceFirst(SVC_INSTANCE_ID, serviceInstanceId.toString())
+ .replaceFirst(WORKFLOW_ID, workflow_UUID.toString())
+ .replaceFirst(VNF_INSTANCE_ID, vnfInstanceId.toString());
+
+ Map<String,String> extraHeaders = new HashMap<>();
+
+ UUID requestId = UUID.randomUUID();
+ extraHeaders.put("X-ONAP-RequestID",requestId.toString());
+ extraHeaders.put("X-ONAP-PartnerName","VID");
+ extraHeaders.put("X-RequestorID",userId);
+
+ return msoClientInterface.invokeWorkflow(request,final_endpoint,extraHeaders);
+ }
+
+ @Override
public MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId) {
logInvocationInDebug("createConfigurationInstance");
@@ -380,7 +430,7 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
}
}
- private List<Task> deserializeManualTasksJson(String manualTasksJson) {
+ private List<Task> deserializeManualTasksJson(String manualTasksJson) {
logInvocationInDebug("deserializeManualTasksJson");
ObjectMapper mapper = new ObjectMapper();
@@ -534,6 +584,20 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
return new MsoResponseWrapper2<>(msoClientInterface.post(path, new RequestDetailsWrapper<>(requestDetails), RequestReferencesContainer.class));
}
+ @Override
+ public SOWorkflowList getWorkflowListByModelId(String modelVersionId) {
+ logInvocationInDebug("getWorkflowListByModelId");
+ String pathTemplate = validateEndpointPath(MSO_REST_API_WORKFLOW_SPECIFICATIONS);
+ String path = pathTemplate.replaceFirst("<model_version_id>", modelVersionId);
+
+ HttpResponse<SOWorkflowList> workflowListByModelId = msoClientInterface.getWorkflowListByModelId(path);
+ if (!isSuccessful(workflowListByModelId)) {
+ logger.error(EELFLoggerDelegate.errorLogger, workflowListByModelId.getStatusText());
+ throw new WorkflowListException(String.format("Get worklflow list for id: %s failed due to %s", modelVersionId, workflowListByModelId.getStatusText()));
+ }
+ return workflowListByModelId.getBody();
+ }
+
@Override
public MsoResponseWrapperInterface updateVnfSoftware(org.onap.vid.changeManagement.RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {
@@ -818,6 +882,18 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
logger.debug(EELFLoggerDelegate.debugLogger, methodName + e.toString());
}
+ private boolean isSuccessful(HttpResponse<SOWorkflowList> workflowListByModelId) {
+ int status = workflowListByModelId.getStatus();
+ return HttpStatus.OK.value() == status || HttpStatus.ACCEPTED.value() == status;
+ }
+
+ static class WorkflowListException extends RuntimeException{
+
+ WorkflowListException(String message) {
+ super(message);
+ }
+ }
+
enum RequestType {
CREATE_INSTANCE("createInstance"),
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index 31063c62b..9befc0f90 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -22,8 +22,12 @@ package org.onap.vid.mso;
import io.joshworks.restclient.http.HttpResponse;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.model.SOWorkflowList;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.mso.rest.RequestDetails;
+import java.util.Map;
+
/**
* Created by pickjonathan on 21/06/2017.
*/
@@ -111,6 +115,10 @@ public interface MsoInterface {
MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath);
+ HttpResponse<SOWorkflowList> getWorkflowListByModelId(String endpoint);
+
+ MsoResponseWrapper invokeWorkflow(WorkflowRequestDetail requestDetails,String invokeWorkflowsPath, Map<String, String> extraHeaders);
+
<T> HttpResponse<T> get(String path, Class<T> responseClass);
<T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
index 3dc1ddcd3..4e6258c16 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoProperties.java
@@ -97,6 +97,9 @@ public class MsoProperties extends SystemProperties {
public static final String MSO_REST_API_VF_MODULE_SCALE_OUT = "mso.restapi.vf.module.scaleout";
+ /** The Constant MSO_REST_API_WORKFLOW_INSTANCE. */
+ public static final String MSO_REST_API_WORKFLOW_INSTANCE = "mso.restapi.workflow.invoke";
+
/** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance";
@@ -122,4 +125,6 @@ public class MsoProperties extends SystemProperties {
/** The Constant MSO_REST_API_SERVICE_INSTANCE_ASSIGN */
public static final String MSO_REST_API_SERVICE_INSTANCE_ASSIGN = "mso.restapi.serviceInstanceAssign";
+
+ public static final String MSO_REST_API_WORKFLOW_SPECIFICATIONS= "mso.restapi.changeManagement.workflowSpecifications";
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
index e14ac0e11..17af75200 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
@@ -26,7 +26,6 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpException;
import org.eclipse.jetty.util.security.Password;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.ExceptionWithRequestInfo;
import org.onap.vid.aai.util.HttpClientMode;
import org.onap.vid.aai.util.HttpsAuthClient;
@@ -34,6 +33,7 @@ import org.onap.vid.client.HttpBasicClient;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.mso.rest.RestInterface;
import org.onap.vid.utils.Logging;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
@@ -64,6 +64,7 @@ public class RestMsoImplementation implements RestInterface {
protected HttpsAuthClient httpsAuthClient;
+ protected SystemPropertiesWrapper systemProperties;
private static final String START_LOG = " start";
private static final String APPLICATION_JSON = "application/json";
@@ -80,8 +81,9 @@ public class RestMsoImplementation implements RestInterface {
*/
@Autowired
- protected RestMsoImplementation(HttpsAuthClient httpsAuthClient){
+ protected RestMsoImplementation(HttpsAuthClient httpsAuthClient, SystemPropertiesWrapper systemProperties){
this.httpsAuthClient=httpsAuthClient;
+ this.systemProperties = systemProperties;
}
@SuppressWarnings("Duplicates")
@@ -89,9 +91,9 @@ public class RestMsoImplementation implements RestInterface {
{
final String methodname = "initRestClient()";
- final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
- final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
- final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
+ final String username = systemProperties.getProperty(MsoProperties.MSO_USER_NAME);
+ final String password = systemProperties.getProperty(MsoProperties.MSO_PASSWORD);
+ final String mso_url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
final String decrypted_password = Password.deobfuscate(password);
String authString = username + ":" + decrypted_password;
@@ -140,7 +142,7 @@ public class RestMsoImplementation implements RestInterface {
try {
restObject.set(t);
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
@@ -179,7 +181,7 @@ public class RestMsoImplementation implements RestInterface {
final String methodName = getMethodName();
logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {})", getMethodCallerName(), methodName, path, clazz);
- String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ String url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " sending request to url= " + url);
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
@@ -216,7 +218,7 @@ public class RestMsoImplementation implements RestInterface {
try {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
Logging.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url, r);
cres = client.target(url)
.request()
@@ -281,7 +283,7 @@ public class RestMsoImplementation implements RestInterface {
public Invocation.Builder prepareClient(String path, String methodName) {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
- String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ String url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + " sending request to url= " + url);
// Change the content length
return client.target(url)
@@ -307,7 +309,7 @@ public class RestMsoImplementation implements RestInterface {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
userId.ifPresent(id->commonHeaders.put("X-RequestorID", Collections.singletonList(id)));
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
Logging.logRequest(outgoingRequestsLogger, httpMethod, url, payload);
// Change the content length
final Invocation.Builder restBuilder = client.target(url)
@@ -369,7 +371,7 @@ public class RestMsoImplementation implements RestInterface {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ url = systemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
Logging.logRequest(outgoingRequestsLogger, HttpMethod.PUT, url, r);
// Change the content length
final Response cres = client.target(url)
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
deleted file mode 100644
index 54ee6464f..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.mso.rest;
-
-import java.util.Collections;
-import org.jetbrains.annotations.NotNull;
-import org.onap.vid.client.SyncRestClient;
-import org.onap.vid.model.SOWorkflowParameterDefinitions;
-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));
- }
-
- public MsoResponseWrapper2<SOWorkflowParameterDefinitions> getWorkflowParameterDefinitions(Long workflowId) {
- return new MsoResponseWrapper2<>(syncRestClient
- .get((workflowId <= 3 && workflowId > 0) ? getParametersUrl(workflowId) : getParametersUrl(),
- Collections.emptyMap(),
- Collections.emptyMap(),
- SOWorkflowParameterDefinitions.class));
- }
-
- @NotNull
- private String getWorkflowsUrl() {
- return baseUrl + "so/workflows";
- }
-
-
- @NotNull
- private String getParametersUrl() {
- return baseUrl + "so/workflow-parameters";
- }
-
- @NotNull
- private String getParametersUrl(Long workflowId) {
- return baseUrl + "so/workflow-parameters/" + workflowId;
- }
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index b47981ecf..6a498fc01 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -21,7 +21,16 @@
package org.onap.vid.mso.rest;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
import io.joshworks.restclient.http.HttpResponse;
+import io.joshworks.restclient.http.JsonNode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.eclipse.jetty.util.security.Password;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -29,18 +38,19 @@ import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.changeManagement.MsoRequestDetails;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.model.RequestReferencesContainer;
-import org.onap.vid.mso.*;
+import org.onap.vid.model.SOWorkflowList;
+import org.onap.vid.mso.MsoInterface;
+import org.onap.vid.mso.MsoProperties;
+import org.onap.vid.mso.MsoResponseWrapper;
+import org.onap.vid.mso.MsoResponseWrapperInterface;
+import org.onap.vid.mso.MsoUtil;
+import org.onap.vid.mso.RestMsoImplementation;
+import org.onap.vid.mso.RestObject;
import org.onap.vid.utils.Logging;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import org.onap.vid.utils.SystemPropertiesWrapper;
/**
@@ -62,8 +72,8 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
*/
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class);
- public MsoRestClientNew(SyncRestClient client, String baseUrl, HttpsAuthClient authClient) {
- super(authClient);
+ public MsoRestClientNew(SyncRestClient client, String baseUrl, HttpsAuthClient authClient, SystemPropertiesWrapper systemPropertiesWrapper) {
+ super(authClient,systemPropertiesWrapper);
this.client = client;
this.baseUrl = baseUrl;
this.commonHeaders = initCommonHeaders();
@@ -220,13 +230,7 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
return MsoUtil.wrapResponse(response);
}
- public MsoResponseWrapper getManualTasks(String endpoint) {
- String path = baseUrl + endpoint;
-
- HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
- return MsoUtil.wrapResponse(response);
- }
-
+ @Override
public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) {
String methodName = "getManualTasksByRequestId";
logger.debug(methodName + START);
@@ -234,9 +238,10 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
try {
String path = baseUrl + endpoint;
- MsoResponseWrapper w =getManualTasks(path);
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse());
+ HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
+ MsoResponseWrapper w = MsoUtil.wrapResponse(response);
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w=" + w.getResponse());
return w;
} catch (Exception e) {
@@ -444,6 +449,20 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
}
@Override
+ public MsoResponseWrapper invokeWorkflow(WorkflowRequestDetail workflowRequestDetail, String invokeWorkflowsPath, Map<String, String> extraHeaders) {
+ String path = baseUrl + invokeWorkflowsPath;
+ Map<String, String> finalHeader = new HashMap<>();
+
+ finalHeader.putAll(commonHeaders);
+ finalHeader.putAll(extraHeaders);
+
+ RequestDetailsWrapper<WorkflowRequestDetail> requestDetailsWrapper = new RequestDetailsWrapper<>(workflowRequestDetail);
+
+ HttpResponse<JsonNode> response = client.post(path, finalHeader, requestDetailsWrapper);
+ return MsoUtil.wrapResponse(response);
+ }
+
+ @Override
public <T> HttpResponse<T> get(String endpoint, Class<T> responseClass) {
String path = baseUrl + endpoint;
return client.get(path, commonHeaders, new HashMap<>(), responseClass);
@@ -457,6 +476,12 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
}
+ public HttpResponse<SOWorkflowList> getWorkflowListByModelId(String endpoint){
+ String path = baseUrl + endpoint;
+
+ return client.get(path, commonHeaders, Maps.newHashMap(), SOWorkflowList.class);
+ }
+
private MsoResponseWrapper createInstance(Object request, String path) {
String methodName = "createInstance";
logger.debug(methodName + START);
@@ -501,8 +526,8 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
}
private Map<String, String> initCommonHeaders() {
- String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
- String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
+ String username = systemProperties.getProperty(MsoProperties.MSO_USER_NAME);
+ String password = systemProperties.getProperty(MsoProperties.MSO_PASSWORD);
String decrypted_password = Password.deobfuscate(password);
String authString = username + ":" + decrypted_password;
@@ -514,7 +539,7 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf
map.put(HttpHeaders.AUTHORIZATION, "Basic " + authStringEnc);
map.put(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- map.put(X_FROM_APP_ID, SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
+ map.put(X_FROM_APP_ID, systemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
map.put(SystemProperties.ECOMP_REQUEST_ID, Logging.extractOrGenerateRequestId());
return ImmutableMap.copyOf(map);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java
deleted file mode 100644
index 1956d8a95..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.mso.rest;
-
-import java.util.List;
-
-public class Task {
-
- private String taskId;
- private String type;
- private String nfRole;
- private String subscriptionServiceType;
- private String originalRequestId;
- private String originalRequestorId;
- private String errorSource;
- private String errorCode;
- private String errorMessage;
- private String buildingBlockName;
- private String buildingBlockStep;
- private List<String> validResponses;
-
-
- public String getTaskId() {
- return taskId;
- }
-
- public void setTaskId(String taskId) {
- this.taskId = taskId;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getNfRole() {
- return nfRole;
- }
-
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
- }
-
- public String getSubscriptionServiceType() {
- return subscriptionServiceType;
- }
-
- public void setSubscriptionServiceType(String subscriptionServiceType) {
- this.subscriptionServiceType = subscriptionServiceType;
- }
-
- public String getOriginalRequestId() {
- return originalRequestId;
- }
-
- public void setOriginalRequestId(String originalRequestId) {
- this.originalRequestId = originalRequestId;
- }
-
- public String getOriginalRequestorId() {
- return originalRequestorId;
- }
-
- public void setOriginalRequestorId(String originalRequestorId) {
- this.originalRequestorId = originalRequestorId;
- }
-
- public String getErrorSource() {
- return errorSource;
- }
-
- public void setErrorSource(String errorSource) {
- this.errorSource = errorSource;
- }
-
- public String getErrorCode() {
- return errorCode;
- }
-
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- public String getBuildingBlockName() {
- return buildingBlockName;
- }
-
- public void setBuildingBlockName(String buildingBlockName) {
- this.buildingBlockName = buildingBlockName;
- }
-
- public String getBuildingBlockStep() {
- return buildingBlockStep;
- }
-
- public void setBuildingBlockStep(String buildingBlockStep) {
- this.buildingBlockStep = buildingBlockStep;
- }
-
- public List<String> getValidResponses() {
- return validResponses;
- }
-
- public void setValidResponses(List<String> validResponses) {
- this.validResponses = validResponses;
- }
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.kt b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.kt
new file mode 100644
index 000000000..7d2a41a6a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/Task.kt
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.mso.rest
+
+data class Task(
+ var taskId: String?,
+ var type: String?,
+ var nfRole: String?,
+ var subscriptionServiceType: String?,
+ var originalRequestId: String?,
+ var originalRequestorId: String?,
+ var errorSource: String?,
+ var errorCode: String?,
+ var errorMessage: String?,
+ var buildingBlockName: String?,
+ var buildingBlockStep: String?,
+ var description: String?,
+ var timeout: String?,
+ var validResponses: List<String>?
+) {
+ // i.e. "default constructor", no params
+ constructor() : this(
+ null, null, null, null,
+ null, null, null, null,
+ null, null, null,
+ null, null, null
+ )
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
index 6f403d9da..4e5340fc2 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/VnfResultTest.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/AlwaysValidRoleValidator.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,36 +18,26 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.aai;
+package org.onap.vid.roles;
-import org.junit.Test;
-import org.onap.vid.aai.model.VnfResult;
+public class AlwaysValidRoleValidator implements RoleValidator {
-import java.util.Map;
+ AlwaysValidRoleValidator() {
+ // package visibility, only for RoleValidator's factory
+ }
-public class VnfResultTest {
+ @Override
+ public boolean isSubscriberPermitted(String subscriberName) {
+ return true;
+ }
- private VnfResult createTestSubject() {
- return new VnfResult();
- }
+ @Override
+ public boolean isServicePermitted(String subscriberName, String serviceType) {
+ return true;
+ }
- @Test
- public void testGetAdditionalProperties() throws Exception {
- VnfResult testSubject;
- Map<String, Object> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
- }
-
- @Test
- public void testSetAdditionalProperty() throws Exception {
- VnfResult testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- }
+ @Override
+ public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ return true;
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
index d3d2b80e2..6c0fd3f52 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
@@ -24,6 +24,14 @@ package org.onap.vid.roles;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.joshworks.restclient.http.HttpResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.web.support.UserUtils;
import org.onap.vid.aai.exceptions.RoleParsingException;
@@ -34,11 +42,6 @@ import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
/**
* Created by Oren on 7/1/17.
@@ -159,7 +162,7 @@ public class RoleProvider {
}
public RoleValidator getUserRolesValidator(HttpServletRequest request) {
- return new RoleValidator(getUserRoles(request));
+ return RoleValidator.by(getUserRoles(request));
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
index 315e22dd7..d37477610 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidator.java
@@ -3,13 +3,14 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 - 2019 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,70 +21,24 @@
package org.onap.vid.roles;
-import org.onap.vid.mso.rest.RequestDetails;
-
import java.util.List;
-import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.portalsdk.core.util.SystemProperties;
-/**
- * Created by Oren on 7/12/17.
- */
-public class RoleValidator {
+public interface RoleValidator {
- private boolean disableRoles = true;
- private List<Role> userRoles;
+ static RoleValidator by(List<Role> roles) {
+ boolean disableRoles =
+ StringUtils.equals(SystemProperties.getProperty("role_management_activated"), "false");
- public RoleValidator(List<Role> roles) {
- this.userRoles = roles;
+ return disableRoles
+ ? new AlwaysValidRoleValidator()
+ : new RoleValidatorByRoles(roles);
}
- public boolean isSubscriberPermitted(String subscriberName) {
- if (this.disableRoles) return true;
-
- for (Role role : userRoles) {
- if (role.getSubscribeName().equals(subscriberName))
- return true;
- }
- return false;
- }
-
- public boolean isServicePermitted(String subscriberName, String serviceType) {
- if (this.disableRoles) return true;
-
- for (Role role : userRoles) {
- if (role.getSubscribeName().equals(subscriberName) && role.getServiceType().equals(serviceType))
- return true;
- }
- return false;
- }
+ boolean isSubscriberPermitted(String subscriberName);
- public boolean isMsoRequestValid(RequestDetails mso_request) {
- if (this.disableRoles) return true;
+ boolean isServicePermitted(String subscriberName, String serviceType);
- try {
- String globalSubscriberIdRequested = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("subscriberInfo")).get("globalSubscriberId");
- String serviceType = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("requestParameters")).get("subscriptionServiceType");
- return isServicePermitted(globalSubscriberIdRequested, serviceType);
- } catch (Exception e) {
- //Until we'll get the exact information regarding the tenants and the global customer id, we'll return true on unknown requests to mso
- return true;
- }
- }
-
- public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
- if (this.disableRoles) return true;
-
- for (Role role : userRoles) {
- if (role.getSubscribeName().equals(globalCustomerId)
- && role.getServiceType().equals(serviceType)
- && (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) {
- return true;
- }
- }
- return false;
- }
-
- void enableRoles() {
- this.disableRoles = false;
- }
+ boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java
new file mode 100644
index 000000000..ad5b519c4
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleValidatorByRoles.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.roles;
+
+import java.util.List;
+import java.util.Map;
+import org.onap.vid.mso.rest.RequestDetails;
+
+public class RoleValidatorByRoles implements RoleValidator {
+
+ private final List<Role> userRoles;
+
+ RoleValidatorByRoles(List<Role> roles) {
+ this.userRoles = roles;
+ }
+
+ @Override
+ public boolean isSubscriberPermitted(String subscriberName) {
+ for (Role role : userRoles) {
+ if (role.getSubscribeName().equals(subscriberName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isServicePermitted(String subscriberName, String serviceType) {
+ for (Role role : userRoles) {
+ if (role.getSubscribeName().equals(subscriberName) && role.getServiceType().equals(serviceType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {
+ for (Role role : userRoles) {
+ if (role.getSubscribeName().equals(globalCustomerId)
+ && role.getServiceType().equals(serviceType)
+ && (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ boolean isMsoRequestValid(RequestDetails msoRequest) {
+ try {
+ String globalSubscriberIdRequested = (String) ((Map) ((Map) msoRequest.getAdditionalProperties()
+ .get("requestDetails")).get("subscriberInfo")).get("globalSubscriberId");
+ String serviceType = (String) ((Map) ((Map) msoRequest.getAdditionalProperties().get("requestDetails"))
+ .get("requestParameters")).get("subscriptionServiceType");
+ return isServicePermitted(globalSubscriberIdRequested, serviceType);
+ } catch (Exception e) {
+ //Until we'll get the exact information regarding the tenants and the global customer id, we'll return true on unknown requests to mso
+ return true;
+ }
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
index 0047396d1..603e1f7be 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementService.java
@@ -23,13 +23,16 @@ package org.onap.vid.services;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.vid.changeManagement.*;
+import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.RestObjectWithRequestInfo;
import org.onap.vid.mso.rest.Request;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;
+import java.util.UUID;
public interface ChangeManagementService {
Collection<Request> getMSOChangeManagements();
@@ -49,4 +52,6 @@ public interface ChangeManagementService {
VnfWorkflowRelationAllResponse getAllVnfWorkflowRelations();
String uploadConfigUpdateFile(MultipartFile file);
+ MsoResponseWrapper invokeVnfWorkflow(HttpServletRequest request, WorkflowRequestDetail requestBody, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID);
+
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
index a20164c9e..fc5a85c04 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ChangeManagementServiceImpl.java
@@ -30,17 +30,20 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.*;
+import org.onap.vid.controller.ControllersUtils;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.exceptions.NotFoundException;
import org.onap.vid.model.VNFDao;
import org.onap.vid.model.VidWorkflow;
import org.onap.vid.mso.MsoBusinessLogic;
+import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.RestObjectWithRequestInfo;
import org.onap.vid.mso.rest.Request;
import org.onap.vid.scheduler.SchedulerProperties;
import org.onap.vid.scheduler.SchedulerRestInterfaceIfc;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -48,6 +51,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.BadRequestException;
import java.io.IOException;
import java.util.*;
@@ -64,16 +68,18 @@ public class ChangeManagementServiceImpl implements ChangeManagementService {
private MsoBusinessLogic msoBusinessLogic;
private final SchedulerRestInterfaceIfc restClient;
private final CloudOwnerService cloudOwnerService;
+ private final SystemPropertiesWrapper systemPropertiesWrapper;
@Autowired
private CsvService csvService;
@Autowired
- public ChangeManagementServiceImpl(DataAccessService dataAccessService, MsoBusinessLogic msoBusinessLogic, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService) {
+ public ChangeManagementServiceImpl(DataAccessService dataAccessService, MsoBusinessLogic msoBusinessLogic, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService, SystemPropertiesWrapper systemPropertiesWrapper) {
this.dataAccessService = dataAccessService;
this.msoBusinessLogic = msoBusinessLogic;
this.restClient = schedulerRestInterface;
this.cloudOwnerService = cloudOwnerService;
+ this.systemPropertiesWrapper = systemPropertiesWrapper;
}
@Override
@@ -327,6 +333,12 @@ public class ChangeManagementServiceImpl implements ChangeManagementService {
return json.toString();
}
+ @Override
+ public MsoResponseWrapper invokeVnfWorkflow(HttpServletRequest request,WorkflowRequestDetail requestBody, UUID serviceInstanceId, UUID vnfInstanceId, UUID workflow_UUID) {
+ String userId = new ControllersUtils(systemPropertiesWrapper).extractUserId(request);
+ return msoBusinessLogic.invokeVnfWorkflow(requestBody, userId, serviceInstanceId, vnfInstanceId, workflow_UUID);
+ }
+
private boolean validateJsonOutput(org.json.JSONObject json) {
if (!json.has(PRIMARY_KEY) || !json.getJSONObject(PRIMARY_KEY).keySet().containsAll(REQUIRED_KEYS))
return false;
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java
index da909a54d..4620eed34 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,10 +22,8 @@ package org.onap.vid.services;
import java.util.List;
import org.onap.vid.model.SOWorkflow;
-import org.onap.vid.model.SOWorkflowParameterDefinitions;
-public interface ExternalWorkflowsService {
- List<SOWorkflow> getWorkflows(String vnfName);
- SOWorkflowParameterDefinitions getWorkflowParameterDefinitions(Long workflowId);
+public interface ExternalWorkflowsService {
+ List<SOWorkflow> getWorkflows(String vnfModelId);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java
index 1da03f0ac..0648b6ac9 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,60 +20,48 @@
package org.onap.vid.services;
-import java.util.List;
+import org.onap.vid.model.ArtifactInfo;
import org.onap.vid.model.SOWorkflow;
-import org.onap.vid.model.SOWorkflowParameterDefinitions;
-import org.onap.vid.model.SOWorkflows;
-import org.onap.vid.mso.MsoResponseWrapper2;
-import org.onap.vid.mso.rest.MockedWorkflowsRestClient;
+import org.onap.vid.model.SOWorkflowList;
+import org.onap.vid.model.WorkflowSource;
+import org.onap.vid.model.WorkflowSpecification;
+import org.onap.vid.mso.MsoBusinessLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
@Service
public class ExternalWorkflowsServiceImpl implements ExternalWorkflowsService {
- private MockedWorkflowsRestClient mockedWorkflowsRestClient;
+ private MsoBusinessLogic msoService;
@Autowired
- public ExternalWorkflowsServiceImpl(MockedWorkflowsRestClient mockedWorkflowsRestClient) {
- this.mockedWorkflowsRestClient = mockedWorkflowsRestClient;
+ public ExternalWorkflowsServiceImpl(MsoBusinessLogic msoService) {
+ this.msoService = msoService;
}
@Override
- public List<SOWorkflow> getWorkflows(String vnfName) {
- MsoResponseWrapper2<SOWorkflows> msoResponse = mockedWorkflowsRestClient.getWorkflows(vnfName);
- validateSOResponse(msoResponse, SOWorkflows.class);
- return convertMsoResponseToWorkflowList(msoResponse);
- }
+ public List<SOWorkflow> getWorkflows(String vnfModelId) {
+ SOWorkflowList workflowListByModelId = msoService.getWorkflowListByModelId(vnfModelId);
+ List<SOWorkflow> soWorkflows = new ArrayList<>();
+ Objects.requireNonNull(workflowListByModelId
+ .getWorkflowSpecificationList())
+ .forEach(
+ workflow -> soWorkflows.add(convertWorkflow(workflow.getWorkflowSpecification()))
+ );
- @Override
- public SOWorkflowParameterDefinitions getWorkflowParameterDefinitions(Long workflowId) {
- MsoResponseWrapper2<SOWorkflowParameterDefinitions> msoResponse = mockedWorkflowsRestClient.getWorkflowParameterDefinitions(workflowId);
- validateSOResponse(msoResponse, SOWorkflowParameterDefinitions.class);
- return (SOWorkflowParameterDefinitions) msoResponse.getEntity();
+ return soWorkflows;
}
- private List<SOWorkflow> convertMsoResponseToWorkflowList(MsoResponseWrapper2<SOWorkflows> msoResponse) {
- SOWorkflows soWorkflows = (SOWorkflows) msoResponse.getEntity();
- return soWorkflows.getWorkflows();
- }
+ private SOWorkflow convertWorkflow(WorkflowSpecification workflow) {
+ ArtifactInfo artifactInfo = workflow.getArtifactInfo();
- private void validateSOResponse(MsoResponseWrapper2 response, Class<?> expectedResponseClass){
- if (response.getStatus() >= 400 || !expectedResponseClass.isInstance(response.getEntity())) {
- throw new BadResponseFromMso(response);
- }
+ return new SOWorkflow(artifactInfo.getArtifactUuid(),
+ artifactInfo.getWorkflowName(),
+ WorkflowSource.valueOf(artifactInfo.getWorkflowSource().toUpperCase()),
+ workflow.getWorkflowInputParameters());
}
-
- public static class BadResponseFromMso extends RuntimeException {
- private final MsoResponseWrapper2<?> msoResponse;
-
- BadResponseFromMso(MsoResponseWrapper2<?> msoResponse) {
- this.msoResponse = msoResponse;
- }
-
- public MsoResponseWrapper2<?> getMsoResponse() {
- return msoResponse;
- }
- }
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/WorkflowServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/WorkflowServiceImpl.java
index 097b05e58..cbc79e86f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/WorkflowServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/WorkflowServiceImpl.java
@@ -20,6 +20,7 @@
package org.onap.vid.services;
+import java.util.List;
import org.onap.vid.model.Workflow;
import org.springframework.stereotype.Service;
@@ -31,29 +32,27 @@ import java.util.stream.Collectors;
@Service
public class WorkflowServiceImpl implements WorkflowService {
//TODO: Add the list of workflows hard coded or from DB.
- private ArrayList<Workflow> workflows = new ArrayList<>(Arrays.asList(
+ private List<Workflow> workflows = Arrays.asList(
new Workflow(0, "Upgrade", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3", "VNF4"))),
new Workflow(1, "Clean", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3"))),
new Workflow(2, "Reinstall", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF4"))),
new Workflow(3, "Dump", new ArrayList<>(Arrays.asList("VNF1", "VNF3", "VNF4"))),
new Workflow(4, "Flush", new ArrayList<>(Arrays.asList("VNF2", "VNF3", "VNF4")))
- ));
+ );
@Override
public Collection<String> getWorkflowsForVNFs(Collection<String> vnfNames) {
- Collection<String> result = workflows.stream()
+ return workflows.stream()
.filter(workflow -> workflow.getVnfNames().containsAll(vnfNames))
- .map(workflow -> workflow.getWorkflowName())
+ .map(Workflow::getWorkflowName)
.distinct()
.collect(Collectors.toList());
-
- return result;
}
@Override
public Collection<String> getAllWorkflows() {
return workflows.stream()
- .map(workflow -> workflow.getWorkflowName())
+ .map(Workflow::getWorkflowName)
.distinct()
.collect(Collectors.toList());
}
diff --git a/vid-app-common/src/main/webapp/app/vid/external/lodash/lodash.min.js b/vid-app-common/src/main/webapp/app/vid/external/lodash/lodash.min.js
index ffa43eaf3..c91126344 100644
--- a/vid-app-common/src/main/webapp/app/vid/external/lodash/lodash.min.js
+++ b/vid-app-common/src/main/webapp/app/vid/external/lodash/lodash.min.js
@@ -6,132 +6,132 @@
return true}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!(null==n||!n.length)&&-1<v(n,t,0)}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return true;return false}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return true;return false}function p(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,false}),e}function _(n,t,r,e){var u=n.length;for(r+=e?1:-1;e?r--:++r<u;)if(t(n[r],r,n))return r;return-1}function v(n,t,r){if(t===t)n:{--r;for(var e=n.length;++r<e;)if(n[r]===t){n=r;break n}n=-1}else n=_(n,d,r);return n}function g(n,t,r,e){
--r;for(var u=n.length;++r<u;)if(e(n[r],t))return r;return-1}function d(n){return n!==n}function y(n,t){var r=null==n?0:n.length;return r?m(n,t)/r:F}function b(n){return function(t){return null==t?T:t[n]}}function x(n){return function(t){return null==n?T:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=false,n):t(r,n,u,i)}),r}function w(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function m(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==T&&(r=r===T?i:r+i)}return r;
-}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function k(n,t){return c(t,function(t){return[t,n[t]]})}function E(n){return function(t){return n(t)}}function S(n,t){return c(t,function(t){return n[t]})}function O(n,t){return n.has(t)}function I(n,t){for(var r=-1,e=n.length;++r<e&&-1<v(t,n[r],0););return r}function R(n,t){for(var r=n.length;r--&&-1<v(t,n[r],0););return r}function z(n){return"\\"+Cn[n]}function W(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n];
-}),r}function B(n,t){return function(r){return n(t(r))}}function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r)}return i}function U(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function C(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function D(n){if(Rn.test(n)){for(var t=On.lastIndex=0;On.test(n);)++t;n=t}else n=Qn(n);return n}function M(n){return Rn.test(n)?n.match(On)||[]:n.split("");
-}var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,kn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",En=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kn+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={};
-Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false;
-var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true,
-Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un,Cn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dn=parseFloat,Mn=parseInt,Tn=typeof global=="object"&&global&&global.Object===Object&&global,$n=typeof self=="object"&&self&&self.Object===Object&&self,Fn=Tn||$n||Function("return this")(),Nn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pn=Nn&&typeof module=="object"&&module&&!module.nodeType&&module,Zn=Pn&&Pn.exports===Nn,qn=Zn&&Tn.process;
-n:{try{Un=qn&&qn.binding&&qn.binding("util");break n}catch(n){}Un=void 0}var Vn=Un&&Un.isArrayBuffer,Kn=Un&&Un.isDate,Gn=Un&&Un.isMap,Hn=Un&&Un.isRegExp,Jn=Un&&Un.isSet,Yn=Un&&Un.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I",
-"\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C",
-"\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i",
-"\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S",
-"\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe",
-"\u0149":"'n","\u017f":"s"}),nt=x({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),tt=x({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),rt=function x(mn){function An(n){if(du(n)&&!of(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(ii.call(n,"__wrapped__"))return $e(n)}return new On(n)}function kn(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,
-this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Cn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function $n(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Nn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new $n;++t<r;)this.add(n[t])}function Pn(n){
-this.size=(this.__data__=new Tn(n)).size}function qn(n,t){var r,e=of(n),u=!e&&uf(n),i=!e&&!u&&cf(n),o=!e&&!u&&!i&&pf(n),u=(e=e||u||i||o)?A(n.length,Xu):[],f=u.length;for(r in n)!t&&!ii.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return Ce(Ur(n),pt(t,0,n.length))}function ut(n){return Ce(Ur(n))}function it(n,t,r){(r===T||au(n[t],r))&&(r!==T||t in n)||st(n,t,r);
-}function ot(n,t,r){var e=n[t];ii.call(n,t)&&au(e,r)&&(r!==T||t in n)||st(n,t,r)}function ft(n,t){for(var r=n.length;r--;)if(au(n[r][0],t))return r;return-1}function ct(n,t,r,e){return eo(n,function(n,u,i){t(e,n,r(n),i)}),e}function at(n,t){return n&&Cr(t,zu(t),n)}function lt(n,t){return n&&Cr(t,Wu(t),n)}function st(n,t,r){"__proto__"==t&&mi?mi(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r}function ht(n,t){for(var r=-1,e=t.length,u=Vu(e),i=null==n;++r<e;)u[r]=i?T:Iu(n,t[r]);return u;
-}function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!gu(n))return n;if(u=of(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=_o(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(cf(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=ke(n,s,c)}}if(o||(o=new Pn),
-i=o.get(n))return i;if(o.set(n,f),hf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(lf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Wu:zu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=zu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Yu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ni("Expected a function");
-return yo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,E(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p),p=e||0!==p?p:0;if(a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function bt(n,t){var r=true;return eo(n,function(n,e,u){return r=!!t(n,e,u)}),r}function xt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===T?o===o&&!ju(o):r(o,f)))var f=o,c=i;
-}return c}function jt(n,t){var r=[];return eo(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Ee),u||(u=[]);++i<o;){var f=n[i];0<t&&r(f)?1<t?wt(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function mt(n,t){return n&&io(n,t,zu)}function At(n,t){return n&&oo(n,t,zu)}function kt(n,t){return i(t,function(t){return pu(n[t])})}function Et(n,t){t=Sr(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[De(t[r++])];return r&&r==e?n:T}function St(n,t,r){return t=t(n),
-of(n)?t:a(t,r(n))}function Ot(n){if(null==n)n=n===T?"[object Undefined]":"[object Null]";else if(wi&&wi in Yu(n)){var t=ii.call(n,wi),r=n[wi];try{n[wi]=T;var e=true}catch(n){}var u=ci.call(n);e&&(t?n[wi]=r:delete n[wi]),n=u}else n=ci.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&ii.call(n,t)}function zt(n,t){return null!=n&&t in Yu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Vu(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,E(t))),s=Ui(p.length,s),
-l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],d=t?t(g):g,g=r||0!==g?g:0;if(v?!O(v,d):!e(h,d,r)){for(a=i;--a;){var y=l[a];if(y?!O(y,d):!e(n[a],d,r))continue n}v&&v.push(d),h.push(g)}}return h}function Bt(n,t,r){var e={};return mt(n,function(n,u,i){t(e,r(n),u,i)}),e}function Lt(t,r,e){return r=Sr(r,t),t=2>r.length?t:Et(t,hr(r,0,-1)),r=null==t?t:t[De(qe(r))],null==r?T:n(r,t,e)}function Ut(n){return du(n)&&"[object Arguments]"==Ot(n)}function Ct(n){
-return du(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return du(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!du(n)&&!du(t))t=n!==n&&t!==t;else n:{var i=of(n),o=of(t),f=i?"[object Array]":_o(n),c=o?"[object Array]":_o(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&cf(n)){if(!cf(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Pn),t=i||pf(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{
-if(!(1&r)&&(i=a&&ii.call(n,"__wrapped__"),f=o&&ii.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Pn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Pn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:ii.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a<o;){var l=f[a],h=n[l],p=t[l];if(e)var _=i?e(p,h,l,t,n,u):e(h,p,l,n,t,u);if(_===T?h!==p&&!Mt(h,p,r,e,u):!_){c=false;break}s||(s="constructor"==l);
-}c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c}}else t=false;else t=false}}return t}function Tt(n){return du(n)&&"[object Map]"==_o(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=Yu(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<i;){var f=r[u],c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===T&&!(c in n))return false;
-}else{if(f=new Pn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return!(!gu(n)||fi&&fi in n)&&(pu(n)?si:dn).test(Me(n))}function Nt(n){return du(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return du(n)&&"[object Set]"==_o(n)}function Zt(n){return du(n)&&vu(n.length)&&!!Bn[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?Tu:typeof n=="object"?of(n)?Jt(n[0],n[1]):Ht(n):Pu(n)}function Vt(n){if(!ze(n))return Bi(n);var t,r=[];for(t in Yu(n))ii.call(n,t)&&"constructor"!=t&&r.push(t);
-return r}function Kt(n,t){return n<t}function Gt(n,t){var r=-1,e=lu(n)?Vu(n.length):[];return eo(n,function(n,u,i){e[++r]=t(n,u,i)}),e}function Ht(n){var t=xe(n);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===n||$t(r,n,t)}}function Jt(n,t){return Ie(n)&&t===t&&!gu(t)?We(De(n),t):function(r){var e=Iu(r,n);return e===T&&e===t?Ru(r,n):Mt(t,e,3)}}function Yt(n,t,r,e,u){n!==t&&io(t,function(i,o){if(gu(i)){u||(u=new Pn);var f=u,c="__proto__"==o?T:n[o],a="__proto__"==o?T:t[o],l=f.get(a);
-if(l)it(n,o,l);else{var l=e?e(c,a,o+"",n,t,f):T,s=l===T;if(s){var h=of(a),p=!h&&cf(a),_=!h&&!p&&pf(a),l=a;h||p||_?of(c)?l=c:su(c)?l=Ur(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:bu(a)||uf(a)?(l=c,uf(c)?l=Su(c):(!gu(c)||r&&pu(c))&&(l=Ae(a))):s=false}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a)),it(n,o,l)}}else f=e?e("__proto__"==o?T:n[o],i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f)},Wu)}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[Tu],E(ye())),
-n=Gt(n,function(n){return{a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e<o;){var c=Wr(u[e],i[e]);if(c){e=e>=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return Ru(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=Et(n,o);r(f,o)&&lr(i,Sr(o,n),f)}return i}function rr(n){return function(t){return Et(t,n)}}function er(n,t,r,e){var u=e?g:v,i=-1,o=t.length,f=n;
-for(n===t&&(t=Ur(t)),r&&(f=c(n,E(r)));++i<o;)for(var a=0,l=t[i],l=r?r(l):l;-1<(a=u(f,l,a,e));)f!==n&&bi.call(f,a,1),bi.call(n,a,1);return n}function ur(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Se(u)?bi.call(n,u,1):xr(n,u)}}}function ir(n,t){return n+Oi(Mi()*(t-n+1))}function or(n,t){var r="";if(!n||1>t||9007199254740991<t)return r;do t%2&&(r+=n),(t=Oi(t/2))&&(n+=n);while(t);return r}function fr(n,t){return bo(Be(n,t,Tu),n+"")}function cr(n){return Qn(Lu(n))}function ar(n,t){
-var r=Lu(n);return Ce(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!gu(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=De(t[u]),a=r;if(u!=o){var l=f[c],a=e?e(l,c,f):T;a===T&&(a=gu(l)?l:Se(t[u+1])?[]:{})}ot(f,c,a),f=f[c]}return n}function sr(n){return Ce(Lu(n))}function hr(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Vu(u);++e<u;)r[e]=n[e+t];return r}function pr(n,t){var r;return eo(n,function(n,e,u){return r=t(n,e,u),
-!r}),!!r}function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!ju(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return vr(n,t,Tu,r)}function vr(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!==t,f=null===t,c=ju(t),a=t===T;u<i;){var l=Oi((u+i)/2),s=r(n[l]),h=s!==T,p=null===s,_=s===s,v=ju(s);(o?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?s<=t:s<t)?u=l+1:i=l}return Ui(i,4294967294)}function gr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
-var o=n[r],f=t?t(o):o;if(!r||!au(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function dr(n){return typeof n=="number"?n:ju(n)?F:+n}function yr(n){if(typeof n=="string")return n;if(of(n))return c(n,yr)+"";if(ju(n))return to?to.call(n):"";var t=n+"";return"0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:lo(n))return U(u);c=false,u=O,l=new Nn}else l=t?[]:a;n:for(;++e<i;){var s=n[e],h=t?t(s):s,s=r||0!==s?s:0;if(c&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n;
-t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function xr(n,t){return t=Sr(t,n),n=2>t.length?n:Et(n,hr(t,0,-1)),null==n||delete n[De(qe(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?hr(n,e?0:i,e?i+1:u):hr(n,e?i+1:0,e?u:i)}function wr(n,t){var r=n;return r instanceof Un&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mr(n,t,r){var e=n.length;if(2>e)return e?br(n[0]):[];for(var u=-1,i=Vu(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=yt(i[u]||o,n[f],t,r));
-return br(wt(i,1),t,r)}function Ar(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:T);return o}function kr(n){return su(n)?n:[]}function Er(n){return typeof n=="function"?n:Tu}function Sr(n,t){return of(n)?n:Ie(n,t)?[n]:xo(Ou(n))}function Or(n,t,r){var e=n.length;return r=r===T?e:r,!t&&r>=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=vi?vi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new _i(t).set(new _i(n)),
-t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=ju(n),o=t!==T,f=null===t,c=t===t,a=ju(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Br(n,t,r,e){var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Li(i-o,0),l=Vu(c+a);for(e=!e;++f<c;)l[f]=t[f];for(;++u<o;)(e||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];
-return l}function Lr(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Li(i-f,0),s=Vu(l+a);for(e=!e;++u<l;)s[u]=n[u];for(l=u;++c<a;)s[l+c]=t[c];for(;++o<f;)(e||u<i)&&(s[l+r[o]]=n[u++]);return s}function Ur(n,t){var r=-1,e=n.length;for(t||(t=Vu(e));++r<e;)t[r]=n[r];return t}function Cr(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):T;c===T&&(c=n[f]),u?st(r,f,c):ot(r,f,c)}return r}function Dr(n,t){return Cr(n,ho(n),t)}function Mr(n,t){return Cr(n,po(n),t);
-}function Tr(n,r){return function(e,u){var i=of(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o)}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1<u?r[u-1]:T,o=2<u?r[2]:T,i=3<n.length&&typeof i=="function"?(u--,i):T;for(o&&Oe(r[0],r[1],o)&&(i=3>u?T:i,u=1),t=Yu(t);++e<u;)(o=r[e])&&n(t,o,e,i);return t})}function Fr(n,t){return function(r,e){if(null==r)return r;if(!lu(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=Yu(r);(t?i--:++i<u)&&false!==e(o[i],i,o););return r}}function Nr(n){return function(t,r,e){
-var u=-1,i=Yu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break}return t}}function Pr(n,t,r){function e(){return(this&&this!==Fn&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Ou(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Du(Cu(t).replace(En,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){
-case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=ro(n.prototype),t=n.apply(r,t);return gu(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Vu(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:L(f,a),
-o-=c.length,o<e?ue(t,r,Jr,u.placeholder,T,f,c,T,T,e-o):n(this&&this!==Fn&&this instanceof u?i:t,this,f)}var i=Vr(t);return u}function Gr(n){return function(t,r,e){var u=Yu(t);if(!lu(t)){var i=ye(r,3);t=zu(t),r=function(n){return i(u[n],n,u)}}return r=n(t,r,e),-1<r?u[i?t[r]:r]:T}}function Hr(n){return pe(function(t){var r=t.length,e=r,u=On.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if(typeof i!="function")throw new ni("Expected a function");if(u&&!o&&"wrapper"==ge(i))var o=new On([],true)}for(e=o?e:r;++e<r;)var i=t[e],u=ge(i),f="wrapper"==u?so(i):T,o=f&&Re(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ge(f[0])].apply(o,f[3]):1==i.length&&Re(i)?o[u]():o.thru(i);
-return function(){var n=arguments,e=n[0];if(o&&1==n.length&&of(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function Jr(n,t,r,e,u,i,o,f,c,a){function l(){for(var d=arguments.length,y=Vu(d),b=d;b--;)y[b]=arguments[b];if(_){var x,j=de(l),b=y.length;for(x=0;b--;)y[b]===j&&++x}if(e&&(y=Br(y,e,u,_)),i&&(y=Lr(y,i,o,_)),d-=x,_&&d<a)return j=L(y,j),ue(n,t,Jr,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[n]:n,d=y.length,f){x=y.length;for(var w=Ui(f.length,x),m=Ur(y);w--;){
-var A=f[w];y[w]=Se(A,x)?m[A]:T}}else v&&1<d&&y.reverse();return s&&c<d&&(y.length=c),this&&this!==Fn&&this instanceof l&&(b=g||Vr(b)),b.apply(j,y)}var s=128&t,h=1&t,p=2&t,_=24&t,v=512&t,g=p?T:Vr(n);return l}function Yr(n,t){return function(r,e){return Bt(r,n,t(e))}}function Qr(n,t){return function(r,e){var u;if(r===T&&e===T)return t;if(r!==T&&(u=r),e!==T){if(u===T)return e;typeof r=="string"||typeof e=="string"?(r=yr(r),e=yr(e)):(r=dr(r),e=dr(e)),u=n(r,e)}return u}}function Xr(t){return pe(function(r){
-return r=c(r,E(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Si(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Vu(l+c),h=this&&this!==Fn&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];return n(h,o?e:this,s)}var o=1&r,f=Vr(t);return i}function re(n){return function(t,r,e){
-e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=mu(t),r===T?(r=t,t=0):r=mu(r),e=e===T?t<r?1:-1:mu(e);var u=-1;r=Li(Si((r-t)/(e||1)),0);for(var i=Vu(r);r--;)i[n?r:++u]=t,t+=e;return i}}function ee(n){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=Eu(t),r=Eu(r)),n(t,r)}}function ue(n,t,r,e,u,i,o,f,c,a){var l=8&t,s=l?o:T;o=l?T:o;var h=l?i:T;return i=l?T:i,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),u=[n,t,u,h,s,i,o,f,c,a],r=r.apply(T,u),Re(n)&&go(r,u),r.placeholder=e,Le(r,n,t)}function ie(n){
-var t=Ju[n];return function(n,r){if(n=Eu(n),r=null==r?0:Ui(Au(r),292)){var e=(Ou(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Ou(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=_o(t);return"[object Map]"==r?W(t):"[object Set]"==r?C(t):k(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ni("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Li(Au(o),0),f=f===T?f:Au(f),a-=u?u.length:0,64&t){
-var l=e,s=u;e=u=T}var h=c?T:so(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ui(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1],
-r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),Le((h?fo:go)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||au(n,ri[r])&&!ii.call(e,r)?t:n}function ae(n,t,r,e,u,i){return gu(n)&&gu(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return bu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new Nn:T;
-for(i.set(n,t),i.set(t,n);++c<f;){var s=n[c],p=t[c];if(e)var _=o?e(p,s,c,t,n,i):e(s,p,c,n,t,i);if(_!==T){if(_)continue;a=false;break}if(l){if(!h(t,function(n,t){if(!O(l,t)&&(s===n||u(s,n,r,e,i)))return l.push(t)})){a=false;break}}else if(s!==p&&!u(s,p,r,e,i)){a=false;break}}return i.delete(n),i.delete(t),a}function he(n,t,r,e,u,i,o){switch(r){case"[object DataView]":if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)break;n=n.buffer,t=t.buffer;case"[object ArrayBuffer]":if(n.byteLength!=t.byteLength||!i(new _i(n),new _i(t)))break;
-return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return au(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=U),n.size!=t.size&&!(1&e))break;return(r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(no)return no.call(n)==no.call(t)}return false}function pe(n){return bo(Be(n,T,Pe),n+"")}function _e(n){
-return St(n,zu,ho)}function ve(n){return St(n,Wu,po)}function ge(n){for(var t=n.name+"",r=Ki[t],e=ii.call(Ki,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return(ii.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||$u,n=n===$u?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map;
-}function xe(n){for(var t=zu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!gu(u)]}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e<u;){var o=De(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&vu(u)&&Se(o,u)&&(of(n)||uf(n)))}function me(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&ii.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ae(n){
-return typeof n.constructor!="function"||ze(n)?{}:ro(gi(n))}function ke(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":
-case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return no?Yu(no.call(n)):{}}}function Ee(n){return of(n)||uf(n)||!!(xi&&n&&n[xi])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1<n&&0==n%1&&n<t;
-}function Oe(n,t,r){if(!gu(r))return false;var e=typeof t;return!!("number"==e?lu(r)&&Se(t,r.length):"string"==e&&t in r)&&au(r[t],n)}function Ie(n,t){if(of(n))return false;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!ju(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Yu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Un.prototype&&(n===r||(t=so(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ri)}function We(n,t){
-return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Yu(r)))}}function Be(t,r,e){return r=Li(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Li(u.length-r,0),f=Vu(o);++i<o;)f[i]=u[r+i];for(i=-1,o=Vu(r+1);++i<r;)o[i]=u[i];return o[r]=e(f),n(t,this,o)}}function Le(n,t,r){var e=t+"";t=bo;var u,i=Te;return u=(u=e.match(an))?u[1].split(ln):[],r=i(u,r),(i=r.length)&&(u=i-1,r[u]=(1<i?"& ":"")+r[u],r=r.join(2<i?", ":" "),e=e.replace(cn,"{\n/* [wrapped with "+r+"] */\n")),t(n,e)}function Ue(n){
-var t=0,r=0;return function(){var e=Ci(),u=16-(e-r);if(r=e,0<u){if(800<=++t)return arguments[0]}else t=0;return n.apply(T,arguments)}}function Ce(n,t){var r=-1,e=n.length,u=e-1;for(t=t===T?e:t;++r<t;){var e=ir(r,u),i=n[e];n[e]=n[r],n[r]=i}return n.length=t,n}function De(n){if(typeof n=="string"||ju(n))return n;var t=n+"";return"0"==t&&1/n==-$?"-0":t}function Me(n){if(null!=n){try{return ui.call(n)}catch(n){}return n+""}return""}function Te(n,t){return r(N,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e);
-}),n.sort()}function $e(n){if(n instanceof Un)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Ur(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Fe(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Au(r),0>r&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Ne(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Au(r),u=0>r?Li(e+u,0):Ui(u,e-1)),_(n,ye(t,3),u,true)}function Pe(n){return(null==n?0:n.length)?wt(n,1):[]}function Ze(n){
-return n&&n.length?n[0]:T}function qe(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ve(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ke(n){return null==n?n:Ti.call(n)}function Ge(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(su(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function He(t,r){if(!t||!t.length)return[];var e=Ge(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Je(n){return n=An(n),n.__chain__=true,n}function Ye(n,t){
-return t(n)}function Qe(){return this}function Xe(n,t){return(of(n)?r:eo)(n,ye(t,3))}function nu(n,t){return(of(n)?e:uo)(n,ye(t,3))}function tu(n,t){return(of(n)?c:Gt)(n,ye(t,3))}function ru(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function eu(n,t){var r;if(typeof t!="function")throw new ni("Expected a function");return n=Au(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function uu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=uu.placeholder,
-n}function iu(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Ko();if(u(n))return o(n);var r,e=yo;r=n-_,n=t-(n-p),r=g?Ui(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Ko(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=yo(i,t),v?e(n):s;if(g)return h=yo(i,t),e(p)}return h===T&&(h=yo(i,t)),
-s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ni("Expected a function");return t=Eu(t)||0,gu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(Eu(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&ao(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Ko())},f}function fu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ni("Expected a function");
-return r.cache=new(fu.Cache||$n),r}function cu(n){if(typeof n!="function")throw new ni("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function au(n,t){return n===t||n!==n&&t!==t}function lu(n){return null!=n&&vu(n.length)&&!pu(n)}function su(n){return du(n)&&lu(n)}function hu(n){if(!du(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!bu(n);
-}function pu(n){return!!gu(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function _u(n){return typeof n=="number"&&n==Au(n)}function vu(n){return typeof n=="number"&&-1<n&&0==n%1&&9007199254740991>=n}function gu(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function du(n){return null!=n&&typeof n=="object"}function yu(n){return typeof n=="number"||du(n)&&"[object Number]"==Ot(n)}function bu(n){return!(!du(n)||"[object Object]"!=Ot(n))&&(n=gi(n),
-null===n||(n=ii.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ui.call(n)==ai))}function xu(n){return typeof n=="string"||!of(n)&&du(n)&&"[object String]"==Ot(n)}function ju(n){return typeof n=="symbol"||du(n)&&"[object Symbol]"==Ot(n)}function wu(n){if(!n)return[];if(lu(n))return xu(n)?M(n):Ur(n);if(ji&&n[ji]){n=n[ji]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=_o(n),("[object Map]"==t?W:"[object Set]"==t?U:Lu)(n)}function mu(n){return n?(n=Eu(n),
-n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Au(n){n=mu(n);var t=n%1;return n===n?t?n-t:n:0}function ku(n){return n?pt(Au(n),0,4294967295):0}function Eu(n){if(typeof n=="number")return n;if(ju(n))return F;if(gu(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=gu(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Mn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Su(n){return Cr(n,Wu(n))}function Ou(n){return null==n?"":yr(n);
-}function Iu(n,t,r){return n=null==n?T:Et(n,t),n===T?r:n}function Ru(n,t){return null!=n&&we(n,t,zt)}function zu(n){return lu(n)?qn(n):Vt(n)}function Wu(n){if(lu(n))n=qn(n,true);else if(gu(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&ii.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Yu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,zu(n));
-}function Uu(n){return Tf(Ou(n).toLowerCase())}function Cu(n){return(n=Ou(n))&&n.replace(xn,Xn).replace(Sn,"")}function Du(n,t,r){return n=Ou(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Mu(n){return function(){return n}}function Tu(n){return n}function $u(n){return qt(typeof n=="function"?n:_t(n,1))}function Fu(n,t,e){var u=zu(t),i=kt(t,u);null!=e||gu(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=kt(t,zu(t)));var o=!(gu(e)&&"chain"in e&&!e.chain),f=pu(n);return r(i,function(r){
-var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Nu(){}function Pu(n){return Ie(n)?b(De(n)):rr(n)}function Zu(){return[]}function qu(){return false}mn=null==mn?Fn:rt.defaults(Fn.Object(),mn,rt.pick(Fn,Wn));var Vu=mn.Array,Ku=mn.Date,Gu=mn.Error,Hu=mn.Function,Ju=mn.Math,Yu=mn.Object,Qu=mn.RegExp,Xu=mn.String,ni=mn.TypeError,ti=Vu.prototype,ri=Yu.prototype,ei=mn["__core-js_shared__"],ui=Hu.prototype.toString,ii=ri.hasOwnProperty,oi=0,fi=function(){
-var n=/[^.]+$/.exec(ei&&ei.keys&&ei.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ci=ri.toString,ai=ui.call(Yu),li=Fn._,si=Qu("^"+ui.call(ii).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hi=Zn?mn.Buffer:T,pi=mn.Symbol,_i=mn.Uint8Array,vi=hi?hi.f:T,gi=B(Yu.getPrototypeOf,Yu),di=Yu.create,yi=ri.propertyIsEnumerable,bi=ti.splice,xi=pi?pi.isConcatSpreadable:T,ji=pi?pi.iterator:T,wi=pi?pi.toStringTag:T,mi=function(){try{var n=je(Yu,"defineProperty");
-return n({},"",{}),n}catch(n){}}(),Ai=mn.clearTimeout!==Fn.clearTimeout&&mn.clearTimeout,ki=Ku&&Ku.now!==Fn.Date.now&&Ku.now,Ei=mn.setTimeout!==Fn.setTimeout&&mn.setTimeout,Si=Ju.ceil,Oi=Ju.floor,Ii=Yu.getOwnPropertySymbols,Ri=hi?hi.isBuffer:T,zi=mn.isFinite,Wi=ti.join,Bi=B(Yu.keys,Yu),Li=Ju.max,Ui=Ju.min,Ci=Ku.now,Di=mn.parseInt,Mi=Ju.random,Ti=ti.reverse,$i=je(mn,"DataView"),Fi=je(mn,"Map"),Ni=je(mn,"Promise"),Pi=je(mn,"Set"),Zi=je(mn,"WeakMap"),qi=je(Yu,"create"),Vi=Zi&&new Zi,Ki={},Gi=Me($i),Hi=Me(Fi),Ji=Me(Ni),Yi=Me(Pi),Qi=Me(Zi),Xi=pi?pi.prototype:T,no=Xi?Xi.valueOf:T,to=Xi?Xi.toString:T,ro=function(){
-function n(){}return function(t){return gu(t)?di?di(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=kn.prototype,An.prototype.constructor=An,On.prototype=ro(kn.prototype),On.prototype.constructor=On,Un.prototype=ro(kn.prototype),Un.prototype.constructor=Un,Cn.prototype.clear=function(){this.__data__=qi?qi(null):{},this.size=0},Cn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],
-this.size-=n?1:0,n},Cn.prototype.get=function(n){var t=this.__data__;return qi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):ii.call(t,n)?t[n]:T},Cn.prototype.has=function(n){var t=this.__data__;return qi?t[n]!==T:ii.call(t,n)},Cn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=qi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():bi.call(t,n,1),
---this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1<ft(this.__data__,n)},Tn.prototype.set=function(n,t){var r=this.__data__,e=ft(r,n);return 0>e?(++this.size,r.push([n,t])):r[e][1]=t,this},$n.prototype.clear=function(){this.size=0,this.__data__={hash:new Cn,map:new(Fi||Tn),string:new Cn}},$n.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},$n.prototype.get=function(n){return be(this,n).get(n);
-},$n.prototype.has=function(n){return be(this,n).has(n)},$n.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Pn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Pn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Pn.prototype.get=function(n){
-return this.__data__.get(n)},Pn.prototype.has=function(n){return this.__data__.has(n)},Pn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Fi||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new $n(e)}return r.set(n,t),this.size=r.size,this};var eo=Fr(mt),uo=Fr(At,true),io=Nr(),oo=Nr(true),fo=Vi?function(n,t){return Vi.set(n,t),n}:Tu,co=mi?function(n,t){return mi(n,"toString",{configurable:true,enumerable:false,value:Mu(t),writable:true})}:Tu,ao=Ai||function(n){
-return Fn.clearTimeout(n)},lo=Pi&&1/U(new Pi([,-0]))[1]==$?function(n){return new Pi(n)}:Nu,so=Vi?function(n){return Vi.get(n)}:Nu,ho=Ii?function(n){return null==n?[]:(n=Yu(n),i(Ii(n),function(t){return yi.call(n,t)}))}:Zu,po=Ii?function(n){for(var t=[];n;)a(t,ho(n)),n=gi(n);return t}:Zu,_o=Ot;($i&&"[object DataView]"!=_o(new $i(new ArrayBuffer(1)))||Fi&&"[object Map]"!=_o(new Fi)||Ni&&"[object Promise]"!=_o(Ni.resolve())||Pi&&"[object Set]"!=_o(new Pi)||Zi&&"[object WeakMap]"!=_o(new Zi))&&(_o=function(n){
-var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Me(n):"")switch(n){case Gi:return"[object DataView]";case Hi:return"[object Map]";case Ji:return"[object Promise]";case Yi:return"[object Set]";case Qi:return"[object WeakMap]"}return t});var vo=ei?pu:qu,go=Ue(fo),yo=Ei||function(n,t){return Fn.setTimeout(n,t)},bo=Ue(co),xo=function(n){n=fu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){
-t.push(e?u.replace(hn,"$1"):r||n)}),t}),jo=fr(function(n,t){return su(n)?yt(n,wt(t,1,su,true)):[]}),wo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),ye(r,2)):[]}),mo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),T,r):[]}),Ao=fr(function(n){var t=c(n,kr);return t.length&&t[0]===n[0]?Wt(t):[]}),ko=fr(function(n){var t=qe(n),r=c(n,kr);return t===qe(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),Eo=fr(function(n){var t=qe(n),r=c(n,kr);return(t=typeof t=="function"?t:T)&&r.pop(),
-r.length&&r[0]===n[0]?Wt(r,T,t):[]}),So=fr(Ve),Oo=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Io=fr(function(n){return br(wt(n,1,su,true))}),Ro=fr(function(n){var t=qe(n);return su(t)&&(t=T),br(wt(n,1,su,true),ye(t,2))}),zo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return br(wt(n,1,su,true),T,t)}),Wo=fr(function(n,t){return su(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,su))}),Lo=fr(function(n){var t=qe(n);return su(t)&&(t=T),
-mr(i(n,su),ye(t,2))}),Uo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return mr(i(n,su),T,t)}),Co=fr(Ge),Do=fr(function(n){var t=n.length,t=1<t?n[t-1]:T,t=typeof t=="function"?(n.pop(),t):T;return He(n,t)}),Mo=pe(function(n){function t(t){return ht(t,n)}var r=n.length,e=r?n[0]:0,u=this.__wrapped__;return!(1<r||this.__actions__.length)&&u instanceof Un&&Se(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:Ye,args:[t],thisArg:T}),new On(u,this.__chain__).thru(function(n){return r&&!n.length&&n.push(T),
-n})):this.thru(t)}),To=Tr(function(n,t,r){ii.call(n,r)?++n[r]:st(n,r,1)}),$o=Gr(Fe),Fo=Gr(Ne),No=Tr(function(n,t,r){ii.call(n,r)?n[r].push(t):st(n,r,[t])}),Po=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=lu(t)?Vu(t.length):[];return eo(t,function(t){o[++u]=i?n(r,t,e):Lt(t,r,e)}),o}),Zo=Tr(function(n,t,r){st(n,r,t)}),qo=Tr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Vo=fr(function(n,t){if(null==n)return[];var r=t.length;return 1<r&&Oe(n,t[0],t[1])?t=[]:2<r&&Oe(t[0],t[1],t[2])&&(t=[t[0]]),
-Xt(n,wt(t,1),[])}),Ko=ki||function(){return Fn.Date.now()},Go=fr(function(n,t,r){var e=1;if(r.length)var u=L(r,de(Go)),e=32|e;return fe(n,e,t,r,u)}),Ho=fr(function(n,t,r){var e=3;if(r.length)var u=L(r,de(Ho)),e=32|e;return fe(t,e,n,r,u)}),Jo=fr(function(n,t){return dt(n,1,t)}),Yo=fr(function(n,t,r){return dt(n,Eu(t)||0,r)});fu.Cache=$n;var Qo=fr(function(t,r){r=1==r.length&&of(r[0])?c(r[0],E(ye())):c(wt(r,1),E(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ui(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);
-return n(t,this,u)})}),Xo=fr(function(n,t){return fe(n,32,T,t,L(t,de(Xo)))}),nf=fr(function(n,t){return fe(n,64,T,t,L(t,de(nf)))}),tf=pe(function(n,t){return fe(n,256,T,T,T,t)}),rf=ee(It),ef=ee(function(n,t){return n>=t}),uf=Ut(function(){return arguments}())?Ut:function(n){return du(n)&&ii.call(n,"callee")&&!yi.call(n,"callee")},of=Vu.isArray,ff=Vn?E(Vn):Ct,cf=Ri||qu,af=Kn?E(Kn):Dt,lf=Gn?E(Gn):Tt,sf=Hn?E(Hn):Nt,hf=Jn?E(Jn):Pt,pf=Yn?E(Yn):Zt,_f=ee(Kt),vf=ee(function(n,t){return n<=t}),gf=$r(function(n,t){
-if(ze(t)||lu(t))Cr(t,zu(t),n);else for(var r in t)ii.call(t,r)&&ot(n,r,t[r])}),df=$r(function(n,t){Cr(t,Wu(t),n)}),yf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),bf=$r(function(n,t,r,e){Cr(t,zu(t),n,e)}),xf=pe(ht),jf=fr(function(n,t){n=Yu(n);var r=-1,e=t.length,u=2<e?t[2]:T;for(u&&Oe(t[0],t[1],u)&&(e=1);++r<e;)for(var u=t[r],i=Wu(u),o=-1,f=i.length;++o<f;){var c=i[o],a=n[c];(a===T||au(a,ri[c])&&!ii.call(n,c))&&(n[c]=u[c])}return n}),wf=fr(function(t){return t.push(T,ae),n(Sf,T,t)}),mf=Yr(function(n,t,r){
-null!=t&&typeof t.toString!="function"&&(t=ci.call(t)),n[t]=r},Mu(Tu)),Af=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ci.call(t)),ii.call(n,t)?n[t].push(r):n[t]=[r]},ye),kf=fr(Lt),Ef=$r(function(n,t,r){Yt(n,t,r)}),Sf=$r(function(n,t,r,e){Yt(n,t,r,e)}),Of=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1<t.length),t}),Cr(n,ve(n),r),e&&(r=_t(r,7,le));for(var u=t.length;u--;)xr(r,t[u]);return r}),If=pe(function(n,t){return null==n?{}:nr(n,t);
-}),Rf=oe(zu),zf=oe(Wu),Wf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Uu(t):t)}),Bf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Lf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Uf=Zr("toLowerCase"),Cf=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Df=qr(function(n,t,r){return n+(r?" ":"")+Tf(t)}),Mf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Tf=Zr("toUpperCase"),$f=fr(function(t,r){try{return n(t,T,r)}catch(n){return hu(n)?n:new Gu(n)}}),Ff=pe(function(n,t){
-return r(t,function(t){t=De(t),st(n,t,Go(n[t],n))}),n}),Nf=Hr(),Pf=Hr(true),Zf=fr(function(n,t){return function(r){return Lt(r,n,t)}}),qf=fr(function(n,t){return function(r){return Lt(n,r,t)}}),Vf=Xr(c),Kf=Xr(u),Gf=Xr(h),Hf=re(),Jf=re(true),Yf=Qr(function(n,t){return n+t},0),Qf=ie("ceil"),Xf=Qr(function(n,t){return n/t},1),nc=ie("floor"),tc=Qr(function(n,t){return n*t},1),rc=ie("round"),ec=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ni("Expected a function");
-return n=Au(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=ru,An.assign=gf,An.assignIn=df,An.assignInWith=yf,An.assignWith=bf,An.at=xf,An.before=eu,An.bind=Go,An.bindAll=Ff,An.bindKey=Ho,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return of(n)?n:[n]},An.chain=Je,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(Au(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Vu(Si(r/t));e<r;)i[u++]=hr(n,e,e+=t);return i},An.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){
-var i=n[t];i&&(u[e++]=i)}return u},An.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Vu(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(of(r)?Ur(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ni("Expected a function");return[e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})},An.conforms=function(n){return vt(_t(n,1))},An.constant=Mu,
-An.countBy=To,An.create=function(n,t){var r=ro(n);return null==t?r:at(r,t)},An.curry=uu,An.curryRight=iu,An.debounce=ou,An.defaults=jf,An.defaultsDeep=wf,An.defer=Jo,An.delay=Yo,An.difference=jo,An.differenceBy=wo,An.differenceWith=mo,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[];
-},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Au(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Au(e),0>e&&(e+=u),e=r>e?0:ku(e);r<e;)n[r++]=t;return n},An.filter=function(n,t){return(of(n)?i:jt)(n,ye(t,3))},An.flatMap=function(n,t){return wt(tu(n,t),1)},An.flatMapDeep=function(n,t){return wt(tu(n,t),$)},An.flatMapDepth=function(n,t,r){return r=r===T?1:Au(r),
-wt(tu(n,t),r)},An.flatten=Pe,An.flattenDeep=function(n){return(null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:Au(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Nf,An.flowRight=Pf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},An.functions=function(n){return null==n?[]:kt(n,zu(n))},An.functionsIn=function(n){return null==n?[]:kt(n,Wu(n))},An.groupBy=No,An.initial=function(n){
-return(null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=Ao,An.intersectionBy=ko,An.intersectionWith=Eo,An.invert=mf,An.invertBy=Af,An.invokeMap=Po,An.iteratee=$u,An.keyBy=Zo,An.keys=zu,An.keysIn=Wu,An.map=tu,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n)}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u))}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=fu,
-An.merge=Ef,An.mergeWith=Sf,An.method=Zf,An.methodOf=qf,An.mixin=Fu,An.negate=cu,An.nthArg=function(n){return n=Au(n),fr(function(t){return Qt(t,n)})},An.omit=Of,An.omitBy=function(n,t){return Bu(n,cu(ye(t)))},An.once=function(n){return eu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(of(t)||(t=null==t?[]:[t]),r=e?T:r,of(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Vf,An.overArgs=Qo,An.overEvery=Kf,An.overSome=Gf,An.partial=Xo,An.partialRight=nf,An.partition=qo,An.pick=If,An.pickBy=Bu,An.property=Pu,
-An.propertyOf=function(n){return function(t){return null==n?T:Et(n,t)}},An.pull=So,An.pullAll=Ve,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Oo,An.range=Hf,An.rangeRight=Jf,An.rearg=tf,An.reject=function(n,t){return(of(n)?i:jt)(n,cu(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),
-u.push(e))}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ni("Expected a function");return t=t===T?t:Au(t),fr(n,t)},An.reverse=Ke,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Au(t),(of(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return(of(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0,
-r=e):(t=null==t?0:Au(t),r=r===T?e:Au(r)),hr(n,t,r)):[]},An.sortBy=Vo,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Ou(n))&&(typeof t=="string"||null!=t&&!sf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ni("Expected a function");return r=null==r?0:Li(Au(r),0),
-fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Au(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),
-n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ni("Expected a function");return gu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ou(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Ye,An.toArray=wu,An.toPairs=Rf,An.toPairsIn=zf,An.toPath=function(n){return of(n)?c(n,De):ju(n)?[n]:Ur(xo(Ou(n)))},An.toPlainObject=Su,An.transform=function(n,t,e){var u=of(n),i=u||cf(n)||pf(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:gu(n)&&pu(o)?ro(gi(n)):{};
-}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return ru(n,1)},An.union=Io,An.unionBy=Ro,An.unionWith=zo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=Ge,An.unzipWith=He,An.update=function(n,t,r){return null==n?n:lr(n,t,Er(r)(Et(n,t)),void 0)},An.updateWith=function(n,t,r,e){
-return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,Er(r)(Et(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Wu(n))},An.without=Wo,An.words=Du,An.wrap=function(n,t){return Xo(Er(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Uo,An.zip=Co,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Do,An.entries=Rf,An.entriesIn=zf,An.extend=df,An.extendWith=yf,Fu(An,An),An.add=Yf,An.attempt=$f,An.camelCase=Wf,An.capitalize=Uu,
-An.ceil=Qf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Eu(r),r=r===r?r:0),t!==T&&(t=Eu(t),t=t===t?t:0),pt(Eu(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,zu(t))},An.deburr=Cu,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=Xf,An.endsWith=function(n,t,r){
-n=Ou(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Au(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=au,An.escape=function(n){return(n=Ou(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Ou(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=of(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=$o,An.findIndex=Fe,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=Fo,An.findLastIndex=Ne,An.findLastKey=function(n,t){return p(n,ye(t,3),At);
-},An.floor=nc,An.forEach=Xe,An.forEachRight=nu,An.forIn=function(n,t){return null==n?n:io(n,ye(t,3),Wu)},An.forInRight=function(n,t){return null==n?n:oo(n,ye(t,3),Wu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Iu,An.gt=rf,An.gte=ef,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=Ru,An.head=Ze,An.identity=Tu,An.includes=function(n,t,r,e){return n=lu(n)?n:Lu(n),r=r&&!e?Au(r):0,e=n.length,0>r&&(r=Li(e+r,0)),xu(n)?r<=e&&-1<n.indexOf(t,r):!!e&&-1<v(n,t,r);
-},An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:Au(r),0>r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=mu(t),r===T?(r=t,t=0):r=mu(r),n=Eu(n),n>=Ui(t,r)&&n<Li(t,r)},An.invoke=kf,An.isArguments=uf,An.isArray=of,An.isArrayBuffer=ff,An.isArrayLike=lu,An.isArrayLikeObject=su,An.isBoolean=function(n){return true===n||false===n||du(n)&&"[object Boolean]"==Ot(n)},An.isBuffer=cf,An.isDate=af,An.isElement=function(n){return du(n)&&1===n.nodeType&&!bu(n)},An.isEmpty=function(n){
-if(null==n)return true;if(lu(n)&&(of(n)||typeof n=="string"||typeof n.splice=="function"||cf(n)||pf(n)||uf(n)))return!n.length;var t=_o(n);if("[object Map]"==t||"[object Set]"==t)return!n.size;if(ze(n))return!Vt(n).length;for(var r in n)if(ii.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=hu,An.isFinite=function(n){return typeof n=="number"&&zi(n)},An.isFunction=pu,
-An.isInteger=_u,An.isLength=vu,An.isMap=lf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return yu(n)&&n!=+n},An.isNative=function(n){if(vo(n))throw new Gu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=yu,An.isObject=gu,An.isObjectLike=du,An.isPlainObject=bu,An.isRegExp=sf,
-An.isSafeInteger=function(n){return _u(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=hf,An.isString=xu,An.isSymbol=ju,An.isTypedArray=pf,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return du(n)&&"[object WeakMap]"==_o(n)},An.isWeakSet=function(n){return du(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Wi.call(n,t)},An.kebabCase=Bf,An.last=qe,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Au(r),u=0>u?Li(e+u,0):Ui(u,e-1)),
-t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Uf,An.lt=_f,An.lte=vf,An.max=function(n){return n&&n.length?xt(n,Tu,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,Tu)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,Tu,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=Zu,An.stubFalse=qu,An.stubObject=function(){return{}},An.stubString=function(){
-return""},An.stubTrue=function(){return true},An.multiply=tc,An.nth=function(n,t){return n&&n.length?Qt(n,Au(t)):T},An.noConflict=function(){return Fn._===this&&(Fn._=li),this},An.noop=Nu,An.now=Ko,An.pad=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Oi(t),r)+n+ne(Si(t),r))},An.padEnd=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return t&&e<t?n+ne(t-e,r):n},An.padStart=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return t&&e<t?ne(t-e,r)+n:n},An.parseInt=function(n,t,r){
-return r||null==t?t=0:t&&(t=+t),Di(Ou(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=mu(n),t===T?(t=n,n=0):t=mu(t)),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Mi(),Ui(n+r*(t-n+Dn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=of(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,eo)},An.reduceRight=function(n,t,r){var e=of(n)?s:j,u=3>arguments.length;
-return e(n,ye(t,4),r,u,uo)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Au(t),or(Ou(n),t)},An.replace=function(){var n=arguments,t=Ou(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e<u;){var i=null==n?T:n[De(t[e])];i===T&&(e=u,i=r),n=pu(i)?i.call(n):i}return n},An.round=rc,An.runInContext=x,An.sample=function(n){return(of(n)?Qn:cr)(n)},An.size=function(n){if(null==n)return 0;if(lu(n))return xu(n)?D(n):n.length;
-var t=_o(n);return"[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Cf,An.some=function(n,t,r){var e=of(n)?h:pr;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e<r&&au(n[e],t))return e}return-1},An.sortedLastIndex=function(n,t){return _r(n,t,true)},An.sortedLastIndexBy=function(n,t,r){return vr(n,t,ye(r,2),true);
-},An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(au(n[r],t))return r}return-1},An.startCase=Df,An.startsWith=function(n,t,r){return n=Ou(n),r=null==r?0:pt(Au(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=ec,An.sum=function(n){return n&&n.length?m(n,Tu):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Ou(n),t=yf({},t,e,ce),r=yf({},t.imports,e.imports,ce);var u,i,o=zu(r),f=S(r,o),c=0;
-r=t.interpolate||jn;var a="__p+='";r=Qu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),
-a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=$f(function(){return Hu(o,l+"return "+a).apply(T,f)}),t.source=a,hu(t))throw t;return t},An.times=function(n,t){if(n=Au(n),1>n||9007199254740991<n)return[];var r=4294967295,e=Ui(n,4294967295);for(t=ye(t),n-=4294967295,e=A(e,t);++r<n;)t(r);return e},An.toFinite=mu,An.toInteger=Au,An.toLength=ku,An.toLower=function(n){
-return Ou(n).toLowerCase()},An.toNumber=Eu,An.toSafeInteger=function(n){return n?pt(Au(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Ou,An.toUpper=function(n){return Ou(n).toUpperCase()},An.trim=function(n,t,r){return(n=Ou(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return(n=Ou(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1,Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){
-return(n=Ou(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(gu(t))var u="separator"in t?t.separator:u,r="length"in t?Au(t.length):r,e="omission"in t?yr(t.omission):e;n=Ou(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),sf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Qu(u.source,Ou(_n.exec(u))+"g")),
-u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1<u&&(r=r.slice(0,u)));return r+e},An.unescape=function(n){return(n=Ou(n))&&G.test(n)?n.replace(V,tt):n},An.uniqueId=function(n){var t=++oi;return Ou(n)+t},An.upperCase=Mf,An.upperFirst=Tf,An.each=Xe,An.eachRight=nu,An.first=Ze,Fu(An,function(){var n={};return mt(An,function(t,r){ii.call(An.prototype,r)||(n[r]=t)}),n}(),{chain:false}),An.VERSION="4.17.5",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){
-An[n].placeholder=An}),r(["drop","take"],function(n,t){Un.prototype[n]=function(r){r=r===T?1:Li(Au(r),0);var e=this.__filtered__&&!t?new Un(this):this.clone();return e.__filtered__?e.__takeCount__=Ui(r,e.__takeCount__):e.__views__.push({size:Ui(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({
-iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter(Tu)},Un.prototype.find=function(n){return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n);
-},Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(cu(ye(n)))},Un.prototype.slice=function(n,t){n=Au(n);var r=this;return r.__filtered__&&(0<n||0>t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Au(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295);
-},mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||of(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({
-func:Ye,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ti[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(of(u)?u:[],n)}return this[r](function(r){return t.apply(of(r)?r:[],n)})}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";
-(Ki[e]||(Ki[e]=[])).push({name:t,func:r})}}),Ki[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n;
-},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=of(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c<a;){var l=o[c],s=l.size;switch(l.type){case"drop":f+=s;break;case"dropRight":n-=s;break;case"take":n=Ui(n,f+s);break;case"takeRight":f=Li(f,n-s)}}if(n={start:f,end:n},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ui(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__);e=[];n:for(;n--&&a<l;){for(o+=r,
-u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=Mo,An.prototype.chain=function(){return Je(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=wu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof kn;){
-var e=$e(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Ye,args:[Ke],thisArg:T}),new On(n,this.__chain__)):this.thru(Ke)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,ji&&(An.prototype[ji]=Qe),
-An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Fn._=rt, define(function(){return rt})):Pn?((Pn.exports=rt)._=rt,Nn._=rt):Fn._=rt}).call(this); \ No newline at end of file
+}function A(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function k(n,t){return c(t,function(t){return[t,n[t]]})}function E(n){return function(t){return n(t)}}function S(n,t){return c(t,function(t){return n[t]})}function O(n,t){return n.has(t)}function I(n,t){for(var r=-1,e=n.length;++r<e&&-1<v(t,n[r],0););return r}function R(n,t){for(var r=n.length;r--&&-1<v(t,n[r],0););return r}function z(n){return"\\"+Ln[n]}function W(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n];
+}),r}function U(n,t){return function(r){return n(t(r))}}function B(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r)}return i}function L(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function C(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function D(n){if(Rn.test(n)){for(var t=On.lastIndex=0;On.test(n);)++t;n=t}else n=Qn(n);return n}function M(n){return Rn.test(n)?n.match(On)||[]:n.split("");
+}var T,$=1/0,F=NaN,N=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],P=/\b__p\+='';/g,Z=/\b(__p\+=)''\+/g,q=/(__e\(.*?\)|\b__t\))\+'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,kn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",En=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kn+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Un={};
+Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=true,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=false;
+var Bn={};Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object DataView]"]=Bn["[object Boolean]"]=Bn["[object Date]"]=Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object Symbol]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,
+Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object WeakMap]"]=false;var Ln={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){
+try{var n=Nn&&Nn.require&&Nn.require("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e",
+"\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a",
+"\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I",
+"\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r",
+"\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ",
+"\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),tt=x({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Ln)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function kn(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Ln(n){
+this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Tn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Fn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function Nn(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new Fn;++t<r;)this.add(n[t]);
+}function Zn(n){this.size=(this.__data__=new Tn(n)).size}function qn(n,t){var r,e=ff(n),u=!e&&of(n),i=!e&&!u&&af(n),o=!e&&!u&&!i&&_f(n),u=(e=e||u||i||o)?A(n.length,ni):[],f=u.length;for(r in n)!t&&!oi.call(n,r)||e&&("length"==r||i&&("offset"==r||"parent"==r)||o&&("buffer"==r||"byteLength"==r||"byteOffset"==r)||Se(r,f))||u.push(r);return u}function Qn(n){var t=n.length;return t?n[ir(0,t-1)]:T}function et(n,t){return De(Lr(n),pt(t,0,n.length))}function ut(n){return De(Lr(n))}function it(n,t,r){(r===T||lu(n[t],r))&&(r!==T||t in n)||st(n,t,r);
+}function ot(n,t,r){var e=n[t];oi.call(n,t)&&lu(e,r)&&(r!==T||t in n)||st(n,t,r)}function ft(n,t){for(var r=n.length;r--;)if(lu(n[r][0],t))return r;return-1}function ct(n,t,r,e){return uo(n,function(n,u,i){t(e,n,r(n),i)}),e}function at(n,t){return n&&Cr(t,Wu(t),n)}function lt(n,t){return n&&Cr(t,Uu(t),n)}function st(n,t,r){"__proto__"==t&&Ai?Ai(n,t,{configurable:true,enumerable:true,value:r,writable:true}):n[t]=r}function ht(n,t){for(var r=-1,e=t.length,u=Ku(e),i=null==n;++r<e;)u[r]=i?T:Ru(n,t[r]);return u;
+}function pt(n,t,r){return n===n&&(r!==T&&(n=n<=r?n:r),t!==T&&(n=n>=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Lr(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Bn[s])return i?n:{};f=ke(n,s,c)}}if(o||(o=new Zn),
+i=o.get(n))return i;if(o.set(n,f),pf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(sf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Uu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function");
+return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,E(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p),p=e||0!==p?p:0;if(a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function bt(n,t){var r=true;return uo(n,function(n,e,u){return r=!!t(n,e,u)}),r}function xt(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===T?o===o&&!wu(o):r(o,f)))var f=o,c=i;
+}return c}function jt(n,t){var r=[];return uo(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function wt(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Ee),u||(u=[]);++i<o;){var f=n[i];0<t&&r(f)?1<t?wt(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function mt(n,t){return n&&oo(n,t,Wu)}function At(n,t){return n&&fo(n,t,Wu)}function kt(n,t){return i(t,function(t){return _u(n[t])})}function Et(n,t){t=Sr(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[Me(t[r++])];return r&&r==e?n:T}function St(n,t,r){return t=t(n),
+ff(n)?t:a(t,r(n))}function Ot(n){if(null==n)return n===T?"[object Undefined]":"[object Null]";if(mi&&mi in Qu(n)){var t=oi.call(n,mi),r=n[mi];try{n[mi]=T;var e=true}catch(n){}var u=ai.call(n);e&&(t?n[mi]=r:delete n[mi]),n=u}else n=ai.call(n);return n}function It(n,t){return n>t}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,E(t))),s=Ci(p.length,s),
+l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],d=t?t(g):g,g=r||0!==g?g:0;if(v?!O(v,d):!e(h,d,r)){for(a=i;--a;){var y=l[a];if(y?!O(y,d):!e(n[a],d,r))continue n}v&&v.push(d),h.push(g)}}return h}function Ut(n,t,r,e){return mt(n,function(n,u,i){t(e,r(n),u,i)}),e}function Bt(t,r,e){return r=Sr(r,t),t=2>r.length?t:Et(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Lt(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){
+return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)return true;if(null==n||null==t||!yu(n)&&!yu(t))return n!==n&&t!==t;n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{
+if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++a<o;){var l=f[a],h=n[l],p=t[l];if(e)var _=i?e(p,h,l,t,n,u):e(h,p,l,n,t,u);if(_===T?h!==p&&!Mt(h,p,r,e,u):!_){c=false;break}s||(s="constructor"==l);
+}c&&!s&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(c=false)),u.delete(n),u.delete(t),t=c}}else t=false;else t=false}}return t}function Tt(n){return yu(n)&&"[object Map]"==vo(n)}function $t(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=Qu(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return false}for(;++u<i;){var f=r[u],c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===T&&!(c in n))return false;
+}else{if(f=new Zn,e)var s=e(a,l,c,n,t,f);if(s===T?!Mt(l,a,3,e,f):!s)return false}}return true}function Ft(n){return!(!du(n)||ci&&ci in n)&&(_u(n)?hi:dn).test(Te(n))}function Nt(n){return yu(n)&&"[object RegExp]"==Ot(n)}function Pt(n){return yu(n)&&"[object Set]"==vo(n)}function Zt(n){return yu(n)&&gu(n.length)&&!!Un[Ot(n)]}function qt(n){return typeof n=="function"?n:null==n?$u:typeof n=="object"?ff(n)?Jt(n[0],n[1]):Ht(n):Zu(n)}function Vt(n){if(!ze(n))return Bi(n);var t,r=[];for(t in Qu(n))oi.call(n,t)&&"constructor"!=t&&r.push(t);
+return r}function Kt(n,t){return n<t}function Gt(n,t){var r=-1,e=su(n)?Ku(n.length):[];return uo(n,function(n,u,i){e[++r]=t(n,u,i)}),e}function Ht(n){var t=xe(n);return 1==t.length&&t[0][2]?We(t[0][0],t[0][1]):function(r){return r===n||$t(r,n,t)}}function Jt(n,t){return Ie(n)&&t===t&&!du(t)?We(Me(n),t):function(r){var e=Ru(r,n);return e===T&&e===t?zu(r,n):Mt(t,e,3)}}function Yt(n,t,r,e,u){n!==t&&oo(t,function(i,o){if(du(i)){u||(u=new Zn);var f=u,c=Be(n,o),a=Be(t,o),l=f.get(a);if(!l){var l=e?e(c,a,o+"",n,t,f):T,s=l===T;
+if(s){var h=ff(a),p=!h&&af(a),_=!h&&!p&&_f(a),l=a;h||p||_?ff(c)?l=c:hu(c)?l=Lr(c):p?(s=false,l=Ir(a,true)):_?(s=false,l=zr(a,true)):l=[]:xu(a)||of(a)?(l=c,of(c)?l=Ou(c):du(c)&&!_u(c)||(l=Ae(a))):s=false}s&&(f.set(a,l),Yt(l,a,r,e,f),f.delete(a))}it(n,o,l)}else f=e?e(Be(n,o),i,o+"",n,t,u):T,f===T&&(f=i),it(n,o,f)},Uu)}function Qt(n,t){var r=n.length;if(r)return t+=0>t?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],E(ye())),n=Gt(n,function(n,r,u){return{a:c(t,function(t){return t(n)}),
+b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e<o;){var c=Wr(u[e],i[e]);if(c){if(e>=f){e=c;break n}e=c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=Et(n,o);r(f,o)&&lr(i,Sr(o,n),f)}return i}function rr(n){return function(t){return Et(t,n)}}function er(n,t,r,e){var u=e?g:v,i=-1,o=t.length,f=n;for(n===t&&(t=Lr(t)),r&&(f=c(n,E(r)));++i<o;)for(var a=0,l=t[i],l=r?r(l):l;-1<(a=u(f,l,a,e));)f!==n&&xi.call(f,a,1),
+xi.call(n,a,1);return n}function ur(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Se(u)?xi.call(n,u,1):xr(n,u)}}return n}function ir(n,t){return n+Ii(Ti()*(t-n+1))}function or(n,t){var r="";if(!n||1>t||9007199254740991<t)return r;do t%2&&(r+=n),(t=Ii(t/2))&&(n+=n);while(t);return r}function fr(n,t){return xo(Ue(n,t,$u),n+"")}function cr(n){return Qn(Lu(n))}function ar(n,t){var r=Lu(n);return De(r,pt(t,0,r.length))}function lr(n,t,r,e){if(!du(n))return n;t=Sr(t,n);for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){
+var c=Me(t[u]),a=r;if(u!=o){var l=f[c],a=e?e(l,c,f):T;a===T&&(a=du(l)?l:Se(t[u+1])?[]:{})}ot(f,c,a),f=f[c]}return n}function sr(n){return De(Lu(n))}function hr(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e<u;)r[e]=n[e+t];return r}function pr(n,t){var r;return uo(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function _r(n,t,r){var e=0,u=null==n?e:n.length;if(typeof t=="number"&&t===t&&2147483647>=u){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:o<t)?e=i+1:u=i;
+}return u}return vr(n,t,$u,r)}function vr(n,t,r,e){t=r(t);for(var u=0,i=null==n?0:n.length,o=t!==t,f=null===t,c=wu(t),a=t===T;u<i;){var l=Ii((u+i)/2),s=r(n[l]),h=s!==T,p=null===s,_=s===s,v=wu(s);(o?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?s<=t:s<t)?u=l+1:i=l}return Ci(i,4294967294)}function gr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r],f=t?t(o):o;if(!r||!lu(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function dr(n){return typeof n=="number"?n:wu(n)?F:+n}function yr(n){
+if(typeof n=="string")return n;if(ff(n))return c(n,yr)+"";if(wu(n))return ro?ro.call(n):"";var t=n+"";return"0"==t&&1/n==-$?"-0":t}function br(n,t,r){var e=-1,u=o,i=n.length,c=true,a=[],l=a;if(r)c=false,u=f;else if(200<=i){if(u=t?null:so(n))return L(u);c=false,u=O,l=new Nn}else l=t?[]:a;n:for(;++e<i;){var s=n[e],h=t?t(s):s,s=r||0!==s?s:0;if(c&&h===h){for(var p=l.length;p--;)if(l[p]===h)continue n;t&&l.push(h),a.push(s)}else u(l,h,r)||(l!==a&&l.push(h),a.push(s))}return a}function xr(n,t){return t=Sr(t,n),
+n=2>t.length?n:Et(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?hr(n,e?0:i,e?i+1:u):hr(n,e?i+1:0,e?u:i)}function wr(n,t){var r=n;return r instanceof Ln&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mr(n,t,r){var e=n.length;if(2>e)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=yt(i[u]||o,n[f],t,r));return br(wt(i,1),t,r)}function Ar(n,t,r){
+for(var e=-1,u=n.length,i=t.length,o={};++e<u;)r(o,n[e],e<i?t[e]:T);return o}function kr(n){return hu(n)?n:[]}function Er(n){return typeof n=="function"?n:$u}function Sr(n,t){return ff(n)?n:Ie(n,t)?[n]:jo(Iu(n))}function Or(n,t,r){var e=n.length;return r=r===T?e:r,!t&&r>=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length);
+}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Ur(n,t,r,e){var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Li(i-o,0),l=Ku(c+a);for(e=!e;++f<c;)l[f]=t[f];for(;++u<o;)(e||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l}function Br(n,t,r,e){var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Li(i-f,0),s=Ku(l+a);
+for(e=!e;++u<l;)s[u]=n[u];for(l=u;++c<a;)s[l+c]=t[c];for(;++o<f;)(e||u<i)&&(s[l+r[o]]=n[u++]);return s}function Lr(n,t){var r=-1,e=n.length;for(t||(t=Ku(e));++r<e;)t[r]=n[r];return t}function Cr(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):T;c===T&&(c=n[f]),u?st(r,f,c):ot(r,f,c)}return r}function Dr(n,t){return Cr(n,po(n),t)}function Mr(n,t){return Cr(n,_o(n),t)}function Tr(n,r){return function(e,u){var i=ff(e)?t:ct,o=r?r():{};return i(e,n,ye(u,2),o);
+}}function $r(n){return fr(function(t,r){var e=-1,u=r.length,i=1<u?r[u-1]:T,o=2<u?r[2]:T,i=3<n.length&&typeof i=="function"?(u--,i):T;for(o&&Oe(r[0],r[1],o)&&(i=3>u?T:i,u=1),t=Qu(t);++e<u;)(o=r[e])&&n(t,o,e,i);return t})}function Fr(n,t){return function(r,e){if(null==r)return r;if(!su(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=Qu(r);(t?i--:++i<u)&&false!==e(o[i],i,o););return r}}function Nr(n){return function(t,r,e){var u=-1,i=Qu(t);e=e(t);for(var o=e.length;o--;){var f=e[n?o:++u];if(false===r(i[f],f,i))break;
+}return t}}function Pr(n,t,r){function e(){return(this&&this!==$n&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=1&t,i=Vr(n);return e}function Zr(n){return function(t){t=Iu(t);var r=Rn.test(t)?M(t):T,e=r?r[0]:t.charAt(0);return t=r?Or(r,1).join(""):t.slice(1),e[n]()+t}}function qr(n){return function(t){return l(Mu(Du(t).replace(En,"")),n,"")}}function Vr(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:
+return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=eo(n.prototype),t=n.apply(r,t);return du(t)?t:r}}function Kr(t,r,e){function u(){for(var o=arguments.length,f=Ku(o),c=o,a=de(u);c--;)f[c]=arguments[c];return c=3>o&&f[0]!==a&&f[o-1]!==a?[]:B(f,a),o-=c.length,o<e?ue(t,r,Jr,u.placeholder,T,f,c,T,T,e-o):n(this&&this!==$n&&this instanceof u?i:t,this,f);
+}var i=Vr(t);return u}function Gr(n){return function(t,r,e){var u=Qu(t);if(!su(t)){var i=ye(r,3);t=Wu(t),r=function(n){return i(u[n],n,u)}}return r=n(t,r,e),-1<r?u[i?t[r]:r]:T}}function Hr(n){return pe(function(t){var r=t.length,e=r,u=On.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if(typeof i!="function")throw new ti("Expected a function");if(u&&!o&&"wrapper"==ge(i))var o=new On([],true)}for(e=o?e:r;++e<r;)var i=t[e],u=ge(i),f="wrapper"==u?ho(i):T,o=f&&Re(f[0])&&424==f[1]&&!f[4].length&&1==f[9]?o[ge(f[0])].apply(o,f[3]):1==i.length&&Re(i)?o[u]():o.thru(i);
+return function(){var n=arguments,e=n[0];if(o&&1==n.length&&ff(e))return o.plant(e).value();for(var u=0,n=r?t[u].apply(this,n):e;++u<r;)n=t[u].call(this,n);return n}})}function Jr(n,t,r,e,u,i,o,f,c,a){function l(){for(var d=arguments.length,y=Ku(d),b=d;b--;)y[b]=arguments[b];if(_){var x,j=de(l),b=y.length;for(x=0;b--;)y[b]===j&&++x}if(e&&(y=Ur(y,e,u,_)),i&&(y=Br(y,i,o,_)),d-=x,_&&d<a)return j=B(y,j),ue(n,t,Jr,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[n]:n,d=y.length,f){x=y.length;for(var w=Ci(f.length,x),m=Lr(y);w--;){
+var A=f[w];y[w]=Se(A,x)?m[A]:T}}else v&&1<d&&y.reverse();return s&&c<d&&(y.length=c),this&&this!==$n&&this instanceof l&&(b=g||Vr(b)),b.apply(j,y)}var s=128&t,h=1&t,p=2&t,_=24&t,v=512&t,g=p?T:Vr(n);return l}function Yr(n,t){return function(r,e){return Ut(r,n,t(e),{})}}function Qr(n,t){return function(r,e){var u;if(r===T&&e===T)return t;if(r!==T&&(u=r),e!==T){if(u===T)return e;typeof r=="string"||typeof e=="string"?(r=yr(r),e=yr(e)):(r=dr(r),e=dr(e)),u=n(r,e)}return u}}function Xr(t){return pe(function(r){
+return r=c(r,E(ye())),fr(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ne(n,t){t=t===T?" ":yr(t);var r=t.length;return 2>r?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];return n(h,o?e:this,s)}var o=1&r,f=Vr(t);return i}function re(n){return function(t,r,e){
+e&&typeof e!="number"&&Oe(t,r,e)&&(r=e=T),t=Au(t),r===T?(r=t,t=0):r=Au(r),e=e===T?t<r?1:-1:Au(e);var u=-1;r=Li(Oi((r-t)/(e||1)),0);for(var i=Ku(r);r--;)i[n?r:++u]=t,t+=e;return i}}function ee(n){return function(t,r){return typeof t=="string"&&typeof r=="string"||(t=Su(t),r=Su(r)),n(t,r)}}function ue(n,t,r,e,u,i,o,f,c,a){var l=8&t,s=l?o:T;o=l?T:o;var h=l?i:T;return i=l?T:i,t=(t|(l?32:64))&~(l?64:32),4&t||(t&=-4),u=[n,t,u,h,s,i,o,f,c,a],r=r.apply(T,u),Re(n)&&yo(r,u),r.placeholder=e,Le(r,n,t)}function ie(n){
+var t=Yu[n];return function(n,r){if(n=Su(n),r=null==r?0:Ci(ku(r),292)){var e=(Iu(n)+"e").split("e"),e=t(e[0]+"e"+(+e[1]+r)),e=(Iu(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return t(n)}}function oe(n){return function(t){var r=vo(t);return"[object Map]"==r?W(t):"[object Set]"==r?C(t):k(t,n(t))}}function fe(n,t,r,e,u,i,o,f){var c=2&t;if(!c&&typeof n!="function")throw new ti("Expected a function");var a=e?e.length:0;if(a||(t&=-97,e=u=T),o=o===T?o:Li(ku(o),0),f=f===T?f:ku(f),a-=u?u.length:0,64&t){
+var l=e,s=u;e=u=T}var h=c?T:ho(n);return i=[n,t,r,e,u,l,s,i,o,f],h&&(r=i[1],n=h[1],t=r|n,e=128==n&&8==r||128==n&&256==r&&i[7].length<=h[8]||384==n&&h[7].length<=h[8]&&8==r,131>t||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Ur(e,r,h[4]):r,i[4]=e?B(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Br(e,r,h[6]):r,i[6]=e?B(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1],
+r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),c=t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),Le((h?co:yo)(c,i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;
+var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++c<f;){var s=n[c],p=t[c];if(e)var _=o?e(p,s,c,t,n,i):e(s,p,c,n,t,i);if(_!==T){if(_)continue;a=false;break}if(l){if(!h(t,function(n,t){if(!O(l,t)&&(s===n||u(s,n,r,e,i)))return l.push(t)})){a=false;break}}else if(s!==p&&!u(s,p,r,e,i)){a=false;break}}return i.delete(n),i.delete(t),a}function he(n,t,r,e,u,i,o){switch(r){case"[object DataView]":if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)break;n=n.buffer,t=t.buffer;case"[object ArrayBuffer]":
+if(n.byteLength!=t.byteLength||!i(new vi(n),new vi(t)))break;return true;case"[object Boolean]":case"[object Date]":case"[object Number]":return lu(+n,+t);case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object RegExp]":case"[object String]":return n==t+"";case"[object Map]":var f=W;case"[object Set]":if(f||(f=L),n.size!=t.size&&!(1&e))break;return(r=o.get(n))?r==t:(e|=2,o.set(n,t),t=se(f(n),f(t),e,u,i,o),o.delete(n),t);case"[object Symbol]":if(to)return to.call(n)==to.call(t)}
+return false}function pe(n){return xo(Ue(n,T,Ze),n+"")}function _e(n){return St(n,Wu,po)}function ve(n){return St(n,Uu,_o)}function ge(n){for(var t=n.name+"",r=Gi[t],e=oi.call(Gi,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function de(n){return(oi.call(An,"placeholder")?An:n).placeholder}function ye(){var n=An.iteratee||Fu,n=n===Fu?qt:n;return arguments.length?n(arguments[0],arguments[1]):n}function be(n,t){var r=n.__data__,e=typeof t;return("string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?r[typeof t=="string"?"string":"hash"]:r.map;
+}function xe(n){for(var t=Wu(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,u===u&&!du(u)]}return t}function je(n,t){var r=null==n?T:n[t];return Ft(r)?r:T}function we(n,t,r){t=Sr(t,n);for(var e=-1,u=t.length,i=false;++e<u;){var o=Me(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&gu(u)&&Se(o,u)&&(ff(n)||of(n)))}function me(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&oi.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ae(n){
+return typeof n.constructor!="function"||ze(n)?{}:eo(di(n))}function ke(n,t,r){var e=n.constructor;switch(t){case"[object ArrayBuffer]":return Rr(n);case"[object Boolean]":case"[object Date]":return new e(+n);case"[object DataView]":return t=r?Rr(n.buffer):n.buffer,new n.constructor(t,n.byteOffset,n.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":
+case"[object Uint16Array]":case"[object Uint32Array]":return zr(n,r);case"[object Map]":return new e;case"[object Number]":case"[object String]":return new e(n);case"[object RegExp]":return t=new n.constructor(n.source,_n.exec(n)),t.lastIndex=n.lastIndex,t;case"[object Set]":return new e;case"[object Symbol]":return to?Qu(to.call(n)):{}}}function Ee(n){return ff(n)||of(n)||!!(ji&&n&&n[ji])}function Se(n,t){var r=typeof n;return t=null==t?9007199254740991:t,!!t&&("number"==r||"symbol"!=r&&bn.test(n))&&-1<n&&0==n%1&&n<t;
+}function Oe(n,t,r){if(!du(r))return false;var e=typeof t;return!!("number"==e?su(r)&&Se(t,r.length):"string"==e&&t in r)&&lu(r[t],n)}function Ie(n,t){if(ff(n))return false;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!wu(n))||(nn.test(n)||!X.test(n)||null!=t&&n in Qu(t))}function Re(n){var t=ge(n),r=An[t];return typeof r=="function"&&t in Ln.prototype&&(n===r||(t=ho(r),!!t&&n===t[0]))}function ze(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||ei)}function We(n,t){
+return function(r){return null!=r&&(r[n]===t&&(t!==T||n in Qu(r)))}}function Ue(t,r,e){return r=Li(r===T?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Li(u.length-r,0),f=Ku(o);++i<o;)f[i]=u[r+i];for(i=-1,o=Ku(r+1);++i<r;)o[i]=u[i];return o[r]=e(f),n(t,this,o)}}function Be(n,t){if("__proto__"!=t)return n[t]}function Le(n,t,r){var e=t+"";t=xo;var u,i=$e;return u=(u=e.match(an))?u[1].split(ln):[],r=i(u,r),(i=r.length)&&(u=i-1,r[u]=(1<i?"& ":"")+r[u],r=r.join(2<i?", ":" "),e=e.replace(cn,"{\n/* [wrapped with "+r+"] */\n")),
+t(n,e)}function Ce(n){var t=0,r=0;return function(){var e=Di(),u=16-(e-r);if(r=e,0<u){if(800<=++t)return arguments[0]}else t=0;return n.apply(T,arguments)}}function De(n,t){var r=-1,e=n.length,u=e-1;for(t=t===T?e:t;++r<t;){var e=ir(r,u),i=n[e];n[e]=n[r],n[r]=i}return n.length=t,n}function Me(n){if(typeof n=="string"||wu(n))return n;var t=n+"";return"0"==t&&1/n==-$?"-0":t}function Te(n){if(null!=n){try{return ii.call(n)}catch(n){}return n+""}return""}function $e(n,t){return r(N,function(r){var e="_."+r[0];
+t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function Fe(n){if(n instanceof Ln)return n.clone();var t=new On(n.__wrapped__,n.__chain__);return t.__actions__=Lr(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function Ne(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:ku(r),0>r&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=ku(r),u=0>r?Li(e+u,0):Ci(u,e-1)),_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[];
+}function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n;
+}function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=ku(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder,
+n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)),
+s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),
+r.cache=i.set(u,e)||i,e)};return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false;
+var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==ku(n)}function gu(n){return typeof n=="number"&&-1<n&&0==n%1&&9007199254740991>=n}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object";
+}function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n)}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Lr(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);
+return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?L:Lu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function ku(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(ku(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n;
+}function Ou(n){return Cr(n,Uu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:Et(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Uu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){
+return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=kt(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=kt(t,Wu(t)));
+var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Lr(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){
+var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.allocUnsafe:T,di=U(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){try{var n=je(Qu,"defineProperty");
+return n({},"",{}),n}catch(n){}}(),ki=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Ui=ri.join,Bi=U(Qu.keys,Qu),Li=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){
+function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=kn.prototype,An.prototype.constructor=An,On.prototype=eo(kn.prototype),On.prototype.constructor=On,Ln.prototype=eo(kn.prototype),Ln.prototype.constructor=Ln,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n],
+this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1),
+--this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1<ft(this.__data__,n)},Tn.prototype.set=function(n,t){var r=this.__data__,e=ft(r,n);return 0>e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n);
+},Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){
+return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=ki||function(n){
+return $n.clearTimeout(n)},so=Zi&&1/L(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){
+var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){
+t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),ko=fr(function(n){var t=c(n,kr);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=Ve(n),r=c(n,kr);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,kr);return(t=typeof t=="function"?t:T)&&r.pop(),
+r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Uo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,hu))}),Lo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),
+mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1<t?n[t-1]:T,t=typeof t=="function"?(n.pop(),t):T;return Je(n,t)}),To=pe(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return ht(t,n)};return!(1<t||this.__actions__.length)&&e instanceof Ln&&Se(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:Qe,args:[u],thisArg:T}),new On(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(T),
+n})):this.thru(u)}),$o=Tr(function(n,t,r){oi.call(n,r)?++n[r]:st(n,r,1)}),Fo=Gr(Ne),No=Gr(Pe),Po=Tr(function(n,t,r){oi.call(n,r)?n[r].push(t):st(n,r,[t])}),Zo=fr(function(t,r,e){var u=-1,i=typeof r=="function",o=su(t)?Ku(t.length):[];return uo(t,function(t){o[++u]=i?n(r,t,e):Bt(t,r,e)}),o}),qo=Tr(function(n,t,r){st(n,r,t)}),Vo=Tr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),Ko=fr(function(n,t){if(null==n)return[];var r=t.length;return 1<r&&Oe(n,t[0],t[1])?t=[]:2<r&&Oe(t[0],t[1],t[2])&&(t=[t[0]]),
+Xt(n,wt(t,1),[])}),Go=Ei||function(){return $n.Date.now()},Ho=fr(function(n,t,r){var e=1;if(r.length)var u=B(r,de(Ho)),e=32|e;return fe(n,e,t,r,u)}),Jo=fr(function(n,t,r){var e=3;if(r.length)var u=B(r,de(Jo)),e=32|e;return fe(t,e,n,r,u)}),Yo=fr(function(n,t){return dt(n,1,t)}),Qo=fr(function(n,t,r){return dt(n,Su(t)||0,r)});cu.Cache=Fn;var Xo=fr(function(t,r){r=1==r.length&&ff(r[0])?c(r[0],E(ye())):c(wt(r,1),E(ye()));var e=r.length;return fr(function(u){for(var i=-1,o=Ci(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);
+return n(t,this,u)})}),nf=fr(function(n,t){return fe(n,32,T,t,B(t,de(nf)))}),tf=fr(function(n,t){return fe(n,64,T,t,B(t,de(tf)))}),rf=pe(function(n,t){return fe(n,256,T,T,T,t)}),ef=ee(It),uf=ee(function(n,t){return n>=t}),of=Lt(function(){return arguments}())?Lt:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?E(Vn):Ct,af=zi||Vu,lf=Kn?E(Kn):Dt,sf=Gn?E(Gn):Tt,hf=Hn?E(Hn):Nt,pf=Jn?E(Jn):Pt,_f=Yn?E(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){
+if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Uu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Uu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2<e?t[2]:T;for(u&&Oe(t[0],t[1],u)&&(e=1);++r<e;)for(var u=t[r],i=Uu(u),o=-1,f=i.length;++o<f;){var c=i[o],a=n[c];(a===T||lu(a,ei[c])&&!oi.call(n,c))&&(n[c]=u[c])}return n}),mf=fr(function(t){return t.push(T,ae),n(Of,T,t)}),Af=Yr(function(n,t,r){
+null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),n[t]=r},Tu($u)),kf=Yr(function(n,t,r){null!=t&&typeof t.toString!="function"&&(t=ai.call(t)),oi.call(n,t)?n[t].push(r):n[t]=[r]},ye),Ef=fr(Bt),Sf=$r(function(n,t,r){Yt(n,t,r)}),Of=$r(function(n,t,r,e){Yt(n,t,r,e)}),If=pe(function(n,t){var r={};if(null==n)return r;var e=false;t=c(t,function(t){return t=Sr(t,n),e||(e=1<t.length),t}),Cr(n,ve(n),r),e&&(r=_t(r,7,le));for(var u=t.length;u--;)xr(r,t[u]);return r}),Rf=pe(function(n,t){return null==n?{}:nr(n,t);
+}),zf=oe(Wu),Wf=oe(Uu),Uf=qr(function(n,t,r){return t=t.toLowerCase(),n+(r?Cu(t):t)}),Bf=qr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Lf=qr(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Cf=Zr("toLowerCase"),Df=qr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Mf=qr(function(n,t,r){return n+(r?" ":"")+$f(t)}),Tf=qr(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),$f=Zr("toUpperCase"),Ff=fr(function(t,r){try{return n(t,T,r)}catch(n){return pu(n)?n:new Hu(n)}}),Nf=pe(function(n,t){
+return r(t,function(t){t=Me(t),st(n,t,Ho(n[t],n))}),n}),Pf=Hr(),Zf=Hr(true),qf=fr(function(n,t){return function(r){return Bt(r,n,t)}}),Vf=fr(function(n,t){return function(r){return Bt(n,r,t)}}),Kf=Xr(c),Gf=Xr(u),Hf=Xr(h),Jf=re(),Yf=re(true),Qf=Qr(function(n,t){return n+t},0),Xf=ie("ceil"),nc=Qr(function(n,t){return n/t},1),tc=ie("floor"),rc=Qr(function(n,t){return n*t},1),ec=ie("round"),uc=Qr(function(n,t){return n-t},0);return An.after=function(n,t){if(typeof t!="function")throw new ti("Expected a function");
+return n=ku(n),function(){if(1>--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(ku(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));e<r;)i[u++]=hr(n,e,e+=t);return i},An.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){
+var i=n[t];i&&(u[e++]=i)}return u},An.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Ku(n-1),r=arguments[0];n--;)t[n-1]=arguments[n];return a(ff(r)?Lr(r):[r],wt(t,1))},An.cond=function(t){var r=null==t?0:t.length,e=ye();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new ti("Expected a function");return[e(n[0]),n[1]]}):[],fr(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})},An.conforms=function(n){return vt(_t(n,1))},An.constant=Tu,
+An.countBy=$o,An.create=function(n,t){var r=eo(n);return null==t?r:at(r,t)},An.curry=iu,An.curryRight=ou,An.debounce=fu,An.defaults=wf,An.defaultsDeep=mf,An.defer=Yo,An.delay=Qo,An.difference=wo,An.differenceBy=mo,An.differenceWith=Ao,An.drop=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),hr(n,0>t?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[];
+},An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=ku(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:ku(e),0>e&&(e+=u),e=r>e?0:Eu(e);r<e;)n[r++]=t;return n},An.filter=function(n,t){return(ff(n)?i:jt)(n,ye(t,3))},An.flatMap=function(n,t){return wt(ru(n,t),1)},An.flatMapDeep=function(n,t){return wt(ru(n,t),$)},An.flatMapDepth=function(n,t,r){return r=r===T?1:ku(r),
+wt(ru(n,t),r)},An.flatten=Ze,An.flattenDeep=function(n){return(null==n?0:n.length)?wt(n,$):[]},An.flattenDepth=function(n,t){return null!=n&&n.length?(t=t===T?1:ku(t),wt(n,t)):[]},An.flip=function(n){return fe(n,512)},An.flow=Pf,An.flowRight=Zf,An.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},An.functions=function(n){return null==n?[]:kt(n,Wu(n))},An.functionsIn=function(n){return null==n?[]:kt(n,Uu(n))},An.groupBy=Po,An.initial=function(n){
+return(null==n?0:n.length)?hr(n,0,-1):[]},An.intersection=ko,An.intersectionBy=Eo,An.intersectionWith=So,An.invert=Af,An.invertBy=kf,An.invokeMap=Zo,An.iteratee=Fu,An.keyBy=qo,An.keys=Wu,An.keysIn=Uu,An.map=ru,An.mapKeys=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,t(n,e,u),n)}),r},An.mapValues=function(n,t){var r={};return t=ye(t,3),mt(n,function(n,e,u){st(r,e,t(n,e,u))}),r},An.matches=function(n){return Ht(_t(n,1))},An.matchesProperty=function(n,t){return Jt(n,_t(t,1))},An.memoize=cu,
+An.merge=Sf,An.mergeWith=Of,An.method=qf,An.methodOf=Vf,An.mixin=Nu,An.negate=au,An.nthArg=function(n){return n=ku(n),fr(function(t){return Qt(t,n)})},An.omit=If,An.omitBy=function(n,t){return Bu(n,au(ye(t)))},An.once=function(n){return uu(2,n)},An.orderBy=function(n,t,r,e){return null==n?[]:(ff(t)||(t=null==t?[]:[t]),r=e?T:r,ff(r)||(r=null==r?[]:[r]),Xt(n,t,r))},An.over=Kf,An.overArgs=Xo,An.overEvery=Gf,An.overSome=Hf,An.partial=nf,An.partialRight=tf,An.partition=Vo,An.pick=Rf,An.pickBy=Bu,An.property=Zu,
+An.propertyOf=function(n){return function(t){return null==n?T:Et(n,t)}},An.pull=Oo,An.pullAll=Ke,An.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,ye(r,2)):n},An.pullAllWith=function(n,t,r){return n&&n.length&&t&&t.length?er(n,t,T,r):n},An.pullAt=Io,An.range=Jf,An.rangeRight=Yf,An.rearg=rf,An.reject=function(n,t){return(ff(n)?i:jt)(n,au(ye(t,3)))},An.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=ye(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),
+u.push(e))}return ur(n,u),r},An.rest=function(n,t){if(typeof n!="function")throw new ti("Expected a function");return t=t===T?t:ku(t),fr(n,t)},An.reverse=Ge,An.sampleSize=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:ku(t),(ff(n)?et:ar)(n,t)},An.set=function(n,t,r){return null==n?n:lr(n,t,r)},An.setWith=function(n,t,r,e){return e=typeof e=="function"?e:T,null==n?n:lr(n,t,r,e)},An.shuffle=function(n){return(ff(n)?ut:sr)(n)},An.slice=function(n,t,r){var e=null==n?0:n.length;return e?(r&&typeof r!="number"&&Oe(n,t,r)?(t=0,
+r=e):(t=null==t?0:ku(t),r=r===T?e:ku(r)),hr(n,t,r)):[]},An.sortBy=Ko,An.sortedUniq=function(n){return n&&n.length?gr(n):[]},An.sortedUniqBy=function(n,t){return n&&n.length?gr(n,ye(t,2)):[]},An.split=function(n,t,r){return r&&typeof r!="number"&&Oe(n,t,r)&&(t=r=T),r=r===T?4294967295:r>>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Li(ku(r),0),
+fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:ku(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n),
+n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Lr(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{};
+}return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),void 0)),n},An.updateWith=function(n,t,r,e){
+return e=typeof e=="function"?e:T,null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Uu(n))},An.without=Uo,An.words=Mu,An.wrap=function(n,t){return nf(Er(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Uf,An.capitalize=Cu,
+An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){
+n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(ku(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At);
+},An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Uu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Uu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Lu(n),r=r&&!e?ku(r):0,e=n.length,0>r&&(r=Li(e+r,0)),ju(n)?r<=e&&-1<n.indexOf(t,r):!!e&&-1<v(n,t,r);
+},An.indexOf=function(n,t,r){var e=null==n?0:n.length;return e?(r=null==r?0:ku(r),0>r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n<Li(t,r)},An.invoke=Ef,An.isArguments=of,An.isArray=ff,An.isArrayBuffer=cf,An.isArrayLike=su,An.isArrayLikeObject=hu,An.isBoolean=function(n){return true===n||false===n||yu(n)&&"[object Boolean]"==Ot(n)},An.isBuffer=af,An.isDate=lf,An.isElement=function(n){return yu(n)&&1===n.nodeType&&!xu(n)},An.isEmpty=function(n){
+if(null==n)return true;if(su(n)&&(ff(n)||typeof n=="string"||typeof n.splice=="function"||af(n)||_f(n)||of(n)))return!n.length;var t=vo(n);if("[object Map]"==t||"[object Set]"==t)return!n.size;if(ze(n))return!Vt(n).length;for(var r in n)if(oi.call(n,r))return false;return true},An.isEqual=function(n,t){return Mt(n,t)},An.isEqualWith=function(n,t,r){var e=(r=typeof r=="function"?r:T)?r(n,t):T;return e===T?Mt(n,t,T,r):!!e},An.isError=pu,An.isFinite=function(n){return typeof n=="number"&&Wi(n)},An.isFunction=_u,
+An.isInteger=vu,An.isLength=gu,An.isMap=sf,An.isMatch=function(n,t){return n===t||$t(n,t,xe(t))},An.isMatchWith=function(n,t,r){return r=typeof r=="function"?r:T,$t(n,t,xe(t),r)},An.isNaN=function(n){return bu(n)&&n!=+n},An.isNative=function(n){if(go(n))throw new Hu("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ft(n)},An.isNil=function(n){return null==n},An.isNull=function(n){return null===n},An.isNumber=bu,An.isObject=du,An.isObjectLike=yu,An.isPlainObject=xu,An.isRegExp=hf,
+An.isSafeInteger=function(n){return vu(n)&&-9007199254740991<=n&&9007199254740991>=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Ui.call(n,t)},An.kebabCase=Bf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=ku(r),u=0>u?Li(e+u,0):Ci(u,e-1)),
+t===t)n:{for(r=u+1;r--;)if(n[r]===t){n=r;break n}n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){
+return{}},An.stubString=function(){return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,ku(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return t&&e<t?n+ne(t-e,r):n},An.padStart=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return t&&e<t?ne(t-e,r)+n:n;
+},An.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),Mi(Iu(n).replace(on,""),t||0)},An.random=function(n,t,r){if(r&&typeof r!="boolean"&&Oe(n,t,r)&&(t=r=T),r===T&&(typeof t=="boolean"?(r=t,t=T):typeof n=="boolean"&&(r=n,n=T)),n===T&&t===T?(n=0,t=1):(n=Au(n),t===T?(t=n,n=0):t=Au(t)),n>t){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){
+var e=ff(n)?s:j,u=3>arguments.length;return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:ku(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++e<u;){var i=null==n?T:n[Me(t[e])];i===T&&(e=u,i=r),n=_u(i)?i.call(n):i}return n},An.round=ec,An.runInContext=x,An.sample=function(n){return(ff(n)?Qn:cr)(n)},An.size=function(n){if(null==n)return 0;
+if(su(n))return ju(n)?D(n):n.length;var t=vo(n);return"[object Map]"==t||"[object Set]"==t?n.size:Vt(n).length},An.snakeCase=Df,An.some=function(n,t,r){var e=ff(n)?h:pr;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.sortedIndex=function(n,t){return _r(n,t)},An.sortedIndexBy=function(n,t,r){return vr(n,t,ye(r,2))},An.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=_r(n,t);if(e<r&&lu(n[e],t))return e}return-1},An.sortedLastIndex=function(n,t){return _r(n,t,true)},An.sortedLastIndexBy=function(n,t,r){
+return vr(n,t,ye(r,2),true)},An.sortedLastIndexOf=function(n,t){if(null==n?0:n.length){var r=_r(n,t,true)-1;if(lu(n[r],t))return r}return-1},An.startCase=Mf,An.startsWith=function(n,t,r){return n=Iu(n),r=null==r?0:pt(ku(r),0,n.length),t=yr(t),n.slice(r,r+t.length)==t},An.subtract=uc,An.sum=function(n){return n&&n.length?m(n,$u):0},An.sumBy=function(n,t){return n&&n.length?m(n,ye(t,2)):0},An.template=function(n,t,r){var e=An.templateSettings;r&&Oe(n,t,r)&&(t=T),n=Iu(n),t=bf({},t,e,ce),r=bf({},t.imports,e.imports,ce);
+var u,i,o=Wu(r),f=S(r,o),c=0;r=t.interpolate||jn;var a="__p+='";r=Xu((t.escape||jn).source+"|"+r.source+"|"+(r===Q?pn:jn).source+"|"+(t.evaluate||jn).source+"|$","g");var l="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,o,f,l){return e||(e=o),a+=n.slice(c,l).replace(wn,z),r&&(u=true,a+="'+__e("+r+")+'"),f&&(i=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+t.length,t}),a+="';",(t=t.variable)||(a="with(obj){"+a+"}"),a=(i?a.replace(P,""):a).replace(Z,"$1").replace(q,"$1;"),
+a="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",t=Ff(function(){return Ju(o,l+"return "+a).apply(T,f)}),t.source=a,pu(t))throw t;return t},An.times=function(n,t){if(n=ku(n),1>n||9007199254740991<n)return[];var r=4294967295,e=Ci(n,4294967295);for(t=ye(t),n-=4294967295,e=A(e,t);++r<n;)t(r);return e},An.toFinite=Au,An.toInteger=ku,An.toLength=Eu,An.toLower=function(n){
+return Iu(n).toLowerCase()},An.toNumber=Su,An.toSafeInteger=function(n){return n?pt(ku(n),-9007199254740991,9007199254740991):0===n?n:0},An.toString=Iu,An.toUpper=function(n){return Iu(n).toUpperCase()},An.trim=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(un,""):n&&(t=yr(t))?(n=M(n),r=M(t),t=I(n,r),r=R(n,r)+1,Or(n,t,r).join("")):n},An.trimEnd=function(n,t,r){return(n=Iu(n))&&(r||t===T)?n.replace(fn,""):n&&(t=yr(t))?(n=M(n),t=R(n,M(t))+1,Or(n,0,t).join("")):n},An.trimStart=function(n,t,r){
+return(n=Iu(n))&&(r||t===T)?n.replace(on,""):n&&(t=yr(t))?(n=M(n),t=I(n,M(t)),Or(n,t).join("")):n},An.truncate=function(n,t){var r=30,e="...";if(du(t))var u="separator"in t?t.separator:u,r="length"in t?ku(t.length):r,e="omission"in t?yr(t.omission):e;n=Iu(n);var i=n.length;if(Rn.test(n))var o=M(n),i=o.length;if(r>=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")),
+u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1<u&&(r=r.slice(0,u)));return r+e},An.unescape=function(n){return(n=Iu(n))&&G.test(n)?n.replace(V,tt):n},An.uniqueId=function(n){var t=++fi;return Iu(n)+t},An.upperCase=Tf,An.upperFirst=$f,An.each=nu,An.eachRight=tu,An.first=qe,Nu(An,function(){var n={};return mt(An,function(t,r){oi.call(An.prototype,r)||(n[r]=t)}),n}(),{chain:false}),An.VERSION="4.17.11",r("bind bindKey curry curryRight partial partialRight".split(" "),function(n){
+An[n].placeholder=An}),r(["drop","take"],function(n,t){Ln.prototype[n]=function(r){r=r===T?1:Li(ku(r),0);var e=this.__filtered__&&!t?new Ln(this):this.clone();return e.__filtered__?e.__takeCount__=Ci(r,e.__takeCount__):e.__views__.push({size:Ci(r,4294967295),type:n+(0>e.__dir__?"Right":"")}),e},Ln.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Ln.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({
+iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Ln.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ln.prototype[n]=function(){return this.__filtered__?new Ln(this):this[r](1)}}),Ln.prototype.compact=function(){return this.filter($u)},Ln.prototype.find=function(n){return this.filter(n).head()},Ln.prototype.findLast=function(n){return this.reverse().find(n);
+},Ln.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Ln(this):this.map(function(r){return Bt(r,n,t)})}),Ln.prototype.reject=function(n){return this.filter(au(ye(n)))},Ln.prototype.slice=function(n,t){n=ku(n);var r=this;return r.__filtered__&&(0<n||0>t)?new Ln(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=ku(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Ln.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295);
+},mt(Ln.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ln,c=o[0],l=f||ff(t),s=function(n){return n=u.apply(An,a([n],o)),e&&h?n[0]:n};l&&r&&typeof c=="function"&&1!=c.length&&(f=l=false);var h=this.__chain__,p=!!this.__actions__.length,c=i&&!h,f=f&&!p;return!i&&l?(t=f?t:new Ln(this),t=n.apply(t,o),t.__actions__.push({
+func:Qe,args:[s],thisArg:T}),new On(t,h)):c&&f?n.apply(this,o):(t=this.thru(s),c?e?t.value()[0]:t.value():t)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)})}}),mt(Ln.prototype,function(n,t){var r=An[t];if(r){var e=r.name+"";
+(Gi[e]||(Gi[e]=[])).push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Ln.prototype.clone=function(){var n=new Ln(this.__wrapped__);return n.__actions__=Lr(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Lr(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Lr(this.__views__),n},Ln.prototype.reverse=function(){if(this.__filtered__){var n=new Ln(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n;
+},Ln.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=0;for(var o=i,f=this.__views__,c=-1,a=f.length;++c<a;){var l=f[c],s=l.size;switch(l.type){case"drop":n+=s;break;case"dropRight":o-=s;break;case"take":o=Ci(o,n+s);break;case"takeRight":n=Li(n,o-s)}}if(n={start:n,end:o},o=n.start,f=n.end,n=f-o,o=u?f:o-1,f=this.__iteratees__,c=f.length,a=0,l=Ci(n,this.__takeCount__),!e||!u&&i==n&&l==n)return wr(t,this.__actions__);e=[];n:for(;n--&&a<l;){for(o+=r,
+u=-1,i=t[o];++u<c;){var h=f[u],s=h.type,h=(0,h.iteratee)(i);if(2==s)i=h;else if(!h){if(1==s)continue n;break n}}e[a++]=i}return e},An.prototype.at=To,An.prototype.chain=function(){return Ye(this)},An.prototype.commit=function(){return new On(this.value(),this.__chain__)},An.prototype.next=function(){this.__values__===T&&(this.__values__=mu(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof kn;){
+var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ln?(this.__actions__.length&&(n=new Ln(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,wi&&(An.prototype[wi]=Xe),
+An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); \ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html
index 9acc2c2e1..4cfc5be7f 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html
@@ -21,13 +21,13 @@
<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/alert-change-management/alert-change-management.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/css/manual-task-popup.css" />
-<div class="modal-header">
- <h3 class="modal-title" id="alert-modal-header">On Hold</h3>
- <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
-</div>
-<div class="modal-body">
- <span id="alert-modal-content">{{vm.content}}</span>
-</div>
-<div class="modal-footer">
- <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div>
-</div>
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title" id="alert-modal-header">On Hold</h3>
+ <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
+ </div>
+ <div class="modal-body">
+ <span id="alert-modal-content">{{vm.content}}</span>
+ </div>
+ <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'" />
+</div> \ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js
index bfe733023..38096a581 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js
@@ -22,9 +22,9 @@
'use strict';
appDS2.controller("changeManagementManualTasksController", ["$uibModalInstance", "jobInfo", "MsoService", "COMPONENT",
- "$log", changeManagementManualTasksController]);
+ "$log", "moment", changeManagementManualTasksController]);
- function changeManagementManualTasksController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log) {
+ function changeManagementManualTasksController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log, moment) {
var vm = this;
vm.manualTasks = [];
@@ -43,10 +43,12 @@
};
function loadAvailableTasks(requestId) {
- MsoService.getManualTasks(requestId)
+ return MsoService.getManualTasks(requestId)
.then(function(response) {
vm.task = response.data[0];
vm.manualTasks = vm.task && vm.task.validResponses;
+ vm.description = vm.task && vm.task.description || null;
+ vm.timeout = vm.task && vm.task.timeout || null;
})
.catch(function(error) {
$log.error(error);
@@ -73,6 +75,37 @@
return vm.manualTasks.includes(task);
};
+ vm.timeoutHumanized = function() {
+ // moment.duration() can parse ISO 8601 time-intervals,
+ // e.g. "P1Y2M10DT2H30M"
+ // https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
+ let duration = moment.duration(vm.timeout);
+
+ return isDurationValid()
+ ? durationAsHoursAndMinutes() + ' hours (' + vm.timeout + ')'
+ : vm.timeout;
+
+
+ function isDurationValid() {
+ return duration.isValid() && duration.toISOString() !== 'P0D';
+ }
+
+ function durationAsHoursAndMinutes() {
+ return ''
+ + Math.floor(duration.asHours())
+ + ':'
+ + withLeadingZero(duration.minutes());
+ }
+
+ function withLeadingZero(x) {
+ return ("00" + Math.round(x)).slice(-2);
+ }
+ };
+
+ vm.__test_only__ = {
+ loadAvailableTasks: loadAvailableTasks,
+ };
+
init();
}
})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.test.js
new file mode 100644
index 000000000..deefca7e1
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.test.js
@@ -0,0 +1,201 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+require('./change-management-manual-tasks.controller');
+const jestMock = require('jest-mock');
+const moment = require('moment');
+
+describe('changeManagementManualTasksController testing', () => {
+ let $controller;
+ let $uibModalInstance = jestMock.fn();
+ let $MsoService = jestMock.fn();
+ let $log = jestMock.fn();
+
+ beforeEach(
+ angular.mock.module('app')
+ );
+
+ beforeEach(inject(function (_$controller_) {
+ $log.error = jestMock.fn();
+ $uibModalInstance.close = jestMock.fn();
+
+ mockManualTaskResponse(manualTaskResponse);
+
+ $controller = _$controller_('changeManagementManualTasksController', {
+ "MsoService": $MsoService,
+ "$uibModalInstance": $uibModalInstance,
+ "$log": $log,
+ "moment": moment,
+ "jobInfo": {
+ requestState: job.requestStatus.requestState,
+ details: job.requestStatus.statusMessage,
+ job: job,
+ },
+ "COMPONENT": {
+ MANUAL_TASKS: ["manualTaskName1", "manualTaskName2"]
+ },
+ });
+ }));
+
+ function mockManualTaskResponse(manualTaskResponse) {
+ $MsoService.getManualTasks = jestMock.fn().mockResolvedValue(
+ {data: [manualTaskResponse]}
+ );
+ }
+
+ const job = {
+ "requestId": "db775fac-d9b5-480e-8b3e-4f0d0ae67890",
+ "requestScope": "vnf",
+ "requestStatus": {
+ "percentProgress": 100.0,
+ "requestState": "FAILED",
+ "statusMessage": "Error validating request. No valid catalog entry is specified",
+ "finishTime": "Thu, 05 Oct 2017 18:58:29 GMT"
+ },
+ "requestType": "replaceInstance",
+ "startTime": "Thu, 05 Oct 2017 18:58:29 GMT",
+ "instanceReferences": {
+ "serviceInstanceId": "cc8fa0a9-7576-4c39-af31-7ad61d057ac9",
+ "vnfInstanceId": "bec0c3d3-09ae-4eb1-b694-057987a10982",
+ "requestorId": "pa2396"
+ }
+ };
+
+ const manualTaskResponseWithoutValidResponses = {
+ "taskId": "db775fac-d9b5-480e-8b3e-4f0d0ae67890",
+ };
+
+ const manualTaskResponse = Object.assign({
+ "validResponses": ["rollback", "abort", "skip", "resume", "retry"],
+ }, manualTaskResponseWithoutValidResponses);
+
+ const manualTaskResponseWithTimeout = Object.assign({
+ description: 'description',
+ timeout: 'timeout',
+ }, manualTaskResponse);
+
+ test('should populate vm.manualTasks (while init)', () => {
+ expect($controller.manualTasks).toEqual(
+ manualTaskResponse.validResponses);
+ });
+
+ test('should undefine vm.manualTasks when ValidResponses not given', () => {
+ // given
+ mockManualTaskResponse(manualTaskResponseWithoutValidResponses);
+ // when
+ return $controller.__test_only__.loadAvailableTasks('anything')
+ .then(() => {
+ expect($controller.manualTasks).toBeUndefined()
+ });
+ });
+
+ test('should populate vm.MANUAL_TASKS from COMPONENT (while init)', () => {
+ expect($controller.MANUAL_TASKS).toEqual(
+ ["manualTaskName1", "manualTaskName2"]);
+ });
+
+ test('should populate vm.task (while init)', () => {
+ expect($controller.task).toEqual(manualTaskResponse);
+ });
+
+ test('should nullify vm.description (while init)', () => {
+ expect($controller.description).toBeNull();
+ });
+
+ test('should nullify vm.timeout (while init)', () => {
+ expect($controller.timeout).toBeNull();
+ });
+
+ test('should populate vm.description', () => {
+ // given
+ mockManualTaskResponse(manualTaskResponseWithTimeout);
+ // when
+ return $controller.__test_only__.loadAvailableTasks('anything')
+ .then(() => {
+ expect($controller.description).toEqual('description');
+ });
+ });
+
+ test('should populate vm.timeout', () => {
+ // given
+ mockManualTaskResponse(manualTaskResponseWithTimeout);
+ // when
+ return $controller.__test_only__.loadAvailableTasks('anything')
+ .then(() => {
+ expect($controller.timeout).toEqual('timeout');
+ });
+ });
+
+ test('should humanize timeout if proper ISO-8601', () => {
+ $controller.timeout = 'PT3350S';
+ expect($controller.timeoutHumanized()).toEqual('0:55 hours (PT3350S)');
+ });
+
+ test('should humanize timeout if proper ISO-8601', () => {
+ $controller.timeout = 'P3DT1H1M';
+ expect($controller.timeoutHumanized()).toEqual('73:01 hours (P3DT1H1M)');
+ });
+
+ test('should drive-through timeout if not proper ISO-8601', () => {
+ $controller.timeout = '56 minutes';
+ expect($controller.timeoutHumanized()).toEqual('56 minutes');
+ });
+
+ test('should drive-through timeout if undefined', () => {
+ $controller.timeout = undefined;
+ expect($controller.timeoutHumanized()).toEqual(undefined);
+ });
+
+ test('should find manual task using isTaskAvailable', () => {
+ expect($controller.isTaskAvailable('abort')).toBeTruthy();
+ expect($controller.isTaskAvailable('resume')).toBeTruthy();
+
+ expect($controller.isTaskAvailable('foo')).toBeFalsy();
+ expect($controller.isTaskAvailable(undefined)).toBeFalsy();
+ });
+
+ test('should call MsoService upon completeTask', () => {
+ $MsoService.completeTask = jestMock.fn().mockResolvedValue({data: {}});
+
+ $controller.completeTask("taskName");
+ expect($MsoService.completeTask).toBeCalledWith(
+ manualTaskResponse.taskId, "taskName");
+ });
+
+ test('should close modal upon completeTask', done => {
+ $MsoService.completeTask = jestMock.fn().mockResolvedValue({data: {}});
+ $uibModalInstance.close = jestMock.fn(() => {
+ done();
+ });
+
+ $controller.completeTask("taskName");
+ });
+
+ test('should close modal upon failed completeTask', done => {
+ $MsoService.completeTask = jestMock.fn().mockRejectedValue();
+ $uibModalInstance.close = jestMock.fn(() => {
+ done();
+ });
+
+ $controller.completeTask("taskName");
+ });
+
+});
+
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html
index 40fefab98..031146e91 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html
@@ -18,7 +18,12 @@
============LICENSE_END=========================================================
-->
-<div class="pull-right">
+<div class="modal-body">
+ <span id="in-progress-modal-description" ng-if="vm.description">{{vm.description}}</span>
+ <span id="in-progress-modal-timeout" ng-if="vm.timeout" class="text-danger"><strong>(task will time out in {{vm.timeoutHumanized()}})</strong></span>
+</div>
+
+<div class="modal-footer">
<button ng-repeat="task in vm.manualTasks"
type="button" id="{{task}}-button" name="{{task}}" class="btn btn-primary"
ng-show="vm.isTaskAvailable(vm.MANUAL_TASKS[task])"
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html
index 11d73e26e..4a4a3cfec 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html
@@ -21,13 +21,13 @@
<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/failed-change-management/failed-change-management.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/css/manual-task-popup.css" />
-<div class="modal-header">
- <h3 class="modal-title" id="failed-modal-header">{{vm.requestState || 'Failed' }}</h3>
- <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
-</div>
-<div class="modal-body">
- <span id="failed-modal-content">{{vm.content}}</span>
-</div>
-<div class="modal-footer">
- <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div>
-</div>
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title" id="failed-modal-header">{{vm.requestState || 'Failed' }}</h3>
+ <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
+ </div>
+ <div class="modal-body">
+ <span id="failed-modal-content">{{vm.content}}</span>
+ </div>
+ <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'" />
+</div> \ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html
index e0c88660b..d133d4960 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html
@@ -21,13 +21,13 @@
<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css" />
<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/css/manual-task-popup.css" />
-<div class="modal-header">
- <h3 class="modal-title" id="in-progress-modal-header">In Progress</h3>
- <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
-</div>
-<div class="modal-body">
- <span id="in-progress-modal-content">{{vm.content}}</span>
-</div>
-<div class="modal-footer">
- <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div>
-</div>
+<div>
+ <div class="modal-header">
+ <h3 class="modal-title" id="in-progress-modal-header">In Progress</h3>
+ <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">&times;</span>
+ </div>
+ <div class="modal-body">
+ <span id="in-progress-modal-content">{{vm.content}}</span>
+ </div>
+ <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'" />
+</div> \ No newline at end of file
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 88caef29e..246834cdd 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
@@ -380,33 +380,80 @@
});
return JSON.stringify(result);
}
+
+ function getWorkflowParametersFromForm() {
+ let workflowParameters =
+ {requestDetails:{
+ cloudConfiguration:{},
+ requestParameters:{userParams:[{}]}
+ }};
+ workflowParameters.requestDetails.cloudConfiguration = vm.changeManagement.vnfNames[0].cloudConfiguration;
+
+ let parameters = vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow);
+ parameters.forEach((parameter)=>{
+ let inputField = document.getElementById('so-workflow-parameter-'+parameter.soFieldName);
+ workflowParameters.requestDetails.requestParameters.userParams[0][parameter.soFieldName]=inputField.value;
+ });
+
+ return workflowParameters;
+ }
+
vm.openModal = function () {
if(vm.hasScheduler) { //scheduling supported
- $scope.widgetParameter = ""; // needed by the scheduler?
-
- // properties needed by the scheduler so it knows whether to show
- // policy or sniro related features on the scheduler UI or not.
- vm.changeManagement.policyYN = "Y";
- vm.changeManagement.sniroYN = "Y";
-
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
- vm.changeManagement.testApi = DataService.getMsoRequestParametersTestApi();
- }
- var data = {
- widgetName: 'Portal-Common-Scheduler',
- widgetData: vm.changeManagement,
- widgetParameter: $scope.widgetParameter
- };
-
- window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL);
+ vm.scheduleWorkflow();
} else {
- //no scheduling support
- var dataToSo = extractChangeManagementCallbackDataStr(vm.changeManagement);
- if(dataToSo) {
- var vnfName = vm.changeManagement.vnfNames[0].name;
- changeManagementService.postChangeManagementNow(dataToSo, vnfName);
+ //no scheduling support
+ vm.executeWorkflow();
+ }
+ };
+
+ vm.scheduleWorkflow = function () {
+ $scope.widgetParameter = ""; // needed by the scheduler?
+
+ // properties needed by the scheduler so it knows whether to show
+ // policy or sniro related features on the scheduler UI or not.
+ vm.changeManagement.policyYN = "Y";
+ vm.changeManagement.sniroYN = "Y";
+
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
+ vm.changeManagement.testApi = DataService.getMsoRequestParametersTestApi();
+ }
+ var data = {
+ widgetName: 'Portal-Common-Scheduler',
+ widgetData: vm.changeManagement,
+ widgetParameter: $scope.widgetParameter
+ };
+
+ window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL);
+ };
+
+ vm.executeWorkflow = function () {
+ if (vm.localWorkflows && vm.localWorkflows.length > 0) {
+ vm.triggerLocalWorkflow();
+ } else {
+ vm.triggerRemoteWorkflow();
+ }
+ };
+
+ vm.triggerLocalWorkflow = function () {
+ var dataToSo = extractChangeManagementCallbackDataStr(vm.changeManagement);
+ if (dataToSo) {
+ var vnfName = vm.changeManagement.vnfNames[0].name;
+ changeManagementService.postChangeManagementNow(dataToSo, vnfName);
+ }
+ };
+
+ vm.triggerRemoteWorkflow = function () {
+ let cachedWorkflowDetails = vm.getCachedWorkflowDetails(vm.changeManagement.workflow);
+ if (cachedWorkflowDetails.length > 0) {
+ let workflowParameters = getWorkflowParametersFromForm();
+ if (workflowParameters) {
+ let servieInstanceId = vm.changeManagement.vnfNames[0]['service-instance-node'][0].properties['service-instance-id'];
+ let vnfInstanceId = vm.changeManagement.vnfNames[0].id;
+ let workflow_UUID = cachedWorkflowDetails[0].id;
+ changeManagementService.postWorkflowsParametersNow(servieInstanceId, vnfInstanceId, workflow_UUID, workflowParameters);
}
- }
+ }
};
vm.loadSubscribers = function () {
@@ -660,8 +707,8 @@
};
vm.loadRemoteWorkFlows = function () {
- let vnfNames = vm.changeManagement.vnfNames.map(vnfName => vnfName.name);
- return changeManagementService.getSOWorkflows(vnfNames)
+ let vnfModelIDs = vm.changeManagement.vnfNames.map(vnfName => vnfName.modelVersionId);
+ return changeManagementService.getSOWorkflows(vnfModelIDs)
.then(function (response) {
vm.remoteWorkflows = response.data || [];
}).catch(function (error) {
@@ -699,13 +746,37 @@
};
vm.loadRemoteWorkFlowParameters = function (workflow) {
- changeManagementService.getSOWorkflowParameter(workflow.id)
- .then(function (response) {
- vm.remoteWorkflowsParameters.set(workflow.name, response.data.parameterDefinitions);
- })
- .catch(function (error) {
- $log.error(error);
- });
+ let parameters = [];
+ workflow.workflowInputParameters
+ .filter( function (param) {
+ return param.soPayloadLocation === "userParams"
+ })
+ .forEach(function (param) {
+ let workflowParams = vm.repackAttributes(param);
+ if (param.validation.length > 0) {
+ let validation = param.validation[0];
+ if ('maxLength' in validation) {
+ workflowParams.maxLength = validation.maxLength;
+ }
+ if ('allowableChars' in validation) {
+ workflowParams.pattern = validation.allowableChars;
+ }
+ }
+ parameters.push(workflowParams);
+ }
+ );
+ vm.remoteWorkflowsParameters.set(workflow.name, parameters);
+ };
+
+ vm.repackAttributes = function (workflowParam){
+ return {
+ name: workflowParam.label,
+ required: workflowParam.required,
+ id: workflowParam.soFieldName,
+ soFieldName: workflowParam.soFieldName,
+ maxLength: '500',
+ pattern: '.*'
+ }
};
vm.getRemoteWorkFlowParameters = function (workflow) {
@@ -728,6 +799,13 @@
}
};
+ vm.getCachedWorkflowDetails = function (workflow) {
+ return vm.remoteWorkflows.filter( function (remoteWorkflow) {
+ return remoteWorkflow.name === workflow;
+ });
+
+ };
+
//Must be $scope because we bind to the onchange of the html (cannot attached to vm variable).
$scope.selectFileForVNFName = function (fileInput) {
if (fileInput && fileInput.id) {
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
index 9810c0013..5989ffdd6 100644
--- 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
@@ -100,32 +100,59 @@ describe('Testing workFlows from SO', () => {
}
],
}});
- let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 1"}, {"id": "2", "name": "workflow 2"}]});
- let getSOWorkflowsParametersPromiseStub = Promise.resolve({"data":{"parameterDefinitions": []}});
+ let getSOWorkflowsPromiseStub = Promise.resolve({"data":[{
- $controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
+ "id": "ab6478e4-ea33-3346-ac12-ab121484a333",
+ "workflowName": "inPlaceSoftwareUpdate",
+ "name": "inPlaceSoftwareUpdate",
+ "source": "sdc",
+ "workflowInputParameters": [
+ {
+ "label": "New Software Version",
+ "inputType": "text",
+ "required": true,
+ "soFieldName": "new_software_version",
+ "soPayloadLocation": "userParams",
+ "validation":[]
+ }
+ ]
+ }]
+ });
+
+ $controller.changeManagement.vnfNames = [{modelVersionId: 'test1', name:'test'}];
$changeManagementService.getWorkflows = () => getWorkflowsStub;
$changeManagementService.getLocalWorkflowParameter = () => getLocalWorkflowsParametersStub;
$changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
- $changeManagementService.getSOWorkflowParameter = () => getSOWorkflowsParametersPromiseStub;
// when
return $controller.loadWorkFlows().then(() => {
- expect($controller.workflows).toContain('workflow 1');
- expect($controller.workflows).toContain('workflow 2');
+ expect($controller.workflows).toContain('inPlaceSoftwareUpdate');
+ expect($controller.localWorkflowsParameters).toBeUndefined();
});
});
- test('Verify load workflows will call load workflows parameters from SO', () => {
+ test('Verify load workflows will set workflows and parameters', () => {
// given
let getWorkflowsStub = Promise.resolve({"data": {"workflows": ["workflow 0"]}});
let getLocalWorkflowsParametersStub = Promise.resolve({"data": {}});
- let getSOWorkflowsPromiseStub = Promise.resolve({"data": [{"id": "1", "name": "workflow 0"}]});
- let getSOWorkflowsParametersPromiseStub = Promise.resolve({"data":{"parameterDefinitions": [
- {"id": 1, "name": "parameter 1", "required": true, "type": "STRING", "pattern": "[0-9]*"},
- {"id": 2, "name": "parameter 2", "required": true, "type": "STRING", "pattern": ".*"},
- {"id": 3, "name": "parameter 3", "required": false, "type": "STRING", "pattern": "[0-9]*"}]}});
+ let getSOWorkflowsPromiseStub = Promise.resolve({"data":[{
- $controller.changeManagement.vnfNames = [{name: 'test1'}, {name: "test2"}];
+ "id": "ab6478e4-ea33-3346-ac12-ab121484a333",
+ "workflowName": "inPlaceSoftwareUpdate",
+ "name": "inPlaceSoftwareUpdate",
+ "source": "sdc",
+ "workflowInputParameters": [
+ {
+ "label": "New Software Version",
+ "inputType": "text",
+ "required": true,
+ "soFieldName": "new_software_version",
+ "soPayloadLocation": "userParams",
+ "validation":[]
+ }
+ ]
+ }]
+ });
+ $controller.changeManagement.vnfNames = [{modelVersionId: 'test1', name:'test'}];
$changeManagementService.getWorkflows = () => getWorkflowsStub;
$changeManagementService.getLocalWorkflowParameter = () => getLocalWorkflowsParametersStub;
$changeManagementService.getSOWorkflows = () => getSOWorkflowsPromiseStub;
@@ -133,10 +160,17 @@ describe('Testing workFlows from SO', () => {
// when
return $controller.loadWorkFlows()
.then(() => {
- expect($controller.remoteWorkflowsParameters).toEqual(new Map([["workflow 0",
- [{"id": 1, "name": "parameter 1", "pattern": "[0-9]*", "required": true, "type": "STRING"},
- {"id": 2, "name": "parameter 2", "pattern": ".*", "required": true, "type": "STRING"},
- {"id": 3, "name": "parameter 3", "pattern": "[0-9]*", "required": false, "type": "STRING"}]]]));
+ expect($controller.workflows).toEqual(["inPlaceSoftwareUpdate"]);
+ expect($controller.remoteWorkflowsParameters).toEqual(new Map([["inPlaceSoftwareUpdate",
+ [{
+ "name": "New Software Version",
+ "required": true,
+ "id": "new_software_version",
+ "soFieldName": "new_software_version",
+ "maxLength": '500',
+ "pattern": '.*'
+ }]]
+ ]));
});
});
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
index 9fb978c42..a5a6d1610 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
@@ -97,7 +97,7 @@
<div class="form-group" ng-if="vm.changeManagement.workflow" ng-repeat="item in vm.getRemoteWorkFlowParameters(vm.changeManagement.workflow)">
<label for="so-workflow-parameter-{{item.id}}" class="control-label">{{item.name}}</label>
- <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" ng-required="{{item.required}}">
+ <input ng-model="item.value" type="text" id="so-workflow-parameter-{{item.id}}" pattern="{{item.pattern}}" maxlength="{{item.maxLength}}" ng-required="{{item.required}}" soFieldName="{{item.soFieldName}}">
</div>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js
index 819be9374..956ae1db5 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js
@@ -127,6 +127,10 @@ var vfModuleActionModalController = function(COMPONENT, $scope, $uibModal, Creat
$uibModalInstance.close({requestParams : requestParams, msoType: COMPONENT.MSO_DEACTIVATE_AND_CLOUD_DELETE});
};
+ $scope.removeVendorFromCloudOwner = function(cloudOwner) {
+ return AaiService.removeVendorFromCloudOwner(cloudOwner)
+ };
+
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html
index 620754307..eb67e6ed9 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html
@@ -64,7 +64,7 @@
<option ng-repeat="option in lcpRegionList" value="{{option.cloudRegionId}}"
data-ng-if="option.isPermitted && isFeatureFlagCloudOwner">
- {{option.cloudRegionId}} ({{option.cloudOwner.trim().toUpperCase().replace("ATT-", "")}})
+ {{option.cloudRegionId}} ({{removeVendorFromCloudOwner(option.cloudOwner).toUpperCase()}})
</option>
</select>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
index bd8bd9baa..030faf524 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
@@ -1,778 +1,784 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-"use strict";
-
-var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q, featureFlags) {
-
- function getServiceInstance(serviceInstanceIdentifier, findBy) {
- serviceInstanceIdentifier.trim();
-
- return $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + serviceInstanceIdentifier + "/" + findBy + "?r=" + Math.random(), {}, {
- timeout: PropertyService.getServerResponseTimeoutMsec()
- });
- }
-
- function getPnfByName(pnfName) {
- var deferred = $q.defer();
- var url = COMPONENT.AAI_GET_PNF_BY_NAME+ encodeURIComponent(pnfName) ;
- var config = { timeout: PropertyService.getServerResponseTimeoutMsec() };
-
- $http.get(url, config)
- .success(function (response) {
- deferred.resolve({data: response});
- })
- .error(function(data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
-
- return deferred.promise;
- }
- function getGlobalCustomerIdFromServiceInstanceResponse(response) {
- var globalCustomerId = "";
- if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
- var customerIndex = 5;
- var customerIdIndex = 6;
- var itemIndex = 0;
-
- var item = response.data[FIELD.ID.RESULT_DATA][itemIndex];
- var url = item[FIELD.ID.RESOURCE_LINK];
- var urlParts = url.split("/");
- if (urlParts[customerIndex] === FIELD.ID.CUSTOMER) {
- globalCustomerId = urlParts[customerIdIndex];
- }
- }
- return globalCustomerId;
- }
-
- function searchServiceInstances(query) {
- return $http.get( COMPONENT.SEARCH_SERVICE_INSTANCES + query, {}, {
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function (response) {
- var displayData = response.data[FIELD.ID.SERVICE_INSTANCES];
- if (!displayData || !displayData.length) {
- displayData = [{
- globalCustomerId : null,
- subscriberName : null,
- serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
- serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
- }];
- }
- return {displayData: displayData};
- });
- };
-
- function getJoinedQueryString(queries) {
- return queries.filter(function (val) {return val;}).join("&");
- }
-
- return {
- getSubscriberName : function(globalCustomerId,
- successCallbackFunction) {
- $log
- .debug("AaiService:getSubscriberName: globalCustomerId: "
- + globalCustomerId);
- $http.get(
- COMPONENT.AAI_SUB_DETAILS_PATH
- + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- var result = {};
- if (response.data) {
- result.subscriberName = response.data[FIELD.ID.SUBNAME];
- result.serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS];
- }
- successCallbackFunction(result);
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
-
- runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
-
- var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(namedQueryId) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
- return $http.get(url, {}, {
-
-
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data != null) {
- successCallback(response);
- } else {
- errorCallback(response);
- }
- }, function(response) {
- errorCallback(response);
- });
- },
-
-
- getVNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
-
- var url = COMPONENT.AAI_GET_VNF_INFO +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
- $http.get(url, {}, {
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data != null) {
- successCallback(response);
- } else {
- errorCallback(response);
- }
- }, function(response) {
- errorCallback(response);
- });
- },
-
- getPNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
-
- var url = COMPONENT.AAI_GET_PNF_INSTANCE +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
- $http.get(url, {}, {
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data != null) {
- successCallback(response);
- } else {
- errorCallback(response);
- }
- }, function(response) {
- errorCallback(response);
- });
- },
-
- getCRInformationByInstanceId : function (serviceInstanceId) {
-
- var deferred = $q.defer();
-
- var url = COMPONENT.AAI_GET_CR_INSTANCE +
- COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
- $http.get(url, {}, {
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data != null) {
- deferred.resolve(response);
- } else {
- deferred.resolve(response);
- }
- }, function(response) {
- deferred.resolve(response);
- });
- return deferred.promise;
- },
-
- searchServiceInstances: searchServiceInstances,
-
- getModelVersionId: function (subscriberId, instanceId) {
- var globalCustomerIdQuery = COMPONENT.SELECTED_SUBSCRIBER_SUB_PATH + subscriberId;
- var serviceInstanceQuery = COMPONENT.SELECTED_SERVICE_INSTANCE_SUB_PATH + instanceId;
-
- var query = "?" + getJoinedQueryString([globalCustomerIdQuery, serviceInstanceQuery]);
-
- var deferred = $q.defer();
-
- searchServiceInstances(query).then(function (response) {
- var displayData = response.displayData;
- if (displayData[0] && displayData[0].aaiModelVersionId) {
- deferred.resolve(displayData[0].aaiModelVersionId);
- } else {
- deferred.reject(FIELD.ERROR.MODEL_VERSION_ID_MISSING);
- }
- }).catch(function (err) {
- deferred.reject(err);
- });
-
- return deferred.promise;
- },
-
- getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) {
- var subscriber;
- var displayData;
- $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, {
-
-
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- displayData = [];
- subscriber = response.data;
- var subscriberName = subscriber[FIELD.ID.SUBNAME];
- if (subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) {
- angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) {
- var serviceInstanceId = [];
- var serviceType = "";
- if (serviceSubscription[FIELD.ID.SERVICETYPE] != null) {
- serviceType = serviceSubscription[FIELD.ID.SERVICETYPE];
- } else {
- serviceType = FIELD.PROMPT.NO_SERVICE_SUB;
- }
- if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) {
- angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) {
- // put them together, i guess
- var inst = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID],
- "aaiModelInvariantId": instValue[FIELD.ID.MODEL_INVAR_ID],
- "aaiModelVersionId": instValue[FIELD.ID.MODEL_VERSION_ID],
- "serviceInstanceName": instValue[FIELD.ID.SERVICE_INSTANCE_NAME]
- };
- if (selectedServiceInstance != null) {
- if ((instValue[FIELD.ID.SERVICE_INSTANCE_ID] == selectedServiceInstance ) || (instValue[FIELD.ID.SERVICE_INSTANCE_NAME] == selectedServiceInstance)) {
- serviceInstanceId.push(inst);
- }
- } else {
- serviceInstanceId.push(inst);
- }
- });
- } else {
- serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ];
- }
- angular.forEach(serviceInstanceId, function(subVal, subKey) {
- displayData.push({
- globalCustomerId : selectedSubscriber,
- subscriberName : subscriberName,
- serviceType : serviceType,
- serviceInstanceId : subVal.serviceInstanceId,
- aaiModelInvariantId : subVal.aaiModelInvariantId,
- aaiModelVersionId
- : subVal.aaiModelVersionId,
- serviceInstanceName : subVal.serviceInstanceName,
- isPermitted: serviceSubscription[FIELD.ID.IS_PERMITTED]
- });
- });
- });
- } else {
- displayData.push({
- globalCustomerId : selectedSubscriber,
- subscriberName : subscriberName,
- serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
- serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
- });
- }
- successCallback(displayData, subscriberName);
- }, function(response) {
- errorCallback(response);});
- },
-
- getSubList : function(successCallback, errorCallback ) {
-
- $http.get( FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, {
-
-
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- var customerList = [];
- if (response.data.customer != null) {
- angular.forEach(response.data.customer, function(subVal, subKey) {
- var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME],
- "isPermitted": subVal[FIELD.ID.IS_PERMITTED], };
- customerList.push(cust);
- });
- successCallback(customerList);
- } else {
- errorCallback(response);
- }
- },function(response) {
- errorCallback(response);
- });
- },
-
- getServiceInstance : getServiceInstance,
- getPnfByName : getPnfByName,
-
- getGlobalCustomerIdByInstanceIdentifier : function(serviceInstanceIdentifier, findBy) {
- serviceInstanceIdentifier.trim();
-
- return getServiceInstance(serviceInstanceIdentifier, findBy)
- .then(function (response) {
- return getGlobalCustomerIdFromServiceInstanceResponse(response);
- });
- },
-
- getMultipleValueParamQueryString: function(values, paramSubPath) {
- if (values.length) {
- return paramSubPath + values.filter(function (val) {return val;}).join("&" + paramSubPath);
- }
- },
-
- getJoinedQueryString: getJoinedQueryString,
-
- getServices2 : function(successCallback, errorCallback ) {
-
- $http.get( FIELD.ID.AAI_GET_SERVICES, {}, {
-
-
- timeout : PropertyService.getServerResponseTimeoutMsec()
- }).then(function(response) {
- var customerList = [];
- if (response.data != null) {
- var serviceIdList = [];
- angular.forEach(response.data, function(value, key) {
- angular.forEach(value, function(subVal, key) {
- var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] ,
- "isPermitted" : subVal[FIELD.ID.IS_PERMITTED]
-
- };serviceIdList.push(newVal);
- });
- });
- successCallback(serviceIdList);
- } else {
- errorCallback(response);
- }
- },function(response) {
- errorCallback(response);
- });
- },
-
- getPortMirroringData: function (ids) {
- var defer = $q.defer();
-
- var url = COMPONENT.AAI_GET_PORT_MIRRORING_CONFIGS_DATA + '?configurationIds=' + ids.join(',');
- $http.get(url).then(function (res) {
- defer.resolve(res);
- }).catch(function (err) {
- $log.error(err);
- defer.resolve({});
- });
-
- return defer.promise;
-
- },
-
- getPortMirroringSourcePorts : function (ids) {
- var defer = $q.defer();
- var url = COMPONENT.AAI_GET_PORT_MIRRORING_SOURCE_PORTS +'?configurationIds=' + ids.join(',');
- $http.get(url).then(function(res){
- defer.resolve(res);
- }).catch(function(err) {
- $log.error(err);
- defer.resolve({});
- });
- return defer.promise;
- },
-
- getVlansByNetworksMapping : function (globalCustomerId, serviceType, serviceInstanceId, sdcModelUuid) {
- var defer = $q.defer();
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS)) {
- var url = COMPONENT.AAI_GET_PROVIDER_NETWORKS_ASSOCIATIONS + '?'
- + 'globalCustomerId=' + globalCustomerId
- + '&serviceType=' + serviceType
- + '&serviceInstanceId=' + serviceInstanceId
- + '&sdcModelUuid=' + sdcModelUuid
- ;
-
- $http.get(url).then(function(res){
- defer.resolve(res.data);
- }).catch(function(err) {
- $log.error(err);
- defer.resolve({});
- });
-
- } else {
- defer.resolve({});
- }
- return defer.promise;
- },
-
- getSubscriptionServiceTypeList : function(globalCustomerId,
- successCallbackFunction) {
- $log
- .debug("AaiService:getSubscriptionServiceTypeList: globalCustomerId: "
- + globalCustomerId);
- if ( UtilityService.hasContents(globalCustomerId) ) {
- $http.get(
- COMPONENT.AAI_SUB_DETAILS_PATH
- + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data && response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS]) {
- var serviceTypes = [];
- var serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION];
-
- for (var i = 0; i < serviceSubscriptions.length; i++) {
- serviceTypes.push({
- "name":serviceSubscriptions[i][FIELD.ID.SERVICETYPE],
- "isPermitted": serviceSubscriptions[i][FIELD.ID.IS_PERMITTED],
- "id": i
- });}
- successCallbackFunction(serviceTypes);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- }
- },
- getLcpCloudRegionTenantList : function(globalCustomerId, serviceType,
- successCallbackFunction) {
- $log
- .debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: "
- + globalCustomerId);
- var url = COMPONENT.AAI_GET_TENANTS
- + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- var lcpCloudRegionTenants = [];
- var aaiLcpCloudRegionTenants = response.data;
-
- for (var i = 0; i < aaiLcpCloudRegionTenants.length; i++) {
- lcpCloudRegionTenants.push({
- "cloudRegionId": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID],
- "cloudOwner": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_OWNER],
- "tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME],
- "tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID],
- "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED]});
- }
-
- successCallbackFunction(lcpCloudRegionTenants);
- }).catch(function(error) {
- (UtilityService.runHttpErrorHandler(error.data, error.status));
- })
- },
- getSubscribers : function(successCallbackFunction) {
- $log
- .debug("AaiService:getSubscribers");
- var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response.data.customer);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
- getProvOptionsFromSystemProp : function(successCallbackFunction) {
- $log
- .debug("AaiService:getProvOptionsFromSystemProp");
- var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH;
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
- getLoggedInUserID : function(successCallbackFunction, catchCallbackFunction) {
- $log
- .debug("AaiService:getLoggedInUserID");
- var url = COMPONENT.GET_USER_ID;
-
- $http.get(url,
- {
- transformResponse: [function (data) {
- return data;
- }],
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"] (function(response, status) {
- if (catchCallbackFunction) {
- catchCallbackFunction();
- }
- UtilityService.runHttpErrorHandler(response, status);
- })
- },
- getServices : function(successCallbackFunction) {
- $log
- .debug("AaiService:getServices");
- var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout: PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function (response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
-
- getAicZones: function (successCallbackFunction) {
- $log
- .debug("getAicZones:getAicZones");
- var url = COMPONENT.AAI_GET_AIC_ZONES +COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);},
- getAicZoneForPNF: function (globalCustomerId,serviceType,serviceInstanceId,successCallbackFunction) {
- $log
- .debug("getAicZones:getAicZones");
- var url = COMPONENT.AAI_GET_AIC_ZONE_FOR_PNF
- .replace('@serviceInstanceId', serviceInstanceId)
- .replace('@globalCustomerId', globalCustomerId)
- .replace('@serviceType', serviceType);
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- successCallbackFunction(response.data);
- })["catch"]
- (UtilityService.runHttpErrorHandler);},
-
- getServiceModels : function(globalCustomerId,serviceType,successCallbackFunction) {
- $log
- .debug("AaiService:getServices");
- var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH+globalCustomerId+ COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
- getServiceModelsByServiceType : function(namedQueryId,globalCustomerId,serviceType,successCallbackFunction) {
- $log
- .debug("AaiService:getServiceModelsByServiceType");
- var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE+COMPONENT.FORWARD_SLASH+namedQueryId+COMPONENT.FORWARD_SLASH+globalCustomerId+COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random();
-
- $http.get(url,
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(function(response) {
- if (response.data) {
- successCallbackFunction(response);
- } else {
- successCallbackFunction([]);
- }
- })["catch"]
- (UtilityService.runHttpErrorHandler);
- },
-
- getVnfsByCustomerIdAndServiceType: function(globalSubscriberId, serviceType){
- var deferred = $q.defer();
-
- if (UtilityService.hasContents(globalSubscriberId) &&
- UtilityService.hasContents(serviceType) ) {
-
- $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + globalSubscriberId + COMPONENT.FORWARD_SLASH
- + serviceType )
- .success(function (response) {
- if(response) {
- deferred.resolve({data: response});
- } else {
- deferred.resolve({data: []});
- }
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
- }
-
- return deferred.promise;
- },
-
- getVnfVersionsByInvariantId: function(modelInvariantId){
- var deferred = $q.defer();
-
- if (UtilityService.hasContents(modelInvariantId)) {
- var body = {"versions": modelInvariantId};
- $http.post(( COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID),body)
-
- .success(function (response) {
- if(response) {
- deferred.resolve({data: response});
- } else {
- deferred.resolve({data: []});
- }
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
- }
-
- return deferred.promise;
- },
-
-
-
- getSubscriberServiceTypes: function(subscriberUuid) {
- var deferred = $q.defer();
- $log.debug("AaiService:getSubscriberServiceTypes: subscriberUuid: " + subscriberUuid);
-
- if (UtilityService.hasContents(subscriberUuid)) {
- $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + subscriberUuid + COMPONENT.ASSIGN + Math.random())
- .success(function (response) {
- if(response && [FIELD.ID.SERVICE_SUBSCRIPTIONS]) {
- deferred.resolve({data: response[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]});
- } else {
- deferred.resolve({data: []});
- }
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
- }
-
- return deferred.promise;
- },
- getVnfInstancesList: function(globalSubscriberId, serviceType, modelVersionId ,modelInvariantId, cloudRegionId) {
- var deferred = $q.defer();
- $http.get([COMPONENT.AAI_GET_VNF_INSTANCES_LIST,
- globalSubscriberId,
- serviceType,
- modelVersionId,
- modelInvariantId,
- cloudRegionId]
- .join(COMPONENT.FORWARD_SLASH))
- .success(function (response) {
- deferred.resolve(response);
- }).error(function (data, status) {
- deferred.reject({message: data, status: status});
- });
- return deferred.promise;
- },
- getPnfInstancesList: function (globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegionId, equipVendor, equipModel) {
- var deferred = $q.defer();
- $http.get([COMPONENT.AAI_GET_PNF_INSTANCES_LIST,
- globalCustomerId, serviceType,
- modelVersionId, modelInvariantId,
- cloudRegionId,
- equipVendor, equipModel
- ].join(COMPONENT.FORWARD_SLASH))
- .success(function (response) {
- deferred.resolve(response);
- }).error(function (data, status) {
- deferred.reject({message: data, status: status});
- });
- return deferred.promise;
- },
- getByUri: function(uri) {
- var deferred = $q.defer();
-
- $http.get(COMPONENT.AAI_GET_BY_URI + uri)
- .success(function (response) {
- deferred.resolve({data: []});
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
-
- return deferred.promise;
- },
- getConfiguration: function(configurationId) {
- var deferred = $q.defer();
-
- $http.get(COMPONENT.AAI_GET_CONFIGURATION + configurationId)
- .success(function (response) {
- deferred.resolve({data: []});
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
-
- return deferred.promise;
- },
-
- getInstanceGroupsByVNFInstanceId: function (vnf_instance_id, successCallback, errorCallback) {
- var url = COMPONENT.AAI_GET_INSTANCE_GROUPS_BY_VNF_INSTANCE_ID_PATH + "/" + vnf_instance_id;
-
- $http.get(url, {}, {
- timeout: PropertyService.getServerResponseTimeoutMsec()
- }).then(function (response) {
- successCallback(response);
- }, function (response) {
- errorCallback(response);
- });
- },
-
- postPOMBAverificationRequest: function (url, data, config) {
- $http.post(url, data, config)
- .success(function (data, status, headers, config) {
- //If at some point in the future the result should be handled - this should be the entry point.
- log.debug("POMBA was called successfully with data: " + data);
- })
- .error(function (data, status, header, config) {
- log.debug("Error: " +
- "Data: " + data +
- "status: " + status +
- "headers: " + header +
- "config: " + config);
- });
- },
-
- getHomingData: function(vnfInstanceId, vfModuleId) {
- var url = COMPONENT.AAI_GET_HOMING_DATA.replace('@vnfInstanceId', vnfInstanceId)
- .replace('@vfModuleId', vfModuleId);
-
- var deferred = $q.defer();
-
- $http.get(url)
- .success(function (response) {
- deferred.resolve({data: response});
- }).error(function (data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
-
- return deferred.promise;
-
- }
- };
-};
-
-appDS2.factory("AaiService", ["$http", "$log", "PropertyService",
- "UtilityService", "COMPONENT", "FIELD", "$q", "featureFlags", AaiService]);
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+"use strict";
+
+var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q, featureFlags) {
+
+ function getServiceInstance(serviceInstanceIdentifier, findBy) {
+ serviceInstanceIdentifier.trim();
+
+ return $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + serviceInstanceIdentifier + "/" + findBy + "?r=" + Math.random(), {}, {
+ timeout: PropertyService.getServerResponseTimeoutMsec()
+ });
+ }
+
+ function getPnfByName(pnfName) {
+ var deferred = $q.defer();
+ var url = COMPONENT.AAI_GET_PNF_BY_NAME+ encodeURIComponent(pnfName) ;
+ var config = { timeout: PropertyService.getServerResponseTimeoutMsec() };
+
+ $http.get(url, config)
+ .success(function (response) {
+ deferred.resolve({data: response});
+ })
+ .error(function(data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+ }
+ function getGlobalCustomerIdFromServiceInstanceResponse(response) {
+ var globalCustomerId = "";
+ if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
+ var customerIndex = 5;
+ var customerIdIndex = 6;
+ var itemIndex = 0;
+
+ var item = response.data[FIELD.ID.RESULT_DATA][itemIndex];
+ var url = item[FIELD.ID.RESOURCE_LINK];
+ var urlParts = url.split("/");
+ if (urlParts[customerIndex] === FIELD.ID.CUSTOMER) {
+ globalCustomerId = urlParts[customerIdIndex];
+ }
+ }
+ return globalCustomerId;
+ }
+
+ function searchServiceInstances(query) {
+ return $http.get( COMPONENT.SEARCH_SERVICE_INSTANCES + query, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ var displayData = response.data[FIELD.ID.SERVICE_INSTANCES];
+ if (!displayData || !displayData.length) {
+ displayData = [{
+ globalCustomerId : null,
+ subscriberName : null,
+ serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
+ serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
+ }];
+ }
+ return {displayData: displayData};
+ });
+ };
+
+ function getJoinedQueryString(queries) {
+ return queries.filter(function (val) {return val;}).join("&");
+ }
+
+ return {
+ getSubscriberName : function(globalCustomerId,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscriberName: globalCustomerId: "
+ + globalCustomerId);
+ $http.get(
+ COMPONENT.AAI_SUB_DETAILS_PATH
+ + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var result = {};
+ if (response.data) {
+ result.subscriberName = response.data[FIELD.ID.SUBNAME];
+ result.serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS];
+ }
+ successCallbackFunction(result);
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+ runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
+
+ var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(namedQueryId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ return $http.get(url, {}, {
+
+
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ successCallback(response);
+ } else {
+ errorCallback(response);
+ }
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+
+
+ getVNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
+
+ var url = COMPONENT.AAI_GET_VNF_INFO +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ successCallback(response);
+ } else {
+ errorCallback(response);
+ }
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getPNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
+
+ var url = COMPONENT.AAI_GET_PNF_INSTANCE +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ successCallback(response);
+ } else {
+ errorCallback(response);
+ }
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getCRInformationByInstanceId : function (serviceInstanceId) {
+
+ var deferred = $q.defer();
+
+ var url = COMPONENT.AAI_GET_CR_INSTANCE +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ deferred.resolve(response);
+ } else {
+ deferred.resolve(response);
+ }
+ }, function(response) {
+ deferred.resolve(response);
+ });
+ return deferred.promise;
+ },
+
+ searchServiceInstances: searchServiceInstances,
+
+ getModelVersionId: function (subscriberId, instanceId) {
+ var globalCustomerIdQuery = COMPONENT.SELECTED_SUBSCRIBER_SUB_PATH + subscriberId;
+ var serviceInstanceQuery = COMPONENT.SELECTED_SERVICE_INSTANCE_SUB_PATH + instanceId;
+
+ var query = "?" + getJoinedQueryString([globalCustomerIdQuery, serviceInstanceQuery]);
+
+ var deferred = $q.defer();
+
+ searchServiceInstances(query).then(function (response) {
+ var displayData = response.displayData;
+ if (displayData[0] && displayData[0].aaiModelVersionId) {
+ deferred.resolve(displayData[0].aaiModelVersionId);
+ } else {
+ deferred.reject(FIELD.ERROR.MODEL_VERSION_ID_MISSING);
+ }
+ }).catch(function (err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ },
+
+ getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) {
+ var subscriber;
+ var displayData;
+ $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, {
+
+
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ displayData = [];
+ subscriber = response.data;
+ var subscriberName = subscriber[FIELD.ID.SUBNAME];
+ if (subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) {
+ angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) {
+ var serviceInstanceId = [];
+ var serviceType = "";
+ if (serviceSubscription[FIELD.ID.SERVICETYPE] != null) {
+ serviceType = serviceSubscription[FIELD.ID.SERVICETYPE];
+ } else {
+ serviceType = FIELD.PROMPT.NO_SERVICE_SUB;
+ }
+ if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) {
+ angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) {
+ // put them together, i guess
+ var inst = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID],
+ "aaiModelInvariantId": instValue[FIELD.ID.MODEL_INVAR_ID],
+ "aaiModelVersionId": instValue[FIELD.ID.MODEL_VERSION_ID],
+ "serviceInstanceName": instValue[FIELD.ID.SERVICE_INSTANCE_NAME]
+ };
+ if (selectedServiceInstance != null) {
+ if ((instValue[FIELD.ID.SERVICE_INSTANCE_ID] == selectedServiceInstance ) || (instValue[FIELD.ID.SERVICE_INSTANCE_NAME] == selectedServiceInstance)) {
+ serviceInstanceId.push(inst);
+ }
+ } else {
+ serviceInstanceId.push(inst);
+ }
+ });
+ } else {
+ serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ];
+ }
+ angular.forEach(serviceInstanceId, function(subVal, subKey) {
+ displayData.push({
+ globalCustomerId : selectedSubscriber,
+ subscriberName : subscriberName,
+ serviceType : serviceType,
+ serviceInstanceId : subVal.serviceInstanceId,
+ aaiModelInvariantId : subVal.aaiModelInvariantId,
+ aaiModelVersionId
+ : subVal.aaiModelVersionId,
+ serviceInstanceName : subVal.serviceInstanceName,
+ isPermitted: serviceSubscription[FIELD.ID.IS_PERMITTED]
+ });
+ });
+ });
+ } else {
+ displayData.push({
+ globalCustomerId : selectedSubscriber,
+ subscriberName : subscriberName,
+ serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
+ serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
+ });
+ }
+ successCallback(displayData, subscriberName);
+ }, function(response) {
+ errorCallback(response);});
+ },
+
+ getSubList : function(successCallback, errorCallback ) {
+
+ $http.get( FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, {
+
+
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var customerList = [];
+ if (response.data.customer != null) {
+ angular.forEach(response.data.customer, function(subVal, subKey) {
+ var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME],
+ "isPermitted": subVal[FIELD.ID.IS_PERMITTED], };
+ customerList.push(cust);
+ });
+ successCallback(customerList);
+ } else {
+ errorCallback(response);
+ }
+ },function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getServiceInstance : getServiceInstance,
+ getPnfByName : getPnfByName,
+
+ getGlobalCustomerIdByInstanceIdentifier : function(serviceInstanceIdentifier, findBy) {
+ serviceInstanceIdentifier.trim();
+
+ return getServiceInstance(serviceInstanceIdentifier, findBy)
+ .then(function (response) {
+ return getGlobalCustomerIdFromServiceInstanceResponse(response);
+ });
+ },
+
+ getMultipleValueParamQueryString: function(values, paramSubPath) {
+ if (values.length) {
+ return paramSubPath + values.filter(function (val) {return val;}).join("&" + paramSubPath);
+ }
+ },
+
+ getJoinedQueryString: getJoinedQueryString,
+
+ getServices2 : function(successCallback, errorCallback ) {
+
+ $http.get( FIELD.ID.AAI_GET_SERVICES, {}, {
+
+
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var customerList = [];
+ if (response.data != null) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] ,
+ "isPermitted" : subVal[FIELD.ID.IS_PERMITTED]
+
+ };serviceIdList.push(newVal);
+ });
+ });
+ successCallback(serviceIdList);
+ } else {
+ errorCallback(response);
+ }
+ },function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getPortMirroringData: function (ids) {
+ var defer = $q.defer();
+
+ var url = COMPONENT.AAI_GET_PORT_MIRRORING_CONFIGS_DATA + '?configurationIds=' + ids.join(',');
+ $http.get(url).then(function (res) {
+ defer.resolve(res);
+ }).catch(function (err) {
+ $log.error(err);
+ defer.resolve({});
+ });
+
+ return defer.promise;
+
+ },
+
+ getPortMirroringSourcePorts : function (ids) {
+ var defer = $q.defer();
+ var url = COMPONENT.AAI_GET_PORT_MIRRORING_SOURCE_PORTS +'?configurationIds=' + ids.join(',');
+ $http.get(url).then(function(res){
+ defer.resolve(res);
+ }).catch(function(err) {
+ $log.error(err);
+ defer.resolve({});
+ });
+ return defer.promise;
+ },
+
+ getVlansByNetworksMapping : function (globalCustomerId, serviceType, serviceInstanceId, sdcModelUuid) {
+ var defer = $q.defer();
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS)) {
+ var url = COMPONENT.AAI_GET_PROVIDER_NETWORKS_ASSOCIATIONS + '?'
+ + 'globalCustomerId=' + globalCustomerId
+ + '&serviceType=' + serviceType
+ + '&serviceInstanceId=' + serviceInstanceId
+ + '&sdcModelUuid=' + sdcModelUuid
+ ;
+
+ $http.get(url).then(function(res){
+ defer.resolve(res.data);
+ }).catch(function(err) {
+ $log.error(err);
+ defer.resolve({});
+ });
+
+ } else {
+ defer.resolve({});
+ }
+ return defer.promise;
+ },
+
+ getSubscriptionServiceTypeList : function(globalCustomerId,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscriptionServiceTypeList: globalCustomerId: "
+ + globalCustomerId);
+ if ( UtilityService.hasContents(globalCustomerId) ) {
+ $http.get(
+ COMPONENT.AAI_SUB_DETAILS_PATH
+ + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data && response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS]) {
+ var serviceTypes = [];
+ var serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION];
+
+ for (var i = 0; i < serviceSubscriptions.length; i++) {
+ serviceTypes.push({
+ "name":serviceSubscriptions[i][FIELD.ID.SERVICETYPE],
+ "isPermitted": serviceSubscriptions[i][FIELD.ID.IS_PERMITTED],
+ "id": i
+ });}
+ successCallbackFunction(serviceTypes);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ }
+ },
+ getLcpCloudRegionTenantList : function(globalCustomerId, serviceType,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: "
+ + globalCustomerId);
+ var url = COMPONENT.AAI_GET_TENANTS
+ + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var lcpCloudRegionTenants = [];
+ var aaiLcpCloudRegionTenants = response.data;
+
+ for (var i = 0; i < aaiLcpCloudRegionTenants.length; i++) {
+ lcpCloudRegionTenants.push({
+ "cloudRegionId": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID],
+ "cloudOwner": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_OWNER],
+ "tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME],
+ "tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID],
+ "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED]});
+ }
+
+ successCallbackFunction(lcpCloudRegionTenants);
+ }).catch(function(error) {
+ (UtilityService.runHttpErrorHandler(error.data, error.status));
+ })
+ },
+ getSubscribers : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscribers");
+ var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response.data.customer);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getProvOptionsFromSystemProp : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getProvOptionsFromSystemProp");
+ var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH;
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getLoggedInUserID : function(successCallbackFunction, catchCallbackFunction) {
+ $log
+ .debug("AaiService:getLoggedInUserID");
+ var url = COMPONENT.GET_USER_ID;
+
+ $http.get(url,
+ {
+ transformResponse: [function (data) {
+ return data;
+ }],
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"] (function(response, status) {
+ if (catchCallbackFunction) {
+ catchCallbackFunction();
+ }
+ UtilityService.runHttpErrorHandler(response, status);
+ })
+ },
+ getServices : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getServices");
+ var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout: PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+ getAicZones: function (successCallbackFunction) {
+ $log
+ .debug("getAicZones:getAicZones");
+ var url = COMPONENT.AAI_GET_AIC_ZONES +COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);},
+ getAicZoneForPNF: function (globalCustomerId,serviceType,serviceInstanceId,successCallbackFunction) {
+ $log
+ .debug("getAicZones:getAicZones");
+ var url = COMPONENT.AAI_GET_AIC_ZONE_FOR_PNF
+ .replace('@serviceInstanceId', serviceInstanceId)
+ .replace('@globalCustomerId', globalCustomerId)
+ .replace('@serviceType', serviceType);
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ successCallbackFunction(response.data);
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);},
+
+ getServiceModels : function(globalCustomerId,serviceType,successCallbackFunction) {
+ $log
+ .debug("AaiService:getServices");
+ var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH+globalCustomerId+ COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getServiceModelsByServiceType : function(namedQueryId,globalCustomerId,serviceType,successCallbackFunction) {
+ $log
+ .debug("AaiService:getServiceModelsByServiceType");
+ var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE+COMPONENT.FORWARD_SLASH+namedQueryId+COMPONENT.FORWARD_SLASH+globalCustomerId+COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+ getVnfsByCustomerIdAndServiceType: function(globalSubscriberId, serviceType){
+ var deferred = $q.defer();
+
+ if (UtilityService.hasContents(globalSubscriberId) &&
+ UtilityService.hasContents(serviceType) ) {
+
+ $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + globalSubscriberId + COMPONENT.FORWARD_SLASH
+ + serviceType )
+ .success(function (response) {
+ if(response) {
+ deferred.resolve({data: response});
+ } else {
+ deferred.resolve({data: []});
+ }
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+ }
+
+ return deferred.promise;
+ },
+
+ getVnfVersionsByInvariantId: function(modelInvariantId){
+ var deferred = $q.defer();
+
+ if (UtilityService.hasContents(modelInvariantId)) {
+ var body = {"versions": modelInvariantId};
+ $http.post(( COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID),body)
+
+ .success(function (response) {
+ if(response) {
+ deferred.resolve({data: response});
+ } else {
+ deferred.resolve({data: []});
+ }
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+ }
+
+ return deferred.promise;
+ },
+
+
+
+ getSubscriberServiceTypes: function(subscriberUuid) {
+ var deferred = $q.defer();
+ $log.debug("AaiService:getSubscriberServiceTypes: subscriberUuid: " + subscriberUuid);
+
+ if (UtilityService.hasContents(subscriberUuid)) {
+ $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + subscriberUuid + COMPONENT.ASSIGN + Math.random())
+ .success(function (response) {
+ if(response && [FIELD.ID.SERVICE_SUBSCRIPTIONS]) {
+ deferred.resolve({data: response[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]});
+ } else {
+ deferred.resolve({data: []});
+ }
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+ }
+
+ return deferred.promise;
+ },
+ getVnfInstancesList: function(globalSubscriberId, serviceType, modelVersionId ,modelInvariantId, cloudRegionId) {
+ var deferred = $q.defer();
+ $http.get([COMPONENT.AAI_GET_VNF_INSTANCES_LIST,
+ globalSubscriberId,
+ serviceType,
+ modelVersionId,
+ modelInvariantId,
+ cloudRegionId]
+ .join(COMPONENT.FORWARD_SLASH))
+ .success(function (response) {
+ deferred.resolve(response);
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
+ });
+ return deferred.promise;
+ },
+ getPnfInstancesList: function (globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegionId, equipVendor, equipModel) {
+ var deferred = $q.defer();
+ $http.get([COMPONENT.AAI_GET_PNF_INSTANCES_LIST,
+ globalCustomerId, serviceType,
+ modelVersionId, modelInvariantId,
+ cloudRegionId,
+ equipVendor, equipModel
+ ].join(COMPONENT.FORWARD_SLASH))
+ .success(function (response) {
+ deferred.resolve(response);
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
+ });
+ return deferred.promise;
+ },
+ getByUri: function(uri) {
+ var deferred = $q.defer();
+
+ $http.get(COMPONENT.AAI_GET_BY_URI + uri)
+ .success(function (response) {
+ deferred.resolve({data: []});
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+ },
+ getConfiguration: function(configurationId) {
+ var deferred = $q.defer();
+
+ $http.get(COMPONENT.AAI_GET_CONFIGURATION + configurationId)
+ .success(function (response) {
+ deferred.resolve({data: []});
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+ },
+
+ getInstanceGroupsByVNFInstanceId: function (vnf_instance_id, successCallback, errorCallback) {
+ var url = COMPONENT.AAI_GET_INSTANCE_GROUPS_BY_VNF_INSTANCE_ID_PATH + "/" + vnf_instance_id;
+
+ $http.get(url, {}, {
+ timeout: PropertyService.getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ successCallback(response);
+ }, function (response) {
+ errorCallback(response);
+ });
+ },
+
+ postPOMBAverificationRequest: function (url, data, config) {
+ $http.post(url, data, config)
+ .success(function (data, status, headers, config) {
+ //If at some point in the future the result should be handled - this should be the entry point.
+ log.debug("POMBA was called successfully with data: " + data);
+ })
+ .error(function (data, status, header, config) {
+ log.debug("Error: " +
+ "Data: " + data +
+ "status: " + status +
+ "headers: " + header +
+ "config: " + config);
+ });
+ },
+
+ getHomingData: function(vnfInstanceId, vfModuleId) {
+ var url = COMPONENT.AAI_GET_HOMING_DATA.replace('@vnfInstanceId', vnfInstanceId)
+ .replace('@vfModuleId', vfModuleId);
+
+ var deferred = $q.defer();
+
+ $http.get(url)
+ .success(function (response) {
+ deferred.resolve({data: response});
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+
+ },
+
+ removeVendorFromCloudOwner: function(cloudOwner) {
+ // Handle the case where cloud owner is formatted
+ // like "{vendor}-{cloud-name}"
+ return cloudOwner.trim().replace(/^[^-]*-/, '');
+ }
+ };
+};
+
+appDS2.factory("AaiService", ["$http", "$log", "PropertyService",
+ "UtilityService", "COMPONENT", "FIELD", "$q", "featureFlags", AaiService]);
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 2a06e75b1..e545aadb1 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
@@ -41,8 +41,8 @@
});
};
- this.getSOWorkflows = function (vnfNames) {
- return $http.get(COMPONENT.GET_SO_WORKFLOWS, {params: {vnfName: vnfNames}})
+ this.getSOWorkflows = function (vnfIDs) {
+ return $http.get(COMPONENT.GET_SO_WORKFLOWS, {params: {vnfModelId: vnfIDs}})
.success(function (response) {
return {data: response};
}).catch(function (ex) {
@@ -142,5 +142,22 @@
return {data: []};
});
};
+
+ this.postWorkflowsParametersNow = function (serviceInstanceId,vnfInstanceId,workflow_UUID,requestData) {
+ let baseUrl = "workflows-management/{serviceInstanceId}/{vnfInstanceId}/{workflow_UUID}";
+ let url = baseUrl.
+ replace("{serviceInstanceId}",serviceInstanceId).
+ replace("{vnfInstanceId}",vnfInstanceId).
+ replace("{workflow_UUID}",workflow_UUID);
+
+ return $http.post(url, requestData)
+ .success(function (response) {
+ return {data: response};
+ })
+ .catch(function (err) {
+ return {data: []};
+ });
+ };
+
}
})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
index 739a17912..d5fd32001 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
@@ -1,1299 +1,1299 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-"use strict";
-
-/*
- * "CreationService" isolates the "component-specific" logic required by the
- * "CreationDialog" controller.
- *
- * "Components" are defined as the 5 element types managed by the dialogs: A)
- * Service B) VNF C) VF Module D) Volume Group and E) Network.
- *
- */
-
-var CreationService = function($log, AaiService, AsdcService, DataService,VIDCONFIGURATION,
- ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService, OwningEntityService,featureFlags) {
-
- var _this = this;
- var getAsyncOperationList = function() {
- if (DataService.getLoggedInUserId() == null) {
- getLoggedInUserID();
- } else {
- UtilityService.startNextAsyncOperation();
- }
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- return [ getSubscribers, getServices, getAicZones, getOwningEntityProperties ];
- case COMPONENT.NETWORK:
- return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
- case COMPONENT.VNF:
- return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
- case COMPONENT.VF_MODULE:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VOLUME_GROUP:
- return [ getLcpCloudRegionTenantList ];
- }
- };
-
- /*
- * "getSummaryList" and "getUserProvidedList" return parameters that should
- * be displayed in the summary and user provided sections, respectively. The
- * functions are expected to return lists that are in the format needed by
- * the parameter-block directive.
- */
-
- var getSummaryList = function() {
-
- /*
- * These placeholders should be removed and their usage in
- * "getSummaryList" should be replaced by appropriate code as the
- * requirements and interfaces firm up.
- */
-
- var PLACEHOLDER_RESOURCE_DESCRIPTION = "Resource Description (PLACEHOLDER)";
- var PLACEHOLDER_SERVICE_CATEGORY = "Service Category (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_DESCRIPTION = "VF Module Description (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_LABEL = "VF Module Label (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_TYPE = "VF Module Type (PLACEHOLDER)";
-
- _this.parameterList = new Array();
-
- /*
- * Common fields displayed at the top of all create instance screens.
- */
- if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]==null
- || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==undefined
- || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==''){
- addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
- }
-
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- if ( !DataService.getALaCarte() ) {
- // for macro instantiation need to add the resource names under the node template list
- // this field is called modelCustomizationName in the asdc client code
- var p;
- var rlist = DataService.getResources();
- var res;
- if ( rlist != null ) {
- for (var i = 0; i < rlist.length; i++) {
- res = rlist[i];
-
- p = FIELD.NAME.RESOURCE_NAME.concat(" " + (i+1));
- addToList(p, res.name );
- p = FIELD.NAME.RESOURCE_DESCRIPTION.concat(" " + (i+1));
- addToList(p, res.description );
- }
- }
- }
- if(DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=null && DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=''){
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getModelInfo(_this.componentId)["createSubscriberName"]);
- }
- if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=null && DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=''){
- addToList(FIELD.NAME.SERVICE_TYPE, DataService
- .getModelInfo(_this.componentId)["serviceTypeName"]);
- addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
- }
- addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.SERVICE_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.SERVICE_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
- addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
- if (DataService.getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE] != "null") {
- addToList(FIELD.NAME.SERVICE_TYPE, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE]);
- addToList(FIELD.NAME.SERVICE_ROLE, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_ROLE]);
- }
-
- break;
- case COMPONENT.VF_MODULE:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- break;
- case COMPONENT.VNF:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_CUSTOMIZATION_NAME]);
- addToList(FIELD.NAME.MODEL_VNF_TYPE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_TYPE]);
- addToList(FIELD.NAME.MODEL_VNF_ROLE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_ROLE]);
- addToList(FIELD.NAME.MODEL_VNF_FUNCTION, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_FUNCTION]);
- addToList(FIELD.NAME.MODEL_VNF_CODE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_CODE]);
- break;
- case COMPONENT.NETWORK:
- case COMPONENT.VOLUME_GROUP:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- break;
- }
-
- return _this.parameterList;
- };
-
- var getUserProvidedList = function() {
- var parameterList = [];
- var isUserProvidedNaming = false;
- if ( ((DataService.getModelInfo(_this.componentId).serviceEcompNaming != null)
- && (DataService.getModelInfo(_this.componentId).serviceEcompNaming === "false")) || DataService.getE2EService() ) {
- isUserProvidedNaming = true;
- }
-
- var isInTop = DataService.getHideServiceFields() || false;
- if (_this.componentId === COMPONENT.SERVICE) {
- if ( DataService.getALaCarte() ) {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
- if(!isInTop){
- parameterList = parameterList.concat([ getSubscribersParameter(),
- FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
- }
- }
- else {
- // macro
-
- if(!isInTop){
- if (isUserProvidedNaming) {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
-
- }
- parameterList = parameterList.concat([ getSubscribersParameter() ]);
- parameterList = parameterList.concat([ getServiceId(),
- FIELD.PARAMETER.SERVICE_TYPE,
- FIELD.PARAMETER.LCP_REGION,
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED
- ]);
- if(!DataService.getE2EService()) {
- parameterList = parameterList.concat([getAicZonesParameter()]);
- }
-
- }else{
- parameterList = parameterList.concat([ getServiceId(),
- FIELD.PARAMETER.LCP_REGION,
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- }
-
- if(!DataService.getE2EService()) {
- parameterList = parameterList.concat([getProjectParameter()]);
- parameterList = parameterList.concat([getOwningEntityParameter()]);
- }
-
- //if service model has a pnf, add a PNF ID parameter
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_PNP_INSTANTIATION) && DataService.getPnf()) {
- parameterList = parameterList.concat([ FIELD.PARAMETER.PNF_ID ]);
- }
- }
- else {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- parameterList = parameterList.concat([ getServiceId(),
- getLcpRegionParameter(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- parameterList = parameterList.concat([ getLineOfBusinessParameter() ]);
- parameterList = parameterList.concat([ getPlatformParameter() ]);
-
- break;
- case COMPONENT.VF_MODULE:
- parameterList = parameterList.concat([
- getLcpRegionParameter(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED
- ]);
-
- var availableVolumeGroupList = DataService.getAvailableVolumeGroupList();
-
- if (availableVolumeGroupList && availableVolumeGroupList.length > 0) {
- var availableVolumeGroupNames = [FIELD.STATUS.NONE];
-
- for (var i = 0; i < availableVolumeGroupList.length; i++) {
- availableVolumeGroupNames.push(availableVolumeGroupList[i].instance.name);
- }
-
- parameterList.push(addOptionList(
- FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP,
- availableVolumeGroupNames));
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- parameterList = parameterList.concat([ getLcpRegionParameter(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- }
- parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
- if(_this.componentId === COMPONENT.VF_MODULE ){
- parameterList.push({name: FIELD.NAME.SDN_C_PRELOAD,
- id: FIELD.ID.SDN_C_PRELOAD,
- type: "checkbox",
- isEnabled: true,
- isRequired: false,
- hideFieldAndLabel: true
- }
- );
- parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- type: "checkbox",
- isEnabled: true,
- isRequired: false,
- value:false
- }
- );
-
- parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
- type: "file",
- isRequired: false,
- isVisiblity: false
- }
- );
- }
-
- if( VIDCONFIGURATION.UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED && _this.componentId === COMPONENT.VOLUME_GROUP){
- parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- type: "checkbox",
- isEnabled: true,
- isRequired: false
- }
- );
-
- parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
- type: "file",
- isRequired: false,
- isVisiblity: false
- }
- );
- }
-
- addArbitraryParameters(parameterList);
-
- return parameterList;
- };
-
- var addArbitraryParameters = function(parameterList) {
- if ( DataService.getModelInfo(_this.componentId).displayInputs != null ) {
- var inputs = DataService.getModelInfo(_this.componentId).displayInputs;
- for ( var key in inputs) {
- var parameter = {
- id : key,
- type : PARAMETER.STRING,
- name : ComponentService.getFieldDisplayName(key),
- value : inputs[key][PARAMETER.DEFAULT],
- isRequired : inputs[key][PARAMETER.REQUIRED],
- description : inputs[key][PARAMETER.DESCRIPTION]
- };
- if ( DataService.getALaCarte() ) {
- parameter.name = ComponentService.getFieldDisplayName(inputs[key][PARAMETER.DISPLAY_NAME]);
- }
- switch (inputs[key][PARAMETER.TYPE]) {
- case PARAMETER.INTEGER:
- parameter.type = PARAMETER.NUMBER;
- break;
- case PARAMETER.BOOLEAN:
- parameter.type = PARAMETER.BOOLEAN;
- break;
- case PARAMETER.RANGE:
- break;
- case PARAMETER.LIST:
- parameter.type = PARAMETER.LIST;
- break;
- case PARAMETER.MAP:
- parameter.type = PARAMETER.MAP;
- break;
- }
-
- if ( UtilityService.hasContents(inputs[key][PARAMETER.CONSTRAINTS])
- && ( inputs[key][PARAMETER.CONSTRAINTS].length > 0 ) ) {
- var constraintsArray = inputs[key][PARAMETER.CONSTRAINTS];
- //console.log ("Calling addConstraintParameters for input name=" + key);
- addConstraintParameters (parameterList, constraintsArray, key, inputs, parameter);
- }
- else {
-
- parameterList.push(parameter);
- }
- }
- DataService.setArbitraryParameters (parameterList);
- }
- };
-
- var addConstraintParameters = function(parameterList, constraintsArray, key, inputs, parameter) {
- // If there are constraints and the operator is "valid_values",
- // use a select parameter type.
- var i = constraintsArray.length;
- var parameterPushed = false;
- if ( i > 0 ) {
- while ( (i--) && (!parameterPushed) ) {
- var keys = Object.keys(constraintsArray[i]);
- //var keys_len = keys.length;
- for ( var operator in keys ) {
- //console.log ("keys[operator]=" + keys[operator]);
- switch (keys[operator]) {
- case PARAMETER.VALID_VALUES:
- var j = constraintsArray[i][PARAMETER.VALID_VALUES].length;
- if ( j > 0 ) {
- var oList = [];
- var option;
- while (j--) {
- option = {
- name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
- isDefault: false
- }
- if ( ( UtilityService.hasContents (inputs[key][PARAMETER.DEFAULT]) )
- && (inputs[key][PARAMETER.DEFAULT] === constraintsArray[i][PARAMETER.VALID_VALUES][j] ) ) {
- option = {
- name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
- isDefault: true
- }
- }
- oList.push(option);
- }
- parameter.type = PARAMETER.SELECT;
- parameter.optionList = oList;
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for valid values");
- }
- break;
-
- case PARAMETER.EQUAL:
- if ( constraintsArray[i][PARAMETER.EQUAL] != null ) {
- //override parameter type
- parameter.type = PARAMETER.STRING;
- parameter.isReadOnly = true;
- parameter.value = constraintsArray[i][PARAMETER.EQUAL];
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for equal");
- }
- break;
-
- case PARAMETER.LENGTH:
- if ( constraintsArray[i][PARAMETER.LENGTH] != null ) {
- parameter.minLength = constraintsArray[i][PARAMETER.LENGTH];
- parameter.maxLength = constraintsArray[i][PARAMETER.LENGTH];
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for length: ");
- //console.log (JSON.stringify (parameter, null, 4));
- }
- break;
- case PARAMETER.MAX_LENGTH:
- if ( constraintsArray[i][PARAMETER.MAX_LENGTH] != null ) {
- parameter.maxLength = constraintsArray[i][PARAMETER.MAX_LENGTH];
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for max length: ");
- //console.log (JSON.stringify (parameter, null, 4));
- }
- break;
- case PARAMETER.MIN_LENGTH:
- if ( constraintsArray[i][PARAMETER.MIN_LENGTH] != null ) {
- parameter.minLength = constraintsArray[i][PARAMETER.MIN_LENGTH];
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for min length: ");
- //console.log (JSON.stringify (parameter, null, 4));
- }
- break;
- case PARAMETER.IN_RANGE:
- if ( constraintsArray[i][PARAMETER.IN_RANGE] != null ) {
- if (constraintsArray[i][PARAMETER.IN_RANGE].length > 1 ) {
- parameter.min = constraintsArray[i][PARAMETER.IN_RANGE][0];
- parameter.max = constraintsArray[i][PARAMETER.IN_RANGE][1];
- parameter.type = PARAMETER.NUMBER;
- parameter.value = inputs[key][PARAMETER.DEFAULT]
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for in_range");
- }
- }
- break;
- case PARAMETER.GREATER_THAN:
- if ( constraintsArray[i][PARAMETER.GREATER_THAN] != null ) {
- parameter.type = PARAMETER.NUMBER;
- parameter.min = constraintsArray[i][PARAMETER.GREATER_THAN];
- parameter.value = inputs[key][PARAMETER.DEFAULT]
- parameterList.push(parameter);
- parameterPushed = true;
- //console.log ("pushed param for greater_than");
-
- }
- break;
- }//switch
- }//for
-
- }//while
- }//if
- };
- var addToList = function(name, value) {
- _this.parameterList.push({
- name : name,
- value : value
- });
- };
- var setInventoryInfo = function(){
- var inventoryItem = DataService.getInventoryItem();
- var inventoryInfo = ComponentService.getInventoryInfo(
- _this.componentId, inventoryItem);
- }
-
- /*
- * The "*Mso*" functions return URL and request details that can be passed
- * to the MSO controller. The request details defines the info passed as
- * part of the POST body.
- */
-
- var getMsoUrl = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- return "mso_create_nw_instance/"
- + DataService.getServiceInstanceId();
- case COMPONENT.SERVICE:
- if(DataService.getE2EService() === true)
- return "mso_create_e2e_svc_instance";
- else
- return "mso_create_svc_instance";
- case COMPONENT.VNF:
- return "mso_create_vnf_instance/"
- + DataService.getServiceInstanceId();
- case COMPONENT.VF_MODULE:
- return "mso_create_vfmodule_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId();
- case COMPONENT.VOLUME_GROUP:
- return "mso_create_volumegroup_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId();
- }
- };
-
- var getMsoE2ERequest = function(parameterList) {
- var modelInfo = DataService.getModelInfo(_this.componentId);
-
- //region id
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- var cloudOwner = _.find(DataService.getCloudRegionTenantList(), function(region){
- return region.cloudRegionId === lcpRegion;
- }).cloudOwner;
-
- var params = [];
- var displayInputs = modelInfo.displayInputs;
- var groupBy = _.groupBy(displayInputs, "templateUUID");
-
- _.forEach(groupBy, function(nodeTemplateInputs, nodeTemplateUUID) {
- var reqParas = {};
- var vfLocations = [];
-
- nodeTemplateInputs.forEach(function(parameter){
- if(parameter.type === 'vf_location') {
- var loc = {
- vnfProfileId: parameter.displayName,
- locationConstraints : {
- vimId: cloudOwner + '_' + lcpRegion
- }
- };
- vfLocations.push(loc);
- } else if(parameter.type === 'sdn_controller') {
- if(parameter.value === undefined || parameter.value === null) {
- reqParas[parameter.name] = '';
- } else {
- reqParas[parameter.name] = parameter.value.value;
- }
- } else {
- var name;
- _.forEach(displayInputs, function(item, key){
- if(item === parameter) {
- name = key;
- }
- });
- var value = _.find(parameterList, function(item){
- return item.id === name;
- }).value;
- reqParas[parameter.displayName] = value;
- }
- });
-
- params.push({
- resourceName: nodeTemplateInputs[0].templateName,
- resourceInvariantUuid: nodeTemplateInputs[0].templateInvariantUUID,
- resourceUuid: nodeTemplateInputs[0].templateUUID,
- resourceCustomizationUuid: nodeTemplateInputs[0].templateCustomizationUUID,
- parameters: {
- locationConstraints: vfLocations,
- //TODO resources: [],
- requestInputs: reqParas
- }
- });
- });
-
- var requestBody = {
- service: {
- name: getValueFromList(FIELD.ID.INSTANCE_NAME, parameterList),
- description: modelInfo["description"],
- serviceInvariantUuid: modelInfo["modelInvariantId"],
- serviceUuid: modelInfo["modelNameVersionId"],
- globalSubscriberId: DataService.getGlobalCustomerId(),
- serviceType: getValueFromList(FIELD.ID.SERVICE_TYPE, parameterList) || modelInfo["serviceTypeName"],
- parameters: {
- locationConstraints: [],
- resources: params,
- requestInputs: {} //TODO
- }
- }
- };
-
- return requestBody;
- };
-
- var getMsoRequestDetails = function(parameterList) {
- console.log("getMsoRequestDetails invoked, parameterList="); console.log(JSON.stringify(parameterList,null,4));
- //console.log("getMsoRequestDetails invoked, DataService.getArbitraryParameters()=");
- //console.log(JSON.stringify(DataService.getArbitraryParameters(),null,4));
-
- //VoLTE logic goes here
- if(DataService.getE2EService() === true) {
- return getMsoE2ERequest(parameterList);
- }
-
- var modelInfo = DataService.getModelInfo(_this.componentId);
- var requestorloggedInId = DataService.getLoggedInUserId();
- var owningEntityId = getValueFromList(FIELD.ID.OWNING_ENTITY, parameterList);
- if (requestorloggedInId == null)
- requestorloggedInId = "";
- var isSupRollback = false;
- if (getValueFromList(FIELD.ID.SUPPRESS_ROLLBACK,parameterList) === "true") {
- isSupRollback = true;
- }
- var requestDetails = {
- requestInfo : {
- instanceName : getValueFromList(FIELD.ID.INSTANCE_NAME,
- parameterList) || DataService.getVfModuleInstanceName(),
- source : FIELD.ID.VID,
- suppressRollback : isSupRollback,
- requestorId: requestorloggedInId
- },
- modelInfo : {
- modelType : _this.componentId,
- modelInvariantId : modelInfo.modelInvariantId,
- modelVersionId : modelInfo.modelNameVersionId,
- modelName : modelInfo.modelName,
- modelVersion : modelInfo.modelVersion,
- modelCustomizationId: modelInfo.customizationUuid,
- modelCustomizationName : modelInfo.modelCustomizationName
- },
- requestParameters : {
- userParams : getArbitraryParameters(parameterList)
- }
- };
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
- if ((_this.componentId != COMPONENT.SERVICE) || ( DataService.getALaCarte() )) {
- requestDetails.requestParameters.testApi = DataService.getMsoRequestParametersTestApi();
- }
- }
- if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
- // include cloud region for everything but service create alacarte
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
- }
- switch (_this.componentId) {
-
- case COMPONENT.SERVICE:
- requestDetails.subscriberInfo = {
- globalSubscriberId : DataService.getGlobalCustomerId(),
- subscriberName : DataService.getSubscriberName()
- };
- var isInTop = DataService.getHideServiceFields() || false;
- if(isInTop){
- requestDetails.requestParameters.subscriptionServiceType = DataService.getModelInfo(_this.componentId)["serviceTypeName"];
- }else{
- requestDetails.requestParameters.subscriptionServiceType = getValueFromList(
- FIELD.ID.SERVICE_TYPE, parameterList);
- }
- requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
- if ( !DataService.getALaCarte() ) {
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
- }
- var svcModelInfo = {
- modelType : _this.componentId,
- modelInvariantId : modelInfo.modelInvariantId,
- modelVersionId : modelInfo.modelNameVersionId,
- modelName : modelInfo.modelName,
- modelVersion : modelInfo.modelVersion
- };
- requestDetails.modelInfo = svcModelInfo;
-
- var selectedProject = getValueFromList(FIELD.ID.PROJECT, parameterList);
-
- if (selectedProject) {
- requestDetails.project = {
- projectName: getValueFromList(FIELD.ID.PROJECT, parameterList)
- };
- }
-
- requestDetails.owningEntity = {
- owningEntityId: owningEntityId,
- owningEntityName: getOwningEntityNameById(owningEntityId)
- };
-
- break;
- case COMPONENT.VNF:
-
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
-
- var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
-
- if(lineOfBusiness) {
- var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
-
- requestDetails.lineOfBusiness = {
- lineOfBusinessName: lineOfBusinessNamesString
- }
- }
-
- requestDetails.platform = {
- platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
- };
-
- break;
- case COMPONENT.NETWORK:
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
- var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
-
- if(lineOfBusiness) {
- var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
-
- requestDetails.lineOfBusiness = {
- lineOfBusinessName: lineOfBusinessNamesString
- }
- }
-
- requestDetails.platform = {
- platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
- };
- break;
- case COMPONENT.VF_MODULE:
- requestDetails.requestParameters.usePreload = getValueFromList(
- FIELD.ID.SDN_C_PRELOAD, parameterList);
- if(_this.componentId == COMPONENT.VF_MODULE &&(requestDetails.requestParameters.usePreload== null || requestDetails.requestParameters.usePreload === '')){
- requestDetails.requestParameters.usePreload = false;
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- break;
- }
-
- var relatedInstanceList = getRelatedInstanceList(parameterList);
-
- if (relatedInstanceList !== undefined) {
- requestDetails.relatedInstanceList = relatedInstanceList;
- }
-
- return requestDetails;
- };
-
- var getRelatedInstanceList = function(parameterList) {
- var relatedInstanceList = new Array();
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- return undefined;
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- break;
- case COMPONENT.VF_MODULE:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
- .getVnfInstanceId());
-
- var availableVolumeGroup = getValueFromList(
- FIELD.ID.AVAILABLE_VOLUME_GROUP, parameterList);
-
- if (UtilityService.hasContents(availableVolumeGroup) && availableVolumeGroup !== "None") {
- var availableVolumeGroups = DataService.getAvailableVolumeGroupList();
-
- for (var i = 0; i < availableVolumeGroups.length; i++) {
- if (availableVolumeGroups[i].instance.name == availableVolumeGroup) {
- DataService.setModelInfo(COMPONENT.VOLUME_GROUP, DataService.getModelInfo(COMPONENT.VF_MODULE));
- DataService.setVolumeGroupInstanceId(availableVolumeGroups[i].instance.object["volume-group-id"]);
- break;
- }
- }
-
- addRelatedInstance(relatedInstanceList, COMPONENT.VOLUME_GROUP,
- DataService.getVolumeGroupInstanceId());
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
- .getVnfInstanceId());
- break;
- }
-
- return relatedInstanceList;
- };
-
- var addRelatedInstance = function(relatedInstanceList, componentId,
- instanceId) {
- var modelInfo = DataService.getModelInfo(componentId);
- var relatedInstance;
- if (modelInfo !== undefined) {
- if (componentId === COMPONENT.SERVICE) {
- relatedInstance = {
- "instanceId" : instanceId,
- "modelInfo" : {
- "modelType" : componentId,
- "modelName" : modelInfo.modelName,
- "modelInvariantId" : modelInfo.modelInvariantId,
- "modelVersion" : modelInfo.modelVersion,
- "modelVersionId" : modelInfo.modelNameVersionId,
-
- }
- };
- }
- else {
- relatedInstance = {
- "instanceId" : instanceId,
- "modelInfo" : {
- "modelType" : componentId,
- "modelName" : modelInfo.modelName,
- "modelInvariantId" : modelInfo.modelInvariantId,
- "modelVersion" : modelInfo.modelVersion,
- "modelVersionId" : modelInfo.modelNameVersionId,
- "modelCustomizationId": modelInfo.customizationUuid,
- "modelCustomizationName": modelInfo.modelCustomizationName
- }
- }
- }
- relatedInstanceList.push({
- relatedInstance : relatedInstance
- });
- }
- };
-
- /*
- * var getArbitraryParameters = function(parameterList) { var
- * arbitraryParameters = new Object(); for (var i = 0; i <
- * parameterList.length; i++) { var parameter = parameterList[i]; switch
- * (parameter.id) { case FIELD.ID.INSTANCE_NAME: case
- * FIELD.ID.PRODUCT_FAMILY: case FIELD.ID.LCP_REGION: case
- * FIELD.ID.LCP_REGION_TEXT: case FIELD.ID.SERVICE_TYPE: case
- * FIELD.ID.TENANT: case FIELD.ID.SUPPRESS_ROLLBACK: break; default:
- * arbitraryParameters[parameter.id] = parameter.value; } } return
- * arbitraryParameters; }
- */
- var getArbitraryParameters = function(parameterList) {
- var arbitraryParameters = new Object();
- var arbitraryArray = new Array();
- for (var i = 0; i < parameterList.length; i++) {
- var parameter = parameterList[i];
- switch (parameter.id) {
- case FIELD.ID.AVAILABLE_VOLUME_GROUP:
- case FIELD.ID.INSTANCE_NAME:
- case FIELD.ID.PRODUCT_FAMILY:
- case FIELD.ID.LCP_REGION:
- case FIELD.ID.LCP_REGION_TEXT:
- case FIELD.ID.SERVICE_TYPE:
- case FIELD.ID.TENANT:
- case FIELD.ID.SUPPRESS_ROLLBACK:
- case FIELD.ID.SUBSCRIBER_NAME:
- case FIELD.ID.SDN_C_PRELOAD:
- case FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE:
- case FIELD.ID.OWNING_ENTITY:
- case FIELD.ID.PLATFORM:
- case FIELD.ID.LINE_OF_BUSINESS:
- case FIELD.ID.PROJECT:
- break;
- case FIELD.ID.SUPPLEMENTORY_DATA_FILE:
- arbitraryParameters = FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'];
- arbitraryArray=arbitraryParameters;
- FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value']=[];
- break;
-
- default:
- if (parameter.value != '') {
- arbitraryParameters = {
- name: parameter.id,
- value: parameter.value
- }
- arbitraryArray.push(arbitraryParameters);
- }
- }
- }
- return (arbitraryArray);
- }
-
- var getModel = function() {
- AsdcService.getModel(DataService.getModelId(), function(response) {
- DataService.setModelInfo(_this.componentId, {
- modelInvariantId : response.data.invariantUUID,
- modelNameVersionId : response.data.uuid,
- modelName : response.data.name,
- modelVersion : response.data.version,
- inputs : response.data.inputs
- });
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getSubscriptionServiceTypeList = function() {
- AaiService.getSubscriptionServiceTypeList(DataService
- .getGlobalCustomerId(), function(response) {
- DataService.setSubscriptionServiceTypeList(response);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getLoggedInUserID = function() {
- AaiService.getLoggedInUserID(function(response) {
- DataService.setLoggedInUserId(response.data);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getSubscribers = function() {
- AaiService.getSubscribers(function(response) {
- DataService.setSubscribers(response);
- UtilityService.startNextAsyncOperation();
- });
- };
- var getServices = function() {
- AaiService.getServices(function(response) {
- var serviceIdList = [];
- angular.forEach(response.data, function(value, key) {
- angular.forEach(value, function(subVal, key) {
- var newVal = {
- "id" : subVal[FIELD.ID.SERVICE_ID],
- "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION],
- "isPermitted" : subVal[FIELD.ID.IS_PERMITTED],
- };
- serviceIdList.push(newVal);
- DataService.setServiceIdList(serviceIdList);
- });
- });
-
- UtilityService.startNextAsyncOperation();
- });
- };
- var getAicZones = function() {
- AaiService.getAicZones(function(response) {
- var serviceIdList = [];
- angular.forEach(response.data, function(value, key) {
- angular.forEach(value, function(subVal, key) {
- var newVal = {
- "id" : subVal[FIELD.ID.ZONE_ID],
- "name" : subVal[FIELD.ID.ZONE_NAME],
- };
- serviceIdList.push(newVal);
- DataService.setAicZones(serviceIdList);
- });
- });
-
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getOwningEntityProperties = function() {
- OwningEntityService.getOwningEntityProperties(function(owningEntityProperties) {
- DataService.setOwningEntityProperties(owningEntityProperties);
- UtilityService.startNextAsyncOperation();
- });
-
- };
-
- var getLcpCloudRegionTenantList = function() {
- AaiService.getLcpCloudRegionTenantList(DataService
- .getGlobalCustomerId(), DataService.getServiceType(), function(
- response) {
- DataService.setCloudRegionTenantList(response);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var internalGetParametersHandler = function() {
- if (angular.isFunction(_this.getParametersHandler)) {
- _this.getParametersHandler({
- summaryList : getSummaryList(),
- userProvidedList : getUserProvidedList()
- });
- }
- };
-
- var getSubscribersParameter = function() {
- var subscribers = DataService.getSubscribers();
- var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
- if ( UtilityService.hasContents(subscribers)) {
- parameter.optionList = [];
-
- for (var i = 0; i < subscribers.length; i++) {
- parameter.optionList.push({
- id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
- name : subscribers[i][FIELD.ID.SUBNAME],
- isPermitted : subscribers[i][FIELD.ID.IS_PERMITTED]
- })
- }
- }
- return parameter;
- };
-
- var getServiceId = function() {
- var serviceIdList = DataService.getServiceIdList();
- //var serviceTypeList = DataService.getSubscriptionServiceTypeList();
- var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
- parameter.optionList = new Array();
- if ( UtilityService.hasContents(serviceIdList) ) {
- // load them all
- for (var i = 0; i < serviceIdList.length; i++) {
- parameter.optionList.push({
- id : serviceIdList[i].id,
- name : serviceIdList[i].description,
- isPermitted : serviceIdList[i].isPermitted
- });
- }
- }
-
- return parameter;
- };
-
- var getAicZonesParameter = function() {
- var aicList = DataService.getAicZones();
- var parameter = FIELD.PARAMETER.AIC_ZONES;
- parameter.optionList = new Array();
- if ( UtilityService.hasContents(aicList) ) {
- // load them all
- for (var i = 0; i < aicList.length; i++) {
- parameter.optionList.push({
- id : aicList[i].id,
- name : aicList[i].name,
- isPermitted : true
-
- });
- }
- }
-
- return parameter;
- };
-
- var getProjectParameter = function() {
- return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PROJECT);
- };
-
- var getOwningEntityParameter = function() {
- return getOwningEntityParameterWithOptions(FIELD.PARAMETER.OWNING_ENTITY);
- };
-
- var getLineOfBusinessParameter = function() {
- return getOwningEntityParameterWithOptions(FIELD.PARAMETER.LINE_OF_BUSINESS);
- };
-
- var getPlatformParameter = function() {
- return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PLATFORM);
- };
-
- var getOwningEntityNameById = function (id) {
- var properties = DataService.getOwningEntityProperties();
- var parameter = _.find(properties[FIELD.ID.OWNING_ENTITY], {"id": id});
- return parameter && parameter.name;
- };
-
- var getOwningEntityParameterWithOptions = function(parameter) {
- var properties = DataService.getOwningEntityProperties();
- if (properties && properties[parameter.id]) {
- parameter.optionList = _.map(properties[parameter.id], function(parameter) {
- return {
- "id" : parameter.id,
- "name" : parameter.name,
- "isPermitted": true
- };
- });
- }
-
- return parameter;
- };
-
- var getLcpRegionParameter = function() {
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- console.log ( "cloudRegionTenantList=");
- console.log ( JSON.stringify (cloudRegionTenantList, null, 4 ));
-
- var parameter = FIELD.PARAMETER.LCP_REGION;
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- for (var j = 0; j < parameter.optionList.length; j++) {
- if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
- parameter.optionList[j].isPermitted =
- parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted;
- break;
- }
- }
- if (j < parameter.optionList.length) {
- continue;
- }
-
- var optionName = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST) && cloudRegionTenantList[i].cloudOwner ?
- cloudRegionTenantList[i].cloudRegionId + " (" + cloudRegionTenantList[i].cloudOwner.trim().toLowerCase().replace(/^att-/, "").toUpperCase() + ")" :
- cloudRegionTenantList[i].cloudRegionId;
-
- parameter.optionList.push({
- id : cloudRegionTenantList[i].cloudRegionId,
- name: optionName,
- isPermitted : cloudRegionTenantList[i].isPermitted
- });
- }
- }
- return parameter;
- };
-
- var getTenantList = function(cloudRegionId) {
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- var parameter = "";
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- parameter = FIELD.PARAMETER.TENANT_ENABLED;
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
- parameter.optionList.push({
- id : cloudRegionTenantList[i].tenantId,
- name : cloudRegionTenantList[i].tenantName,
- isPermitted : cloudRegionTenantList[i].isPermitted
-
- });
- }
- }
- }
- return parameter;
-
- };
-
- var addOptionList = function(parameter, optionSimpleArray) {
- var optionList = new Array();
- if (!angular.isArray(optionSimpleArray)) {
- return optionList;
- }
- for (var i = 0; i < optionSimpleArray.length; i++) {
- optionList.push({
- name : optionSimpleArray[i],
- isPermitted :true,
- });
- }
- parameter.optionList = optionList;
- return parameter;
- };
-
- var getValueFromList = function(id, parameterList) {
- for (var i = 0; i < parameterList.length; i++) {
- if (parameterList[i].id === id) {
- return parameterList[i].value;
- }
- }
- };
- var updateUserParameterList = function(updatedId, parameterListControl) {
- console.log ("updateUserParameterList() updatedId=" + updatedId);
- if (updatedId === FIELD.ID.PRODUCT_FAMILY && DataService.getHideServiceFields()) {
- var cloudRegionTenantList = new Array();
- AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
- DataService.setCloudRegionTenantList(cloudRegionTenantList);
- parameterListControl.updateList([ getLcpRegionParameter() ]);
- });
- }else if (updatedId === FIELD.ID.SDN_C_PRELOAD) {
- var list = parameterListControl.getList(updatedId);
- if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
- FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED.value=true;
- parameterListControl
- .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED ]);
- }else{
- parameterListControl
- .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_UNCHECKED ]);
- }
- }else if (updatedId === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE) {
- if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
- $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').show();
- FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=true;
- parameterListControl
- .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED ]);
- }else{
- $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').hide();
- FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=false;
- parameterListControl
- .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_UNCHECKED ]);
- }
- } else if (updatedId === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
- var filePath = $('input[parameter-id="'+updatedId+'"]').val();
- var arr =filePath.split('.');
- var fileExt = arr[arr.length-1];
- if(fileExt!='' && fileExt.toLowerCase()!='json'){
- $('input[parameter-id="'+updatedId+'"]').val('');
- alert("Invalid file format. Please select *.json format file.");
- return false;
- }
- } else if (updatedId === FIELD.ID.LCP_REGION) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- parameterListControl
- .updateList([ getTenantList(list[0].value) ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
- }
- } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- DataService.setGlobalCustomerId(list[0].value);
-
- AaiService.getSubscriptionServiceTypeList(DataService
- .getGlobalCustomerId(), function(response) {
- DataService.setSubscriptionServiceTypeList(response);
- var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
- serviceTypeParameters.optionList = [];
-
- for (var i = 0; i < response.length; i++) {
- serviceTypeParameters.optionList.push({
- "id" : response[i].name,
- "name" : response[i].name,
- "isPermitted" :response[i].isPermitted
-
- });
- }
- console.log ( "updateUserParameterList: service type parameters " );
- console.log ( JSON.stringify (serviceTypeParameters, null, 4));
- parameterListControl.updateList([ serviceTypeParameters ]);
- });
-
- }
- } else if ( updatedId === FIELD.ID.SERVICE_TYPE ) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
-
- DataService.setServiceType(list[0].value);
- var cloudRegionTenantList = new Array();
- AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
- DataService.setCloudRegionTenantList(cloudRegionTenantList);
- parameterListControl.updateList([ getLcpRegionParameter() ]);
- });
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
- }
- }
-
- };
-
- return {
- initializeComponent : function(componentId) {
- _this.componentId = ComponentService.initialize(componentId);
- },
- setHttpErrorHandler : function(httpErrorHandler) {
- _this.httpErrorHandler = httpErrorHandler;
- },
- getComponentDisplayName : ComponentService.getComponentDisplayName,
- getParameters : function(getParametersHandler) {
- _this.getParametersHandler = getParametersHandler;
- UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
- UtilityService.startAsyncOperations(getAsyncOperationList(),
- internalGetParametersHandler);
- },
- updateUserParameterList : updateUserParameterList,
- getMsoRequestDetails : getMsoRequestDetails,
- getMsoUrl : getMsoUrl,
- setInventoryInfo: setInventoryInfo
- }
-}
-
-appDS2.factory("CreationService", [ "$log", "AaiService", "AsdcService",
- "DataService","VIDCONFIGURATION", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
- "UtilityService", "OwningEntityService","featureFlags", CreationService ]);
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+"use strict";
+
+/*
+ * "CreationService" isolates the "component-specific" logic required by the
+ * "CreationDialog" controller.
+ *
+ * "Components" are defined as the 5 element types managed by the dialogs: A)
+ * Service B) VNF C) VF Module D) Volume Group and E) Network.
+ *
+ */
+
+var CreationService = function($log, AaiService, AsdcService, DataService,VIDCONFIGURATION,
+ ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService, OwningEntityService,featureFlags) {
+
+ var _this = this;
+ var getAsyncOperationList = function() {
+ if (DataService.getLoggedInUserId() == null) {
+ getLoggedInUserID();
+ } else {
+ UtilityService.startNextAsyncOperation();
+ }
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return [ getSubscribers, getServices, getAicZones, getOwningEntityProperties ];
+ case COMPONENT.NETWORK:
+ return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
+ case COMPONENT.VNF:
+ return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
+ case COMPONENT.VF_MODULE:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VOLUME_GROUP:
+ return [ getLcpCloudRegionTenantList ];
+ }
+ };
+
+ /*
+ * "getSummaryList" and "getUserProvidedList" return parameters that should
+ * be displayed in the summary and user provided sections, respectively. The
+ * functions are expected to return lists that are in the format needed by
+ * the parameter-block directive.
+ */
+
+ var getSummaryList = function() {
+
+ /*
+ * These placeholders should be removed and their usage in
+ * "getSummaryList" should be replaced by appropriate code as the
+ * requirements and interfaces firm up.
+ */
+
+ var PLACEHOLDER_RESOURCE_DESCRIPTION = "Resource Description (PLACEHOLDER)";
+ var PLACEHOLDER_SERVICE_CATEGORY = "Service Category (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_DESCRIPTION = "VF Module Description (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_LABEL = "VF Module Label (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_TYPE = "VF Module Type (PLACEHOLDER)";
+
+ _this.parameterList = new Array();
+
+ /*
+ * Common fields displayed at the top of all create instance screens.
+ */
+ if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]==null
+ || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==undefined
+ || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==''){
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+ }
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ if ( !DataService.getALaCarte() ) {
+ // for macro instantiation need to add the resource names under the node template list
+ // this field is called modelCustomizationName in the asdc client code
+ var p;
+ var rlist = DataService.getResources();
+ var res;
+ if ( rlist != null ) {
+ for (var i = 0; i < rlist.length; i++) {
+ res = rlist[i];
+
+ p = FIELD.NAME.RESOURCE_NAME.concat(" " + (i+1));
+ addToList(p, res.name );
+ p = FIELD.NAME.RESOURCE_DESCRIPTION.concat(" " + (i+1));
+ addToList(p, res.description );
+ }
+ }
+ }
+ if(DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=null && DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=''){
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getModelInfo(_this.componentId)["createSubscriberName"]);
+ }
+ if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=null && DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=''){
+ addToList(FIELD.NAME.SERVICE_TYPE, DataService
+ .getModelInfo(_this.componentId)["serviceTypeName"]);
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+ }
+ addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.SERVICE_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.SERVICE_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
+ addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
+ if (DataService.getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE] != "null") {
+ addToList(FIELD.NAME.SERVICE_TYPE, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE]);
+ addToList(FIELD.NAME.SERVICE_ROLE, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_ROLE]);
+ }
+
+ break;
+ case COMPONENT.VF_MODULE:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ case COMPONENT.VNF:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_CUSTOMIZATION_NAME]);
+ addToList(FIELD.NAME.MODEL_VNF_TYPE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_TYPE]);
+ addToList(FIELD.NAME.MODEL_VNF_ROLE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_ROLE]);
+ addToList(FIELD.NAME.MODEL_VNF_FUNCTION, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_FUNCTION]);
+ addToList(FIELD.NAME.MODEL_VNF_CODE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_CODE]);
+ break;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VOLUME_GROUP:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ }
+
+ return _this.parameterList;
+ };
+
+ var getUserProvidedList = function() {
+ var parameterList = [];
+ var isUserProvidedNaming = false;
+ if ( ((DataService.getModelInfo(_this.componentId).serviceEcompNaming != null)
+ && (DataService.getModelInfo(_this.componentId).serviceEcompNaming === "false")) || DataService.getE2EService() ) {
+ isUserProvidedNaming = true;
+ }
+
+ var isInTop = DataService.getHideServiceFields() || false;
+ if (_this.componentId === COMPONENT.SERVICE) {
+ if ( DataService.getALaCarte() ) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ if(!isInTop){
+ parameterList = parameterList.concat([ getSubscribersParameter(),
+ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+ else {
+ // macro
+
+ if(!isInTop){
+ if (isUserProvidedNaming) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+
+ }
+ parameterList = parameterList.concat([ getSubscribersParameter() ]);
+ parameterList = parameterList.concat([ getServiceId(),
+ FIELD.PARAMETER.SERVICE_TYPE,
+ FIELD.PARAMETER.LCP_REGION,
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+ if(!DataService.getE2EService()) {
+ parameterList = parameterList.concat([getAicZonesParameter()]);
+ }
+
+ }else{
+ parameterList = parameterList.concat([ getServiceId(),
+ FIELD.PARAMETER.LCP_REGION,
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+
+ if(!DataService.getE2EService()) {
+ parameterList = parameterList.concat([getProjectParameter()]);
+ parameterList = parameterList.concat([getOwningEntityParameter()]);
+ }
+
+ //if service model has a pnf, add a PNF ID parameter
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_PNP_INSTANTIATION) && DataService.getPnf()) {
+ parameterList = parameterList.concat([ FIELD.PARAMETER.PNF_ID ]);
+ }
+ }
+ else {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ parameterList = parameterList.concat([ getServiceId(),
+ getLcpRegionParameter(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ parameterList = parameterList.concat([ getLineOfBusinessParameter() ]);
+ parameterList = parameterList.concat([ getPlatformParameter() ]);
+
+ break;
+ case COMPONENT.VF_MODULE:
+ parameterList = parameterList.concat([
+ getLcpRegionParameter(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+
+ var availableVolumeGroupList = DataService.getAvailableVolumeGroupList();
+
+ if (availableVolumeGroupList && availableVolumeGroupList.length > 0) {
+ var availableVolumeGroupNames = [FIELD.STATUS.NONE];
+
+ for (var i = 0; i < availableVolumeGroupList.length; i++) {
+ availableVolumeGroupNames.push(availableVolumeGroupList[i].instance.name);
+ }
+
+ parameterList.push(addOptionList(
+ FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP,
+ availableVolumeGroupNames));
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ parameterList = parameterList.concat([ getLcpRegionParameter(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+ parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
+ if(_this.componentId === COMPONENT.VF_MODULE ){
+ parameterList.push({name: FIELD.NAME.SDN_C_PRELOAD,
+ id: FIELD.ID.SDN_C_PRELOAD,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false,
+ hideFieldAndLabel: true
+ }
+ );
+ parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false,
+ value:false
+ }
+ );
+
+ parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
+ type: "file",
+ isRequired: false,
+ isVisiblity: false
+ }
+ );
+ }
+
+ if( VIDCONFIGURATION.UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED && _this.componentId === COMPONENT.VOLUME_GROUP){
+ parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false
+ }
+ );
+
+ parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
+ type: "file",
+ isRequired: false,
+ isVisiblity: false
+ }
+ );
+ }
+
+ addArbitraryParameters(parameterList);
+
+ return parameterList;
+ };
+
+ var addArbitraryParameters = function(parameterList) {
+ if ( DataService.getModelInfo(_this.componentId).displayInputs != null ) {
+ var inputs = DataService.getModelInfo(_this.componentId).displayInputs;
+ for ( var key in inputs) {
+ var parameter = {
+ id : key,
+ type : PARAMETER.STRING,
+ name : ComponentService.getFieldDisplayName(key),
+ value : inputs[key][PARAMETER.DEFAULT],
+ isRequired : inputs[key][PARAMETER.REQUIRED],
+ description : inputs[key][PARAMETER.DESCRIPTION]
+ };
+ if ( DataService.getALaCarte() ) {
+ parameter.name = ComponentService.getFieldDisplayName(inputs[key][PARAMETER.DISPLAY_NAME]);
+ }
+ switch (inputs[key][PARAMETER.TYPE]) {
+ case PARAMETER.INTEGER:
+ parameter.type = PARAMETER.NUMBER;
+ break;
+ case PARAMETER.BOOLEAN:
+ parameter.type = PARAMETER.BOOLEAN;
+ break;
+ case PARAMETER.RANGE:
+ break;
+ case PARAMETER.LIST:
+ parameter.type = PARAMETER.LIST;
+ break;
+ case PARAMETER.MAP:
+ parameter.type = PARAMETER.MAP;
+ break;
+ }
+
+ if ( UtilityService.hasContents(inputs[key][PARAMETER.CONSTRAINTS])
+ && ( inputs[key][PARAMETER.CONSTRAINTS].length > 0 ) ) {
+ var constraintsArray = inputs[key][PARAMETER.CONSTRAINTS];
+ //console.log ("Calling addConstraintParameters for input name=" + key);
+ addConstraintParameters (parameterList, constraintsArray, key, inputs, parameter);
+ }
+ else {
+
+ parameterList.push(parameter);
+ }
+ }
+ DataService.setArbitraryParameters (parameterList);
+ }
+ };
+
+ var addConstraintParameters = function(parameterList, constraintsArray, key, inputs, parameter) {
+ // If there are constraints and the operator is "valid_values",
+ // use a select parameter type.
+ var i = constraintsArray.length;
+ var parameterPushed = false;
+ if ( i > 0 ) {
+ while ( (i--) && (!parameterPushed) ) {
+ var keys = Object.keys(constraintsArray[i]);
+ //var keys_len = keys.length;
+ for ( var operator in keys ) {
+ //console.log ("keys[operator]=" + keys[operator]);
+ switch (keys[operator]) {
+ case PARAMETER.VALID_VALUES:
+ var j = constraintsArray[i][PARAMETER.VALID_VALUES].length;
+ if ( j > 0 ) {
+ var oList = [];
+ var option;
+ while (j--) {
+ option = {
+ name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
+ isDefault: false
+ }
+ if ( ( UtilityService.hasContents (inputs[key][PARAMETER.DEFAULT]) )
+ && (inputs[key][PARAMETER.DEFAULT] === constraintsArray[i][PARAMETER.VALID_VALUES][j] ) ) {
+ option = {
+ name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
+ isDefault: true
+ }
+ }
+ oList.push(option);
+ }
+ parameter.type = PARAMETER.SELECT;
+ parameter.optionList = oList;
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for valid values");
+ }
+ break;
+
+ case PARAMETER.EQUAL:
+ if ( constraintsArray[i][PARAMETER.EQUAL] != null ) {
+ //override parameter type
+ parameter.type = PARAMETER.STRING;
+ parameter.isReadOnly = true;
+ parameter.value = constraintsArray[i][PARAMETER.EQUAL];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for equal");
+ }
+ break;
+
+ case PARAMETER.LENGTH:
+ if ( constraintsArray[i][PARAMETER.LENGTH] != null ) {
+ parameter.minLength = constraintsArray[i][PARAMETER.LENGTH];
+ parameter.maxLength = constraintsArray[i][PARAMETER.LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.MAX_LENGTH:
+ if ( constraintsArray[i][PARAMETER.MAX_LENGTH] != null ) {
+ parameter.maxLength = constraintsArray[i][PARAMETER.MAX_LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for max length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.MIN_LENGTH:
+ if ( constraintsArray[i][PARAMETER.MIN_LENGTH] != null ) {
+ parameter.minLength = constraintsArray[i][PARAMETER.MIN_LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for min length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.IN_RANGE:
+ if ( constraintsArray[i][PARAMETER.IN_RANGE] != null ) {
+ if (constraintsArray[i][PARAMETER.IN_RANGE].length > 1 ) {
+ parameter.min = constraintsArray[i][PARAMETER.IN_RANGE][0];
+ parameter.max = constraintsArray[i][PARAMETER.IN_RANGE][1];
+ parameter.type = PARAMETER.NUMBER;
+ parameter.value = inputs[key][PARAMETER.DEFAULT]
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for in_range");
+ }
+ }
+ break;
+ case PARAMETER.GREATER_THAN:
+ if ( constraintsArray[i][PARAMETER.GREATER_THAN] != null ) {
+ parameter.type = PARAMETER.NUMBER;
+ parameter.min = constraintsArray[i][PARAMETER.GREATER_THAN];
+ parameter.value = inputs[key][PARAMETER.DEFAULT]
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for greater_than");
+
+ }
+ break;
+ }//switch
+ }//for
+
+ }//while
+ }//if
+ };
+ var addToList = function(name, value) {
+ _this.parameterList.push({
+ name : name,
+ value : value
+ });
+ };
+ var setInventoryInfo = function(){
+ var inventoryItem = DataService.getInventoryItem();
+ var inventoryInfo = ComponentService.getInventoryInfo(
+ _this.componentId, inventoryItem);
+ }
+
+ /*
+ * The "*Mso*" functions return URL and request details that can be passed
+ * to the MSO controller. The request details defines the info passed as
+ * part of the POST body.
+ */
+
+ var getMsoUrl = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ return "mso_create_nw_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.SERVICE:
+ if(DataService.getE2EService() === true)
+ return "mso_create_e2e_svc_instance";
+ else
+ return "mso_create_svc_instance";
+ case COMPONENT.VNF:
+ return "mso_create_vnf_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.VF_MODULE:
+ return "mso_create_vfmodule_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ case COMPONENT.VOLUME_GROUP:
+ return "mso_create_volumegroup_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ }
+ };
+
+ var getMsoE2ERequest = function(parameterList) {
+ var modelInfo = DataService.getModelInfo(_this.componentId);
+
+ //region id
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ var cloudOwner = _.find(DataService.getCloudRegionTenantList(), function(region){
+ return region.cloudRegionId === lcpRegion;
+ }).cloudOwner;
+
+ var params = [];
+ var displayInputs = modelInfo.displayInputs;
+ var groupBy = _.groupBy(displayInputs, "templateUUID");
+
+ _.forEach(groupBy, function(nodeTemplateInputs, nodeTemplateUUID) {
+ var reqParas = {};
+ var vfLocations = [];
+
+ nodeTemplateInputs.forEach(function(parameter){
+ if(parameter.type === 'vf_location') {
+ var loc = {
+ vnfProfileId: parameter.displayName,
+ locationConstraints : {
+ vimId: cloudOwner + '_' + lcpRegion
+ }
+ };
+ vfLocations.push(loc);
+ } else if(parameter.type === 'sdn_controller') {
+ if(parameter.value === undefined || parameter.value === null) {
+ reqParas[parameter.name] = '';
+ } else {
+ reqParas[parameter.name] = parameter.value.value;
+ }
+ } else {
+ var name;
+ _.forEach(displayInputs, function(item, key){
+ if(item === parameter) {
+ name = key;
+ }
+ });
+ var value = _.find(parameterList, function(item){
+ return item.id === name;
+ }).value;
+ reqParas[parameter.displayName] = value;
+ }
+ });
+
+ params.push({
+ resourceName: nodeTemplateInputs[0].templateName,
+ resourceInvariantUuid: nodeTemplateInputs[0].templateInvariantUUID,
+ resourceUuid: nodeTemplateInputs[0].templateUUID,
+ resourceCustomizationUuid: nodeTemplateInputs[0].templateCustomizationUUID,
+ parameters: {
+ locationConstraints: vfLocations,
+ //TODO resources: [],
+ requestInputs: reqParas
+ }
+ });
+ });
+
+ var requestBody = {
+ service: {
+ name: getValueFromList(FIELD.ID.INSTANCE_NAME, parameterList),
+ description: modelInfo["description"],
+ serviceInvariantUuid: modelInfo["modelInvariantId"],
+ serviceUuid: modelInfo["modelNameVersionId"],
+ globalSubscriberId: DataService.getGlobalCustomerId(),
+ serviceType: getValueFromList(FIELD.ID.SERVICE_TYPE, parameterList) || modelInfo["serviceTypeName"],
+ parameters: {
+ locationConstraints: [],
+ resources: params,
+ requestInputs: {} //TODO
+ }
+ }
+ };
+
+ return requestBody;
+ };
+
+ var getMsoRequestDetails = function(parameterList) {
+ console.log("getMsoRequestDetails invoked, parameterList="); console.log(JSON.stringify(parameterList,null,4));
+ //console.log("getMsoRequestDetails invoked, DataService.getArbitraryParameters()=");
+ //console.log(JSON.stringify(DataService.getArbitraryParameters(),null,4));
+
+ //VoLTE logic goes here
+ if(DataService.getE2EService() === true) {
+ return getMsoE2ERequest(parameterList);
+ }
+
+ var modelInfo = DataService.getModelInfo(_this.componentId);
+ var requestorloggedInId = DataService.getLoggedInUserId();
+ var owningEntityId = getValueFromList(FIELD.ID.OWNING_ENTITY, parameterList);
+ if (requestorloggedInId == null)
+ requestorloggedInId = "";
+ var isSupRollback = false;
+ if (getValueFromList(FIELD.ID.SUPPRESS_ROLLBACK,parameterList) === "true") {
+ isSupRollback = true;
+ }
+ var requestDetails = {
+ requestInfo : {
+ instanceName : getValueFromList(FIELD.ID.INSTANCE_NAME,
+ parameterList) || DataService.getVfModuleInstanceName(),
+ source : FIELD.ID.VID,
+ suppressRollback : isSupRollback,
+ requestorId: requestorloggedInId
+ },
+ modelInfo : {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion,
+ modelCustomizationId: modelInfo.customizationUuid,
+ modelCustomizationName : modelInfo.modelCustomizationName
+ },
+ requestParameters : {
+ userParams : getArbitraryParameters(parameterList)
+ }
+ };
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
+ if ((_this.componentId != COMPONENT.SERVICE) || ( DataService.getALaCarte() )) {
+ requestDetails.requestParameters.testApi = DataService.getMsoRequestParametersTestApi();
+ }
+ }
+ if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
+ // include cloud region for everything but service create alacarte
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+ }
+ switch (_this.componentId) {
+
+ case COMPONENT.SERVICE:
+ requestDetails.subscriberInfo = {
+ globalSubscriberId : DataService.getGlobalCustomerId(),
+ subscriberName : DataService.getSubscriberName()
+ };
+ var isInTop = DataService.getHideServiceFields() || false;
+ if(isInTop){
+ requestDetails.requestParameters.subscriptionServiceType = DataService.getModelInfo(_this.componentId)["serviceTypeName"];
+ }else{
+ requestDetails.requestParameters.subscriptionServiceType = getValueFromList(
+ FIELD.ID.SERVICE_TYPE, parameterList);
+ }
+ requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
+ if ( !DataService.getALaCarte() ) {
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ }
+ var svcModelInfo = {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion
+ };
+ requestDetails.modelInfo = svcModelInfo;
+
+ var selectedProject = getValueFromList(FIELD.ID.PROJECT, parameterList);
+
+ if (selectedProject) {
+ requestDetails.project = {
+ projectName: getValueFromList(FIELD.ID.PROJECT, parameterList)
+ };
+ }
+
+ requestDetails.owningEntity = {
+ owningEntityId: owningEntityId,
+ owningEntityName: getOwningEntityNameById(owningEntityId)
+ };
+
+ break;
+ case COMPONENT.VNF:
+
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+
+ var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
+
+ if(lineOfBusiness) {
+ var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
+
+ requestDetails.lineOfBusiness = {
+ lineOfBusinessName: lineOfBusinessNamesString
+ }
+ }
+
+ requestDetails.platform = {
+ platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
+ };
+
+ break;
+ case COMPONENT.NETWORK:
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
+
+ if(lineOfBusiness) {
+ var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
+
+ requestDetails.lineOfBusiness = {
+ lineOfBusinessName: lineOfBusinessNamesString
+ }
+ }
+
+ requestDetails.platform = {
+ platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
+ };
+ break;
+ case COMPONENT.VF_MODULE:
+ requestDetails.requestParameters.usePreload = getValueFromList(
+ FIELD.ID.SDN_C_PRELOAD, parameterList);
+ if(_this.componentId == COMPONENT.VF_MODULE &&(requestDetails.requestParameters.usePreload== null || requestDetails.requestParameters.usePreload === '')){
+ requestDetails.requestParameters.usePreload = false;
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ break;
+ }
+
+ var relatedInstanceList = getRelatedInstanceList(parameterList);
+
+ if (relatedInstanceList !== undefined) {
+ requestDetails.relatedInstanceList = relatedInstanceList;
+ }
+
+ return requestDetails;
+ };
+
+ var getRelatedInstanceList = function(parameterList) {
+ var relatedInstanceList = new Array();
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return undefined;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ break;
+ case COMPONENT.VF_MODULE:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+
+ var availableVolumeGroup = getValueFromList(
+ FIELD.ID.AVAILABLE_VOLUME_GROUP, parameterList);
+
+ if (UtilityService.hasContents(availableVolumeGroup) && availableVolumeGroup !== "None") {
+ var availableVolumeGroups = DataService.getAvailableVolumeGroupList();
+
+ for (var i = 0; i < availableVolumeGroups.length; i++) {
+ if (availableVolumeGroups[i].instance.name == availableVolumeGroup) {
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, DataService.getModelInfo(COMPONENT.VF_MODULE));
+ DataService.setVolumeGroupInstanceId(availableVolumeGroups[i].instance.object["volume-group-id"]);
+ break;
+ }
+ }
+
+ addRelatedInstance(relatedInstanceList, COMPONENT.VOLUME_GROUP,
+ DataService.getVolumeGroupInstanceId());
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+ break;
+ }
+
+ return relatedInstanceList;
+ };
+
+ var addRelatedInstance = function(relatedInstanceList, componentId,
+ instanceId) {
+ var modelInfo = DataService.getModelInfo(componentId);
+ var relatedInstance;
+ if (modelInfo !== undefined) {
+ if (componentId === COMPONENT.SERVICE) {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
+
+ }
+ };
+ }
+ else {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
+ "modelCustomizationId": modelInfo.customizationUuid,
+ "modelCustomizationName": modelInfo.modelCustomizationName
+ }
+ }
+ }
+ relatedInstanceList.push({
+ relatedInstance : relatedInstance
+ });
+ }
+ };
+
+ /*
+ * var getArbitraryParameters = function(parameterList) { var
+ * arbitraryParameters = new Object(); for (var i = 0; i <
+ * parameterList.length; i++) { var parameter = parameterList[i]; switch
+ * (parameter.id) { case FIELD.ID.INSTANCE_NAME: case
+ * FIELD.ID.PRODUCT_FAMILY: case FIELD.ID.LCP_REGION: case
+ * FIELD.ID.LCP_REGION_TEXT: case FIELD.ID.SERVICE_TYPE: case
+ * FIELD.ID.TENANT: case FIELD.ID.SUPPRESS_ROLLBACK: break; default:
+ * arbitraryParameters[parameter.id] = parameter.value; } } return
+ * arbitraryParameters; }
+ */
+ var getArbitraryParameters = function(parameterList) {
+ var arbitraryParameters = new Object();
+ var arbitraryArray = new Array();
+ for (var i = 0; i < parameterList.length; i++) {
+ var parameter = parameterList[i];
+ switch (parameter.id) {
+ case FIELD.ID.AVAILABLE_VOLUME_GROUP:
+ case FIELD.ID.INSTANCE_NAME:
+ case FIELD.ID.PRODUCT_FAMILY:
+ case FIELD.ID.LCP_REGION:
+ case FIELD.ID.LCP_REGION_TEXT:
+ case FIELD.ID.SERVICE_TYPE:
+ case FIELD.ID.TENANT:
+ case FIELD.ID.SUPPRESS_ROLLBACK:
+ case FIELD.ID.SUBSCRIBER_NAME:
+ case FIELD.ID.SDN_C_PRELOAD:
+ case FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE:
+ case FIELD.ID.OWNING_ENTITY:
+ case FIELD.ID.PLATFORM:
+ case FIELD.ID.LINE_OF_BUSINESS:
+ case FIELD.ID.PROJECT:
+ break;
+ case FIELD.ID.SUPPLEMENTORY_DATA_FILE:
+ arbitraryParameters = FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'];
+ arbitraryArray=arbitraryParameters;
+ FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value']=[];
+ break;
+
+ default:
+ if (parameter.value != '') {
+ arbitraryParameters = {
+ name: parameter.id,
+ value: parameter.value
+ }
+ arbitraryArray.push(arbitraryParameters);
+ }
+ }
+ }
+ return (arbitraryArray);
+ }
+
+ var getModel = function() {
+ AsdcService.getModel(DataService.getModelId(), function(response) {
+ DataService.setModelInfo(_this.componentId, {
+ modelInvariantId : response.data.invariantUUID,
+ modelNameVersionId : response.data.uuid,
+ modelName : response.data.name,
+ modelVersion : response.data.version,
+ inputs : response.data.inputs
+ });
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscriptionServiceTypeList = function() {
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getLoggedInUserID = function() {
+ AaiService.getLoggedInUserID(function(response) {
+ DataService.setLoggedInUserId(response.data);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscribers = function() {
+ AaiService.getSubscribers(function(response) {
+ DataService.setSubscribers(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getServices = function() {
+ AaiService.getServices(function(response) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = {
+ "id" : subVal[FIELD.ID.SERVICE_ID],
+ "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION],
+ "isPermitted" : subVal[FIELD.ID.IS_PERMITTED],
+ };
+ serviceIdList.push(newVal);
+ DataService.setServiceIdList(serviceIdList);
+ });
+ });
+
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getAicZones = function() {
+ AaiService.getAicZones(function(response) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = {
+ "id" : subVal[FIELD.ID.ZONE_ID],
+ "name" : subVal[FIELD.ID.ZONE_NAME],
+ };
+ serviceIdList.push(newVal);
+ DataService.setAicZones(serviceIdList);
+ });
+ });
+
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getOwningEntityProperties = function() {
+ OwningEntityService.getOwningEntityProperties(function(owningEntityProperties) {
+ DataService.setOwningEntityProperties(owningEntityProperties);
+ UtilityService.startNextAsyncOperation();
+ });
+
+ };
+
+ var getLcpCloudRegionTenantList = function() {
+ AaiService.getLcpCloudRegionTenantList(DataService
+ .getGlobalCustomerId(), DataService.getServiceType(), function(
+ response) {
+ DataService.setCloudRegionTenantList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var internalGetParametersHandler = function() {
+ if (angular.isFunction(_this.getParametersHandler)) {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ });
+ }
+ };
+
+ var getSubscribersParameter = function() {
+ var subscribers = DataService.getSubscribers();
+ var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
+ if ( UtilityService.hasContents(subscribers)) {
+ parameter.optionList = [];
+
+ for (var i = 0; i < subscribers.length; i++) {
+ parameter.optionList.push({
+ id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
+ name : subscribers[i][FIELD.ID.SUBNAME],
+ isPermitted : subscribers[i][FIELD.ID.IS_PERMITTED]
+ })
+ }
+ }
+ return parameter;
+ };
+
+ var getServiceId = function() {
+ var serviceIdList = DataService.getServiceIdList();
+ //var serviceTypeList = DataService.getSubscriptionServiceTypeList();
+ var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
+ parameter.optionList = new Array();
+ if ( UtilityService.hasContents(serviceIdList) ) {
+ // load them all
+ for (var i = 0; i < serviceIdList.length; i++) {
+ parameter.optionList.push({
+ id : serviceIdList[i].id,
+ name : serviceIdList[i].description,
+ isPermitted : serviceIdList[i].isPermitted
+ });
+ }
+ }
+
+ return parameter;
+ };
+
+ var getAicZonesParameter = function() {
+ var aicList = DataService.getAicZones();
+ var parameter = FIELD.PARAMETER.AIC_ZONES;
+ parameter.optionList = new Array();
+ if ( UtilityService.hasContents(aicList) ) {
+ // load them all
+ for (var i = 0; i < aicList.length; i++) {
+ parameter.optionList.push({
+ id : aicList[i].id,
+ name : aicList[i].name,
+ isPermitted : true
+
+ });
+ }
+ }
+
+ return parameter;
+ };
+
+ var getProjectParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PROJECT);
+ };
+
+ var getOwningEntityParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.OWNING_ENTITY);
+ };
+
+ var getLineOfBusinessParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.LINE_OF_BUSINESS);
+ };
+
+ var getPlatformParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PLATFORM);
+ };
+
+ var getOwningEntityNameById = function (id) {
+ var properties = DataService.getOwningEntityProperties();
+ var parameter = _.find(properties[FIELD.ID.OWNING_ENTITY], {"id": id});
+ return parameter && parameter.name;
+ };
+
+ var getOwningEntityParameterWithOptions = function(parameter) {
+ var properties = DataService.getOwningEntityProperties();
+ if (properties && properties[parameter.id]) {
+ parameter.optionList = _.map(properties[parameter.id], function(parameter) {
+ return {
+ "id" : parameter.id,
+ "name" : parameter.name,
+ "isPermitted": true
+ };
+ });
+ }
+
+ return parameter;
+ };
+
+ var getLcpRegionParameter = function() {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ console.log ( "cloudRegionTenantList=");
+ console.log ( JSON.stringify (cloudRegionTenantList, null, 4 ));
+
+ var parameter = FIELD.PARAMETER.LCP_REGION;
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ for (var j = 0; j < parameter.optionList.length; j++) {
+ if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
+ parameter.optionList[j].isPermitted =
+ parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted;
+ break;
+ }
+ }
+ if (j < parameter.optionList.length) {
+ continue;
+ }
+
+ var optionName = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST) && cloudRegionTenantList[i].cloudOwner ?
+ cloudRegionTenantList[i].cloudRegionId + " (" + AaiService.removeVendorFromCloudOwner(cloudRegionTenantList[i].cloudOwner).toUpperCase() + ")" :
+ cloudRegionTenantList[i].cloudRegionId;
+
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].cloudRegionId,
+ name: optionName,
+ isPermitted : cloudRegionTenantList[i].isPermitted
+ });
+ }
+ }
+ return parameter;
+ };
+
+ var getTenantList = function(cloudRegionId) {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ var parameter = "";
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter = FIELD.PARAMETER.TENANT_ENABLED;
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].tenantId,
+ name : cloudRegionTenantList[i].tenantName,
+ isPermitted : cloudRegionTenantList[i].isPermitted
+
+ });
+ }
+ }
+ }
+ return parameter;
+
+ };
+
+ var addOptionList = function(parameter, optionSimpleArray) {
+ var optionList = new Array();
+ if (!angular.isArray(optionSimpleArray)) {
+ return optionList;
+ }
+ for (var i = 0; i < optionSimpleArray.length; i++) {
+ optionList.push({
+ name : optionSimpleArray[i],
+ isPermitted :true,
+ });
+ }
+ parameter.optionList = optionList;
+ return parameter;
+ };
+
+ var getValueFromList = function(id, parameterList) {
+ for (var i = 0; i < parameterList.length; i++) {
+ if (parameterList[i].id === id) {
+ return parameterList[i].value;
+ }
+ }
+ };
+ var updateUserParameterList = function(updatedId, parameterListControl) {
+ console.log ("updateUserParameterList() updatedId=" + updatedId);
+ if (updatedId === FIELD.ID.PRODUCT_FAMILY && DataService.getHideServiceFields()) {
+ var cloudRegionTenantList = new Array();
+ AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
+ DataService.setCloudRegionTenantList(cloudRegionTenantList);
+ parameterListControl.updateList([ getLcpRegionParameter() ]);
+ });
+ }else if (updatedId === FIELD.ID.SDN_C_PRELOAD) {
+ var list = parameterListControl.getList(updatedId);
+ if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
+ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED.value=true;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED ]);
+ }else{
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_UNCHECKED ]);
+ }
+ }else if (updatedId === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE) {
+ if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
+ $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').show();
+ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=true;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED ]);
+ }else{
+ $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').hide();
+ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=false;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_UNCHECKED ]);
+ }
+ } else if (updatedId === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
+ var filePath = $('input[parameter-id="'+updatedId+'"]').val();
+ var arr =filePath.split('.');
+ var fileExt = arr[arr.length-1];
+ if(fileExt!='' && fileExt.toLowerCase()!='json'){
+ $('input[parameter-id="'+updatedId+'"]').val('');
+ alert("Invalid file format. Please select *.json format file.");
+ return false;
+ }
+ } else if (updatedId === FIELD.ID.LCP_REGION) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ parameterListControl
+ .updateList([ getTenantList(list[0].value) ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
+ }
+ } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ DataService.setGlobalCustomerId(list[0].value);
+
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
+ serviceTypeParameters.optionList = [];
+
+ for (var i = 0; i < response.length; i++) {
+ serviceTypeParameters.optionList.push({
+ "id" : response[i].name,
+ "name" : response[i].name,
+ "isPermitted" :response[i].isPermitted
+
+ });
+ }
+ console.log ( "updateUserParameterList: service type parameters " );
+ console.log ( JSON.stringify (serviceTypeParameters, null, 4));
+ parameterListControl.updateList([ serviceTypeParameters ]);
+ });
+
+ }
+ } else if ( updatedId === FIELD.ID.SERVICE_TYPE ) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+
+ DataService.setServiceType(list[0].value);
+ var cloudRegionTenantList = new Array();
+ AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
+ DataService.setCloudRegionTenantList(cloudRegionTenantList);
+ parameterListControl.updateList([ getLcpRegionParameter() ]);
+ });
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getParameters : function(getParametersHandler) {
+ _this.getParametersHandler = getParametersHandler;
+ UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
+ UtilityService.startAsyncOperations(getAsyncOperationList(),
+ internalGetParametersHandler);
+ },
+ updateUserParameterList : updateUserParameterList,
+ getMsoRequestDetails : getMsoRequestDetails,
+ getMsoUrl : getMsoUrl,
+ setInventoryInfo: setInventoryInfo
+ }
+}
+
+appDS2.factory("CreationService", [ "$log", "AaiService", "AsdcService",
+ "DataService","VIDCONFIGURATION", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
+ "UtilityService", "OwningEntityService","featureFlags", CreationService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
index efb9ebefd..6163184c2 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
@@ -424,7 +424,7 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
}
var optionName = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST) && cloudRegionTenantList[i].cloudOwner ?
- cloudRegionTenantList[i].cloudRegionId + " (" + cloudRegionTenantList[i].cloudOwner.trim().toLowerCase().replace(/^att-/, "").toUpperCase() + ")" :
+ cloudRegionTenantList[i].cloudRegionId + " (" + AaiService.removeVendorFromCloudOwner(cloudRegionTenantList[i].cloudOwner).toUpperCase() + ")" :
cloudRegionTenantList[i].cloudRegionId;
parameter.optionList.push({
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
index 8bcadd139..5bdfd1207 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
@@ -18,7 +18,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.onap.vid.aai;
import com.google.common.collect.ImmutableList;
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java
index 5eb47a1ff..9d8734b39 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiGetVnfResponseTest.java
@@ -20,34 +20,88 @@
package org.onap.vid.aai;
-import java.util.Map;
+import java.io.IOException;
+import java.util.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.junit.Before;
import org.junit.Test;
+import org.onap.vid.aai.model.VnfResult;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
public class AaiGetVnfResponseTest {
- private AaiGetVnfResponse createTestSubject() {
- return new AaiGetVnfResponse();
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ private static final String VNF_RESULT =
+ "{\n" +
+ " \"id\": \"1\",\n" +
+ " \"nodetype\": \"testNodeType\",\n" +
+ " \"url\": \"test/url\",\n" +
+ " \"serviceProperties\": {},\n" +
+ " \"relatedTo\": []\n" +
+ "}\n";
+
+ private static final String AAI_GET_VNF_RESPONSE_TEST = "{ \n" +
+ " \"results\": \n" +
+ " [\n" +
+ VNF_RESULT +
+ " ]\n" +
+ "}";
+
+
+ private AaiGetVnfResponse aaiGetVnfResponse;
+ private VnfResult expectedVnfResult;
+ private List<VnfResult> expectedList;
+
+ @Before
+ public void setUp() throws IOException {
+ expectedVnfResult = OBJECT_MAPPER.readValue(VNF_RESULT, VnfResult.class);
+ expectedList = Collections.singletonList(expectedVnfResult);
+
}
@Test
- public void testGetAdditionalProperties() throws Exception {
- AaiGetVnfResponse testSubject;
- Map<String, Object> result;
+ public void shouldHaveProperSetters() {
+ aaiGetVnfResponse = new AaiGetVnfResponse();
+ aaiGetVnfResponse.setAdditionalProperty("key","value");
+ aaiGetVnfResponse.setResults(expectedList);
+
+ assertEquals(aaiGetVnfResponse.getAdditionalProperties().size(), 1);
+ assertTrue(aaiGetVnfResponse.getAdditionalProperties().containsKey("key"));
+ assertTrue(aaiGetVnfResponse.getAdditionalProperties().containsValue("value"));
+ assertEquals(aaiGetVnfResponse.getResults().size(), 1);
+ assertEquals(aaiGetVnfResponse.getResults().get(0), expectedVnfResult);
+ }
+
+ @Test
+ public void shouldProperlyConvertJsonToAiiGetVnfResponse() throws IOException {
+ aaiGetVnfResponse = OBJECT_MAPPER.readValue(AAI_GET_VNF_RESPONSE_TEST, AaiGetVnfResponse.class);
+ assertThat(aaiGetVnfResponse.getResults(), is(expectedList));
+ }
+
+ @Test
+ public void shouldReturnProperToString(){
+ aaiGetVnfResponse = new AaiGetVnfResponse();
+ aaiGetVnfResponse.setAdditionalProperty("testKey","testValue");
+ aaiGetVnfResponse.setResults(expectedList);
+ Map<String,Object> expectedMap = new HashMap<>();
+ expectedMap.put("testKey", "testValue");
+
+ String expectedOutput = "AaiGetVnfResponse{" +
+ "results=" + expectedList +
+ ", additionalProperties="+expectedMap+"}";
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
+ assertEquals(aaiGetVnfResponse.toString(), expectedOutput);
}
@Test
- public void testSetAdditionalProperty() throws Exception {
- AaiGetVnfResponse testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAdditionalProperty(name, value);
+ public void shouldAddAdditionalProperty(){
+ aaiGetVnfResponse = new AaiGetVnfResponse();
+ aaiGetVnfResponse.setAdditionalProperty("key", "value");
+ assertTrue(aaiGetVnfResponse.getAdditionalProperties().containsKey("key"));
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
index 76cd21391..c331b3252 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
@@ -3,13 +3,14 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,190 +21,69 @@
package org.onap.vid.aai;
-import org.junit.Test;
-import org.onap.vid.aai.model.RelationshipList;
-
-public class OperationalEnvironmentTest {
-
- private OperationalEnvironment createTestSubject() {
- return new OperationalEnvironment();
- }
-
- @Test
- public void testGetOperationalEnvironmentId() throws Exception {
- OperationalEnvironment testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentId();
- }
-
- @Test
- public void testSetOperationalEnvironmentId() throws Exception {
- OperationalEnvironment testSubject;
- String operationalEnvironmentId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonOperationalEnvironmentId(operationalEnvironmentId);
- }
-
- @Test
- public void testGetOperationalEnvironmentName() throws Exception {
- OperationalEnvironment testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentName();
- }
-
- @Test
- public void testSetOperationalEnvironmentName() throws Exception {
- OperationalEnvironment testSubject;
- String operationalEnvironmentName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonOperationalEnvironmentName(operationalEnvironmentName);
- }
-
- @Test
- public void testGetOperationalEnvironmentType() throws Exception {
- OperationalEnvironment testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentType();
- }
-
- @Test
- public void testSetOperationalEnvironmentType() throws Exception {
- OperationalEnvironment testSubject;
- String operationalEnvironmentType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonOperationalEnvironmentType(operationalEnvironmentType);
- }
- @Test
- public void testGetOperationalEnvironmentStatus() throws Exception {
- OperationalEnvironment testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironmentStatus();
- }
-
- @Test
- public void testSetOperationalEnvironmentStatus() throws Exception {
- OperationalEnvironment testSubject;
- String operationalEnvironmentStatus = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonOperationalEnvironmentStatus(operationalEnvironmentStatus);
- }
-
- @Test
- public void testGetTenantContext() throws Exception {
- OperationalEnvironment testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getTenantContext();
- }
-
- @Test
- public void testSetTenantContext() throws Exception {
- OperationalEnvironment testSubject;
- String tenantContext = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonTenantContext(tenantContext);
- }
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Assert;
+import org.onap.vid.aai.model.RelationshipList;
+import org.testng.annotations.Test;
- @Test
- public void testGetWorkloadContext() throws Exception {
- OperationalEnvironment testSubject;
- String result;
+import java.io.IOException;
+import java.util.ArrayList;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getWorkloadContext();
- }
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.assertj.core.api.Assertions.assertThat;
- @Test
- public void testSetWorkloadContext() throws Exception {
- OperationalEnvironment testSubject;
- String workloadContext = "";
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonWorkloadContext(workloadContext);
- }
+public class OperationalEnvironmentTest {
- @Test
- public void testGetResourceVersion() throws Exception {
- OperationalEnvironment testSubject;
- String result;
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
- }
+ private static final String OPERATIONAL_ENVIRONMENT_TEST = "{\n" +
+ "\"operational-environment-id\": \"environmentId\",\n" +
+ "\"operational-environment-name\": \"environmentName\",\n" +
+ "\"operational-environment-type\": \"environmentType\",\n" +
+ "\"operational-environment-status\": \"environmentStatus\",\n" +
+ "\"tenant-context\": \"tenantContext\",\n" +
+ "\"workload-context\": \"workloadContext\",\n" +
+ "\"resource-version\": \"resourceVersion\",\n" +
+ "\"relationship-list\": {\n" +
+ "\"relationship\": []\n" +
+ "}\n" +
+ "}";
@Test
- public void testSetResourceVersion() throws Exception {
- OperationalEnvironment testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonResourceVersion(resourceVersion);
- }
+ public void shouldCreateProperOperationalEnvironmentWithConstructor(){
+ RelationshipList relationshipList = new RelationshipList();
+ relationshipList.relationship = new ArrayList<>();
- @Test
- public void testGetRelationshipList() throws Exception {
- OperationalEnvironment testSubject;
- RelationshipList result;
+ OperationalEnvironment operationalEnvironment = new OperationalEnvironment("testId",
+ "testEnvName", "testEnvType",
+ "testEnvStatus", "testTenant", "testWorkload",
+ "testResource", relationshipList);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipList();
+ assertThat(operationalEnvironment.getOperationalEnvironmentId()).isEqualTo("testId");
+ assertThat(operationalEnvironment.getWorkloadContext()).isEqualTo("testWorkload");
+ assertThat(operationalEnvironment.getRelationshipList().getRelationship()).hasSize(0);
+ assertThat(operationalEnvironment.getResourceVersion()).isEqualTo("testResource");
+ assertThat(operationalEnvironment.getTenantContext()).isEqualTo("testTenant");
+ assertThat(operationalEnvironment.getOperationalEnvironmentType()).isEqualTo("testEnvType");
+ assertThat(operationalEnvironment.getOperationalEnvironmentStatus()).isEqualTo("testEnvStatus");
+ assertThat(operationalEnvironment.getOperationalEnvironmentName()).isEqualTo("testEnvName");
}
@Test
- public void testSetRelationshipList() throws Exception {
- OperationalEnvironment testSubject;
- RelationshipList relationshipList = null;
+ public void shouldProperlyConvertJsonToOperationalEnvironment() throws IOException {
+ OperationalEnvironment operationalEnvironment =
+ OBJECT_MAPPER.readValue(OPERATIONAL_ENVIRONMENT_TEST, OperationalEnvironment.class);
- // default test
- testSubject = createTestSubject();
- testSubject.setJsonRelationshipList(relationshipList);
+ assertThat(operationalEnvironment.getOperationalEnvironmentId()).isEqualTo("environmentId");
+ assertThat(operationalEnvironment.getWorkloadContext()).isEqualTo("workloadContext");
+ assertThat(operationalEnvironment.getRelationshipList().getRelationship()).hasSize(0);
+ assertThat(operationalEnvironment.getResourceVersion()).isEqualTo("resourceVersion");
+ assertThat(operationalEnvironment.getTenantContext()).isEqualTo("tenantContext");
+ assertThat(operationalEnvironment.getOperationalEnvironmentType()).isEqualTo("environmentType");
+ assertThat(operationalEnvironment.getOperationalEnvironmentStatus()).isEqualTo("environmentStatus");
+ assertThat(operationalEnvironment.getOperationalEnvironmentName()).isEqualTo("environmentName");
}
- @Test
- public void testOperationalEnvironment() throws Exception {
- OperationalEnvironment testSubject;
- String operationalEnvironmentId = "";
- String operationalEnvironmentName = "";
- String operationalEnvironmentType = "";
- String operationalEnvironmentStatus = "";
- String tenantContext = "";
- String workloadContext = "";
- String resourceVersion = "";
- RelationshipList relationshipList = null;
-
- // default test
- testSubject = new OperationalEnvironment(operationalEnvironmentId, operationalEnvironmentName,
- operationalEnvironmentType, operationalEnvironmentStatus, tenantContext, workloadContext,
- resourceVersion, relationshipList);
- }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java
index ef2220c2d..b8dd2cfa7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberAaiResponseTest.java
@@ -20,23 +20,39 @@
package org.onap.vid.aai;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
+import org.onap.vid.model.Subscriber;
import org.onap.vid.model.SubscriberList;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
public class SubscriberAaiResponseTest {
- private SubscriberAaiResponse createTestSubject() {
- return new SubscriberAaiResponse(new SubscriberList(), "", 0);
- }
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ private static final String SUBSCRIBER_JSON_EXAMPLE = "{\n" +
+ " \"global-customer-id\": \"id\",\n" +
+ " \"subscriber-name\": \"name\",\n" +
+ " \"subscriber-type\": \"type\",\n" +
+ " \"resource-version\": \"version\"\n" +
+ "}";
-
@Test
- public void testGetSubscriberList() throws Exception {
- SubscriberAaiResponse testSubject;
- SubscriberList result;
+ public void shouldGetSubscriberList() throws IOException {
+ Subscriber sampleSubscriber =
+ OBJECT_MAPPER.readValue(SUBSCRIBER_JSON_EXAMPLE, Subscriber.class);
+ List<Subscriber> expectedListOfSubscribers = Arrays.asList(sampleSubscriber);
+ SubscriberList expectedSubscriberList = new SubscriberList(expectedListOfSubscribers);
+ SubscriberAaiResponse subscriberAaiResponse = new SubscriberAaiResponse(expectedSubscriberList, "msg", 200);
+
+ assertEquals(subscriberAaiResponse.getSubscriberList(), expectedSubscriberList);
+ assertEquals(subscriberAaiResponse.getSubscriberList().customer.size(), 1);
+ assertEquals(subscriberAaiResponse.getSubscriberList().customer.get(0), sampleSubscriber);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSubscriberList();
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
index 4655292c6..f9668c960 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberFilteredResultsTest.java
@@ -20,45 +20,89 @@
package org.onap.vid.aai;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
import org.junit.Test;
+import org.onap.vid.model.Subscriber;
import org.onap.vid.model.SubscriberList;
import org.onap.vid.roles.EcompRole;
import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleValidator;
+import static org.junit.Assert.assertEquals;
+
public class SubscriberFilteredResultsTest {
- private SubscriberFilteredResults createTestSubject() {
- ArrayList<Role> list = new ArrayList<Role>();
- list.add(new Role(EcompRole.READ, "a", "a", "a"));
- RoleValidator rl=new RoleValidator(list);
- SubscriberList sl = new SubscriberList();
- sl.customer = new ArrayList<org.onap.vid.model.Subscriber>();
- sl.customer.add(new org.onap.vid.model.Subscriber());
- return new SubscriberFilteredResults(rl, sl, "OK", 200);
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+ private SubscriberFilteredResults subscriberFilteredResults;
+ private RoleValidator roleValidator;
+ private SubscriberList subscriberList;
+ private SubscriberListWithFilterData subscriberListWithFilterData;
+
+ private static final String SUBSCRIBER_JSON_EXAMPLE = "{\n" +
+ " \"global-customer-id\": \"id\",\n" +
+ " \"subscriber-name\": \"name\",\n" +
+ " \"subscriber-type\": \"type\",\n" +
+ " \"resource-version\": \"version\"\n" +
+ "}";
+
+ @Before
+ public void setUp() throws IOException {
+ createTestSubject();
}
@Test
- public void testGetSubscriberList() throws Exception {
- SubscriberFilteredResults testSubject;
- SubscriberListWithFilterData result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSubscriberList();
+ public void testGetSubscriberList(){
+ assertEquals(subscriberFilteredResults.getSubscriberList(), subscriberListWithFilterData);
}
@Test
public void testSetSubscriberList() throws Exception {
- SubscriberFilteredResults testSubject;
- SubscriberListWithFilterData subscriberList = null;
+ subscriberList.customer = new ArrayList<>();
+ subscriberList.customer.add(new Subscriber());
+ SubscriberListWithFilterData expectedList = createSubscriberList(subscriberList,roleValidator);
+ subscriberFilteredResults.setSubscriberList(expectedList);
+
+ assertEquals(subscriberFilteredResults.getSubscriberList(), expectedList);
+ }
+
+ private void createTestSubject() throws IOException {
+ prepareRoleValidator();
+ prepareSubscriberList();
+ prepareSubscriberListWithFilterData();
+ createSubscriberFilteredResults();
+ }
+
+ private void createSubscriberFilteredResults() {
+ subscriberFilteredResults =
+ new SubscriberFilteredResults(roleValidator, subscriberList, "OK", 200);
+ subscriberFilteredResults.setSubscriberList(subscriberListWithFilterData);
+ }
+
+ private void prepareSubscriberListWithFilterData() {
+ subscriberListWithFilterData = createSubscriberList(subscriberList, roleValidator);
+ }
+
+ private void prepareRoleValidator() {
+ ArrayList<Role> list = new ArrayList<>();
+ list.add(new Role(EcompRole.READ, "a", "a", "a"));
+ roleValidator = RoleValidator.by(list);
+ }
+
+ private void prepareSubscriberList() throws IOException {
+ Subscriber sampleSubscriber =
+ OBJECT_MAPPER.readValue(SUBSCRIBER_JSON_EXAMPLE, Subscriber.class);
+ List<Subscriber> expectedListOfSubscribers = Collections.singletonList(sampleSubscriber);
+ subscriberList = new SubscriberList(expectedListOfSubscribers);
+ }
- // default test
- testSubject = createTestSubject();
- //testSubject.setSubscriberList(subscriberList);
- testSubject.getSubscriberList();
+ private SubscriberListWithFilterData createSubscriberList(SubscriberList subscriberList,
+ RoleValidator roleValidator){
+ return new SubscriberListWithFilterData(subscriberList,roleValidator);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java
index 2842b08dc..c690b5fa0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/SubscriberWithFilterTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,31 +20,15 @@
package org.onap.vid.aai;
-import org.junit.Test;
-public class SubscriberWithFilterTest {
-
- private SubscriberWithFilter createTestSubject() {
- return new SubscriberWithFilter();
- }
-
- @Test
- public void testGetIsPermitted() throws Exception {
- SubscriberWithFilter testSubject;
- boolean result;
+import org.testng.annotations.Test;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getIsPermitted();
- }
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
- @Test
- public void testSetIsPermitted() throws Exception {
- SubscriberWithFilter testSubject;
- boolean isPermitted = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIsPermitted(isPermitted);
- }
+public class SubscriberWithFilterTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(SubscriberWithFilter.class, hasValidGettersAndSetters());
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipListTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipListTest.java
new file mode 100644
index 000000000..cc57171b8
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipListTest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.aai.model;
+
+
+import org.testng.annotations.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class RelationshipListTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(RelationshipList.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ServicePropertiesTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServicePropertiesTest.java
new file mode 100644
index 000000000..3eccba9b6
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServicePropertiesTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.aai.model;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.testng.annotations.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ServicePropertiesTest {
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+ private static final String SERVICE_PROPERTIES_JSON = "{\n" +
+ "\"service-instance-id\": \"instanceId\",\n" +
+ "\"service-instance-name\": \"instanceName\",\n" +
+ "\"model-invariant-id\": \"invariantId\",\n" +
+ "\"model-version-id\": \"versionId\",\n" +
+ "\"resource-version\": \"version\",\n" +
+ "\"orchestration-status\": \"status\",\n" +
+ "\"global-customer-id\": \"customerId\",\n" +
+ "\"subscriber-name\": \"subscriberName\",\n" +
+ "\"subscriber-type\": \"subscriberType\",\n" +
+ "\"vnf-id\": \"vnfId\",\n" +
+ "\"vnf-name\": \"vnfName\",\n" +
+ "\"vnf-type\": \"vnfType\",\n" +
+ "\"service-id\": \"serviceId\",\n" +
+ "\"prov-status\": \"provStatus\",\n" +
+ "\"in-maint\": false,\n" +
+ "\"is-closed-loop-disabled\": false,\n" +
+ "\"model-customization-id\": \"customizationId\",\n" +
+ "\"nf-type\": \"nfType\",\n" +
+ "\"nf-function\": \"nfFunction\",\n" +
+ "\"nf-role\": \"nfRole\",\n" +
+ "\"nf-naming-code\": \"namingCode\",\n" +
+ "\"not-listed-property\":\"value\"}"+
+ "}";
+
+
+ @Test
+ public void shouldProperlyConvertJsonToServiceProperties() throws IOException {
+ ServiceProperties serviceProperties = OBJECT_MAPPER.readValue(SERVICE_PROPERTIES_JSON, ServiceProperties.class);
+
+
+ assertThat(serviceProperties.isClosedLoopDisabled).isFalse();
+ assertThat(serviceProperties.globalCustomerId).isEqualTo("customerId");
+ assertThat(serviceProperties.inMaint).isFalse();
+ assertThat(serviceProperties.modelCustomizationId).isEqualTo("customizationId");
+ assertThat(serviceProperties.modelInvariantId).isEqualTo("invariantId");
+ assertThat(serviceProperties.modelVersionId).isEqualTo("versionId");
+ assertThat(serviceProperties.nfRole).isEqualTo("nfRole");
+ assertThat(serviceProperties.nfFunction).isEqualTo("nfFunction");
+ assertThat(serviceProperties.nfType).isEqualTo("nfType");
+ assertThat(serviceProperties.nfNamingCode).isEqualTo("namingCode");
+ assertThat(serviceProperties.serviceId).isEqualTo("serviceId");
+ assertThat(serviceProperties.serviceInstanceName).isEqualTo("instanceName");
+ assertThat(serviceProperties.serviceInstanceId).isEqualTo("instanceId");
+ assertThat(serviceProperties.provStatus).isEqualTo("provStatus");
+ assertThat(serviceProperties.vnfId).isEqualTo("vnfId");
+ assertThat(serviceProperties.vnfName).isEqualTo("vnfName");
+ assertThat(serviceProperties.vnfType).isEqualTo("vnfType");
+ }
+
+ @Test
+ public void shouldAddAdditionalProperty() throws IOException {
+ ServiceProperties serviceProperties = OBJECT_MAPPER.readValue(SERVICE_PROPERTIES_JSON, ServiceProperties.class);
+
+ serviceProperties.setAdditionalProperty("additional", "property");
+
+ assertThat(serviceProperties.getAdditionalProperties())
+ .containsOnlyKeys("not-listed-property","additional")
+ .containsValues("value","property");
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/VnfResultTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/VnfResultTest.java
new file mode 100644
index 000000000..075d29f28
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/VnfResultTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Assert;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.assertj.core.api.Assertions.assertThat;
+
+
+public class VnfResultTest {
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ private static final String VNF_RESULT_JSON = "{\n" +
+ "\"id\": \"sample\",\n" +
+ "\"node-type\": \"sampleNodeType\",\n" +
+ "\"url\": \"sample\",\n" +
+ "\"properties\": {\n" +
+ "\"service-instance-id\": \"sample\",\n" +
+ "\"service-instance-name\": \"sample\",\n" +
+ "\"model-invariant-id\": \"sample\",\n" +
+ "\"model-version-id\": \"sample\",\n" +
+ "\"resource-version\": \"sample\",\n" +
+ "\"orchestration-status\": \"sample\",\n" +
+ "\"global-customer-id\": \"sample\",\n" +
+ "\"subscriber-name\": \"sample\",\n" +
+ "\"subscriber-type\": \"sample\",\n" +
+ "\"vnf-id\": \"sample\",\n" +
+ "\"vnf-name\": \"sample\",\n" +
+ "\"vnf-type\": \"sample\",\n" +
+ "\"service-id\": \"sample\",\n" +
+ "\"prov-status\": \"sample\",\n" +
+ "\"in-maint\": false,\n" +
+ "\"is-closed-loop-disabled\": false,\n" +
+ "\"model-customization-id\": \"sample\",\n" +
+ "\"nf-type\": \"sample\",\n" +
+ "\"nf-function\": \"sample\",\n" +
+ "\"nf-role\": \"sample\",\n" +
+ "\"nf-naming-code\": \"sample\"\n" +
+ "},\n" +
+ "\"related-to\": [{\n" +
+ "\"id\": \"sample\",\n" +
+ "\"relationship-label\": \"sample\",\n" +
+ "\"node-type\": \"sample\",\n" +
+ "\"url\": \"sample\"\n" +
+ "\t}]\n" +
+ "}";
+
+ @Test
+ public void shouldProperlyConvertJsonToVnfResult() throws IOException {
+ VnfResult vnfResult = OBJECT_MAPPER.readValue(VNF_RESULT_JSON, VnfResult.class);
+
+ assertThat(vnfResult.nodeType).isEqualTo("sampleNodeType");
+ assertThat(vnfResult.id).isEqualTo("sample");
+ assertThat(vnfResult.url).isEqualTo("sample");
+ assertThat(vnfResult.relatedTo).hasSize(1);
+ assertThat(vnfResult.properties.globalCustomerId).isEqualTo("sample");
+ assertThat(vnfResult.getAdditionalProperties()).isEmpty();
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/AAIRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/AAIRestInterfaceTest.java
index 3ed59ed38..e64b2ac55 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/util/AAIRestInterfaceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/util/AAIRestInterfaceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 - 2019 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,80 +20,276 @@
package org.onap.vid.aai.util;
-import org.junit.Test;
+
+import org.mockito.Mock;
+import org.mockito.Mockito;
+
+import org.onap.vid.aai.ExceptionWithRequestInfo;
+import org.onap.vid.aai.exceptions.InvalidPropertyException;
+import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.utils.Unchecked;
+import org.springframework.http.HttpMethod;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.Optional;
+import java.util.UUID;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static javax.ws.rs.core.Response.Status.*;
+import static junit.framework.TestCase.assertSame;
+import static junit.framework.TestCase.fail;
+import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
public class AAIRestInterfaceTest {
- /*
- TO BE IMPLEMENTED
-
+ private static final String PATH = "path";
+ private static final String HTTP_LOCALHOST = "http://localhost/";
+ @Mock
+ private Client client;
+ @Mock
+ private WebTarget webTarget;
+ @Mock
+ private Invocation.Builder builder;
+ @Mock
+ private Invocation invocation;
+ @Mock
+ private ServletRequestHelper servletRequestHelper;
+ @Mock
+ private HttpsAuthClient httpsAuthClient;
+ @Mock
+ private HttpServletRequest httpServletRequest;
+ @Mock
+ private Response response;
+ @Mock
+ private SystemPropertyHelper systemPropertyHelper;
+
+ private AAIRestInterface testSubject;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ initMocks(this);
+ mockSystemProperties();
+ testSubject = createTestSubject();
+ when(client.target(HTTP_LOCALHOST+PATH)).thenReturn(webTarget);
+ when(webTarget.request()).thenReturn(builder);
+ when(builder.accept(Mockito.anyString())).thenReturn(builder);
+ when(builder.header(Mockito.anyString(), Mockito.anyString())).thenReturn(builder);
+ when(builder.build(Mockito.anyString())).thenReturn(invocation);
+ when(builder.build(Mockito.anyString(), any(Entity.class))).thenReturn(invocation);
+ when(invocation.invoke()).thenReturn(response);
+ when(servletRequestHelper.extractOrGenerateRequestId()).thenReturn(UUID.randomUUID().toString());
+ }
+
private AAIRestInterface createTestSubject() {
- return new AAIRestInterface("");
+ return new AAIRestInterface(Optional.of(client), httpsAuthClient, servletRequestHelper, systemPropertyHelper);
}
@Test
- public void testEncodeURL() throws Exception {
- AAIRestInterface testSubject;
- String nodeKey = "";
- String result;
+ public void shouldEncodeURL() throws Exception {
+ String nodeKey = "some unusual uri";
+ String nodeKey2 = "some/usual/uri";
+ Assert.assertEquals(testSubject.encodeURL(nodeKey), "some%20unusual%20uri");
+ Assert.assertEquals(testSubject.encodeURL(nodeKey2), "some%2Fusual%2Furi");
+ }
- // default test
- testSubject = createTestSubject();
- result = testSubject.encodeURL(nodeKey);
+ @Test
+ public void shouldSetRestSrvrBaseURL() {
+ String baseUrl = "anything";
+ testSubject.setRestSrvrBaseURL(baseUrl);
+ Assert.assertEquals(testSubject.getRestSrvrBaseURL(), baseUrl);
}
@Test
- public void testSetRestSrvrBaseURL() throws Exception {
- AAIRestInterface testSubject;
- String baseURL = "";
+ public void shouldExecuteRestJsonPutMethodWithResponse200() {
+ // given
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
- // test 1
- testSubject = createTestSubject();
- baseURL = null;
- testSubject.SetRestSrvrBaseURL(baseURL);
+ // when
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestPut("", PATH, payload, false, true).getResponse();
- // test 2
- testSubject = createTestSubject();
- baseURL = "";
- testSubject.SetRestSrvrBaseURL(baseURL);
+ // then
+ verify(builder).build(HttpMethod.PUT.name(), entity);
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test(expectedExceptions = {ExceptionWithRequestInfo.class})
+ public void shouldFailWhenRestJsonPutMethodExecuted() {
+ // given
+ String payload = "{\"id\": 1}";
+
+ // when
+ when(builder.build(eq(HttpMethod.PUT.name()), any(Entity.class))).thenThrow(new GenericUncheckedException("msg"));
+ testSubject.RestPut("", PATH, payload, false, true);
+
+ //then
}
@Test
- public void testGetRestSrvrBaseURL() throws Exception {
- AAIRestInterface testSubject;
- String result;
+ public void shouldExecuteRestJsonPutMethodWithResponse400() {
+ // given
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRestSrvrBaseURL();
+ // when
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestPut("", PATH, payload, false, true).getResponse();
+
+ // then
+ verify(builder).build(HttpMethod.PUT.name(), entity);
+ Assert.assertEquals(response, finalResponse);
}
+ @Test
+ public void shouldExecuteRestPostMethodWithResponse200() {
+ // given
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertEquals(response, finalResponse);
+ }
@Test
- public void testRestPut() throws Exception {
- AAIRestInterface testSubject;
- String fromAppId = "";
- String transId = "";
- String path = "";
- String payload = "";
- boolean xml = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.RestPut(fromAppId, transId, path, payload, xml);
+ public void shouldExecuteRestPostMethodWithResponse400() {
+ // given
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertEquals(response, finalResponse);
}
@Test
- public void testRestPost() throws Exception {
- AAIRestInterface testSubject;
- String fromAppId = "";
- String transId = "";
- String path = "";
- String payload = "";
- boolean xml = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.RestPost(fromAppId, transId, path, payload, xml);
- }*/
+ public void shouldFailWhenRestPostMethodExecuted() {
+ // given
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenThrow(new RuntimeException());
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertNull(finalResponse);
+ }
+
+ @Test
+ public void shouldExecuteRestDeleteMethodWithResponse400() {
+ // given
+ // when
+ when(builder.delete()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ String reason = "Any reason";
+ when(response.readEntity(String.class)).thenReturn(reason);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void shouldExecuteRestDeleteMethodWithResponse404() {
+ // given
+ // when
+ when(builder.delete()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(NOT_FOUND);
+ String reason = "Any reason";
+ when(response.readEntity(String.class)).thenReturn(reason);
+ when(response.getStatus()).thenReturn(NOT_FOUND.getStatusCode());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void shouldFailWhenRestDeleteExecuted() {
+ // given
+ // when
+ when(builder.delete()).thenThrow(new RuntimeException());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void shouldExecuteRestGetMethodWithResponse200() {
+ // given
+ // when
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
+
+ // then
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void shouldExecuteRestGetMethodWithResponse400() {
+ // given
+ // when
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
+
+ // then
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void shouldFailWhenRestGetMethodExecuted() {
+ // given
+ // when
+ when(builder.build(HttpMethod.GET.name())).thenThrow(new RuntimeException());
+ Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
+
+ // then
+ Assert.assertNull(finalResponse);
+ }
+
+ private void mockSystemProperties() throws UnsupportedEncodingException, InvalidPropertyException {
+ when(systemPropertyHelper.getEncodedCredentials()).thenReturn("someCredentials");
+ when(systemPropertyHelper.getFullServicePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ when(systemPropertyHelper.getFullServicePath(Mockito.any(URI.class))).thenReturn("http://localhost/path");
+ when(systemPropertyHelper.getServiceBasePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ }
+
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java
deleted file mode 100644
index 3393aa7c1..000000000
--- a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2018 - 2019 Nokia. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.aai.util;
-
-
-import org.mockito.Mock;
-import org.mockito.Mockito;
-
-import org.onap.vid.aai.ExceptionWithRequestInfo;
-import org.onap.vid.aai.exceptions.InvalidPropertyException;
-import org.onap.vid.exceptions.GenericUncheckedException;
-import org.onap.vid.utils.Unchecked;
-import org.springframework.http.HttpMethod;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.Optional;
-import java.util.UUID;
-
-import static javax.ws.rs.core.Response.Status.*;
-import static junit.framework.TestCase.fail;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-
-public class SingleAAIRestInterfaceTest {
-
- private static final String PATH = "path";
- private static final String HTTP_LOCALHOST = "http://localhost/";
- @Mock
- private Client client;
- @Mock
- private WebTarget webTarget;
- @Mock
- private Invocation.Builder builder;
- @Mock
- private Invocation invocation;
- @Mock
- private ServletRequestHelper servletRequestHelper;
- @Mock
- private HttpsAuthClient httpsAuthClient;
- @Mock
- private HttpServletRequest httpServletRequest;
- @Mock
- private Response response;
- @Mock
- private SystemPropertyHelper systemPropertyHelper;
-
- private AAIRestInterface testSubject;
-
- @BeforeMethod
- public void setUp() throws Exception {
- initMocks(this);
- mockSystemProperties();
- testSubject = createTestSubject();
- when(client.target(HTTP_LOCALHOST+PATH)).thenReturn(webTarget);
- when(webTarget.request()).thenReturn(builder);
- when(builder.accept(Mockito.anyString())).thenReturn(builder);
- when(builder.header(Mockito.anyString(), Mockito.anyString())).thenReturn(builder);
- when(builder.build(Mockito.anyString())).thenReturn(invocation);
- when(builder.build(Mockito.anyString(), any(Entity.class))).thenReturn(invocation);
- when(invocation.invoke()).thenReturn(response);
- when(servletRequestHelper.extractOrGenerateRequestId()).thenReturn(UUID.randomUUID().toString());
- }
-
- private AAIRestInterface createTestSubject() {
- return new AAIRestInterface(Optional.of(client), httpsAuthClient, servletRequestHelper, systemPropertyHelper);
- }
-
- @Test
- public void testEncodeURL() throws Exception {
- String nodeKey = "some unusual uri";
- Assert.assertEquals(testSubject.encodeURL(nodeKey), "some%20unusual%20uri");
- }
-
- @Test
- public void testSetRestSrvrBaseURLWithNullValue() {
- testSubject.SetRestSrvrBaseURL(null);
- }
-
- @Test
- public void testSetRestSrvrBaseURL() {
- String baseUrl = "anything";
- testSubject.SetRestSrvrBaseURL(baseUrl);
- Assert.assertEquals(testSubject.getRestSrvrBaseURL(), baseUrl);
- }
-
- @Test
- public void testRestJsonPutWithResponse200() {
- // given
- String methodName = "RestPut";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(response.getStatusInfo()).thenReturn(OK);
- Response finalResponse = testSubject.RestPut("", PATH, payload, false, true).getResponse();
-
- // then
- verify(builder).build(HttpMethod.PUT.name(), entity);
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test(expectedExceptions = {ExceptionWithRequestInfo.class})
- public void testFailedRestJsonPut() {
- // given
- String methodName = "RestPut";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(builder.build(eq(HttpMethod.PUT.name()), any(Entity.class))).thenThrow(new GenericUncheckedException("msg"));
- Response finalResponse = testSubject.RestPut("", PATH, payload, false, true).getResponse();
-
- // then
- fail("expected unreachable: exception to be thrown");
- }
-
- @Test
- public void testRestJsonPutWithResponse400() {
- // given
- String methodName = "RestPut";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
- when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
- Response finalResponse = testSubject.RestPut("", PATH, payload, false, true).getResponse();
-
- // then
- verify(builder).build(HttpMethod.PUT.name(), entity);
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test
- public void testRestPostWithResponse200() {
- // given
- String methodName = "RestPost";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
- when(response.getStatusInfo()).thenReturn(OK);
- Response finalResponse = testSubject.RestPost("", PATH, payload, false);
-
- // then
- verify(builder).post(entity);
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test
- public void testRestPostWithResponse400() {
- // given
- String methodName = "RestPost";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
- when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
- when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
- Response finalResponse = testSubject.RestPost("", PATH, payload, false);
-
- // then
- verify(builder).post(entity);
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test
- public void testFailedRestPost() {
- // given
- String methodName = "RestPost";
- String payload = "{\"id\": 1}";
- Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
-
- // when
- when(builder.post(Mockito.any(Entity.class))).thenThrow(new RuntimeException());
- Response finalResponse = testSubject.RestPost("", PATH, payload, false);
-
- // then
- verify(builder).post(entity);
- Assert.assertEquals(finalResponse, null);
- }
-
- @Test
- public void testRestDeleteWithResponse400() {
- // given
- String methodName = "Delete";
-
- // when
- when(builder.delete()).thenReturn(response);
- when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
- String reason = "Any reason";
- when(response.readEntity(String.class)).thenReturn(reason);
- when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
- boolean finalResponse = testSubject.Delete("", "", PATH);
-
- // then
- verify(builder).delete();
- Assert.assertFalse(finalResponse);
- }
-
- @Test
- public void testRestDeleteWithResponse404() {
- // given
- String methodName = "Delete";
-
- // when
- when(builder.delete()).thenReturn(response);
- when(response.getStatusInfo()).thenReturn(NOT_FOUND);
- String reason = "Any reason";
- when(response.readEntity(String.class)).thenReturn(reason);
- when(response.getStatus()).thenReturn(NOT_FOUND.getStatusCode());
- boolean finalResponse = testSubject.Delete("", "", PATH);
-
- // then
- verify(builder).delete();
- Assert.assertFalse(finalResponse);
- }
-
- @Test
- public void testFailedRestDelete() {
- // given
- String methodName = "Delete";
-
- // when
- when(builder.delete()).thenThrow(new RuntimeException());
- boolean finalResponse = testSubject.Delete("", "", PATH);
-
- // then
- verify(builder).delete();
- Assert.assertFalse(finalResponse);
- }
-
- @Test
- public void testRestJsonGetWithResponse200() {
- // given
- String methodName = "RestGet";
-
- // when
- when(response.getStatusInfo()).thenReturn(OK);
- Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
-
- // then
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test
- public void testRestJsonGetWithResponse400() {
- // given
- String methodName = "RestGet";
-
- // when
- when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
- when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
- Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
-
- // then
- Assert.assertEquals(response, finalResponse);
- }
-
- @Test
- public void testFailedRestGet() {
- // given
- String methodName = "RestGet";
-
- // when
- when(builder.build(HttpMethod.GET.name())).thenThrow(new RuntimeException());
- Response finalResponse = testSubject.RestGet("", "", Unchecked.toURI(PATH), false).getResponse();
-
- // then
- Assert.assertEquals(finalResponse, null);
- }
-
- private void mockSystemProperties() throws UnsupportedEncodingException, InvalidPropertyException {
- when(systemPropertyHelper.getEncodedCredentials()).thenReturn("someCredentials");
- when(systemPropertyHelper.getFullServicePath(Mockito.anyString())).thenReturn("http://localhost/path");
- when(systemPropertyHelper.getFullServicePath(Mockito.any(URI.class))).thenReturn("http://localhost/path");
- when(systemPropertyHelper.getServiceBasePath(Mockito.anyString())).thenReturn("http://localhost/path");
- }
-
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java
index 9f1dc84c0..1b50681fc 100644
--- a/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/bl/AaiServiceTest.java
@@ -20,15 +20,29 @@
package org.onap.vid.bl;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayWithSize;
+import static org.hamcrest.Matchers.equalTo;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.AaiResponse;
-import org.onap.vid.aai.model.*;
+import org.onap.vid.aai.model.AaiGetPnfResponse;
import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
+import org.onap.vid.aai.model.LogicalLinkResponse;
+import org.onap.vid.aai.model.Relationship;
+import org.onap.vid.aai.model.RelationshipData;
+import org.onap.vid.aai.model.RelationshipList;
+import org.onap.vid.aai.model.ServiceRelationships;
import org.onap.vid.roles.Role;
import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AaiServiceImpl;
@@ -36,16 +50,6 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.arrayWithSize;
-import static org.hamcrest.Matchers.equalTo;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
public class AaiServiceTest {
@InjectMocks
@@ -164,7 +168,7 @@ public class AaiServiceTest {
AaiResponse<GetTenantsResponse[]> aaiResponse = new AaiResponse<>(getTenantsResponses, null, 200);
Mockito.doReturn(aaiResponse).when(aaiClientInterface).getTenants(serviceGlobalCustomerId, serviceServiceType);
Role role = new Role(null, userGlobalCustomerId, userServiceType, userTenantName);
- RoleValidator roleValidator = new RoleValidator(Collections.singletonList(role));
+ RoleValidator roleValidator = RoleValidator.by(Collections.singletonList(role));
AaiResponse<GetTenantsResponse[]> actualTenants = aaiService.getTenants(serviceGlobalCustomerId, serviceServiceType, roleValidator);
assertThat(actualTenants.getT(), arrayWithSize(1));
diff --git a/vid-app-common/src/test/java/org/onap/vid/changeManagement/RequestParametersTest.java b/vid-app-common/src/test/java/org/onap/vid/changeManagement/RequestParametersTest.java
new file mode 100644
index 000000000..8651981e4
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/changeManagement/RequestParametersTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import org.testng.annotations.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class RequestParametersTest {
+
+ @Test
+ public void shouldHaveProperSettersAndGetters() {
+ assertThat(RequestParameters.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/changeManagement/UIWorkflowsRequestTest.java b/vid-app-common/src/test/java/org/onap/vid/changeManagement/UIWorkflowsRequestTest.java
new file mode 100644
index 000000000..cf2a05377
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/changeManagement/UIWorkflowsRequestTest.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import org.testng.annotations.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class UIWorkflowsRequestTest {
+
+ @Test
+ public void shouldHaveProperSettersAndGetters() {
+ assertThat(UIWorkflowsRequest.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java b/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java
new file mode 100644
index 000000000..38f15d7e5
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.changeManagement;
+
+import org.testng.annotations.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class WorkflowRequestDetailTest {
+
+ @Test
+ public void shouldHaveProperSettersAndGetters() {
+ assertThat(WorkflowRequestDetail.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
index 6d4508dbf..a7676d152 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
@@ -3,13 +3,14 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia.
* ================================================================================
* 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.
@@ -20,57 +21,94 @@
package org.onap.vid.controller;
-import com.google.common.collect.ImmutableList;
+import static org.mockito.BDDMockito.given;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
-import org.mockito.InjectMocks;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.vid.aai.AaiResponseTranslator;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.vid.aai.AaiResponseTranslator.PortMirroringConfigData;
+import org.onap.vid.aai.AaiResponseTranslator.PortMirroringConfigDataError;
+import org.onap.vid.aai.AaiResponseTranslator.PortMirroringConfigDataOk;
+import org.onap.vid.aai.model.PortDetailsTranslator.PortDetails;
+import org.onap.vid.aai.model.PortDetailsTranslator.PortDetailsError;
+import org.onap.vid.aai.model.PortDetailsTranslator.PortDetailsOk;
+import org.onap.vid.aai.util.AAIRestInterface;
+import org.onap.vid.roles.RoleProvider;
import org.onap.vid.services.AaiService;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.Map;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
+import org.onap.vid.utils.SystemPropertiesWrapper;
+import org.springframework.http.MediaType;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+@RunWith(MockitoJUnitRunner.class)
public class AaiControllerTest {
- @InjectMocks
- AaiController aaiController = new AaiController();
-
+ private static final String ID_1 = "id1";
+ private static final String ID_2 = "id2";
+ @Mock
+ private AaiService aaiService;
+ @Mock
+ private AAIRestInterface aaiRestInterface;
+ @Mock
+ private RoleProvider roleProvider;
@Mock
- AaiService aaiService;
+ private SystemPropertiesWrapper systemPropertiesWrapper;
- @BeforeMethod
- public void initMocks(){
- MockitoAnnotations.initMocks(this);
+ private MockMvc mockMvc;
+ private AaiController aaiController;
+
+ @Before
+ public void setUp() {
+ aaiController = new AaiController(aaiService, aaiRestInterface, roleProvider, systemPropertiesWrapper);
+ mockMvc = MockMvcBuilders.standaloneSetup(aaiController).build();
}
@Test
- public void getPortMirroringConfigData_givenThreeIds_ReturnsThreeResults() {
-
- final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForA = new AaiResponseTranslator.PortMirroringConfigDataOk("foobar");
- final AaiResponseTranslator.PortMirroringConfigDataError toBeReturnedForB = new AaiResponseTranslator.PortMirroringConfigDataError("foo", "{ baz: qux }");
- final AaiResponseTranslator.PortMirroringConfigDataOk toBeReturnedForC = new AaiResponseTranslator.PortMirroringConfigDataOk("corge");
-
- Mockito
- .doReturn(toBeReturnedForA)
- .doReturn(toBeReturnedForB)
- .doReturn(toBeReturnedForC)
- .when(aaiService).getPortMirroringConfigData(Mockito.anyString());
-
- final Map<String, AaiResponseTranslator.PortMirroringConfigData> result = aaiController.getPortMirroringConfigsData(ImmutableList.of("a", "b", "c"));
-
- assertThat(result, is(ImmutableMap.of(
- "a", toBeReturnedForA,
- "b", toBeReturnedForB,
- "c", toBeReturnedForC
- )));
+ public void getPortMirroringConfigData_givenIds_shouldReturnConfigDataMappedById() throws Exception {
+ PortMirroringConfigDataOk okConfigData = new PortMirroringConfigDataOk("foo");
+ PortMirroringConfigDataError errorConfigData = new PortMirroringConfigDataError("bar", "{ baz: qux }");
+ Map<String, PortMirroringConfigData> expectedJson = ImmutableMap.of(
+ ID_1, okConfigData,
+ ID_2, errorConfigData);
+ given(aaiService.getPortMirroringConfigData(ID_1)).willReturn(okConfigData);
+ given(aaiService.getPortMirroringConfigData(ID_2)).willReturn(errorConfigData);
+
+ mockMvc
+ .perform(get("/aai_getPortMirroringConfigsData")
+ .param("configurationIds", ID_1, ID_2)
+ .contentType(MediaType.APPLICATION_JSON)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(new ObjectMapper().writeValueAsString(expectedJson)));
}
-
-
+ @Test
+ public void getPortMirroringSourcePorts_givenIds_shouldReturnPortDetailsMappedById() throws Exception {
+ PortDetailsOk portDetailsOk = new PortDetailsOk("foo", "testInterface", true);
+ PortDetailsError portDetailsError = new PortDetailsError("bar", "{ baz: qux }");
+ Multimap<String, PortDetails> expectedJson = ImmutableMultimap.of(
+ ID_1, portDetailsOk,
+ ID_2, portDetailsError);
+ given(aaiService.getPortMirroringSourcePorts(ID_1)).willReturn(Lists.newArrayList(portDetailsOk));
+ given(aaiService.getPortMirroringSourcePorts(ID_2)).willReturn(Lists.newArrayList(portDetailsError));
+
+ mockMvc
+ .perform(get("/aai_getPortMirroringSourcePorts")
+ .param("configurationIds", ID_1, ID_2)
+ .contentType(MediaType.APPLICATION_JSON)
+ .accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andExpect(content().json(new ObjectMapper().writeValueAsString(expectedJson.asMap())));
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ControllersUtilsTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/ControllersUtilsTest.java
new file mode 100644
index 000000000..80836d155
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/ControllersUtilsTest.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.controller;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.model.ExceptionResponse;
+import org.onap.vid.utils.SystemPropertiesWrapper;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ControllersUtilsTest {
+
+ private static final String USER_ATTRIBUTE = "userAttribute";
+ @Mock
+ private SystemPropertiesWrapper systemPropertiesWrapper;
+ @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+ private HttpServletRequest httpServletRequest;
+
+ @Test
+ public void shouldExtractLoginIdAsUserId_fromHttpServletRequest() {
+ // GIVEN
+ String expectedUserId = "rootUser";
+ given(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).willReturn(USER_ATTRIBUTE);
+ User user = new User();
+ user.setLoginId(expectedUserId);
+ given(httpServletRequest.getSession().getAttribute(USER_ATTRIBUTE)).willReturn(user);
+
+ // WHEN
+ String loginId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
+
+ // THEN
+ assertThat(loginId).isEqualTo(expectedUserId);
+ }
+
+ @Test
+ public void shouldExtractOrgUserIdAsUserId_fromHttpServletRequest_whenLoginIdIsNull() {
+ // GIVEN
+ String expectedUserId = "secondUser";
+ given(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).willReturn(USER_ATTRIBUTE);
+ User user = new User();
+ user.setOrgUserId(expectedUserId);
+ given(httpServletRequest.getSession().getAttribute(USER_ATTRIBUTE)).willReturn(user);
+
+ // WHEN
+ String loginId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
+
+ // THEN
+ assertThat(loginId).isEqualTo(expectedUserId);
+ }
+
+ @Test
+ public void shouldReturnEmptyString_whenBothLoginIdAndOrgUserIdAreNull() {
+ // GIVEN
+ given(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).willReturn(USER_ATTRIBUTE);
+ given(httpServletRequest.getSession().getAttribute(USER_ATTRIBUTE)).willReturn(new User());
+
+ // WHEN
+ String loginId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
+
+ // THEN
+ assertThat(loginId).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnEmptyString_whenSessionIsNull() {
+ // GIVEN
+ given(httpServletRequest.getSession()).willReturn(null);
+
+ // WHEN
+ String loginId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
+
+ // THEN
+ assertThat(loginId).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnEmptyString_whenUserIsNull() {
+ // GIVEN
+ given(systemPropertiesWrapper.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).willReturn(USER_ATTRIBUTE);
+ given(httpServletRequest.getSession().getAttribute(USER_ATTRIBUTE)).willReturn(null);
+
+ // WHEN
+ String loginId = new ControllersUtils(systemPropertiesWrapper).extractUserId(httpServletRequest);
+
+ // THEN
+ assertThat(loginId).isEmpty();
+ }
+
+ @Test
+ public void shouldCreateResponseEntity_fromGivenException() {
+ // GIVEN
+ EELFLoggerDelegate eelfLoggerDelegate = mock(EELFLoggerDelegate.class);
+ Response response = mock(Response.class);
+ given(response.getStatus()).willReturn(HttpStatus.OK.value());
+ WebApplicationException webApplicationException = new WebApplicationException("ErrorMessage", response);
+
+ // WHEN
+ ResponseEntity responseEntity = ControllersUtils
+ .handleWebApplicationException(webApplicationException, eelfLoggerDelegate);
+
+ // THEN
+ assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK);
+ assertThat(responseEntity.getBody())
+ .isInstanceOfSatisfying(ExceptionResponse.class,
+ er -> assertThat(er.getMessage()).isEqualTo("ErrorMessage (Request id: null)"));
+ then(eelfLoggerDelegate).should()
+ .error(EELFLoggerDelegate.errorLogger, "{}: {}", "handleWebApplicationException",
+ ExceptionUtils.getMessage(webApplicationException), webApplicationException);
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
index abdf31572..36af92c0c 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/ServicePermissionsTest.java
@@ -20,14 +20,6 @@
package org.onap.vid.controller;
-import org.jetbrains.annotations.NotNull;
-import org.onap.vid.aai.model.Permissions;
-import org.onap.vid.roles.RoleProvider;
-import org.onap.vid.roles.RoleValidator;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
@@ -37,6 +29,14 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import org.jetbrains.annotations.NotNull;
+import org.onap.vid.aai.model.Permissions;
+import org.onap.vid.roles.RoleProvider;
+import org.onap.vid.roles.RoleValidator;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
public class ServicePermissionsTest {
@DataProvider
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/WorkflowsControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/WorkflowsControllerTest.java
new file mode 100644
index 000000000..50f78b23d
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/WorkflowsControllerTest.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.controller;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.joshworks.restclient.http.HttpResponse;
+import io.joshworks.restclient.http.JsonMapper;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.StatusLine;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.mockito.Mock;
+import org.onap.vid.changeManagement.UIWorkflowsRequest;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
+import org.onap.vid.mso.MsoUtil;
+import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.services.ChangeManagementService;
+import org.onap.vid.services.ExternalWorkflowsService;
+import org.onap.vid.services.LocalWorkflowsService;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.MockitoAnnotations.initMocks;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+public class WorkflowsControllerTest {
+
+ private static final String VID_WORKFLOWS = "/workflows-management/{serviceInstanceId}/{vnfInstanceId}/{workflow_UUID}";
+
+ private MockMvc mockMvc;
+
+ private WorkflowsController workflowsController;
+
+ @Mock
+ private ExternalWorkflowsService externalWorkflowsService;
+
+ @Mock
+ private LocalWorkflowsService localWorkflowsService;
+
+ @Mock
+ private ChangeManagementService changeManagementService;
+
+ @BeforeClass
+ public void setUp(){
+ initMocks(this);
+ workflowsController = new WorkflowsController(externalWorkflowsService,localWorkflowsService,changeManagementService);
+ mockMvc = MockMvcBuilders.standaloneSetup(workflowsController).build();
+ }
+
+ @Test
+ public void shouldProperlyReceivePostRequestFromUI() throws Exception {
+ // given
+ HttpResponse<String> expectedResponse = createOkResponse();
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ UIWorkflowsRequest uiWorkflowsRequest = new UIWorkflowsRequest();
+
+ WorkflowRequestDetail workflowRequestDetail = createWorkflowRequestDetail();
+
+ uiWorkflowsRequest.setRequestDetails(workflowRequestDetail);
+
+ UUID serviceInstanceId = new UUID(1,10);
+ UUID vnfInstanceId = new UUID(2,20);
+ UUID workflow_UUID = new UUID(3,30);
+
+ given(changeManagementService.invokeVnfWorkflow(
+ any(HttpServletRequest.class), eq(uiWorkflowsRequest.getRequestDetails()),eq(serviceInstanceId),eq(vnfInstanceId), eq(workflow_UUID)
+ )).willReturn(MsoUtil.wrapResponse(expectedResponse));
+
+ // when
+ ResultActions response = mockMvc.perform( post(VID_WORKFLOWS,serviceInstanceId,vnfInstanceId,workflow_UUID)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(objectMapper.writeValueAsString(uiWorkflowsRequest)));
+
+ //then
+ response.andExpect(status().isOk());
+ }
+
+ private WorkflowRequestDetail createWorkflowRequestDetail() {
+ WorkflowRequestDetail workflowRequestDetail = new WorkflowRequestDetail();
+ org.onap.vid.changeManagement.RequestParameters requestParameters = new org.onap.vid.changeManagement.RequestParameters();
+ HashMap<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("testKey1","testValue1");
+ paramsMap.put("testKey2","testValue2");
+
+ List<Map<String,String>> mapArray= new ArrayList<>();
+ mapArray.add(paramsMap);
+ requestParameters.setUserParams(mapArray);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setCloudOwner("testOwne");
+ cloudConfiguration.setTenantId("testId");
+ cloudConfiguration.setLcpCloudRegionId("testLcpCloudId");
+
+ workflowRequestDetail.setRequestParameters(requestParameters);
+ workflowRequestDetail.setCloudConfiguration(cloudConfiguration);
+ return workflowRequestDetail;
+ }
+
+ private HttpResponse<String> createOkResponse() {
+ StatusLine statusline = new BasicStatusLine(
+ new ProtocolVersion("http",1,1), 200, "acceptResponse");
+
+ org.apache.http.HttpResponse responseBase = new BasicHttpResponse(statusline);
+
+ return new HttpResponse<>(responseBase ,String.class, new JsonMapper());
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/HealthCheckControllerTest.java
index 49e6645bc..76ee5617b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/HealthCheckControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/HealthCheckControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
import org.apache.log4j.BasicConfigurator;
import org.junit.Before;
@@ -26,6 +26,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.vid.controller.open.HealthCheckController;
import org.onap.vid.dao.FnAppDoaImpl;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MaintenanceControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/MaintenanceControllerTest.java
index b9193810a..3e78828f0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/MaintenanceControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/MaintenanceControllerTest.java
@@ -1,4 +1,4 @@
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
/*-
* ============LICENSE_START=======================================================
@@ -35,6 +35,7 @@ import org.onap.vid.category.AddCategoryOptionResponse;
import org.onap.vid.category.AddCategoryOptionsRequest;
import org.onap.vid.category.CategoryParameterOptionRep;
import org.onap.vid.category.CategoryParametersResponse;
+import org.onap.vid.controller.open.MaintenanceController;
import org.onap.vid.model.CategoryParameter;
import org.onap.vid.model.CategoryParameterOption;
import org.onap.vid.services.CategoryParameterService;
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/RoleGeneratorControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/RoleGeneratorControllerTest.java
index c5b4a55dc..c1509d956 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/RoleGeneratorControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/RoleGeneratorControllerTest.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.vid.controller.open.RoleGeneratorController;
import org.onap.vid.services.RoleGeneratorService;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/VersionControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/open/VersionControllerTest.java
index f92a26ea7..835ea4a66 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/VersionControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/open/VersionControllerTest.java
@@ -18,8 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.controller;
+package org.onap.vid.controller.open;
+import org.onap.vid.controller.open.VersionController;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
index 47ec44ca7..b4a5c64f5 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
@@ -20,8 +20,14 @@
package org.onap.vid.job.command;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.same;
+import static org.mockito.Mockito.verify;
+
import com.google.common.collect.ImmutableMap;
-import org.apache.commons.beanutils.BeanUtils;
+import java.util.Optional;
import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -32,19 +38,11 @@ import org.onap.vid.model.serviceInstantiation.InstanceGroup;
import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.model.ModelInfo;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.testUtils.TestUtils;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.util.Optional;
-import java.util.Set;
-
-import static java.util.function.Function.identity;
-import static java.util.stream.Collectors.toMap;
-import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.*;
-
public class InstanceGroupCommandTest {
@Mock(answer = Answers.RETURNS_MOCKS)
@@ -73,7 +71,7 @@ public class InstanceGroupCommandTest {
@Test
public void createMyself_callsMso() {
- final ModelInfo serviceModelInfo = setRandomStrings(new ModelInfo());
+ final ModelInfo serviceModelInfo = setStrings(new ModelInfo());
final String serviceInstanceId = "service-instance-id";
final String userId = "ff3223";
@@ -92,14 +90,7 @@ public class InstanceGroupCommandTest {
}
- private ModelInfo setRandomStrings(ModelInfo object) {
- try {
- Set<String> fields = BeanUtils.describe(object).keySet();
- BeanUtils.populate(object,
- fields.stream().collect(toMap(identity(), s -> randomAlphanumeric(4))));
- return object;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ private ModelInfo setStrings(ModelInfo object) {
+ return TestUtils.setStringsInStringProperties(object);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index 39d777be9..4494f4872 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -26,6 +26,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.joshworks.restclient.http.HttpResponse;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
+import org.mockito.hamcrest.MockitoHamcrest;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
+import org.onap.vid.model.SOWorkflowList;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -60,15 +63,22 @@ import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasEntry;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -94,6 +104,12 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
private MsoInterface msoInterface;
@Mock
+ private SOWorkflowList workflowList;
+
+ @Mock
+ private HttpResponse<SOWorkflowList> workflowListResponse;
+
+ @Mock
private RequestDetails msoRequest;
@@ -1329,6 +1345,65 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
MsoBusinessLogicImpl.RequestType.fromValue(testValue);
}
+ @Test
+ public void shouldProperlyInvokeVnfWorkflowWithValidParameters() {
+ // given
+ MsoResponseWrapper okResponse = createOkResponse();
+ WorkflowRequestDetail request = createWorkflowRequestDetail();
+ UUID serviceInstanceId = new UUID(1,10);
+ UUID vnfInstanceId = new UUID(2,20);
+ UUID workflow_UUID = new UUID(3,30);
+ String path = "/onap/so/infra/instanceManagement/v1/serviceInstances/"+serviceInstanceId+"/vnfs/"+vnfInstanceId+"/workflows/"+workflow_UUID;
+
+ given(msoInterface.invokeWorkflow(eq(request), eq(path), MockitoHamcrest.argThat(allOf(hasEntry("X-RequestorID", "testRequester"),hasEntry("X-ONAP-PartnerName", "VID"))))).willReturn(okResponse);
+
+ // when
+ MsoResponseWrapper response = msoBusinessLogic.invokeVnfWorkflow(request, "testRequester", serviceInstanceId, vnfInstanceId, workflow_UUID);
+
+ // then
+ assertThat(response).isEqualToComparingFieldByField(okResponse);
+ }
+
+
+ @Test
+ public void shouldReturnWorkflowListForGivenModelId() {
+ given(msoInterface.getWorkflowListByModelId(anyString())).willReturn(workflowListResponse);
+ given(workflowListResponse.getBody()).willReturn(workflowList);
+ given(workflowListResponse.getStatus()).willReturn(HttpStatus.ACCEPTED.value());
+
+ SOWorkflowList workflows = msoBusinessLogic.getWorkflowListByModelId("sampleModelId");
+
+ assertThat(workflows).isEqualTo(workflowList);
+ }
+
+ @Test(expectedExceptions = {MsoBusinessLogicImpl.WorkflowListException.class})
+ public void shouldRaiseExceptionWhenRetrievingWorkflowsFailed() {
+ given(msoInterface.getWorkflowListByModelId(anyString())).willReturn(workflowListResponse);
+ given(workflowListResponse.getStatus()).willReturn(HttpStatus.INTERNAL_SERVER_ERROR.value());
+
+ msoBusinessLogic.getWorkflowListByModelId("sampleModelId");
+ }
+
+ private WorkflowRequestDetail createWorkflowRequestDetail() {
+ WorkflowRequestDetail workflowRequestDetail = new WorkflowRequestDetail();
+ org.onap.vid.changeManagement.RequestParameters requestParameters = new org.onap.vid.changeManagement.RequestParameters();
+ HashMap<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("testKey1","testValue1");
+ paramsMap.put("testKey2","testValue2");
+
+ List<Map<String,String>> mapArray= new ArrayList<>();
+ mapArray.add(paramsMap);
+ requestParameters.setUserParams(mapArray);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setCloudOwner("testOwne");
+ cloudConfiguration.setTenantId("testId");
+ cloudConfiguration.setLcpCloudRegionId("testLcpCloudId");
+
+ workflowRequestDetail.setRequestParameters(requestParameters);
+ workflowRequestDetail.setCloudConfiguration(cloudConfiguration);
+ return workflowRequestDetail;
+ }
private OperationalEnvironmentActivateInfo createTestOperationalEnvironmentActivateInfo() {
OperationalEnvironmentController.OperationalEnvironmentActivateBody operationalEnvironmentActivateBody = new OperationalEnvironmentController.OperationalEnvironmentActivateBody(
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
index 4cba53785..102c89ac1 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
@@ -24,11 +24,11 @@ import io.joshworks.restclient.request.HttpRequest;
import org.glassfish.jersey.client.JerseyInvocation;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.util.HttpsAuthClient;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.mso.rest.RequestDetails;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
@@ -72,15 +72,19 @@ public class RestMsoImplementationTest {
@Mock
private JerseyInvocation jerseyInvocation;
+ @Mock
+ private SystemPropertiesWrapper systemProperties;
+
@InjectMocks
- private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient);
+ private RestMsoImplementation restMsoImplementation = new RestMsoImplementation(mockHttpsAuthClient, systemProperties);
- String path = "/test_path/";
- String rawData = "test-row-data";
+ private String path = "/test_path/";
+ private String rawData = "test-row-data";
@BeforeClass
public void setUp(){
initMocks(this);
+ when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz");
}
@Test
@@ -127,7 +131,8 @@ public class RestMsoImplementationTest {
RestObject<HttpRequest> restObject = new RestObject<>();
prepareMocks("",HttpStatus.ACCEPTED.value(),"");
- when(mockClient.target(SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL))).thenThrow(new MsoTestException("test-target-exception"));
+ when(systemProperties.getProperty(MsoProperties.MSO_SERVER_URL)).thenReturn("SAMPLE_URL");
+ when(mockClient.target("SAMPLE_URL")).thenThrow(new MsoTestException("test-target-exception"));
// when
restMsoImplementation.Get(httpRequest, "", restObject,false);
@@ -418,4 +423,4 @@ public class RestMsoImplementationTest {
}
}
-} \ No newline at end of file
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
index f58462dd6..832aa098a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
@@ -20,8 +20,18 @@
*/
package org.onap.vid.mso.rest;
+import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
+import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xebialabs.restito.server.StubServer;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.UUID;
import org.glassfish.grizzly.http.util.HttpStatus;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -35,19 +45,9 @@ import org.onap.vid.mso.MsoProperties;
import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.mso.RestObject;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.test.context.ContextConfiguration;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Properties;
-import java.util.UUID;
-
-import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
-import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
-
@ContextConfiguration(classes = {SystemProperties.class})
public class MsoRestClientNewTest {
@@ -280,16 +280,39 @@ public class MsoRestClientNewTest {
}
@Test
- public void testGetManualTasks() {
+ public void testGetManualTasksByRequestId() {
String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
String path = p + "/" + UUID.randomUUID();
+ String validResponse = ""
+ + "{ "
+ + " \"taskList\": [ "
+ + " { "
+ + " \"taskId\": \"daf4dd84-b77a-42da-a051-3239b7a9392c\", "
+ + " \"type\": \"fallout\", "
+ + " \"nfRole\": \"vEsmeralda\", "
+ + " \"subscriptionServiceType\": \"Emanuel\", "
+ + " \"originalRequestId\": \"d352c70d-5ef8-4977-9ea8-4c8cbe860422\", "
+ + " \"originalRequestorId\": \"ss835w\", "
+ + " \"errorSource\": \"A&AI\", "
+ + " \"errorCode\": \"404\", "
+ + " \"errorMessage\": \"Failed in A&AI 404\", "
+ + " \"validResponses\": [ "
+ + " \"rollback\", "
+ + " \"abort\", "
+ + " \"skip\", "
+ + " \"resume\", "
+ + " \"retry\" "
+ + " ] "
+ + " } "
+ + " ] "
+ + "}";
try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
server,
path,
HttpStatus.OK_200,
- CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) {
- closure.executeGet(msoRestClient()::getManualTasks);
+ validResponse,validResponse)) {
+ closure.executeGet(endpoint -> msoRestClient().getManualTasksByRequestId(null, null, endpoint, null));
}
}
@@ -311,23 +334,6 @@ public class MsoRestClientNewTest {
}
@Test
- public void testGetManualTasksByRequestId() throws Exception {
- MsoRestClientNew testSubject;
- String t = "";
- String sourceId = "";
- String endpoint = "";
- RestObject restObject = null;
- MsoResponseWrapper result;
-
- // default test
- try {
- testSubject = createTestSubject();
- result = testSubject.getManualTasksByRequestId(t, sourceId, endpoint, restObject);
- } catch (Exception e) {
- }
- }
-
- @Test
public void testCompleteManualTask() throws Exception {
MsoRestClientNew testSubject;
RequestDetails requestDetails = null;
@@ -468,10 +474,10 @@ public class MsoRestClientNewTest {
private MsoRestClientNew msoRestClient() {
final WebConfig webConfig = new WebConfig();
- return new MsoRestClientNew(new SyncRestClient(webConfig.unirestFasterxmlObjectMapper(new ObjectMapper())), baseUrl(),null);
+ return new MsoRestClientNew(new SyncRestClient(webConfig.unirestFasterxmlObjectMapper(new ObjectMapper())), baseUrl(), null, new SystemPropertiesWrapper());
}
private MsoRestClientNew createTestSubject() {
- return new MsoRestClientNew(null, "",null);
+ return new MsoRestClientNew(null, "", null, new SystemPropertiesWrapper());
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
index 7caafed00..050fa0dce 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
@@ -20,35 +20,51 @@
*/
package org.onap.vid.mso.rest;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasEntry;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
import io.joshworks.restclient.http.HttpResponse;
import io.joshworks.restclient.http.JsonMapper;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
+import org.jetbrains.annotations.NotNull;
import org.mockito.Mock;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.RequestParameters;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.controller.LocalWebConfig;
import org.onap.vid.model.RequestReferencesContainer;
+import org.onap.vid.mso.MsoProperties;
import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.mso.MsoUtil;
import org.onap.vid.mso.RestObject;
+import org.onap.vid.mso.model.CloudConfiguration;
import org.onap.vid.mso.model.RequestReferences;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import static org.mockito.ArgumentMatchers.any;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
+import static org.mockito.ArgumentMatchers.refEq;
+import static org.mockito.hamcrest.MockitoHamcrest.argThat;
@ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class})
@@ -61,14 +77,18 @@ public class MsoRestClientTest {
@Mock
private SyncRestClient client;
+ @Mock
+ private SystemPropertiesWrapper systemProperties;
+
private MsoRestClientNew restClient;
@BeforeClass
private void setUp(){
initMocks(this);
- restClient = new MsoRestClientNew(client,baseUrl,null);
-
+ when(systemProperties.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz");
+ when(systemProperties.getProperty("app_display_name")).thenReturn("vid");
+ restClient = new MsoRestClientNew(client,baseUrl,null,systemProperties);
}
@Test
@@ -391,22 +411,6 @@ public class MsoRestClientTest {
}
@Test
- public void shouldProperlyGetManualTasks() {
- // given
- String endpoint = "testEndpoint";
- HttpResponse<String> httpResponse = HttpResponse.fallback("testOkResponse");
- MsoResponseWrapper expectedResponse = MsoUtil.wrapResponse(httpResponse);
-
- when( client.get( eq(baseUrl+endpoint),anyMap(),anyMap(),eq(String.class) ) ).thenReturn(httpResponse);
-
- // when
- MsoResponseWrapper response = restClient.getManualTasks(endpoint);
-
- // then
- assertThat(response).isEqualToComparingFieldByField(expectedResponse);
- }
-
- @Test
public void shouldProperlyGetManualTasksByRequestId() {
// given
RestObject restObject = generateMockMsoRestObject();
@@ -415,8 +419,7 @@ public class MsoRestClientTest {
HttpResponse<String> httpResponse = HttpResponse.fallback("testOkResponse");
MsoResponseWrapper expectedResponse = MsoUtil.wrapResponse(httpResponse);
- /// WUT 'baseUrl+baseUrl+endpoint'
- when( client.get( eq(baseUrl+baseUrl+endpoint),anyMap(),anyMap(),eq(String.class) ) ).thenReturn(httpResponse);
+ when( client.get( eq(baseUrl+endpoint),anyMap(),anyMap(),eq(String.class) ) ).thenReturn(httpResponse);
// when
MsoResponseWrapper response = restClient.getManualTasksByRequestId(null,null,endpoint,restObject);
@@ -428,7 +431,7 @@ public class MsoRestClientTest {
@Test(expectedExceptions = MsoTestException.class)
public void shouldThrowExceptionWhenGetManualTasksByRequestIdGetsWrongParameter() {
// given
- when( client.get( eq(baseUrl+baseUrl),anyMap(),anyMap(),eq(String.class) ) ).thenThrow(new MsoTestException("testsException"));
+ when( client.get( eq(baseUrl),anyMap(),anyMap(),eq(String.class) ) ).thenThrow(new MsoTestException("testsException"));
// when
restClient.getManualTasksByRequestId(null,null,"",null);
@@ -766,6 +769,34 @@ public class MsoRestClientTest {
assertThat(expectedResponse).isEqualToComparingFieldByField(response);
}
+ @Test
+ public void shouldProperlyInvokeWorkflows() {
+ // given
+ String endpoint = "testPath";
+ HttpResponse expectedResponse = createOkResponse();
+
+ WorkflowRequestDetail workflowRequestDetail = MsoRestClientTestUtil.createWorkflowRequestDetail();
+
+ RequestDetailsWrapper<WorkflowRequestDetail> requestDetailsWrapper = new RequestDetailsWrapper<>(workflowRequestDetail);
+
+ UUID requestId = UUID.randomUUID();
+
+ when(client.post(eq(baseUrl + endpoint), argThat(allOf(hasEntry("X-ONAP-RequestID", requestId.toString()),hasEntry("Content-Type", "application/json"))), refEq(requestDetailsWrapper))).
+ thenReturn(expectedResponse);
+
+ Map<String,String> extraHeaders = new HashMap<>();
+ extraHeaders.put("X-ONAP-RequestID",requestId.toString());
+ extraHeaders.put("X-ONAP-PartnerName","VID");
+ extraHeaders.put("X-RequestorID","testRequester");
+
+ // when
+ MsoResponseWrapper response = restClient.invokeWorkflow(workflowRequestDetail, endpoint, extraHeaders);
+
+ // then
+ assertThat(response).isEqualToComparingFieldByField(MsoUtil.wrapResponse(expectedResponse));
+
+ }
+
private class MsoTestException extends RuntimeException{
MsoTestException(String testException) {
super(testException);
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java
index 1720e0467..f66235728 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java
@@ -31,18 +31,21 @@ import static com.xebialabs.restito.semantics.Condition.method;
import static com.xebialabs.restito.semantics.Condition.post;
import static com.xebialabs.restito.semantics.Condition.uri;
import static com.xebialabs.restito.semantics.Condition.withHeader;
+import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xebialabs.restito.semantics.Action;
import com.xebialabs.restito.server.StubServer;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
-
import org.glassfish.grizzly.http.Method;
import org.glassfish.grizzly.http.util.HttpStatus;
import org.json.JSONObject;
@@ -50,6 +53,7 @@ import org.junit.Assert;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.changeManagement.RelatedInstanceList;
import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
import org.onap.vid.mso.MsoResponseWrapper;
import org.onap.vid.mso.model.CloudConfiguration;
import org.onap.vid.mso.model.ModelInfo;
@@ -116,6 +120,7 @@ class MsoRestClientTestUtil implements AutoCloseable {
MsoResponseWrapper response = func.apply(sampleRequestDetails, endpoint);
Assert.assertEquals(expectedStatus.getStatusCode(), response.getStatus());
+ assertJsonEquals(expectedResponseStr, response.getEntity());
verifyServer(server, endpoint, Method.DELETE);
}
@@ -127,6 +132,7 @@ class MsoRestClientTestUtil implements AutoCloseable {
MsoResponseWrapper response = func.apply(endpoint);
Assert.assertEquals(expectedStatus.getStatusCode(), response.getStatus());
+ assertJsonEquals(expectedResponseStr, response.getEntity());
verifyServer(server, endpoint, Method.GET);
}
@@ -198,6 +204,27 @@ class MsoRestClientTestUtil implements AutoCloseable {
return requestDetails;
}
+ static WorkflowRequestDetail createWorkflowRequestDetail() {
+ WorkflowRequestDetail workflowRequestDetail = new WorkflowRequestDetail();
+ org.onap.vid.changeManagement.RequestParameters requestParameters = new org.onap.vid.changeManagement.RequestParameters();
+ HashMap<String,String> paramsMap = new HashMap<>();
+ paramsMap.put("testKey1","testValue1");
+ paramsMap.put("testKey2","testValue2");
+
+ List<Map<String,String>> mapArray= new ArrayList<>();
+ mapArray.add(paramsMap);
+ requestParameters.setUserParams(mapArray);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setCloudOwner("testOwne");
+ cloudConfiguration.setTenantId("testId");
+ cloudConfiguration.setLcpCloudRegionId("testLcpCloudId");
+
+ workflowRequestDetail.setRequestParameters(requestParameters);
+ workflowRequestDetail.setCloudConfiguration(cloudConfiguration);
+ return workflowRequestDetail;
+ }
+
private void verifyServer(StubServer server, String endpoint, Method httpMethod) {
verifyHttp(server).once(
method(httpMethod),
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/TaskTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/TaskTest.java
index 5d1e480fe..d78627557 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/TaskTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/TaskTest.java
@@ -20,15 +20,90 @@
package org.onap.vid.mso.rest;
-import org.testng.annotations.Test;
-
import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
+import java.io.IOException;
+import org.onap.vid.testUtils.TestUtils;
+import org.testng.annotations.Test;
+
public class TaskTest {
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ private String templateTaskJson(String insertion) {
+ return ""
+ + "{ "
+ + " \"taskId\": \"taskId\", "
+ + " \"type\": \"type\", "
+ + " \"nfRole\": \"nfRole\", "
+ + " \"subscriptionServiceType\": \"subscriptionServiceType\", "
+ + " \"originalRequestId\": \"originalRequestId\", "
+ + " \"originalRequestorId\": \"originalRequestorId\", "
+ + " \"buildingBlockName\": \"buildingBlockName\", "
+ + " \"buildingBlockStep\": \"buildingBlockStep\", "
+ + " \"errorSource\": \"errorSource\", "
+ + " \"errorCode\": \"errorCode\", "
+ + " \"errorMessage\": \"errorMessage\", "
+ + insertion
+ + " \"validResponses\": [ "
+ + " \"a\", "
+ + " \"b\", "
+ + " \"c\" "
+ + " ] "
+ + "} ";
+ }
+
+ private final String TASK_JSON = templateTaskJson(""
+ + " \"description\": \"description\", "
+ + " \"timeout\": \"timeout\", "
+ );
+
+ private final String TASK_JSON_WITHOUT_TIMEOUT = templateTaskJson("");
+
+ private Task newTaskWithPopulatedFields() {
+ Task task = TestUtils.setStringsInStringProperties(new Task());
+ task.setValidResponses(ImmutableList.of("a", "b", "c"));
+ return task;
+ }
+
@Test
public void shouldHaveProperSettersAndGetters() {
assertThat(Task.class, hasValidGettersAndSetters());
}
+
+ @Test
+ public void serializeTask() throws IOException {
+ assertThat(
+ mapper.writeValueAsString(newTaskWithPopulatedFields()),
+ jsonEquals(TASK_JSON)
+ );
+ }
+
+ @Test
+ public void deserializeTask() throws IOException {
+ assertThat(
+ mapper.readValue(TASK_JSON, Task.class),
+ is(newTaskWithPopulatedFields())
+ );
+ }
+
+ @Test
+ public void deserializeTaskWithoutTimeout() throws IOException {
+ /*
+ SO may return no timeout, and therefore no description as well
+ */
+ final Task taskWithoutTimeout = newTaskWithPopulatedFields();
+ taskWithoutTimeout.setDescription(null);
+ taskWithoutTimeout.setTimeout(null);
+
+ assertThat(
+ mapper.readValue(TASK_JSON_WITHOUT_TIMEOUT, Task.class),
+ is(taskWithoutTimeout)
+ );
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java
index 6ff766413..363c6ff76 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/ServicePropertiesTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/AlwaysValidRoleValidatorTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,37 +18,26 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.vid.aai;
+package org.onap.vid.roles;
-import java.util.Map;
+import static org.testng.Assert.assertTrue;
-import org.junit.Test;
-import org.onap.vid.aai.model.ServiceProperties;
+import org.testng.annotations.Test;
-public class ServicePropertiesTest {
+public class AlwaysValidRoleValidatorTest {
- private ServiceProperties createTestSubject() {
- return new ServiceProperties();
- }
+ @Test
+ public void testIsSubscriberPermitted() {
+ assertTrue(new AlwaysValidRoleValidator().isSubscriberPermitted("any"));
+ }
- @Test
- public void testGetAdditionalProperties() throws Exception {
- ServiceProperties testSubject;
- Map<String, Object> result;
+ @Test
+ public void testIsServicePermitted() {
+ assertTrue(new AlwaysValidRoleValidator().isServicePermitted("any", "any"));
+ }
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
- }
-
- @Test
- public void testSetAdditionalProperty() throws Exception {
- ServiceProperties testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAdditionalProperty(name, value);
- }
-}
+ @Test
+ public void testIsTenantPermitted() {
+ assertTrue(new AlwaysValidRoleValidator().isTenantPermitted("any", "any", "any"));
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java
index 69ec3458e..9362ec9d7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleValidatorByRolesTest.java
@@ -21,18 +21,17 @@
package org.onap.vid.roles;
+import static org.assertj.core.api.Assertions.assertThat;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
import org.onap.vid.mso.rest.RequestDetails;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class RoleValidatorTest {
+public class RoleValidatorByRolesTest {
private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
private static final String NOT_MATCHING_SUBSCRIBER = "notMatchingSubscriber";
@@ -47,12 +46,11 @@ public class RoleValidatorTest {
private Map<String, Object> requestParameters = ImmutableMap.of("subscriptionServiceType", SAMPLE_SERVICE_TYPE);
private Map<String, Object> requestDetailsProperties = ImmutableMap.of("subscriberInfo", subscriberInfo, "requestParameters", requestParameters);
private RequestDetails requestDetails;
- private RoleValidator roleValidator;
+ private RoleValidatorByRoles roleValidator;
@BeforeMethod
public void setUp() {
- roleValidator = new RoleValidator(roles);
- roleValidator.enableRoles();
+ roleValidator = new RoleValidatorByRoles(roles);
requestDetails = new RequestDetails();
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index 23951aa3d..e9f94ca0e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,24 +23,37 @@ package org.onap.vid.services;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.core.Response;
+import org.jeasy.random.EasyRandom;
+import org.jeasy.random.EasyRandomParameters;
+import org.jeasy.random.randomizers.misc.BooleanRandomizer;
+import org.jeasy.random.randomizers.text.StringRandomizer;
import org.junit.Test;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.AaiGetVnfResponse;
import org.onap.vid.aai.AaiOverTLSClientInterface;
import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.AaiResponseTranslator;
+import org.onap.vid.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.VnfResult;
import org.onap.vid.roles.RoleValidator;
+import org.onap.vid.roles.RoleValidatorByRoles;
public class AaiServiceImplTest {
+ private static final long STATIC_SEED = 5336L;
+ private EasyRandomParameters parameters = new EasyRandomParameters()
+ .randomize(String.class, new StringRandomizer(4, 4, STATIC_SEED))
+ .randomize(Boolean.class, new BooleanRandomizer(STATIC_SEED));
+ private EasyRandom modelGenerator = new EasyRandom(parameters);
+
private AaiClientInterface aaiClient = mock(AaiClientInterface.class);
private AaiOverTLSClientInterface aaiSslClient = mock(AaiOverTLSClientInterface.class);
private AaiResponseTranslator aaiResponseTranslator = mock(AaiResponseTranslator.class);
@@ -125,7 +138,7 @@ public class AaiServiceImplTest {
when(response.getT()).thenReturn(new GetTenantsResponse[]{ permittedTenant, unpermittedTenant });
when(aaiClient.getTenants(globalCustomerId, serviceType)).thenReturn(response);
- RoleValidator roleValidator = mock(RoleValidator.class);
+ RoleValidator roleValidator = mock(RoleValidatorByRoles.class);
when(roleValidator.isTenantPermitted(globalCustomerId, serviceType, "permitted_tenant")).thenReturn(true);
when(roleValidator.isTenantPermitted(globalCustomerId, serviceType, "unpermitted_tenant")).thenReturn(false);
@@ -185,4 +198,81 @@ public class AaiServiceImplTest {
assertThat(response).isEqualTo(actual);
assertThat(response.getT().results).containsOnly(genericVnf, serviceInstance);
}
-}
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void getServicesShouldMarkAllServicesAsPermitted() {
+ // given
+ RoleValidator roleValidator = modelGenerator.nextObject(RoleValidatorByRoles.class);
+
+ GetServicesAAIRespone inputPayload = modelGenerator.nextObject(GetServicesAAIRespone.class);
+ assertThat(inputPayload.service.stream().allMatch(service -> service.isPermitted)).isFalse();
+
+ when(aaiClient.getServices()).thenReturn(new AaiResponse<>(inputPayload, "", 200));
+
+ // when
+ AaiResponse<GetServicesAAIRespone> result = aaiService.getServices(roleValidator);
+ GetServicesAAIRespone outputPayload = result.getT();
+
+ // then
+ assertThat(outputPayload.service.stream().allMatch(service -> service.isPermitted)).isTrue();
+ }
+
+ @Test
+ public void shouldGetNodeTemplateInstances() {
+ // given
+ String globalCustomerId = "gcid";
+ String serviceType = "st";
+ String modelVersionId = "mvid";
+ String modelInvariantId = "miid";
+ String cloudRegion = "cr";
+
+ // when
+ aaiService
+ .getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion);
+
+ // then
+ verify(aaiClient)
+ .getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion);
+ }
+
+ @Test
+ public void shouldGetNetworkCollectionDetails() {
+ // given
+ String serviceInstanceId = "siid";
+
+ // when
+ aaiService.getNetworkCollectionDetails(serviceInstanceId);
+
+ // then
+ verify(aaiClient).getNetworkCollectionDetails(serviceInstanceId);
+ }
+
+ @Test
+ public void shouldGetInstanceGroupsByCloudRegion() {
+ // given
+ String cloudOwner = "co";
+ String cloudRegionId = "crid";
+ String networkFunction = "nf";
+
+ // when
+ aaiService.getInstanceGroupsByCloudRegion(cloudOwner, cloudRegionId, networkFunction);
+
+ // then
+ verify(aaiClient).getInstanceGroupsByCloudRegion(cloudOwner, cloudRegionId, networkFunction);
+ }
+
+ @Test
+ public void getAAIServiceTree() {
+ // given
+ String globalCustomerId = "gcid";
+ String serviceType = "st";
+ String serviceInstanceId = "siid";
+
+ // when
+ aaiService.getAAIServiceTree(globalCustomerId, serviceType, serviceInstanceId);
+
+ // then
+ verify(aaiServiceTree).getServiceInstanceTopology(globalCustomerId, serviceType, serviceInstanceId);
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java
index d001d566a..621c31327 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceImplTest.java
@@ -27,6 +27,7 @@ import org.onap.vid.changeManagement.RequestDetails;
import org.onap.vid.mso.MsoBusinessLogic;
import org.onap.vid.mso.MsoResponseWrapperInterface;
import org.onap.vid.scheduler.SchedulerRestInterfaceIfc;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.http.ResponseEntity;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -38,16 +39,19 @@ import static org.testng.Assert.assertNull;
public class ChangeManagementServiceImplTest {
@Mock
- DataAccessService dataAccessServiceMock;
+ private DataAccessService dataAccessServiceMock;
@Mock
- MsoBusinessLogic msoBusinessLogicMock;
+ private MsoBusinessLogic msoBusinessLogicMock;
@Mock
- SchedulerRestInterfaceIfc schedulerRestInterface;
+ private SchedulerRestInterfaceIfc schedulerRestInterface;
@Mock
- CloudOwnerService cloudOwnerService;
+ private CloudOwnerService cloudOwnerService;
+
+ @Mock
+ private SystemPropertiesWrapper systemPropertiesWrapper;
@BeforeMethod
public void initMocks(){
@@ -56,14 +60,14 @@ public class ChangeManagementServiceImplTest {
@Test
public void doChangeManagement_requestIsNull_returnsNull() throws Exception {
- ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService);
+ ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService, systemPropertiesWrapper);
ResponseEntity<String> result = changeManagementService.doChangeManagement(null,"anyString");
assertNull(result);
}
@Test
public void doChangeManagement_currentRequestDetailsIsNull_returnsNull() throws Exception {
- ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService);
+ ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService,systemPropertiesWrapper);
ChangeManagementServiceImpl changeManagementServiceSpied = Mockito.spy(changeManagementService);
Mockito.doReturn(null).when(changeManagementServiceSpied).findRequestByVnfName(Matchers.anyList(),Mockito.anyString());
@@ -121,7 +125,7 @@ public class ChangeManagementServiceImplTest {
}
private RequestDetails callChangeManagement(String requestType) throws Exception {
- ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService);
+ ChangeManagementServiceImpl changeManagementService = new ChangeManagementServiceImpl(dataAccessServiceMock, msoBusinessLogicMock, schedulerRestInterface, cloudOwnerService,systemPropertiesWrapper);
ChangeManagementServiceImpl changeManagementServiceSpied = Mockito.spy(changeManagementService);
ChangeManagementRequest updateRequest = new ChangeManagementRequest();
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
index e638605c1..faa7a6a8d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/ChangeManagementServiceUnitTest.java
@@ -40,6 +40,7 @@ import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.properties.AsdcClientConfiguration;
import org.onap.vid.scheduler.SchedulerRestInterfaceIfc;
import org.onap.vid.testUtils.RegExMatcher;
+import org.onap.vid.utils.SystemPropertiesWrapper;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.springframework.context.annotation.Bean;
@@ -118,8 +119,8 @@ public class ChangeManagementServiceUnitTest extends AbstractTestNGSpringContext
public static class TestMsoConfig extends MsoConfig {
@Bean
- public ChangeManagementService getChangeManagementService(DataAccessService dataAccessService, MsoBusinessLogic msoInterface, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService) {
- return new ChangeManagementServiceImpl(dataAccessService, msoInterface, schedulerRestInterface, cloudOwnerService);
+ public ChangeManagementService getChangeManagementService(DataAccessService dataAccessService, MsoBusinessLogic msoInterface, SchedulerRestInterfaceIfc schedulerRestInterface, CloudOwnerService cloudOwnerService, SystemPropertiesWrapper systemPropertiesWrapper) {
+ return new ChangeManagementServiceImpl(dataAccessService, msoInterface, schedulerRestInterface, cloudOwnerService, systemPropertiesWrapper);
}
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowServiceImplTest.java
deleted file mode 100644
index 160ba97a5..000000000
--- a/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowServiceImplTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.services;
-
-
-
-import com.google.common.collect.Lists;
-import io.joshworks.restclient.http.HttpResponse;
-import java.util.Collections;
-import java.util.List;
-
-import org.assertj.core.api.Assertions;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.onap.vid.model.SOWorkflow;
-import org.onap.vid.model.SOWorkflowParameterDefinition;
-import org.onap.vid.model.SOWorkflowParameterDefinitions;
-import org.onap.vid.model.SOWorkflowType;
-import org.onap.vid.model.SOWorkflows;
-import org.onap.vid.mso.MsoResponseWrapper2;
-import org.onap.vid.mso.rest.MockedWorkflowsRestClient;
-import org.onap.vid.services.ExternalWorkflowsServiceImpl.BadResponseFromMso;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class ExternalWorkflowServiceImplTest {
-
- @Mock
- private MockedWorkflowsRestClient client;
- @Mock
- private HttpResponse<SOWorkflows> response;
-
- @Mock
- private HttpResponse<SOWorkflowParameterDefinitions> parameterDefinitionsHttpResponse;
-
-
- @BeforeMethod
- public void init(){
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void shouldReturnWorkflowsOnValidResponse(){
- // given
- ExternalWorkflowsService extWorkflowsService = new ExternalWorkflowsServiceImpl(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");
- Assertions.assertThat(workflows.get(0).getName()).isEqualTo("xyz");
- }
-
- @Test(expectedExceptions = BadResponseFromMso.class)
- public void shouldThrowBadResponseOnInvalidResponse(){
- // given
- ExternalWorkflowsService extWorkflowsService = new ExternalWorkflowsServiceImpl(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
- }
- @Test
- public void shouldReturnWorkflowParametersOnValidResponse() {
- SOWorkflowParameterDefinitions parameters = new SOWorkflowParameterDefinitions(Collections.singletonList(new SOWorkflowParameterDefinition(1L, "sample", "[0-9]", SOWorkflowType.STRING, true)));
- ExternalWorkflowsService extWorkflowsService = new ExternalWorkflowsServiceImpl(client);
- Mockito.when(parameterDefinitionsHttpResponse.getStatus()).thenReturn(200);
- Mockito.when(parameterDefinitionsHttpResponse.getBody()).thenReturn(parameters);
- MsoResponseWrapper2<SOWorkflowParameterDefinitions> msoResponseWrapper = new MsoResponseWrapper2<>(parameterDefinitionsHttpResponse);
- Mockito.when(client.getWorkflowParameterDefinitions(1L)).thenReturn(msoResponseWrapper);
-
-
- SOWorkflowParameterDefinitions workflowParameterDefinitions = extWorkflowsService.getWorkflowParameterDefinitions(1L);
-
- Assertions.assertThat(workflowParameterDefinitions).isEqualTo(parameters);
- }
-
- @Test
- public void shouldProperlyHandleEmptyParametersList(){
- ExternalWorkflowsService extWorkflowsService = new ExternalWorkflowsServiceImpl(client);
- Mockito.when(parameterDefinitionsHttpResponse.getStatus()).thenReturn(200);
- Mockito.when(parameterDefinitionsHttpResponse.getBody()).thenReturn(new SOWorkflowParameterDefinitions(Lists.newArrayList()));
-
- MsoResponseWrapper2<SOWorkflowParameterDefinitions> msoResponseWrapper = new MsoResponseWrapper2<>(parameterDefinitionsHttpResponse);
- Mockito.when(client.getWorkflowParameterDefinitions(1L)).thenReturn(msoResponseWrapper);
-
-
- SOWorkflowParameterDefinitions workflowParameterDefinitions = extWorkflowsService.getWorkflowParameterDefinitions(1L);
- Assertions.assertThat(workflowParameterDefinitions.getParameterDefinitions()).isEmpty();
- }
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowsServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowsServiceImplTest.java
new file mode 100644
index 000000000..94771b29e
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/services/ExternalWorkflowsServiceImplTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.services;
+
+
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.model.ArtifactInfo;
+import org.onap.vid.model.SOWorkflow;
+import org.onap.vid.model.SOWorkflowList;
+import org.onap.vid.model.WorkflowInputParameter;
+import org.onap.vid.model.WorkflowSource;
+import org.onap.vid.model.WorkflowSpecification;
+import org.onap.vid.model.WorkflowSpecificationWrapper;
+import org.onap.vid.mso.MsoBusinessLogic;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+
+public class ExternalWorkflowsServiceImplTest {
+
+ @Mock
+ private MsoBusinessLogic msoBusinessLogic;
+
+
+ private static final UUID SAMPLE_UUID = UUID.randomUUID();
+
+ @BeforeMethod
+ public void init() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void shouldReturnWorkflowsOnValidResponse() {
+ // given
+ ExternalWorkflowsService extWorkflowsService = new ExternalWorkflowsServiceImpl(msoBusinessLogic);
+ WorkflowInputParameter parameter = new WorkflowInputParameter("sampleLabel", "text",
+ true, Collections.EMPTY_LIST, "sampleName", "userParams", "description");
+ SOWorkflowList workflowList = createWorkflowList(parameter);
+ SOWorkflow workflow = new SOWorkflow(SAMPLE_UUID.toString(), "sampleName", WorkflowSource.SDC, Collections.singletonList(parameter));
+ when(msoBusinessLogic.getWorkflowListByModelId("test")).thenReturn(workflowList);
+ // when
+ List<SOWorkflow> workflows = extWorkflowsService.getWorkflows("test");
+ // then
+ assertThat(workflows).hasSize(1).contains(workflow);
+ }
+
+ private SOWorkflowList createWorkflowList(WorkflowInputParameter parameter) {
+ ArtifactInfo artifactInfo = new ArtifactInfo("workflow", SAMPLE_UUID.toString(), "sampleArtifactName",
+ "sampleVersion", "sampleDescription", "sampleName", "sampleOperation", "sdc", "vnf");
+ WorkflowSpecification specification = new WorkflowSpecification(artifactInfo, Collections.EMPTY_LIST, Collections.singletonList(parameter));
+ WorkflowSpecificationWrapper wrapper = new WorkflowSpecificationWrapper(specification);
+ return new SOWorkflowList(Collections.singletonList(wrapper));
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/WorkflowServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/WorkflowServiceImplTest.java
index a8ded2719..fa53a9a80 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/WorkflowServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/WorkflowServiceImplTest.java
@@ -3,13 +3,14 @@
* VID
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 - 2020 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,34 +21,23 @@
package org.onap.vid.services;
-import java.util.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import java.util.Arrays;
+import java.util.Collection;
import org.junit.Test;
public class WorkflowServiceImplTest {
- private WorkflowServiceImpl createTestSubject() {
- return new WorkflowServiceImpl();
- }
-
@Test
- public void testGetWorkflowsForVNFs() throws Exception {
- WorkflowServiceImpl testSubject;
- Collection<String> vnfNames = new ArrayList<String>();
- Collection<String> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getWorkflowsForVNFs(vnfNames);
+ public void testGetWorkflowsForVNFs() {
+ Collection<String> result = new WorkflowServiceImpl().getWorkflowsForVNFs(Arrays.asList("VNF1", "VNF2"));
+ assertThat(result).containsExactly("Upgrade", "Clean", "Reinstall");
}
@Test
- public void testGetAllWorkflows() throws Exception {
- WorkflowServiceImpl testSubject;
- Collection<String> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAllWorkflows();
+ public void testGetAllWorkflows() {
+ Collection<String> result = new WorkflowServiceImpl().getAllWorkflows();
+ assertThat(result).containsExactly("Upgrade", "Clean", "Reinstall", "Dump", "Flush");
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
index 3a7d4690d..3d919d72d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
+++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
@@ -20,6 +20,9 @@
package org.onap.vid.testUtils;
+import static java.util.function.Function.identity;
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toMap;
import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.RETURNS_DEFAULTS;
@@ -46,6 +49,7 @@ import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.json.JSONArray;
@@ -55,7 +59,6 @@ import org.mockito.MockSettings;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.onap.portalsdk.core.domain.support.DomainVo;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.asdc.beans.Service;
import org.springframework.mock.env.MockEnvironment;
@@ -131,12 +134,39 @@ public class TestUtils {
valueType);
}
- public static String[] allPropertiesOf(Class<DomainVo> aClass) {
+ public static String[] allPropertiesOf(Class<?> aClass) {
return Arrays.stream(getPropertyDescriptors(aClass))
.map(PropertyDescriptor::getDisplayName)
.toArray(String[]::new);
}
+ private static <T> List<String> allStringPropertiesOf(T object) {
+ return Arrays.stream(getPropertyDescriptors(object.getClass()))
+ .filter(descriptor -> descriptor.getPropertyType().isAssignableFrom(String.class))
+ .map(PropertyDescriptor::getDisplayName)
+ .collect(toList());
+ }
+
+ /**
+ * Sets each String property with a value equal to the name of
+ * the property; e.g.: { name: "name", city: "city" }
+ * @param object
+ * @param <T>
+ * @return The modified object
+ */
+ public static <T> T setStringsInStringProperties(T object) {
+ try {
+ final List<String> stringFields = allStringPropertiesOf(object);
+
+ BeanUtils.populate(object, stringFields.stream()
+ .collect(toMap(identity(), identity())));
+
+ return object;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
public static class JavaxRsClientMocks {
private final javax.ws.rs.client.Client fakeClient;
diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
index 6f19eb31e..a0f0dbe19 100644
--- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
+++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
@@ -71,6 +71,8 @@ application_name = Virtual Infrastructure Deployment
element_map_file_path = app/fusionapp/files/
element_map_icon_path = app/fusionapp/icons/
+role_management_activated = false
+
#aai related properties
#dev server
#ist servers
@@ -150,6 +152,7 @@ mso.restapi.vnf.changemanagement.instance=/serviceInstances/v5/<service_instance
mso.restapi.network.instance=/serviceInstances/v5/<service_instance_id>/networks
mso.restapi.vf.module.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
mso.restapi.vf.module.scaleout=/serviceInstantiation/v7/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut
+mso.restapi.workflow.invoke=/onap/so/infra/instanceManagement/v1/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/workflows/<workflow_UUID>
mso.restapi.volume.group.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
mso.restapi.instance.group=/serviceInstantiation/v7/instanceGroups
mso.restapi.get.orc.req=/orchestrationRequests/v5
@@ -169,6 +172,7 @@ mso.restapi.operationalEnvironment.create=${mso.restapi.cloudResourcesApiRoot}/o
mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7
mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances
mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign
+mso.restapi.changeManagement.workflowSpecifications=/workflowSpecifications/v1/workflows?vnfModelVersionId=<model_version_id>
vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks
mso.dme2.client.timeout=30000