summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features.properties.md48
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java35
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/VidProperties.java3
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/guilin.features.properties2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/WebConfigTest.java93
6 files changed, 172 insertions, 11 deletions
diff --git a/features.properties.md b/features.properties.md
index 3e7c6cd52..f6075a219 100644
--- a/features.properties.md
+++ b/features.properties.md
@@ -100,6 +100,7 @@
new UI in view/edit mode.
* FLAG_1902_RETRY_JOB
+
Support retry of failed job. Once async job has failed, the user is able to retry execute the job again.
* FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY
@@ -137,101 +138,138 @@
2) Service types fetching on Service Instance creation popup from the "Browse SDC models" page.
* FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI
+
Enable opening transport service (service with type:TRANSPORT) in new instantiation UI.
* FLAG_1908_INFRASTRUCTURE_VPN
+
Enable opening VRF service (service with type:BONDING, role: INFRASTRUCTURE-VPN) in new instantiation UI.
* FLAG_1908_RESUME_MACRO_SERVICE
+
Enable resume macro service from new view edit page, if :
* Service model has a Macro deployment
* Service Instance is in Assigned / Inventoried Ocrh. Status
* Service instance Service Type != Transport (PNFs)
* FLAG_1908_VNF_FABRIC_CONFIGURATION_NEW_INSTANTIATION_UI
+
Enable open the "new" Angular 2 instantiation pages for service with service-role = "VNF"
* FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT
+
Adds a button in legacy View/Edit screen that reopens the service in the _new_ View/Edit screen.
This button is not displayed when no "Edit" permissions.
* FLAG_FLASH_REPLACE_VF_MODULE
+
Enable Replace VF module for upgrade flows, requested by the Flash team.
When upgrading a VF module VID will invoke the MSO POST VF-module/replace request
* FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT
+
Enable New UI on View Edit for Macro, NON TRANSPORT services
* FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH
+
Add cloud-region and nf-role as an optional search criteria fields when fetching VNF details.
* FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE
+
Let the user set the order of resource instantiation while using drawing board (new view edit)
for a-la-carte instantiation.
* FLAG_SHOW_ORCHESTRATION_TYPE
+
enables showing/hiding (true/false) column with orchestration type in Service Model browser.
The types are fetched from aai.
* FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI
+
Any a-la-carte new service deployment will be open in modern UI, besides excluded services : Port mirroring, VLAN Tagging
* FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS
+
When flag is true the new popup will be opened with additional options to perform on VFM.
-* FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND,
+* FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND
+
When flag is true, VID use macro_services_by_invariant_uuid.json file to identify if csar without instantiation type is macro service.
Otherwise, MACRO_SERVICES list in vidConfiguration.js is used to identify if it's a macro service (in ng1 code)
* FLAG_2002_VNF_PLATFORM_MULTI_SELECT
+
When flag is true the platform will appear as a multi select field, if false the platform will be dropdown list.
* FLAG_2004_INSTANTIATION_STATUS_FILTER
+
When flag is true the user can filter rows in instantiation status by using text input
* FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE
+
When flag is true, the user see in instantiation status page, an option to recreate another instance.
This option is enabled only for instantiate jobs.
If the user clicks on this option, the previous instantiation is opened in drawing board,
and the user can create another one from this template.
* FLAG_2004_INSTANTIATION_TEMPLATES_POPUP
+
Enables a designated Templates selection modal, accessible when creating a new instance through "Browse SDC".
* FLAG_2006_VFM_SDNC_PRELOAD_FILES
+
Enables upload files when SDNC preload checkbox is checked
* FLAG_2002_UNLIMITED_MAX
+
when flag is true and max_instances is not declare than user can add unlimited VND, NETWORK, VFMODULE,
User can duplicate up to 10 record in single time.
If the flag is false and max_instances is not declare the max will be 1 else max_instances value.
* FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO
+
On the "audit info" modal (available on Instantiation Status page), shows a link navigating to
the read-only RETRY page with more audit info.
* FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY
+
When flag is true the user will be provided with edit permissions by owning entity id even the user have no permission by Subscriber,
when the flag is false the user provided with edit permission by Subscriber.
* FLAG_2006_LIMIT_OWNING_ENTITY_SELECTION_BY_ROLES
+
While service instantiation, when flag is enabled, a user will not be able to choose Owning Entity which she has no
matching role for. Relevant roles can be provided by using FLAG_2006_USER_PERMISSIONS_BY_OWNING_ENTITY.
* FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF
+
When flag is true new VF Modules on Alacarte service will inherit LCP-Region and Tenant from parent VNF.
When off, user is requested to specify LCP-Region and Tenant for each VF Module.
* FLAG_2006_NETWORK_PLATFORM_MULTI_SELECT
+
When flag is true the platform will appear as a multi select field, if false the platform will be limited to a single value.
* FLAG_2006_NETWORK_LOB_MULTI_SELECT
+
When flag is true the LOB will appear as a multi select field, if false the Line Of Business will be limited to a single value.
-
- * FLAG_2006_VNF_LOB_MULTI_SELECT
+ * FLAG_2006_VNF_LOB_MULTI_SELECT
When flag is true the LOB will appear as a multi select field, if false the Line Of Business will be limited to a single value.
* FLAG_EXP_USE_FORMAT_PARAMETER_FOR_CM_DASHBOARD
- When flag is true VID will use the format=simpleNoTaskInfo parameter in addition to the filter parameter when fetching orchestration requests for the change-management dashboard.
- When OFF, VID will use only the filter parameter \ No newline at end of file
+
+ When flag is true VID will use the format=simpleNoTaskInfo parameter in addition to the filter parameter when fetching
+ orchestration requests for the change-management dashboard. When OFF, VID will use only the filter parameter
+
+
+* FLAG_GUILIN_CONFIG_PORTAL_APP_PASSWORD
+
+ Support setting fn_app.app_password in database to a value provided by the environment variable VID_PORTAL_APP_PASSWORD.
+ VID will persist the given value, replacing any previous value.
+
+ When toggled off, the only way to configure VID's value is by manually setting a value in the DB.
+ See https://jira.onap.org/browse/VID-801
+
+
+ \ No newline at end of file
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 cfb848007..ab028756b 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
@@ -28,7 +28,11 @@ import io.joshworks.restclient.http.mapper.ObjectMapper;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.AaiClient;
import org.onap.vid.aai.AaiClientInterface;
@@ -54,6 +58,7 @@ import org.onap.vid.asdc.rest.SdcRestClient;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.logging.VidLoggingInterceptor;
import org.onap.vid.properties.AsdcClientConfiguration;
+import org.onap.vid.properties.Features;
import org.onap.vid.properties.VidProperties;
import org.onap.vid.scheduler.SchedulerService;
import org.onap.vid.scheduler.SchedulerServiceImpl;
@@ -66,6 +71,7 @@ import org.onap.vid.services.PombaServiceImpl;
import org.onap.vid.utils.JoshworksJacksonObjectMapper;
import org.onap.vid.utils.Logging;
import org.onap.vid.utils.SystemPropertiesWrapper;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -83,11 +89,30 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
public class WebConfig implements WebMvcConfigurer {
- /**
- * Gets the object mapper.
- *
- * @return the object mapper
- */
+ @Autowired DataAccessService dataAccessService;
+ @Autowired FeatureManager featureManager;
+ String portalAppPassword = System.getenv(VidProperties.PORTAL_APP_PASSWORD_ENVIRONMENT_VARIABLE_NAME);
+
+ @PostConstruct
+ public void persistPortalAppPassword() {
+ if (featureManager.isActive(Features.FLAG_GUILIN_CONFIG_PORTAL_APP_PASSWORD)) {
+ if (StringUtils.isEmpty(portalAppPassword)) {
+ return;
+ }
+
+ // Read self app object (i.e. where id=1) from database as AppServiceImpl.getDefaultApp() does
+ App defaultApp = (App) dataAccessService.getDomainObject(App.class, 1L, null);
+
+ if (defaultApp == null || StringUtils.equals(defaultApp.getAppPassword(), portalAppPassword)) {
+ return;
+ }
+
+ defaultApp.setAppPassword(portalAppPassword);
+ dataAccessService.saveDomainObject(defaultApp, null);
+ }
+ }
+
+
@Bean
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() {
return new com.fasterxml.jackson.databind.ObjectMapper().registerModule(new KotlinModule());
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 5c3f7835f..91f787cda 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -94,6 +94,8 @@ public enum Features implements Feature {
FLAG_2006_NETWORK_LOB_MULTI_SELECT,
FLAG_2006_VNF_LOB_MULTI_SELECT,
+ FLAG_GUILIN_CONFIG_PORTAL_APP_PASSWORD,
+
;
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/VidProperties.java b/vid-app-common/src/main/java/org/onap/vid/properties/VidProperties.java
index 39750246b..ab2d1ec74 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/VidProperties.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/VidProperties.java
@@ -21,9 +21,9 @@
package org.onap.vid.properties;
import org.apache.commons.lang3.StringUtils;
-import org.onap.vid.model.ModelConstants;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.model.ModelConstants;
/**
* The Class VidProperties.
*/
@@ -36,6 +36,7 @@ public class VidProperties extends SystemProperties {
public static final String MSO_MAX_OPENED_INSTANTIATION_REQUESTS="mso.maxOpenedInstantiationRequests";
public static final String MSO_ASYNC_POLLING_INTERVAL_SECONDS="mso.asyncPollingIntervalSeconds";
public static final String PROBE_SDC_MODEL_UUID="probe.sdc.model.uuid";
+ public static final String PORTAL_APP_PASSWORD_ENVIRONMENT_VARIABLE_NAME="VID_PORTAL_APP_PASSWORD";
/** The Constant VID_TRUSTSTORE_FILENAME. */
public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/guilin.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/guilin.features.properties
index f86dd970a..e842256f8 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/guilin.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/guilin.features.properties
@@ -40,3 +40,5 @@ FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE=true
FLAG_2004_INSTANTIATION_STATUS_FILTER=true
FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF=true
+FLAG_GUILIN_CONFIG_PORTAL_APP_PASSWORD = true
+
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/WebConfigTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/WebConfigTest.java
new file mode 100644
index 000000000..82b7682d3
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/WebConfigTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.controller;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.testUtils.TestUtils.setStringsInStringFields;
+
+import javax.inject.Inject;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.config.DataSourceConfig;
+import org.onap.vid.properties.Features;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
+
+@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class})
+public class WebConfigTest extends AbstractTestNGSpringContextTests {
+
+ @Inject private DataAccessService dataAccessService;
+ @Mock FeatureManager featureManager;
+ @InjectMocks WebConfig webConfig;
+
+ @BeforeMethod
+ public void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ webConfig.dataAccessService = dataAccessService;
+
+ // set default app values
+ App defaultApp = setStringsInStringFields(new App());
+ defaultApp.setId(1L);
+ dataAccessService.saveDomainObject(defaultApp, null);
+
+ // enable feature
+ when(featureManager.isActive(Features.FLAG_GUILIN_CONFIG_PORTAL_APP_PASSWORD)).thenReturn(true);
+ }
+
+ @Test
+ public void persistPortalAppPassword_givenFlagAndValue_thenValueIsPersisted() {
+ assertThat(setAndGetPortalAppPassword("fresh password"),
+ equalTo("fresh password"));
+ }
+
+ @Test
+ public void persistPortalAppPassword_givenEmptyValue_thenDbValueUnchanged() {
+ assertThat(setAndGetPortalAppPassword(""),
+ equalTo("appPassword"));
+ }
+
+ @Test
+ public void persistPortalAppPassword_givenNullValue_thenDbValueUnchanged() {
+ assertThat(setAndGetPortalAppPassword(null),
+ equalTo("appPassword"));
+ }
+
+ public String setAndGetPortalAppPassword(String password) {
+ webConfig.portalAppPassword = password;
+
+ webConfig.persistPortalAppPassword();
+ return appDomainPasswordFromDB();
+ }
+
+ private String appDomainPasswordFromDB() {
+ return ((App) dataAccessService.getDomainObject(App.class, 1L, null))
+ .getAppPassword();
+ }
+} \ No newline at end of file