fix keypair conflict issue in openstack adapter

Fix wiremock stubs to return proper data and url
Fix copyright header issue on unit test file
Fix keypair issue, clean up unit tests and logging
Fix issues found in unit testing, update data
Fix broken Unit tests that used invalid data
Continue Refactor to support keypair failure scenario
Update logic for when to auto delete a stuck keypair

Change-Id: Ice5256cf0381a3b46d1c442907c0f321a1c0d006
Issue-ID: SO-1897
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index 4dcb7c8..add1918 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -20,18 +20,6 @@
 
 package org.onap.so.adapters.network;
 
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import static org.junit.Assert.assertEquals;
 import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
 import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
@@ -52,6 +40,18 @@
 import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
 import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGet;
 import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
 
 public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
 
@@ -142,12 +142,12 @@
 
         mockOpenStackResponseAccess(wireMockServer, wireMockPort);
 
-        mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
+        mockOpenStackGetStack_404(wireMockServer, "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
 
         mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
 
         mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
-                "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+                "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
 
         String uri = "/services/NetworkAdapter";
         headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -163,7 +163,7 @@
         mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
 
         mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
-                "dvspg-VCE_VPE-mtjnj40avbc");
+                "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
 
         String uri = "/services/NetworkAdapter";
         headers.set("X-ECOMP-RequestID", "123456789456127");
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
index b9fc419..5ee33ab 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
@@ -4,7 +4,7 @@
           <cloudSiteId>mtn13</cloudSiteId>
           <tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
           <networkType>CONTRAIL30_GNDIRECT</networkType>
-          <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+          <networkName>DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001</networkName>
           <physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
           <vlans>3014</vlans>
           <failIfExists>false</failIfExists>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
index af63ca7..be50d09 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
@@ -1,17 +1,15 @@
 {
-	"stack": {
-		"description": null,
-		"links": null,
-		"stackStatusReason": null,
-		"stackName": null,
-		"updatedTime": null,
-		"creationTime": null,
-		"stackStatus": "NOT_FOUND",
-		"id": "stackId",
-		"files": null,
-		"outputs": null,
-		"parameters": {
-			
-		}
-	}
-}
\ No newline at end of file
+  "stack": {
+    "creationTime": null, 
+    "description": null, 
+    "files": null, 
+    "id": "stackId", 
+    "links": null, 
+    "outputs": null, 
+    "parameters": {}, 
+    "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001", 
+    "stack_status": "CREATE_IN_PROGRESS", 
+    "stack_status_reason": null, 
+    "updatedTime": null
+  }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
index 29893cc..e49d407 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
@@ -1,17 +1,15 @@
 {
-	"stack": {
-		"description": null,
-		"links": null,
-		"stack_status_reason": null,
-		"stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
-		"updated_time": null,
-		"creation_time": null,
-		"stack_status": "CREATE_COMPLETE",
-		"id": "stackId",
-		"files": null,
-		"outputs": null,
-		"parameters": {
-			
-		}
-	}
-}
\ No newline at end of file
+  "stack": {
+    "creationTime": null, 
+    "description": null, 
+    "files": null, 
+    "id": "stackId", 
+    "links": null, 
+    "outputs": null, 
+    "parameters": {}, 
+    "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001", 
+    "stack_status": "CREATE_COMPLETE", 
+    "stack_status_reason": "Create Completed", 
+    "updatedTime": null
+  }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
index 8612258..bad85f3 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -3,7 +3,7 @@
 		"description": null,
 		"links": null,
 		"stackStatusReason": null,
-		"stackName": null,
+		"stackName": "stackName",
 		"updatedTime": null,
 		"creationTime": null,
 		"stack_status": "DELETE_COMPLETE",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
index f4a3c52..70c78a6 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
@@ -7,6 +7,7 @@
     			"rel" : "self"
 			}
 		],
-		"stack_name": "vnfBaseStack"
+		"stack_name": "vnfBaseStack",
+		"stack_status": "CREATE_COMPLETE"
 	}
 }
\ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
index 5d6eee7..8bfa6d8 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -29,25 +29,15 @@
     </appender>
 
 
-  <logger name="com.att.eelf.audit" level="INFO" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
-        <appender-ref ref="STDOUT" />
-  </logger>
 
-  <logger name="com.att.eelf.error" level="WARN" additivity="false">
+  <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
     <appender-ref ref="STDOUT" />
   </logger> 
   
  <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
     <appender-ref ref="STDOUT" />
   </logger>
-  
-   <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
+
 
   <root level="WARN">
     <appender-ref ref="STDOUT" />