Merge "[SO] heatbridge implemention to populate AAI with openstack provider network/subnet"
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
index 64c4565..2efd74d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -80,4 +80,14 @@
     public int getTimeout() {
         return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT)));
     }
+
+    @Override
+    public boolean getUseSSL() {
+        return false;
+    }
+
+    @Override
+    public boolean getUseBasicAuth() {
+        return true;
+    }
 }
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index e3181c3..55edf0b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -260,7 +260,7 @@
     public void createPnf(BuildingBlockExecution execution) {
         try {
             Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
-            aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf.getPnfName());
+            aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf);
             ServiceInstance serviceInstance =
                     extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
             aaiPnfResources.createPnfAndConnectServiceInstance(pnf, serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 3b22cd9..3da1719 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -22,6 +22,7 @@
 
 import com.google.common.base.Strings;
 import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
 import org.onap.aai.domain.yang.RelatedToProperty;
 import org.onap.aai.domain.yang.Relationship;
 import org.onap.aai.domain.yang.RelationshipData;
@@ -68,11 +69,39 @@
         injectionHelper.getAaiClient().update(pnfURI, aaiObjectMapper.mapPnf(pnfCopy));
     }
 
-    public void checkIfPnfExistsInAaiAndCanBeUsed(String pnfName) throws Exception {
-        Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai = injectionHelper.getAaiClient()
-                .get(org.onap.aai.domain.yang.Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName));
+    public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception {
+        Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai =
+                injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+                        AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()));
         if (pnfFromAai.isPresent()) {
             checkIfPnfCanBeUsed(pnfFromAai.get());
+            updatePnfInAAI(pnf, pnfFromAai.get());
+        }
+    }
+
+    private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+        updatePnfFields(pnf, pnfFromAai);
+        injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()),
+                pnfFromAai);
+        logger.debug("updatePnfInAAI: {}", pnfFromAai);
+    }
+
+    private void updatePnfFields(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+        if (pnf.getModelInfoPnf() != null
+                && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelCustomizationUuid())) {
+            pnfFromAai.setModelCustomizationId(pnf.getModelInfoPnf().getModelCustomizationUuid());
+        }
+        if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelInvariantUuid())) {
+            pnfFromAai.setModelInvariantId(pnf.getModelInfoPnf().getModelInvariantUuid());
+        }
+        if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelUuid())) {
+            pnfFromAai.setModelVersionId(pnf.getModelInfoPnf().getModelUuid());
+        }
+        if (pnf.getOrchestrationStatus() != null && StringUtils.isNotBlank(pnf.getOrchestrationStatus().toString())) {
+            pnfFromAai.setOrchestrationStatus(pnf.getOrchestrationStatus().toString());
+        }
+        if (StringUtils.isNotBlank(pnf.getRole())) {
+            pnfFromAai.setNfRole(pnf.getRole());
         }
     }
 
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index 59cd53e..b8be045 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -48,13 +48,18 @@
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
 @RunWith(MockitoJUnitRunner.Silent.class)
 public class AAIPnfResourcesTest extends TestDataSetup {
 
+    public static final String TEST_VERSION = "testVersion";
     private static final String PNF_NAME = "pnfTest";
+    public static final String TEST_CUSTOMIZATION_UUID = "testCustomizationUuid";
+    public static final String TEST_INVARIANT_UUID = "testInvariantUuid";
+    public static final String TEST_ROLE = "testRole";
 
     private Pnf pnf;
     private ServiceInstance serviceInstance;
@@ -110,42 +115,87 @@
     @Test
     public void existingPnfInAaiWithInventoriedStatusCanBeUsed() throws Exception {
         // given
+        Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
                 AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
         // when
-        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+        verify(aaiResourcesClientMock, times(1)).update(any(), any());
     }
 
     @Test
     public void existingPnfInAaiWithNullStatusCanBeUsed() throws Exception {
         // given
+        Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+        pnfTest.setRole("test");
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
                 AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
         // when
-        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+        verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+    }
+
+    @Test
+    public void existingPnfInAaiIsUpdated() throws Exception {
+        // given
+        org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+        Pnf pnfTest = getPnfWithTestValues();
+        when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+        // when
+        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+        verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+        verifyPnfFromAai(pnfFromAai);
+    }
+
+    private void verifyPnfFromAai(org.onap.aai.domain.yang.Pnf pnf) {
+        assertEquals(OrchestrationStatus.INVENTORIED.toString(), pnf.getOrchestrationStatus());
+        assertEquals(TEST_ROLE, pnf.getNfRole());
+        assertEquals(TEST_CUSTOMIZATION_UUID, pnf.getModelCustomizationId());
+        assertEquals(TEST_INVARIANT_UUID, pnf.getModelInvariantId());
+        assertEquals(TEST_VERSION, pnf.getModelVersionId());
+    }
+
+    private Pnf getPnfWithTestValues() {
+        Pnf pnfTest = createPnfWithDefaultName();
+        ModelInfoPnf modelInfoPnf = getModelInfoPnf();
+        pnfTest.setModelInfoPnf(modelInfoPnf);
+        pnfTest.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+        pnfTest.setRole(TEST_ROLE);
+        return pnfTest;
+    }
+
+    private ModelInfoPnf getModelInfoPnf() {
+        ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+        modelInfoPnf.setModelCustomizationUuid(TEST_CUSTOMIZATION_UUID);
+        modelInfoPnf.setModelInvariantUuid(TEST_INVARIANT_UUID);
+        modelInfoPnf.setModelUuid(TEST_VERSION);
+        return modelInfoPnf;
     }
 
     @Test
     public void existingPnfInAaiWithEmptyStatusCanBeUsed() throws Exception {
         // given
+        Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
                 AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
         // when
-        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+        testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
     }
 
     @Test
     public void existingPnfInAaiCanNotBeUsed() {
         // given
+        Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
                 AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
         // when
         try {
-            testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+            testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
         } catch (Exception e) {
             // then
             assertThat(e.getMessage()).isEqualTo(String.format(
@@ -153,6 +203,7 @@
                             + "if status is not set or set as Inventoried",
                     PNF_NAME));
         }
+        verify(aaiResourcesClientMock, times(0)).update(any(), any());
     }
 
     @Test
@@ -161,19 +212,21 @@
         final String relatedTo = "service-instance";
         final String serviceInstanceId = "service-instance-id";
         final String path = "src/test/resources/__files/BuildingBlocks/aaiPnf.json";
+        Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai =
                 new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
                 AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
         // when
         try {
-            testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+            testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
         } catch (Exception e) {
             // then
             assertThat(e.getMessage()).isEqualTo(String.format(
                     "Pnf with name %s exist with orchestration status %s and is related to %s service with certain service-instance-id: %s",
                     PNF_NAME, OrchestrationStatus.ACTIVE, relatedTo, serviceInstanceId));
         }
+        verify(aaiResourcesClientMock, times(0)).update(any(), any());
     }
 
     private org.onap.aai.domain.yang.Pnf createPnf(String orchestrationStatus) {
@@ -182,4 +235,10 @@
         pnfFromAai.setOrchestrationStatus(orchestrationStatus);
         return pnfFromAai;
     }
+
+    private Pnf createPnfWithDefaultName() {
+        Pnf pnfTest = new Pnf();
+        pnfTest.setPnfName(PNF_NAME);
+        return pnfTest;
+    }
 }
diff --git a/common/pom.xml b/common/pom.xml
index 4223e0a..24baad7 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" ?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
@@ -358,4 +358,4 @@
       </plugin>
     </plugins>
   </build>
-</project>
+</project>
\ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/client/KeyStoreLoader.java b/common/src/main/java/org/onap/so/client/KeyStoreLoader.java
new file mode 100644
index 0000000..8279be8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/KeyStoreLoader.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Deutsche Telekom.
+ * ================================================================================
+ * 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.so.client;
+
+import java.io.FileInputStream;
+import java.nio.file.Paths;
+import java.security.KeyStore;
+
+public abstract class KeyStoreLoader {
+
+    static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
+
+    static public KeyStore getKeyStore() {
+        KeyStore ks = null;
+        final char[] password = getSSlKeyStorePassword().toCharArray();
+        try (FileInputStream fis =
+                new FileInputStream(Paths.get(System.getProperty(SSL_KEY_STORE_KEY)).normalize().toString())) {
+            ks = KeyStore.getInstance(KeyStore.getDefaultType());
+            ks.load(fis, password);
+        } catch (final Exception e) {
+            return null;
+        }
+
+        return ks;
+    }
+
+    static public String getSSlKeyStorePassword() {
+        return System.getProperty("javax.net.ssl.keyStorePassword");
+    }
+}
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index f5737b8..1e89538 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -20,9 +20,7 @@
 
 package org.onap.so.client;
 
-import java.io.FileInputStream;
 import java.net.URI;
-import java.nio.file.Paths;
 import java.security.KeyStore;
 import java.security.NoSuchAlgorithmException;
 import java.util.Optional;
@@ -33,10 +31,8 @@
 public abstract class RestClientSSL extends RestClient {
 
     private static final String TRUE = "true";
-    private static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
     private static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
 
-
     protected RestClientSSL(RestProperties props, Optional<URI> path) {
         super(props, path);
     }
@@ -52,9 +48,9 @@
         try {
             String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
             if (loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) {
-                KeyStore ks = getKeyStore();
+                KeyStore ks = KeyStoreLoader.getKeyStore();
                 if (ks != null) {
-                    client = ClientBuilder.newBuilder().keyStore(ks, getSSlKeyStorePassword()).build();
+                    client = ClientBuilder.newBuilder().keyStore(ks, KeyStoreLoader.getSSlKeyStorePassword()).build();
                     logger.info("RestClientSSL not using default SSL context - setting keystore here.");
                     return client;
                 }
@@ -67,23 +63,4 @@
         }
         return client;
     }
-
-    private KeyStore getKeyStore() {
-        KeyStore ks = null;
-        char[] password = getSSlKeyStorePassword().toCharArray();
-        try (FileInputStream fis = new FileInputStream(
-                Paths.get(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)).normalize().toString())) {
-            ks = KeyStore.getInstance(KeyStore.getDefaultType());
-
-            ks.load(fis, password);
-        } catch (Exception e) {
-            return null;
-        }
-
-        return ks;
-    }
-
-    private String getSSlKeyStorePassword() {
-        return System.getProperty("javax.net.ssl.keyStorePassword");
-    }
 }
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
index 7ef1589..fa309b5 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
- * Copyright (C) 2017 - 2019 Bell Canada.
+ * Copyright (C) 2017 - 2019 Bell Canada, Deutsche Telekom.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,9 +23,16 @@
 import io.grpc.ManagedChannel;
 import io.grpc.internal.DnsNameResolverProvider;
 import io.grpc.internal.PickFirstLoadBalancerProvider;
+import io.grpc.netty.GrpcSslContexts;
 import io.grpc.netty.NettyChannelBuilder;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
 import java.util.concurrent.CountDownLatch;
+import javax.net.ssl.SSLException;
+import javax.net.ssl.TrustManagerFactory;
 import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.so.client.KeyStoreLoader;
 import org.onap.so.client.PreconditionFailedException;
 import org.onap.so.client.RestPropertiesLoader;
 import org.slf4j.Logger;
@@ -73,10 +80,36 @@
             throw new PreconditionFailedException(
                     "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
         }
-        this.channel = NettyChannelBuilder.forAddress(props.getHost(), props.getPort())
+        NettyChannelBuilder builder = NettyChannelBuilder.forAddress(props.getHost(), props.getPort())
                 .nameResolverFactory(new DnsNameResolverProvider())
-                .loadBalancerFactory(new PickFirstLoadBalancerProvider())
-                .intercept(new BasicAuthClientInterceptor(props)).usePlaintext().build();
+                .loadBalancerFactory(new PickFirstLoadBalancerProvider());
+        if (props.getUseSSL()) {
+            log.info("Configure SSL connection");
+            KeyStore ks = KeyStoreLoader.getKeyStore();
+            if (ks == null) {
+                log.error("Can't load KeyStore");
+                throw new RuntimeException("Can't load KeyStore to create secure channel");
+            }
+            try {
+                TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+                tmf.init(ks);
+                builder.sslContext(GrpcSslContexts.forClient().trustManager(tmf).build());
+            } catch (NoSuchAlgorithmException e) {
+                log.error("Can't get default TrustManager algorithm");
+                throw new RuntimeException(e);
+            } catch (KeyStoreException e) {
+                log.error("TrustManagerFactory initialization failed");
+                throw new RuntimeException(e);
+            } catch (SSLException e) {
+                log.error("SslContext build error");
+                throw new RuntimeException(e);
+            }
+        }
+        if (props.getUseBasicAuth()) {
+            log.info("Configure Basic authentication");
+            builder.intercept(new BasicAuthClientInterceptor(props)).usePlaintext();
+        }
+        this.channel = builder.build();
         this.handler = new CDSProcessingHandler(listener);
         log.info("CDSProcessingClient started");
     }
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index 37a5c0b..db566fa 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -22,7 +22,6 @@
 
 import org.onap.so.client.RestProperties;
 
-
 public interface CDSProperties extends RestProperties {
 
     String getHost();
@@ -32,4 +31,8 @@
     String getBasicAuth();
 
     int getTimeout();
+
+    boolean getUseSSL();
+
+    boolean getUseBasicAuth();
 }
diff --git a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
index 18ec9ef..5792c28 100644
--- a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
+++ b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
@@ -20,7 +20,6 @@
 
 package org.onap.so.client.cds;
 
-
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 import io.grpc.inprocess.InProcessChannelBuilder;
@@ -58,7 +57,6 @@
     private CDSProcessingHandler handler;
     private CDSProcessingClient client;
 
-
     private final MutableHandlerRegistry serviceRegistry = new MutableHandlerRegistry();
     private final List<String> messagesDelivered = new ArrayList<>();
     private final CountDownLatch allRequestsDelivered = new CountDownLatch(1);
@@ -115,7 +113,6 @@
         new CDSProcessingClient(listener);
     }
 
-
     @Test
     public void testSendMessageFail() throws Exception {
 
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
index 2834d37..41238e5 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
@@ -72,4 +72,14 @@
     public int getTimeout() {
         return 60;
     }
+
+    @Override
+    public boolean getUseSSL() {
+        return false;
+    }
+
+    @Override
+    public boolean getUseBasicAuth() {
+        return true;
+    }
 }
diff --git a/docs/developer_info/Working_with_so_monitoring.rst b/docs/developer_info/Working_with_so_monitoring.rst
new file mode 100644
index 0000000..18b6d94
--- /dev/null
+++ b/docs/developer_info/Working_with_so_monitoring.rst
@@ -0,0 +1,70 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 Huawei Technologies Co., Ltd.
+
+Working with SO Monitoring
+==========================
+
+After the SO code is fully deployed, certain changes needs to be made in order to access the so-monitoring ui.
+
+1. Change the service type to NodePort
+---------------------------------------
+
+By default, the type of the so monitoring service is ClusterIP, which makes the Service only reachable from within the cluster.
+This is changed to NodePort, which is used to expose the service at a static port . Hence we will be able to contact the NodePort Service, from outside the cluster, by requesting <NodeIP>:<NodePort>.
+
+Command used to get the service configuration of so monitoring is:
+
+**sudo kubectl edit svc so-monitoring -n onap**
+
+.. image:: ../images/nodeport.png
+
+2. Add the credentials to login
+--------------------------------
+
+The override.yaml needs to be added with the login credentials, that is the username and the password in encrypted form.
+
+.. code-block:: bash
+
+ spring:
+   main:
+     allow-bean-definition-overriding: true
+   security:
+     usercredentials:
+     -                                         
+       username: gui
+       password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+       role: GUI-Client
+
+This override.yaml can be directly edited in case of local setup using docker.
+
+When deploying in any environment  using OOM, then after deployment the configmap needs to be edited. As configmap is the one reading the override.yaml.
+
+**Note** : Before deployment , if we add these changes in override.yaml ,then it may give parsing error in configmap while deployment. And after deployment the permissions on override.yaml don't allow us to edit it. So the best option is to edit the configmap using the below command and restart the pod. 
+
+**kubectl -n onap edit configmap dev-so-monitoring-app-configmap**
+
+.. image:: ../images/configmap.png
+
+Special care needs to be given to the indentation. spring needs to be inline with the mso already present and others added accordingly.
+
+3. Login to SO Monitoring
+-------------------------
+
+We need to first identify the external port which its mapped to using the following command : 
+
+**sudo kubectl -n onap get svc | grep so-monitoring**
+
+.. image:: ../images/nodemap.png
+
+Then access the UI of so monitoring , for example by  http://<IP>:30224/ 
+
+username : gui,
+password: password1$
+
+
+.. image:: ../images/ui.png
+
+
+
+
diff --git a/docs/developer_info/developer_information.rst b/docs/developer_info/developer_information.rst
index 10ea836..63338de 100644
--- a/docs/developer_info/developer_information.rst
+++ b/docs/developer_info/developer_information.rst
@@ -11,6 +11,7 @@
 
    Building_SO.rst
    Working_with_SO_Docker.rst
+   Working_with_so_monitoring.rst
    Camunda_Cockpit_Community_Edition.rst
    Camunda_Cockpit_Enterprise_Edition.rst
    Camunda_Modeler.rst
diff --git a/docs/images/configmap.png b/docs/images/configmap.png
new file mode 100644
index 0000000..3683de3
--- /dev/null
+++ b/docs/images/configmap.png
Binary files differ
diff --git a/docs/images/nodemap.png b/docs/images/nodemap.png
new file mode 100644
index 0000000..8dfda6c
--- /dev/null
+++ b/docs/images/nodemap.png
Binary files differ
diff --git a/docs/images/nodeport.png b/docs/images/nodeport.png
new file mode 100644
index 0000000..53bc02f
--- /dev/null
+++ b/docs/images/nodeport.png
Binary files differ
diff --git a/docs/images/ui.png b/docs/images/ui.png
new file mode 100644
index 0000000..1c075ba
--- /dev/null
+++ b/docs/images/ui.png
Binary files differ
diff --git a/pom.xml b/pom.xml
index ee9a352..68559c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<?xml version="1.0" ?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.onap.oparent</groupId>
@@ -1037,4 +1036,4 @@
       </build>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file