diff options
author | Haddox, Anthony (ah0647) <ah0647@att.com> | 2020-11-18 16:25:23 +0000 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-11-19 18:39:40 +0000 |
commit | 15dface554938da7b737924bae9713fa6b5ef794 (patch) | |
tree | 18f9314460eea1e8edc4c226703d587fa0dc4f28 /ms/generic-resource-api/src/test | |
parent | cdbee91b722e25728fca0af32cf6a55d5be50c2e (diff) |
[SDNC-1416]VNF CRUD Operations
Add database CRUD operations for several VNF related containers
Signed-off-by: Haddox, Anthony (ah0647) <ah0647@att.com>
Issue-ID: SDNC-1416
Change-Id: If85f3a1df76d5aba42b3bbd76475edad5275a9bf
Diffstat (limited to 'ms/generic-resource-api/src/test')
6 files changed, 915 insertions, 0 deletions
diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java index 609e780..7bcfefe 100644 --- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java @@ -2,10 +2,12 @@ package org.onap.sdnc.apps.ms.gra.controllers; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.databind.ObjectMapper; @@ -461,6 +463,192 @@ public class ConfigApiServicesControllerTest { configServicesRepository.deleteAll(); } + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdDelete() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadVnfData("src/test/resources/vnf-data.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + configServicesRepository.deleteAll(); + loadVnfData("src/test/resources/vnf-data.json"); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + + configServicesRepository.deleteAll(); + createBadVnfData(true, true); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + + configServicesRepository.deleteAll(); + createBadVnfData(false, false); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + + configServicesRepository.deleteAll(); + createBadVnfData(false, true); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.delete("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadVnfData("src/test/resources/vnf-data.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + configServicesRepository.deleteAll(); + createBadVnfData(false, false); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + assertEquals(0, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-data.json"))) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-data.json"))) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfTopologyGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadVnfData("src/test/resources/vnf-data.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + configServicesRepository.deleteAll(); + createBadVnfData(false, false); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.get("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfLevelOperStatusPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + assertEquals(0, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-level-oper-status/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-level-oper-status.json"))) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-level-oper-status/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-level-oper-status.json"))) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfTopologyOnapModelInformationPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + assertEquals(0, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/onap-model-information/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-onap-model-info.json"))) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/onap-model-information/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-onap-model-info.json"))) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfTopologyVnfResourceAssignmentsVnfNetworksPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + assertEquals(0, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-vnf-networks.json"))) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-vnf-networks.json"))) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataVnfsVnfVnfIdVnfDataVnfTopologyVnfResourceAssignmentsVnfNetworksVnfNetworkNetworkRolePut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + assertEquals(0, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/vnf-network/test-network-role/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-vnf-networks-network-role.json"))) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/test-siid/service-data/vnfs/vnf/2a3bfc93-cd4c-4845-8919-434b2d999ada/vnf-data/vnf-topology/vnf-resource-assignments/vnf-networks/vnf-network/test-network-role/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-vnf-networks-network-role.json"))) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + } + private String readFileContent(String path) throws IOException { String content = new String(Files.readAllBytes(Paths.get(path))); return content; @@ -485,4 +673,36 @@ public class ConfigApiServicesControllerTest { } } + private void loadVnfData(String path) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + String content = readFileContent(path); + GenericResourceApiServicedataServiceData svcData = new GenericResourceApiServicedataServiceData(); + GenericResourceApiServicedataServicedataVnfsVnf vnfData = objectMapper.readValue(content, GenericResourceApiServicedataServicedataVnfsVnf.class); + svcData.setVnfs(new GenericResourceApiServicedataServicedataVnfs()); + svcData.getVnfs().setVnf(new ArrayList<>()); + svcData.getVnfs().addVnfItem(vnfData); + ConfigServices newService = new ConfigServices(); + newService.setSvcData(objectMapper.writeValueAsString(svcData)); + newService.setSvcInstanceId("test-siid"); + configServicesRepository.save(newService); + } + + private void createBadVnfData(boolean useNullSvc, boolean useNullVnfs) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + ConfigServices newService = new ConfigServices(); + GenericResourceApiServicedataServiceData svcData = useNullSvc ? null : new GenericResourceApiServicedataServiceData(); + GenericResourceApiServicedataServicedataVnfs vnfs = useNullVnfs ? null : new GenericResourceApiServicedataServicedataVnfs(); + + // Overrides useNullSvc + if(!useNullVnfs) { + svcData = new GenericResourceApiServicedataServiceData(); + vnfs.setVnf(new ArrayList<>()); + svcData.setVnfs(vnfs); + } + + newService.setSvcInstanceId("test-siid"); + newService.setSvcData(objectMapper.writeValueAsString(svcData)); + configServicesRepository.save(newService); + } + }
\ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/vnf-data.json b/ms/generic-resource-api/src/test/resources/vnf-data.json new file mode 100644 index 0000000..22fc4aa --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/vnf-data.json @@ -0,0 +1,603 @@ +{ + "vnf-data": { + "request-information": { + "notification-url": "https://dev.null", + "order-number": "Order-123", + "order-version": "Order-v22", + "request-action": "CreateNetworkInstance", + "request-id": "a44e8401-2c62-47df-98be-9a09f6cbd996", + "source": "unit-test" + }, + "sdnc-request-header": { + "svc-action": "assign", + "svc-notification-url": "https://dev.null", + "svc-request-id": "9c06a7c6-be3a-4530-bdd8-c65b58f123a5" + }, + "service-information": { + "global-customer-id": "226fbb03-baf2-42bb-8311-03643a801238", + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "service-id": "98f189dd-2971-46f5-b4f1-1a9a323f39a4", + "service-instance-id": "98f189dd-2971-46f5-b4f1-1a9a323f39a4", + "subscriber-name": "unit-test", + "subscription-service-type": "unit-test" + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-data": { + "request-information": { + "notification-url": "https://dev.null", + "order-number": "Order-123", + "order-version": "Order-v22", + "request-action": "CreateNetworkInstance", + "request-id": "a44e8401-2c62-47df-98be-9a09f6cbd996", + "source": "unit-test" + }, + "sdnc-request-header": { + "svc-action": "assign", + "svc-notification-url": "https://dev.null", + "svc-request-id": "9c06a7c6-be3a-4530-bdd8-c65b58f123a5" + }, + "service-information": { + "global-customer-id": "226fbb03-baf2-42bb-8311-03643a801238", + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "service-id": "98f189dd-2971-46f5-b4f1-1a9a323f39a4", + "service-instance-id": "98f189dd-2971-46f5-b4f1-1a9a323f39a4", + "subscriber-name": "unit-test", + "subscription-service-type": "unit-test" + }, + "vf-module-information": { + "from-preload": true, + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "vf-module-id": "9270c447-3caf-4e12-85aa-3578b0fa61d5", + "vf-module-type": "some-vf-module-type" + }, + "vf-module-level-oper-status": { + "create-timestamp": "string", + "last-action": "CreateNetworkInstance", + "last-order-status": "Active", + "last-rpc-action": "assign", + "last-svc-request-id": "9c06a7c6-be3a-4530-bdd8-c65b58f123a5", + "modify-timestamp": "string", + "order-status": "Active" + }, + "vf-module-request-input": { + "aic-clli": "string", + "aic-cloud-region": "test-region", + "cloud-owner": "unit-test", + "request-version": "string", + "tenant": "string", + "vf-module-input-parameters": { + "param": [ + { + "name": "string", + "resource-resolution-data": { + "capability-name": "string", + "payload": "string", + "resource-key": [ + { + "name": "string", + "value": "string" + } + ], + "status": "string" + }, + "value": "string" + } + ] + }, + "vf-module-name": "string" + }, + "vf-module-topology": { + "aic-clli": "string", + "aic-cloud-region": "test-region", + "cloud-owner": "unit-test", + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "sdnc-generated-cloud-resources": true, + "tenant": "string", + "vf-module-assignments": { + "dhcp-subnet-assignments": { + "dhcp-subnet-assignment": [ + { + "ip-version": "string", + "network-role": "test-network-role", + "neutron-subnet-id": "string" + } + ] + }, + "vf-module-status": "string", + "vlan-vnfc-instance-groups": { + "vlan-vnfc-instance-group": [ + { + "instance-group-function": "string", + "instance-group-id": "string", + "vnf-id": "2a3bfc93-cd4c-4845-8919-434b2d999ada", + "vnfcs": { + "vnfc": [ + { + "vnfc-name": "string", + "vnic-groups": { + "vnic-group": [ + { + "network-instance-group-function": "string", + "vlan-assignment-policy-name": "string", + "vlan-common-ip-addresses": { + "ip-addresses": { + "ipv4-address": "string", + "ipv6-address": "string", + "vipv4-address": "string", + "vipv6-address": "string" + } + }, + "vlan-tag-index-next": 0, + "vlan-vnics": { + "vlan-vnic": [ + { + "vnic-port-id": "string", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "floating-ips": { + "floating-ip-v4": [ + "string" + ], + "floating-ip-v6": [ + "string" + ] + }, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "string", + "network-ips": { + "network-ip": [ + "string" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-name": 0, + "network-role": "test-network-role", + "network-role-tag": "string", + "neutron-network-id": "string", + "vlan-tag-id": 0 + } + ] + } + } + ] + }, + "vnic-interface-role": "string" + } + ] + } + } + ] + } + } + ] + }, + "vms": { + "vm": [ + { + "nfc-naming-code": "string", + "onap-model-information": { + "model-customization-uuid": "string", + "model-invariant-uuid": "string", + "model-name": "string", + "model-uuid": "string", + "model-version": "string" + }, + "vm-count": 0, + "vm-names": { + "vm-name": [ + "string" + ], + "vnfc-names": [ + { + "vnfc-name": "string", + "vnfc-networks": { + "vnfc-network-data": [ + { + "connection-point": { + "connection-point-id": "string", + "port-id": "string", + "vlan-data": [ + { + "vlan-role": "string", + "vlan-tag-description": "string", + "vlan-tag-id": "string", + "vlan-uuid": "string" + } + ] + }, + "vnfc-network-role": "string", + "vnfc-ports": { + "vnfc-port": [ + { + "common-sub-interface-role": "string", + "vnfc-port-id": "string", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "floating-ips": { + "floating-ip-v4": [ + "string" + ], + "floating-ip-v6": [ + "string" + ] + }, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "string", + "network-ips": { + "network-ip": [ + "string" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-name": 0, + "network-role": "test-network-role", + "network-role-tag": "string", + "neutron-network-id": "string", + "vlan-tag-id": 0 + } + ] + } + } + ] + }, + "vnfc-subnet": [ + { + "vnfc-ip-assignments": [ + { + "vnfc-address-family": "ipv4", + "vnfc-subnet-dhcp": "Y", + "vnfc-subnet-ip": [ + { + "ip-type": "FIXED", + "vnfc-client-key": "string", + "vnfc-ip-address": "string" + } + ], + "vnfc-subnet-ip-count": 0 + } + ], + "vnfc-subnet-role": "string" + } + ], + "vnfc-type": "string" + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "floating-ips": { + "floating-ip-v4": [ + "string" + ], + "floating-ip-v6": [ + "string" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "string" + ] + }, + "is-trunked": true, + "mac-addresses": { + "mac-address": [ + "string" + ] + }, + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "string", + "network-ips": { + "network-ip": [ + "string" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-role": "test-network-role", + "network-role-tag": "string", + "related-networks": { + "related-network": [ + { + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-role": "test-network-role", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "string" + } + } + ] + }, + "segmentation-id": "string", + "sriov-parameters": { + "application-tags": { + "c-tags": { + "c-tag": [ + "string" + ], + "ctag": [ + "string" + ] + }, + "ctags": { + "c-tag": [ + "string" + ], + "ctag": [ + "string" + ] + }, + "s-tags": { + "s-tag": [ + "string" + ], + "stag": [ + "string" + ] + }, + "stags": { + "s-tag": [ + "string" + ], + "stag": [ + "string" + ] + } + }, + "heat-vlan-filters": { + "heat-vlan-filter": [ + "string" + ] + } + } + } + ] + }, + "vm-type": "string", + "vm-type-tag": "string" + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "string", + "resource-resolution-data": { + "capability-name": "string", + "payload": "string", + "resource-key": [ + { + "name": "string", + "value": "string" + } + ], + "status": "string" + }, + "value": "string" + } + ] + }, + "vf-module-topology-identifier": { + "vf-module-id": "9270c447-3caf-4e12-85aa-3578b0fa61d5", + "vf-module-name": "some-vf-module-name", + "vf-module-type": "some-vf-module-type" + } + }, + "vnf-information": { + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "vnf-id": "2a3bfc93-cd4c-4845-8919-434b2d999ada", + "vnf-name": "mytestvnf", + "vnf-type" : "SMSF-NC2-578-SVC/SMSF-NC2-578" + } + }, + "vf-module-id": "9270c447-3caf-4e12-85aa-3578b0fa61d5" + } + ] + }, + "vnf-information": { + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "vnf-id": "2a3bfc93-cd4c-4845-8919-434b2d999ada", + "vnf-name": "mytestvnf", + "vnf-type" : "SMSF-NC2-578-SVC/SMSF-NC2-578" + }, + "vnf-level-oper-status": { + "create-timestamp": "string", + "last-action": "CreateNetworkInstance", + "last-order-status": "Active", + "last-rpc-action": "assign", + "last-svc-request-id": "9c06a7c6-be3a-4530-bdd8-c65b58f123a5", + "modify-timestamp": "string", + "order-status": "Active" + }, + "vnf-request-input": { + "aic-clli": "string", + "aic-cloud-region": "test-region", + "cloud-owner": "unit-test", + "request-version": "string", + "tenant": "string", + "vnf-name": "mytestvnf", + "vnf-networks": { + "vnf-network": [ + { + "contrail-network-fqdn": "string", + "is-trunked": true, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-name": "test-network-name", + "network-role": "test-network-role", + "neutron-id": "812562dd-9d91-4ba6-9c3e-e52bf1cd4cc6", + "related-networks": { + "related-network": [ + { + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-role": "test-network-role", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "string" + } + } + ] + }, + "segmentation-id": "string", + "subnets-data": { + "subnet-data": [ + { + "cidr-mask": "string", + "dhcp-enabled": "Y", + "gateway-address": "string", + "ip-version": "string", + "network-start-address": "string", + "sdnc-subnet-id": "string", + "subnet-id": "string", + "subnet-name": "string", + "subnet-role": "string" + } + ] + } + } + ] + } + }, + "vnf-topology": { + "aic-clli": "string", + "aic-cloud-region": "test-region", + "cloud-owner": "unit-test", + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + }, + "sdnc-generated-cloud-resources": true, + "tenant": "string", + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "string" + ], + "max-count": 0 + }, + "vnf-networks": { + "vnf-network": [ + { + "contrail-network-fqdn": "string", + "is-trunked": true, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-name": "test-network-name", + "network-role": "test-network-role", + "neutron-id": "812562dd-9d91-4ba6-9c3e-e52bf1cd4cc6", + "related-networks": { + "related-network": [ + { + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-role": "test-network-role", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "string" + } + } + ] + }, + "segmentation-id": "string", + "subnets-data": { + "subnet-data": [ + { + "cidr-mask": "string", + "dhcp-enabled": "Y", + "gateway-address": "string", + "ip-version": "string", + "network-start-address": "string", + "sdnc-subnet-id": "string", + "subnet-id": "string", + "subnet-name": "string", + "subnet-role": "string" + } + ] + } + } + ] + }, + "vnf-status": "string" + }, + "vnf-topology-identifier-structure": { + "nf-code": "string", + "nf-function": "string", + "nf-role": "string", + "nf-type": "string", + "vnf-id": "2a3bfc93-cd4c-4845-8919-434b2d999ada", + "vnf-name": "mytestvnf", + "vnf-type" : "SMSF-NC2-578-SVC/SMSF-NC2-578" + } + } + }, + "vnf-id": "2a3bfc93-cd4c-4845-8919-434b2d999ada" +}
\ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/vnf-level-oper-status.json b/ms/generic-resource-api/src/test/resources/vnf-level-oper-status.json new file mode 100644 index 0000000..1778cab --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/vnf-level-oper-status.json @@ -0,0 +1,11 @@ +{ + "vnf-level-oper-status": { + "create-timestamp": "string", + "last-action": "CreateNetworkInstance", + "last-order-status": "Active", + "last-rpc-action": "assign", + "last-svc-request-id": "9c06a7c6-be3a-4530-bdd8-c65b58f123a5", + "modify-timestamp": "string", + "order-status": "Active" + } +}
\ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/vnf-onap-model-info.json b/ms/generic-resource-api/src/test/resources/vnf-onap-model-info.json new file mode 100644 index 0000000..d44dc49 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/vnf-onap-model-info.json @@ -0,0 +1,9 @@ +{ + "onap-model-information": { + "model-customization-uuid": "602c6bcc-6cfa-41cb-a8a7-968b38d5935f", + "model-invariant-uuid": "bdb4f943-c9be-4742-b976-a34607f3687e", + "model-name": "SMSF-NC2-578", + "model-uuid": "86c76b5d-fa8d-4034-b79a-1cc4326021a9", + "model-version": "3.0" + } +}
\ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/vnf-vnf-networks-network-role.json b/ms/generic-resource-api/src/test/resources/vnf-vnf-networks-network-role.json new file mode 100644 index 0000000..d435c4a --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/vnf-vnf-networks-network-role.json @@ -0,0 +1,34 @@ +{ + "contrail-network-fqdn": "string", + "is-trunked": true, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-name": "test-network-name", + "network-role": "test-network-role", + "neutron-id": "812562dd-9d91-4ba6-9c3e-e52bf1cd4cc6", + "related-networks": { + "related-network": [{ + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-role": "test-network-role", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "string" + } + }] + }, + "segmentation-id": "string", + "subnets-data": { + "subnet-data": [{ + "cidr-mask": "string", + "dhcp-enabled": "Y", + "gateway-address": "string", + "ip-version": "string", + "network-start-address": "string", + "sdnc-subnet-id": "string", + "subnet-id": "string", + "subnet-name": "string", + "subnet-role": "string" + }] + } +}
\ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/vnf-vnf-networks.json b/ms/generic-resource-api/src/test/resources/vnf-vnf-networks.json new file mode 100644 index 0000000..3f73cba --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/vnf-vnf-networks.json @@ -0,0 +1,38 @@ +{ + "vnf-networks": { + "vnf-network": [{ + "contrail-network-fqdn": "string", + "is-trunked": true, + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-name": "test-network-name", + "network-role": "test-network-role", + "neutron-id": "812562dd-9d91-4ba6-9c3e-e52bf1cd4cc6", + "related-networks": { + "related-network": [{ + "network-id": "69f09279-8af1-4475-83cf-7e357c579dbf", + "network-role": "test-network-role", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "string" + } + }] + }, + "segmentation-id": "string", + "subnets-data": { + "subnet-data": [{ + "cidr-mask": "string", + "dhcp-enabled": "Y", + "gateway-address": "string", + "ip-version": "string", + "network-start-address": "string", + "sdnc-subnet-id": "string", + "subnet-id": "string", + "subnet-name": "string", + "subnet-role": "string" + }] + } + }] + } +}
\ No newline at end of file |