Merge "fix typo in SubResourcess class"
diff --git a/deliveries/src/main/scripts/localize_system.sh b/deliveries/src/main/scripts/localize_system.sh
index 7cd7be6..f38121c 100755
--- a/deliveries/src/main/scripts/localize_system.sh
+++ b/deliveries/src/main/scripts/localize_system.sh
@@ -7,6 +7,7 @@
 
 mkdir -p "${VID_MYLOGIN_FEED_DIRECTORY}"
 
+
 sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \
 	-e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \
 	-e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \
@@ -14,6 +15,9 @@
 	-e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \
 	-e 's/${VID_AAI_HOST}/'${VID_AAI_HOST}'/g' \
 	-e 's/${VID_AAI_PORT}/'${VID_AAI_PORT}'/g' \
+	-e 's/${AAI_USE_CLIENT_CERT}/'${AAI_USE_CLIENT_CERT}'/g' \
+	-e 's/${AAI_VID_UID}/'${AAI_VID_UID}'/g' \
+	-e 's/${AAI_VID_PASSWD_X}/'${AAI_VID_PASSWD_X}'/g' \
 	-e 's,${AAI_TRUSTSTORE_FILENAME},'${AAI_TRUSTSTORE_FILENAME}',g' \
 	-e 's/${AAI_TRUSTSTORE_PASSWD_X}/'${AAI_TRUSTSTORE_PASSWD_X}'/g' \
 	-e 's,${AAI_KEYSTORE_FILENAME},'${AAI_KEYSTORE_FILENAME}',g' \
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
index fa4eefc..cd50951 100755
--- a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
@@ -1,9 +1,9 @@
 /*-

- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 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

@@ -14,7 +14,7 @@
  * 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.
+ * limitations under the License.

  * ============LICENSE_END=========================================================

  */

 package org.openecomp.aai.util;

@@ -276,17 +276,43 @@
         	if (xml)

                	responseType = "application/xml";

         	   

-            initRestClient();    

+            initRestClient();

+

+			String clientCert = SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT);

+

+			boolean useClientCert = false;

+			if (clientCert != null &&

+					SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) {

+				useClientCert  = true;

+			}

     

             url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL_BASE) + path;

 

-            final Response cres = client.target(url)

-                 .request()

-                 .accept(responseType)

-                 .header("X-TransactionId", transId)

-                 .header("X-FromAppId",  fromAppId)

-                 .post(Entity.entity(payload, MediaType.APPLICATION_JSON));

-            

+            final Response cres;

+			if (useClientCert == true) {

+				cres = client.target(url)

+						.request()

+						.accept(responseType)

+						.header("X-TransactionId", transId)

+						.header("X-FromAppId",  fromAppId)

+						.header("Content-Type", "application/json")

+						.post(Entity.entity(payload, MediaType.APPLICATION_JSON));

+			} else {

+

+				String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);

+				String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));

+				String encodeThis = vidUsername + ":" + vidPassword;

+

+				cres = client.target(url)

+						.request()

+						.accept(responseType)

+						.header("X-TransactionId", transId)

+						.header("X-FromAppId", fromAppId)

+						.header("Content-Type", "application/json")

+						.header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))

+						.post(Entity.entity(payload, MediaType.APPLICATION_JSON));

+			}

+

         	if (cres.getStatus() == 200 && cres.getStatus() <= 299) {

         		logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");

     			logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");

diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
index d42c1f1..41c7ca5 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
@@ -61,6 +61,9 @@
 	/** The resource vendor release. */

 	private String resourceVendorRelease;

 	

+	/** the resourceVendorModelNumber */

+	private String resourceVendorModelNumber;

+

 	/** The service ecomp naming. */

 	private String serviceEcompNaming;

 	

@@ -88,6 +91,11 @@
 	

 	/** The vf module model version. */

 	private String vfModuleModelVersion;

+

+        /** serviceType */

+        private String serviceType;

+        /** serviceRole */

+        private String serviceRole;

 	

 	/**

 	 * Instantiates a new tosca metadata.

@@ -458,4 +466,26 @@
 		

 		return vfModuleModelCustomizationUUID;

 	}

+

+        /** serviceType */

+        public String getServiceType() {

+                return serviceType;

+        }

+        public void setServiceType(String serviceType) {

+                this.serviceType= serviceType;

+        }

+        /** serviceRole */

+        public String getServiceRole() {

+                return serviceRole;

+        }

+        public void setServiceRole(String serviceRole) {

+                this.serviceRole= serviceRole;

+        }

+        /** resourceVendorModelNumber */

+        public String getResourceVendorModelNumber() {

+                return resourceVendorModelNumber;

+        }

+        public void setResourceVendorModelNumber(String resourceVendorModelNumber) {

+                this.resourceVendorModelNumber= resourceVendorModelNumber;

+        }

 }