Https to Http from vnfm-adapter to simulator 66/114666/1
authorMukeshKumar <mukeshsharma@est.tech>
Mon, 2 Nov 2020 13:01:25 +0000 (13:01 +0000)
committerMukesh <mukeshsharma@est.tech>
Fri, 6 Nov 2020 16:06:26 +0000 (16:06 +0000)
remove HTTPs for BPMN-Infra and SOL003 Adapter & ETSI NFVO to SOL003 Adapter & SOL003 Adapter & VNFM Simulator communications

Change-Id: I56548b8faad492af4f6f3b3ca061e723ec6c4d2c
Issue-ID: SO-3349
Signed-off-by: Mukesh <mukeshsharma@est.tech>
plans/so/integration-etsi-testing/config/aai-simulator-populate-data/esr-system-info.json
plans/so/integration-etsi-testing/config/override-files/bpmn-infra/onapheat/override.yaml
plans/so/integration-etsi-testing/config/override-files/so-vnfm-adapter/onapheat/override.yaml
plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/config/ApplicationConfig.java
plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/oauth/AuthorizationServerConfig.java
plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/OperationProgressor.java
plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/resources/application.yaml

index d204a77..fcc8537 100644 (file)
@@ -4,8 +4,8 @@
     "type": "simulator",
     "vendor": "EST",
     "version": "V1.0",
-    "service-url": "https://so-vnfm-simulator:9093/vnflcm/v1",
-    "user-name": "",
-    "password": "",
+    "service-url": "http://so-vnfm-simulator:9093/vnflcm/v1",
+    "user-name": "vnfm",
+    "password": "password1$",
     "system-type": "VNFM"
 }
index 8ecd603..684c675 100644 (file)
@@ -358,19 +358,10 @@ spring:
 so:
   vnfm:
     adapter:
-      url: https://so-vnfm-adapter:9092/so/vnfm-adapter/v1/
+      url: http://so-vnfm-adapter:9092/so/vnfm-adapter/v1/
       auth: Basic dm5mbTpwYXNzd29yZDEk
 org:
   onap:
     so:
       cloud-owner: CloudOwner
-rest:
-  http:
-    client:
-      configuration:
-        ssl:
-          keyStore: file:/app/bpmn-infra-certs/org.onap.so.p12
-          keyStorePassword: 'RLe5ExMWW;Kd6GTSt0WQz;.Y'
-          trustStore: file:/app/bpmn-infra-certs/org.onap.so.trust.jks
-          trustStorePassword: '[)3KV.k*!IlkFhWEq0Nv2dDa'
 
index ec2031c..99c9dbd 100644 (file)
@@ -3,17 +3,7 @@ server:
     tomcat:
         max-threads: 4
     ssl:
-        key-alias: so@so.onap.org
-        key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
-        key-store: file:/app/so-vnfm-adapter-certs/so-vnfm-adapter.p12
-        key-store-type: PKCS12
-        client-auth: need
-
-http:
-  client:
-    ssl:
-      trust-store: file:/app/so-vnfm-adapter-certs/org.onap.so.trust.jks
-      trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
+      enabled: false
 aai:
   auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885
   version: v15
@@ -38,7 +28,7 @@ sdc:
   endpoint: http://sdc-simulator:9991/
   toscametapath: Artifacts/Deployment/OTHER/TOSCA.meta
 vnfmadapter:
-  endpoint: https://so-vnfm-adapter:9092
+  endpoint: http://so-vnfm-adapter:9092
 etsi-catalog-manager:
   vnfpkgm:
     endpoint: http://modeling-etsicatalog:8806/api/vnfpkgm/v1
index 79b3fa8..b465792 100644 (file)
@@ -32,7 +32,7 @@ public class ApplicationConfig implements ApplicationRunner {
 
     @Override
     public void run(final ApplicationArguments args) throws Exception {
-        baseUrl = "https://" + serverDnsName + ":" + environment.getProperty(PORT);
+        baseUrl = "http://" + serverDnsName + ":" + environment.getProperty(PORT);
     }
 
     public String getBaseUrl() {
index a97c41f..026ac0f 100644 (file)
@@ -1,5 +1,7 @@
 package org.onap.so.svnfm.simulator.oauth;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Profile;
 import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
@@ -14,13 +16,15 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.E
  * "oauth-authentication" is active
  */
 public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationServerConfig.class);
 
     private static final int ONE_DAY = 60 * 60 * 24;
 
     @Override
     public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
-        clients.inMemory().withClient("vnfmadapter")
-                .secret("$2a$10$dHzTlqSBcm8hdO52LBvnX./zNTvUzzJy.lZrc4bCBL5gkln0wX6T6") //123456
+        LOGGER.info("configuring oauth-authentication ...");
+        clients.inMemory().withClient("vnfm")
+                .secret("$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke") //password1$
                 .authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
                 .refreshTokenValiditySeconds(ONE_DAY);
     }
index 5c27665..e6e16e4 100644 (file)
@@ -1,12 +1,33 @@
 package org.onap.so.svnfm.simulator.services;
 
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.ws.rs.core.MediaType;
 import org.apache.commons.codec.binary.Base64;
 import org.modelmapper.ModelMapper;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiResponse;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.*;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiClient;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.ApiException;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api.DefaultApi;
@@ -19,7 +40,11 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperatio
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.NotificationTypeEnum;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.*;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
 import org.onap.so.svnfm.simulator.api.VeVnfmApi;
 import org.onap.so.svnfm.simulator.config.ApplicationConfig;
 import org.onap.so.svnfm.simulator.model.VnfOperation;
@@ -30,23 +55,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.KeyManagerFactory;
-import javax.ws.rs.core.MediaType;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.util.*;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 
 public abstract class OperationProgressor implements Runnable {
 
@@ -211,10 +221,12 @@ public abstract class OperationProgressor implements Runnable {
         try {
             final SubscriptionsAuthenticationParamsBasic subscriptionAuthentication =
                     getLastLccnSubscriptionRequest().getAuthentication().getParamsBasic();
-            final String auth = subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
+            final String auth =
+                    subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
             final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
             String authHeader = "Basic " + new String(encodedAuth);
-            notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification, MediaType.APPLICATION_JSON, authHeader);
+            notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification,
+                    MediaType.APPLICATION_JSON, authHeader);
         } catch (final ApiException exception) {
             LOGGER.error("Error sending notification: " + notification, exception);
             LOGGER.error("Response code: {}, body: {}, basePath: {}", exception.getCode(), exception.getResponseBody(),
@@ -260,14 +272,22 @@ public abstract class OperationProgressor implements Runnable {
         try {
             final SubscriptionsAuthenticationParamsOauth2ClientCredentials subscriptionAuthentication =
                     getLastLccnSubscriptionRequest().getAuthentication().getParamsOauth2ClientCredentials();
+            SubscriptionsAuthenticationParamsBasic paramsBasic =
+                    getLastLccnSubscriptionRequest().getAuthentication().getParamsBasic();
+
             final String authHeader = applicationConfig.getGrantAuth().equals("oauth")
                     ? "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication)
-                    : null;
+                    : getAuthorizationHeader(paramsBasic.getUserName(), paramsBasic.getPassword());
+
+            LOGGER.info("Sending grant request with authorization: {}", authHeader);
             final ApiResponse<InlineResponse201> response = grantClient.grantsPostWithHttpInfo(grantRequest,
                     MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, authHeader);
             LOGGER.info("Grant Response: {}", response);
             return response.getData();
         } catch (final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiException exception) {
+            LOGGER.error("Status: {}", exception.getCode());
+            LOGGER.error("ResponseHeaders: {}", exception.getResponseHeaders());
+            LOGGER.error("ResponseBody: {}", exception.getResponseBody());
             LOGGER.error("Error sending notification: " + grantRequest, exception);
             return null;
         }
@@ -308,7 +328,11 @@ public abstract class OperationProgressor implements Runnable {
 
     private String getAuthorizationHeader(
             final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
-        final String auth = oauthClientCredentials.getClientId() + ":" + oauthClientCredentials.getClientPassword();
+        return getAuthorizationHeader(oauthClientCredentials.getClientId(), oauthClientCredentials.getClientPassword());
+    }
+
+    private String getAuthorizationHeader(final String username, final String password) {
+        final String auth = username + ":" + password;
         final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
         return "Basic " + new String(encodedAuth);
     }
@@ -338,4 +362,4 @@ public abstract class OperationProgressor implements Runnable {
 
         return last;
     }
-}
+}
\ No newline at end of file
index ffae8eb..db2a6d4 100644 (file)
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 spring:
+   profiles:
+      active: oauth-authentication
    h2:
       console: null
       enabled: true
@@ -35,40 +37,55 @@ server:
    tomcat:
       max-threads: 50
    ssl:
-      key-alias: so@so.onap.org
-      key--store-password: 7Em3&j4.19xYiMelhD5?xbQ.
-      key-store: classpath:so-vnfm-simulator.p12
-      key-store-type: PKCS12
-http:
-   client:
-      ssl:
-         trust-store: classpath:so-vnfm-adapter.p12
-         trust-store-password: ywsqCy:EEo#j}HJHM7z^Rk[L
+      enabled: false
+   request:
+      grant:
+         auth: none
 endpoint:
-   callbackUri: https://so-vnfm-simulator.onap:9093/vnfpkgm/v1/notification
+   callbackUri: http://so-vnfm-simulator.onap:9093/vnfpkgm/v1/notification
 vnfm-adapter:
    auth:
       name: vnfm
       password: password1$
 vnfds:
    vnfdlist:
-   -  vnfdid: 1
-      vnfclist:
-      -  vnfcid: VNFC1
-         resourceTemplateId: vnfd1_vnfc1
-         vduId: vnfd1_vduForVnfc1
-         type: COMPUTE
-      -  vnfcid: VNFC2
-         resourceTemplateId: vnfd1_vnfc2
-         vduId: vnfd1_vduForVnfc2
-         type: COMPUTE
-   -  vnfdid: 2
-      vnfclist:
-      -  vnfcid: VNFC3
-         resourceTemplateId: vnfd2_vnfc3
-         vduId: vnfd2_vduForVnfc3
-         type: COMPUTE
-      -  vnfcid: VNFC4
-         resourceTemplateId: vnfd2_vnfc4
-         vduId: vnfd2_vduForVnfc4
-         type: COMPUTE
+      -  vnfdid: 1
+         vnfclist:
+         -  vnfcid: VNFC1
+            resourceTemplateId: vnfd1_vnfc1
+            vduId: vnfd1_vduForVnfc1
+            type: COMPUTE
+         -  vnfcid: VNFC2
+            resourceTemplateId: vnfd1_vnfc2
+            vduId: vnfd1_vduForVnfc2
+            type: COMPUTE
+      -  vnfdid: 2
+         vnfclist:
+         -  vnfcid: VNFC3
+            resourceTemplateId: vnfd2_vnfc3
+            vduId: vnfd2_vduForVnfc3
+            type: COMPUTE
+         -  vnfcid: VNFC4
+            resourceTemplateId: vnfd2_vnfc4
+            vduId: vnfd2_vduForVnfc4
+            type: COMPUTE
+      -  vnfdid: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
+         vnfclist:
+         -  vnfcid: VNFC5
+            resourceTemplateId: vnfd3_vnfc4
+            vduId: vnfd3_vduForVnfc4
+            type: COMPUTE
+         -  vnfcid: VNFC6
+            resourceTemplateId: vnfd3_vnfc5
+            vduId: vnfd3_vduForVnfc5
+            type: COMPUTE
+      -  vnfdid: 0c960b3a-d88f-11ea-87d0-0242ac130003
+         vnfclist:
+         -  vnfcid: VNFC7
+            resourceTemplateId: vnfd4_vnfc5
+            vduId: vnfd4_vduForVnfc5
+            type: COMPUTE
+         -  vnfcid: VNFC8
+            resourceTemplateId: vnfd4_vnfc6
+            vduId: vnfd4_vduForVnfc6
+            type: COMPUTE
\ No newline at end of file