more stability fixes

Remove conditional to not check VNF topology
add empty string verification for serviceName field
Add junits for CNRCR and NtwkAdptr changes.
Add search in new CollNtwkResCust tbl to get NtwkResource.
-  Updated test data files to include 'pre-load' flag in both
VfModuleOperation and NetworkOperation json test data files.
-  MSO to not to send <preload>boolean</from-preload> to SDNC in
network-topology-opertion and vf-module-topology-operation. Updated
GeneralTopologyObjectMapper to set 'from-preload' to null so that
elements with Nulls are not sent to SDNC. Updated
buildNetworkInformation() and buildVfModuleInformation() methods.
update flow stats to not cause bpmn flow to crash
Fix headers so SDNC does not return XML
Add implementation of deleteVolumeGroupResponse parsing; fix JUnits
that worked by accident.

Change-Id: Ia96d552d731e112505fcf739029a6fd4d0134546
Issue-ID: SO-1061
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/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
index 2a4564b..6123415 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
@@ -142,7 +142,7 @@
 
 		ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
 				createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
+		
 		CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
 				new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class);
 
@@ -150,6 +150,8 @@
 		assertThat(response.getBody(), sameBeanAs(expectedResponse));
 	}
 	
+
+	
 	@Test
 	public void testDeleteNetwork() throws IOException{
 		
@@ -267,6 +269,33 @@
 		assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
 	}	
 	
+	@Test
+	public void testCreateNetworkCNRC_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
+		
+		mockOpenStackResponseAccess(wireMockPort);
+
+		mockOpenStackPostPublicUrlWithBodyFile_200();
+
+		mockOpenStackGetStackCreatedAppC_200();
+		
+		mockOpenStackGetStackAppC_404();
+		
+		headers.add("Content-Type", MediaType.APPLICATION_JSON);
+		headers.add("Accept", MediaType.APPLICATION_JSON);
+		
+		String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json");
+		HttpEntity<String> entity = new HttpEntity<String>(request, headers);
+
+		ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
+				createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
+
+		CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
+				new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class);
+		
+		assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+		assertThat(response.getBody(), sameBeanAs(expectedResponse));
+	}
+	
 	@Override
 	protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
 		return new String(Files.readAllBytes(Paths.get(fileLocation)));
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json
new file mode 100644
index 0000000..accd9e9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork3.json
@@ -0,0 +1,42 @@
+{
+	"createNetworkRequest": {
+		"skipAAI": true,
+		"messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709",
+		"synchronous": true,
+		"cloudSiteId": "mtn13",
+		"tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+		"networkId": "da886914-efb2-4917-b335-c8381528d90b",
+		"networkName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3",
+		"networkType": "CONTRAIL30_BASIC",
+		"modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844",
+		"networkTechnology": "NEUTRON",
+		"subnets": [{
+			"subnetName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3_subnet_1",
+			"subnetId": "da60501d-9aa8-48d2-99b7-26644fa01093",
+			"cidr": "20",
+			"gatewayIp": "",
+			"ipVersion": "4",
+			"enableDHCP": false,
+			"addrFromStart": true,
+			"hostRoutes": []
+		}],
+		"providerVlanNetwork": {
+			"physicalNetworkName": "FALSE",
+			"vlans": []
+		},
+		"contrailNetwork": {
+			"shared": "false",
+			"external": "false",
+			"routeTargets": [],
+			"policyFqdns": [],
+			"routeTableFqdns": []
+		},
+		"failIfExists": true,
+		"backout": false,
+		"msoRequest": {
+			"requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+			"serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+		},
+		"contrailRequest": false
+	}
+}
\ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json
new file mode 100644
index 0000000..2e5517c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse3.json
@@ -0,0 +1,25 @@
+{
+	"createNetworkResponse": {
+		"networkId": "da886914-efb2-4917-b335-c8381528d90b",
+		"neutronNetworkId": null,
+		"networkStackId": "stackname/stackId",
+		"networkFqdn": null,
+		"networkCreated": true,
+		"subnetMap": {
+
+		},
+		"rollback": {
+			"networkStackId": "stackname/stackId",
+			"tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+			"cloudId": "mtn13",
+			"networkType": "CONTRAIL30_BASIC",
+			"modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844",
+			"networkCreated": true,
+			"msoRequest": {
+				"requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+				"serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+			}
+		},
+		"messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709"
+	}
+}
\ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql
index d16ca45..960f483 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/data.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql
@@ -71,6 +71,20 @@
 ('3bdbb104-476c-483e-9f8b-c095b3d30844', 'CONTRAIL30_BASIC', '', 'CONTRAIL30_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4789'),
 ('3bdbb104-476c-483e-9f8b-c095b3d3068c', 'CONTRAIL31_BASIC', '', 'CONTRAIL31_BASIC', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c4790');
 
+insert into instance_group(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, role, object_type, cr_model_uuid, instance_group_type) values
+('21e43a7c-d823-4f5b-a427-5235f63035ff', 'dror_cr_network_resource_1806..NetworkCollection..0', '81c94263-c01e-4046-b0c7-51878d658eab', '1', 'org.openecomp.groups.NetworkCollection', 'SUB_INTERFACE', 'L3_NETWORK', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'L3_NETWORK');
+
+insert into collection_resource(model_uuid, model_name, model_invariant_uuid, model_version, tosca_node_type, description) values
+('5e3fca45-e2d8-4987-bef1-016d9bda1a8c', 'Dror_CR_Network_Resource_1806', 'fe243154-ac18-405f-94c2-ef629d26b8bb', '2.0', 'org.openecomp.resource.cr.DrorCrNetworkResource1806', 'Creation date: 07/25/18');
+
+insert into collection_resource_customization(model_customization_uuid, model_instance_name, role, object_type, function, collection_resource_type, cr_model_uuid) values
+('c51096a4-6081-41f4-a540-3ed015a8064a', 'Dror_CR_Network_Resource_1806', 'Dror2', 'NetworkCollection', 'Dror1', 'Dror3', '5e3fca45-e2d8-4987-bef1-016d9bda1a8c');
+
+insert into collection_network_resource_customization(model_customization_uuid, model_instance_name, network_technology, network_type, network_role, network_scope, network_resource_model_uuid, instance_group_model_uuid, crc_model_customization_uuid) values
+('3bdbb104-ffff-483e-9f8b-c095b3d30844', 'ExtVL 0', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c4789', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a'),
+('3bdbb104-ffff-483e-9f8b-c095b3d3068c', 'ExtVL 0', 'CONTRAIL', 'L3-NETWORK', '', '', '10b36f65-f4e6-4be6-ae49-9596dc1c4790', '21e43a7c-d823-4f5b-a427-5235f63035ff', 'c51096a4-6081-41f4-a540-3ed015a8064a');
+
+
 insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
 ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null);