From fc24231f90399ee7c6395dd5b6d6da7b703a695a Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Wed, 24 Jun 2020 08:14:17 -0400 Subject: Add REST CRUD ops for service data Add REST Create/Read/Update/Delete for service data Change-Id: Ie22e8a82afa6b50c4a9fbe80ec792996e377abed Issue-ID: SDNC-1213 Signed-off-by: Dan Timoney --- .../ConfigApiPreloadControllerTest.java | 468 +++++++++++++++++++ .../ConfigApiServicesControllerTest.java | 487 +++++++++++++++++++ .../gra/controllers/GenericResourceMsAppTest.java | 42 ++ .../src/test/resources/application.properties | 20 + .../src/test/resources/preload-net.json | 91 ---- .../src/test/resources/preload-vfmodule.json | 375 --------------- .../src/test/resources/preload.data | 518 --------------------- .../src/test/resources/preload1-net-list-item.json | 81 ++++ .../test/resources/preload1-net-model-info.json | 84 ++++ .../test/resources/preload1-net-preload-data.json | 78 ++++ .../src/test/resources/preload1-rpc-network.json | 91 ++++ .../src/test/resources/preload1-rpc-vfmodule.json | 375 +++++++++++++++ .../src/test/resources/preload1.json | 84 ---- .../src/test/resources/preload2-net-list-item.json | 81 ++++ .../test/resources/preload2-net-model-info.json | 84 ++++ .../src/test/resources/service1-servicedata.json | 221 +++++++++ .../src/test/resources/service1-serviceitem.json | 233 +++++++++ .../src/test/resources/service1-servicestatus.json | 10 + .../src/test/resources/service1.json | 236 ++++++++++ .../src/test/resources/svclogic.properties | 29 ++ 20 files changed, 2620 insertions(+), 1068 deletions(-) create mode 100644 ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java create mode 100644 ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java create mode 100644 ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java create mode 100644 ms/generic-resource-api/src/test/resources/application.properties delete mode 100644 ms/generic-resource-api/src/test/resources/preload-net.json delete mode 100644 ms/generic-resource-api/src/test/resources/preload-vfmodule.json delete mode 100644 ms/generic-resource-api/src/test/resources/preload.data create mode 100644 ms/generic-resource-api/src/test/resources/preload1-net-list-item.json create mode 100644 ms/generic-resource-api/src/test/resources/preload1-net-model-info.json create mode 100644 ms/generic-resource-api/src/test/resources/preload1-net-preload-data.json create mode 100644 ms/generic-resource-api/src/test/resources/preload1-rpc-network.json create mode 100644 ms/generic-resource-api/src/test/resources/preload1-rpc-vfmodule.json delete mode 100644 ms/generic-resource-api/src/test/resources/preload1.json create mode 100644 ms/generic-resource-api/src/test/resources/preload2-net-list-item.json create mode 100644 ms/generic-resource-api/src/test/resources/preload2-net-model-info.json create mode 100644 ms/generic-resource-api/src/test/resources/service1-servicedata.json create mode 100644 ms/generic-resource-api/src/test/resources/service1-serviceitem.json create mode 100644 ms/generic-resource-api/src/test/resources/service1-servicestatus.json create mode 100644 ms/generic-resource-api/src/test/resources/service1.json create mode 100644 ms/generic-resource-api/src/test/resources/svclogic.properties (limited to 'ms/generic-resource-api/src/test') diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java new file mode 100644 index 0000000..7e7a3ac --- /dev/null +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java @@ -0,0 +1,468 @@ +package org.onap.sdnc.apps.ms.gra.controllers; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; +import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import static org.junit.Assert.assertEquals; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes={GenericResourceMsApp.class}) +@AutoConfigureMockMvc +@Transactional +public class ConfigApiPreloadControllerTest { + + private final static String CONFIG_PRELOAD_URL = "/config/GENERIC-RESOURCE-API:preload-information/"; + private final static String CONFIG_PRELOAD_LIST_URL = "/config/GENERIC-RESOURCE-API:preload-information/GENERIC-RESOURCE-API:preload-list/"; + + + @Autowired + private MockMvc mvc; + + @Autowired + ConfigPreloadDataRepository configPreloadDataRepository; + + @BeforeClass + public static void setUp() throws Exception { + System.setProperty("serviceLogicProperties", "src/test/resources/svclogic.properties"); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationDelete() throws Exception { + + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Load test data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + + assertEquals(1, configPreloadDataRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + // Test with no data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGet() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configPreloadDataRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationPost() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String content = readFileContent("src/test/resources/preload1-net-model-info.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + // Clean up data + configPreloadDataRepository.deleteAll(); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationPut() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String content = readFileContent("src/test/resources/preload1-net-model-info.json"); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPost() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String content = readFileContent("src/test/resources/preload1-net-model-info.json"); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeDelete() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + // Test without data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGet() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configPreloadDataRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypePostNoData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String content = readFileContent("src/test/resources/preload1-net-list-item.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypePostExistingData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + String content = readFileContent("src/test/resources/preload1-net-list-item.json"); + + // Test with existing data - should return 409 + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + } + + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypePut() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String badContent = readFileContent("src/test/resources/preload1-net-model-info.json"); + String goodContent = readFileContent("src/test/resources/preload1-net-list-item.json"); + + // Test with bad file content + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(badContent)) + .andReturn(); + assertEquals(400, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + // Test with no data + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + // Test with existing data - should return 204 + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + } + + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataDelete() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + // Test without data + configPreloadDataRepository.deleteAll(); + assertEquals(0, configPreloadDataRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataGet() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configPreloadDataRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPostNoData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPostBadContent() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String badContent = readFileContent("src/test/resources/preload1-net-model-info.json"); + + // Load single entry with no preloadData + ConfigPreloadData preloadData = new ConfigPreloadData(); + preloadData.setPreloadId("preload1"); + preloadData.setPreloadType("network"); + preloadData.setPreloadData(null); + configPreloadDataRepository.save(preloadData); + + // Test with bad file content + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent)) + .andReturn(); + assertEquals(400, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPostGoodData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + // Load single entry with no preloadData + ConfigPreloadData preloadData = new ConfigPreloadData(); + preloadData.setPreloadId("preload1"); + preloadData.setPreloadType("network"); + preloadData.setPreloadData(null); + configPreloadDataRepository.save(preloadData); + + + // Test with no existing preload data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPostExistingRecord() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + + // Test with existing preload dat + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + } + + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPutNoData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configPreloadDataRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPutBadContent() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String badContent = readFileContent("src/test/resources/preload1-net-model-info.json"); + + // Load single entry with no preloadData + ConfigPreloadData preloadData = new ConfigPreloadData(); + preloadData.setPreloadId("preload1"); + preloadData.setPreloadType("network"); + preloadData.setPreloadData(null); + configPreloadDataRepository.save(preloadData); + + // Test with bad file content + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent)) + .andReturn(); + assertEquals(400, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPutGoodData() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + // Load single entry with no preloadData + ConfigPreloadData preloadData = new ConfigPreloadData(); + preloadData.setPreloadId("preload1"); + preloadData.setPreloadType("network"); + preloadData.setPreloadData(null); + configPreloadDataRepository.save(preloadData); + + + // Test with no existing preload data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + } + + @Test + public void configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPutExistingRecord() throws Exception { + // Clean up data + configPreloadDataRepository.deleteAll(); + + String goodContent = readFileContent("src/test/resources/preload1-net-preload-data.json"); + + + // Test with data + loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json"); + assert(configPreloadDataRepository.count() > 0); + + + // Test with existing preload dat + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configPreloadDataRepository.count()); + } + + private String readFileContent(String path) throws IOException { + String content = new String(Files.readAllBytes(Paths.get(path))); + return content; + } + + private void deleteData(String url) throws Exception { + mvc.perform(MockMvcRequestBuilders.delete(url).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + } + + private void loadData(String url, String path) throws Exception { + String content = readFileContent(path); + mvc.perform(MockMvcRequestBuilders.post(url).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + + + } +} \ No newline at end of file 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 new file mode 100644 index 0000000..5653b3b --- /dev/null +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java @@ -0,0 +1,487 @@ +package org.onap.sdnc.apps.ms.gra.controllers; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; +import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData; +import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository; +import org.onap.sdnc.apps.ms.gra.data.ConfigServices; +import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceModelInfrastructure; +import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicemodelinfrastructureService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes={GenericResourceMsApp.class}) +@AutoConfigureMockMvc +@Transactional +public class ConfigApiServicesControllerTest { + + private final static String CONFIG_SERVICES_URL = "/config/GENERIC-RESOURCE-API:services/"; + private final static String CONFIG_SERVICES_SERVICE_URL = "/config/GENERIC-RESOURCE-API:services/GENERIC-RESOURCE-API:service/"; + + @Autowired + private MockMvc mvc; + + @Autowired + ConfigServicesRepository configServicesRepository; + + @BeforeClass + public static void setUp() throws Exception { + System.setProperty("serviceLogicProperties", "src/test/resources/svclogic.properties"); + } + + + @Test + public void configGENERICRESOURCEAPIservicesDelete() throws Exception { + + // Clean up data + configServicesRepository.deleteAll(); + + // Load test data + loadServicesData( "src/test/resources/service1.json"); + + assertEquals(1, configServicesRepository.count()); + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Test with no data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + + } + + @Test + public void configGENERICRESOURCEAPIservicesGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with data + loadServicesData("src/test/resources/service1.json"); + assert(configServicesRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configServicesRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesPost() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Clean up data + configServicesRepository.deleteAll(); + + } + + @Test + public void configGENERICRESOURCEAPIservicesPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Clean up data + configServicesRepository.deleteAll(); + + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdDelete() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadServicesData("src/test/resources/service1.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with data + loadServicesData("src/test/resources/service1.json"); + assert(configServicesRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configServicesRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdPost() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-serviceitem.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Clean up data + configServicesRepository.deleteAll(); + + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-serviceitem.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + + // Clean up data + configServicesRepository.deleteAll(); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataDelete() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadServicesData("src/test/resources/service1.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List services = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, services.size()); + assertEquals(null, services.get(0).getSvcData()); + + + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with data + loadServicesData("src/test/resources/service1.json"); + assert(configServicesRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configServicesRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataPost() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-servicedata.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Test with empty service data + ConfigServices service = new ConfigServices(); + service.setSvcInstanceId("service1"); + configServicesRepository.save(service); + assertEquals(1, configServicesRepository.count()); + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List updatedService = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, updatedService.size()); + assertNotEquals(null, updatedService.get(0).getSvcData()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + + // Clean up data + configServicesRepository.deleteAll(); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-servicedata.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Test with empty service data + ConfigServices service = new ConfigServices(); + service.setSvcInstanceId("service1"); + configServicesRepository.save(service); + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List updatedService = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, updatedService.size()); + assertNotEquals(null, updatedService.get(0).getSvcData()); + + // Test with existing data - should return 204 + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + + // Clean up data + configServicesRepository.deleteAll(); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusDelete() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Load data + loadServicesData("src/test/resources/service1.json"); + assertEquals(1, configServicesRepository.count()); + + // Test with data + mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List services = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, services.size()); + assertEquals(null, services.get(0).getServiceStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusGet() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + // Test with data + loadServicesData("src/test/resources/service1.json"); + assert(configServicesRepository.count() > 0); + + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(200, mvcResult.getResponse().getStatus()); + + // Test with no data + configServicesRepository.deleteAll(); + mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusPost() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-servicestatus.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Test with empty service data + ConfigServices service = new ConfigServices(); + service.setSvcInstanceId("service1"); + configServicesRepository.save(service); + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List updatedService = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, updatedService.size()); + assertNotEquals(null, updatedService.get(0).getServiceStatus()); + + // Test with existing data - should return 409 + mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(409, mvcResult.getResponse().getStatus()); + + // Clean up data + configServicesRepository.deleteAll(); + } + + @Test + public void configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusPut() throws Exception { + // Clean up data + configServicesRepository.deleteAll(); + + String content = readFileContent("src/test/resources/service1-servicestatus.json"); + + // Test with no data + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(404, mvcResult.getResponse().getStatus()); + assertEquals(0, configServicesRepository.count()); + + // Test with empty service status + ConfigServices service = new ConfigServices(); + service.setSvcInstanceId("service1"); + configServicesRepository.save(service); + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(201, mvcResult.getResponse().getStatus()); + assertEquals(1, configServicesRepository.count()); + List updatedService = configServicesRepository.findBySvcInstanceId("service1"); + assertEquals(1, updatedService.size()); + assertNotEquals(null, updatedService.get(0).getServiceStatus()); + + // Test with existing data - should return 204 + mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content)) + .andReturn(); + assertEquals(204, mvcResult.getResponse().getStatus()); + + // Clean up data + configServicesRepository.deleteAll(); + } + + private String readFileContent(String path) throws IOException { + String content = new String(Files.readAllBytes(Paths.get(path))); + return content; + } + + private void deleteData(String url) throws Exception { + mvc.perform(MockMvcRequestBuilders.delete(url).contentType(MediaType.APPLICATION_JSON).content("")) + .andReturn(); + } + + private void loadServicesData(String path) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + String content = readFileContent(path); + GenericResourceApiServiceModelInfrastructure services = objectMapper.readValue(content, GenericResourceApiServiceModelInfrastructure.class); + + for (GenericResourceApiServicemodelinfrastructureService service : services.getService()) { + ConfigServices newService = new ConfigServices(); + newService.setSvcInstanceId(service.getServiceInstanceId()); + newService.setSvcData(objectMapper.writeValueAsString(service.getServiceData())); + newService.setServiceStatus(service.getServiceStatus()); + configServicesRepository.save(newService); + } + } + +} \ No newline at end of file diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java new file mode 100644 index 0000000..0a19f39 --- /dev/null +++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/GenericResourceMsAppTest.java @@ -0,0 +1,42 @@ +package org.onap.sdnc.apps.ms.gra.controllers; + +import org.apache.shiro.realm.Realm; +import org.apache.shiro.realm.text.PropertiesRealm; +import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.sdnc.apps.ms.gra.core.GenericResourceMsApp; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class GenericResourceMsAppTest { + + GenericResourceMsApp app; + + @Before + public void setUp() throws Exception { + app = new GenericResourceMsApp(); + System.setProperty("serviceLogicProperties", "src/test/resources/svclogic.properties"); + } + + @Test + public void realm() { + Realm realm = app.realm(); + assertTrue(realm instanceof PropertiesRealm); + + + } + + @Test + public void shiroFilterChainDefinition() { + ShiroFilterChainDefinition chainDefinition = app.shiroFilterChainDefinition(); + Map chainMap = chainDefinition.getFilterChainMap(); + assertEquals("anon", chainMap.get("/**")); + + + } +} \ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/application.properties b/ms/generic-resource-api/src/test/resources/application.properties new file mode 100644 index 0000000..04538f1 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/application.properties @@ -0,0 +1,20 @@ +springfox.documentation.swagger.v2.path=/api-docs +server.servlet.context-path=/restconf +server.port=8080 +spring.jackson.date-format=org.onap.sdnc.apps.ms.gra.swagger.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false +logging.level.com.att=TRACE +logging.level.org.onap=TRACE +spring.datasource.url=jdbc:derby:memory:sdnctl;create=true +spring.datasource.username=sdnc +spring.datasource.password=abc123 +spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver +spring.datasource.testWhileIdle=true +spring.datasource.validationQuery=SELECT 1 +spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=update +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl +# spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy +spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl +spring.jpa.database=derby +serviceLogicProperties=src/test/resources/svclogic.properties \ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/preload-net.json b/ms/generic-resource-api/src/test/resources/preload-net.json deleted file mode 100644 index 8cc41c1..0000000 --- a/ms/generic-resource-api/src/test/resources/preload-net.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "input": { - "preload-network-topology-information": { - "host-routes": [ - { - "next-hop": "10.1.12.1", - "route-prefix": "12" - } - ], - "is-external-network": true, - "is-provider-network": true, - "is-shared-network": true, - "network-policy": [ - { - "network-policy-fqdn": "policy-sdnc.onap.org", - "network-policy-id": "123" - } - ], - "network-topology-identifier-structure": { - "eipam-v4-address-plan": "plan9", - "eipam-v6-address-plan": "plan9v6", - "is-trunked": true, - "network-id": "321", - "network-instance-group-id": "abc123", - "network-name": "syfy", - "network-role": "secret", - "network-technology": "soupcan", - "network-type": "fake", - "related-networks": { - "related-network": [ - { - "network-id": "skynet", - "network-role": "master", - "vlan-tags": { - "is-private": true, - "lower-tag-id": 0, - "upper-tag-id": 0, - "vlan-interface": "le0" - } - } - ] - }, - "segmentation-id": "seg1" - }, - "physical-network-name": "skynet", - "route-table-reference": [ - { - "route-table-reference-fqdn": "sky.net", - "route-table-reference-id": "ref1" - } - ], - "subnets": [ - { - "addr-from-start": "Y", - "cidr-mask": "255.255.0.0", - "dhcp-enabled": "Y", - "dhcp-end-address": "10.1.2.254", - "dhcp-start-address": "10.1.2.1", - "gateway-address": "10.1.2.255", - "ip-version": "ipv4", - "start-address": "10.1.2.1", - "subnet-name": "subnet1", - "subnet-role": "puppies", - "subnet-sequence": 0 - } - ], - "vpn-bindings": [ - { - "aic-zone": "zone1", - "global-route-target": "string", - "route-target-role": "string", - "vpn-binding-id": "string", - "vpn-name": "string" - } - ] - }, - "request-information": { - "notification-url": "http://dev.null.com", - "order-number": "123456", - "order-version": "2010.06", - "request-action": "CreateNetworkInstance", - "request-id": "REQ123456", - "source": "curl" - }, - "sdnc-request-header": { - "svc-action": "reserve", - "svc-notification-url": "http://dev.null.com", - "svc-request-id": "SVCREQ123456" - } - } -} diff --git a/ms/generic-resource-api/src/test/resources/preload-vfmodule.json b/ms/generic-resource-api/src/test/resources/preload-vfmodule.json deleted file mode 100644 index 4deae1b..0000000 --- a/ms/generic-resource-api/src/test/resources/preload-vfmodule.json +++ /dev/null @@ -1,375 +0,0 @@ -{ - "input": { - "preload-vf-module-topology-information": { - "vf-module-topology": { - "aic-clli": "AIC12345", - "aic-cloud-region": "Cloud9", - "cloud-owner": "aic", - "onap-model-information": { - "model-customization-uuid": "123123123", - "model-invariant-uuid": "123123123", - "model-name": "frankfurt", - "model-uuid": "121212", - "model-version": "frankfurt" - }, - "sdnc-generated-cloud-resources": true, - "tenant": "tenant", - "vf-module-assignments": { - "dhcp-subnet-assignments": { - "dhcp-subnet-assignment": [ - { - "ip-version": "ipv4", - "network-role": "netrole", - "neutron-subnet-id": "sub1" - } - ] - }, - "vf-module-status": "Active", - "vlan-vnfc-instance-groups": { - "vlan-vnfc-instance-group": [ - { - "instance-group-function": "function", - "instance-group-id": "groupid", - "vnf-id": "123", - "vnfcs": { - "vnfc": [ - { - "vnfc-name": "vnc1", - "vnic-groups": { - "vnic-group": [ - { - "network-instance-group-function": "func1", - "vlan-assignment-policy-name": "policy1", - "vlan-common-ip-addresses": { - "ip-addresses": { - "ipv4-address": "10.1.2.1" - } - }, - "vlan-tag-index-next": 0, - "vlan-vnics": { - "vlan-vnic": [ - { - "vnic-port-id": "8080", - "vnic-sub-interfaces": { - "sub-interface-network-data": [ - { - "floating-ips": { - "floating-ip-v4": [ - "10.1.2.1" - ] - }, - "network-id": "string", - "network-information-items": { - "network-information-item": [ - { - "ip-count": 0, - "ip-version": "ipv4", - "network-ips": { - "network-ip": [ - "10.1.2.2" - ] - }, - "use-dhcp": "Y" - } - ] - }, - "network-name": 0, - "network-role": "role1", - "network-role-tag": "tag1", - "neutron-network-id": "net1", - "vlan-tag-id": 0 - } - ] - } - } - ] - }, - "vnic-interface-role": "vnicrole1" - } - ] - } - } - ] - } - } - ] - }, - "vms": { - "vm": [ - { - "nfc-naming-code": "name1", - "onap-model-information": { - "model-customization-uuid": "456456456", - "model-invariant-uuid": "456456456", - "model-name": "model2", - "model-uuid": "678678678", - "model-version": "version2" - }, - "vm-count": 0, - "vm-names": { - "vm-name": [ - "vm1" - ], - "vnfc-names": [ - { - "vnfc-name": "vnc1", - "vnfc-networks": { - "vnfc-network-data": [ - { - "connection-point": { - "connection-point-id": "conn1", - "port-id": "8181", - "vlan-data": [ - { - "vlan-role": "role2", - "vlan-tag-description": "tag2", - "vlan-tag-id": "1", - "vlan-uuid": "78789789" - } - ] - }, - "vnfc-network-role": "role3", - "vnfc-ports": { - "vnfc-port": [ - { - "common-sub-interface-role": "subrole1", - "vnfc-port-id": "8787", - "vnic-sub-interfaces": { - "sub-interface-network-data": [ - { - "floating-ips": { - "floating-ip-v4": [ - "10.1.3.10" - ] - }, - "network-id": "net2", - "network-information-items": { - "network-information-item": [ - { - "ip-count": 0, - "ip-version": "ipv4", - "network-ips": { - "network-ip": [ - "10.1.3.4" - ] - }, - "use-dhcp": "Y" - } - ] - }, - "network-name": 0, - "network-role": "netrole4", - "network-role-tag": "tag5", - "neutron-network-id": "nnet5", - "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": "10.1.7.1" - } - ], - "vnfc-subnet-ip-count": 0 - } - ], - "vnfc-subnet-role": "string" - } - ], - "vnfc-type": "string" - } - ] - } - } - ] - }, - "vm-networks": { - "vm-network": [ - { - "floating-ips": { - "floating-ip-v4": [ - "10.1.9.1" - ] - }, - "interface-route-prefixes": { - "interface-route-prefix": [ - "10" - ] - }, - "is-trunked": true, - "mac-addresses": { - "mac-address": [ - "cafe:beef" - ] - }, - "network-information-items": { - "network-information-item": [ - { - "ip-count": 0, - "ip-version": "ipv4", - "network-ips": { - "network-ip": [ - "10.2.3.10" - ] - }, - "use-dhcp": "Y" - } - ] - }, - "network-role": "netrole9", - "network-role-tag": "tag9", - "related-networks": { - "related-network": [ - { - "network-id": "net9", - "network-role": "netrole9", - "vlan-tags": { - "is-private": true, - "lower-tag-id": 0, - "upper-tag-id": 0, - "vlan-interface": "vlan0" - } - } - ] - }, - "segmentation-id": "seg1", - "sriov-parameters": { - "application-tags": { - "c-tags": { - "c-tag": [ - "ctag1" - ] - }, - "s-tags": { - "s-tag": [ - "stag1" - ] - } - }, - "heat-vlan-filters": { - "heat-vlan-filter": [ - "10" - ] - } - } - } - ] - }, - "vm-type": "vmtype1", - "vm-type-tag": "vmtag1" - } - ] - } - }, - "vf-module-parameters": { - "param": [ - { - "name": "vfmodname", - "resource-resolution-data": { - "capability-name": "cap1", - "payload": "payload1", - "resource-key": [ - { - "name": "key1", - "value": "value1" - } - ], - "status": "active" - }, - "value": "value1" - } - ] - }, - "vf-module-topology-identifier": { - "vf-module-id": "vfmodule1", - "vf-module-name": "vfmodule1", - "vf-module-type": "router" - } - }, - "vnf-resource-assignments": { - "availability-zones": { - "availability-zone": [ - "zone1" - ], - "max-count": 0 - }, - "vnf-networks": { - "vnf-network": [ - { - "contrail-network-fqdn": "skynet.net", - "is-trunked": true, - "network-id": "net1", - "network-name": "net1", - "network-role": "netrole1", - "neutron-id": "neutron1", - "related-networks": { - "related-network": [ - { - "network-id": "net2", - "network-role": "netrole2", - "vlan-tags": { - "is-private": true, - "lower-tag-id": 0, - "upper-tag-id": 0, - "vlan-interface": "vlan2" - } - } - ] - }, - "segmentation-id": "seg2", - "subnets-data": { - "subnet-data": [ - { - "cidr-mask": "255.255", - "dhcp-enabled": "Y", - "gateway-address": "10.1.2.254", - "ip-version": "ipv4", - "network-start-address": "10.1.2.1", - "sdnc-subnet-id": "sub1", - "subnet-id": "sub1", - "subnet-name": "sub1", - "subnet-role": "subrole1" - } - ] - } - } - ] - }, - "vnf-status": "active" - }, - "vnf-topology-identifier-structure": { - "nf-code": "code1", - "nf-function": "function1", - "nf-role": "role1", - "nf-type": "type1", - "vnf-id": "123", - "vnf-name": "vnf1", - "vnf-type": "vnftype1" - } - }, - "request-information": { - "notification-url": "http://dev.null", - "order-number": "order123", - "order-version": "1", - "request-action": "CreateNetworkInstance", - "request-id": "req001", - "source": "curl" - }, - "sdnc-request-header": { - "svc-action": "reserve", - "svc-notification-url": "http://dev.null", - "svc-request-id": "svcreq001" - } - } -} diff --git a/ms/generic-resource-api/src/test/resources/preload.data b/ms/generic-resource-api/src/test/resources/preload.data deleted file mode 100644 index d1e52f5..0000000 --- a/ms/generic-resource-api/src/test/resources/preload.data +++ /dev/null @@ -1,518 +0,0 @@ -{ - "preload-list": [ - { - "preload-data": { - "preload-network-topology-information": { - "host-routes": null, - "network-policy": null, - "network-topology-identifier-structure": { - "related-networks": null, - "network-role": "master", - "is-trunked": false, - "network-technology": "AI", - "network-id": "123", - "eipam-v4-address-plan": "evilv4", - "network-instance-group-id": null, - "network-name": "sky-net", - "segmentation-id": null, - "eipam-v6-address-plan": "evilv6", - "network-type": "evil" - }, - "physical-network-name": null, - "is-external-network": null, - "is-shared-network": null, - "is-provider-network": null, - "route-table-reference": null, - "subnets": null, - "vpn-bindings": null - }, - "preload-oper-status": null, - "preload-vf-module-topology-information": null - }, - "preload-type": "network", - "preload-id": "preload1" - }, - { - "preload-data": { - "preload-network-topology-information": { - "host-routes": [ - { - "route-prefix": "12", - "next-hop": "10.1.12.1" - } - ], - "network-policy": [ - { - "network-policy-fqdn": "policy-sdnc.onap.org", - "network-policy-id": "123" - } - ], - "network-topology-identifier-structure": { - "related-networks": { - "related-network": [ - { - "vlan-tags": { - "is-private": true, - "vlan-interface": "string", - "upper-tag-id": 0, - "lower-tag-id": 0 - }, - "network-role": "string", - "network-id": "string" - } - ] - }, - "network-role": "secret", - "is-trunked": true, - "network-technology": "soupcan", - "network-id": "321", - "eipam-v4-address-plan": "plan9", - "network-instance-group-id": "abc123", - "network-name": "syfy", - "segmentation-id": "string", - "eipam-v6-address-plan": "plan9v6", - "network-type": "fake" - }, - "physical-network-name": "string", - "is-external-network": true, - "is-shared-network": true, - "is-provider-network": true, - "route-table-reference": [ - { - "route-table-reference-id": "string", - "route-table-reference-fqdn": "string" - } - ], - "subnets": [ - { - "subnet-role": "string", - "cidr-mask": "string", - "subnet-sequence": 0, - "addr-from-start": "Y", - "dhcp-start-address": "string", - "gateway-address": "string", - "dhcp-end-address": "string", - "ip-version": "string", - "start-address": "string", - "dhcp-enabled": "Y", - "subnet-name": "string" - } - ], - "vpn-bindings": [ - { - "vpn-name": "string", - "vpn-binding-id": "string", - "route-target-role": "string", - "aic-zone": "string", - "global-route-target": "string" - } - ] - }, - "preload-oper-status": null, - "preload-vf-module-topology-information": null - }, - "preload-type": null, - "preload-id": null - }, - { - "preload-data": { - "preload-network-topology-information": null, - "preload-oper-status": null, - "preload-vf-module-topology-information": { - "vf-module-topology": { - "onap-model-information": { - "model-name": "string", - "model-version": "string", - "model-customization-uuid": "string", - "model-uuid": "string", - "model-invariant-uuid": "string" - }, - "aic-clli": "string", - "aic-cloud-region": "string", - "cloud-owner": "string", - "tenant": "string", - "vf-module-assignments": { - "vlan-vnfc-instance-groups": { - "vlan-vnfc-instance-group": [ - { - "vnf-id": "string", - "vnfcs": { - "vnfc": [ - { - "vnic-groups": { - "vnic-group": [ - { - "vlan-vnics": { - "vlan-vnic": [ - { - "vnic-sub-interfaces": { - "sub-interface-network-data": [ - { - "network-role": "string", - "floating-ips": { - "floating-ip-v4": [ - "string" - ], - "floating-ip-v6": [ - "string" - ] - }, - "network-id": "string", - "network-information-items": { - "network-information-item": [ - { - "ip-version": "string", - "network-ips": { - "network-ip": [ - "string" - ] - }, - "ip-count": 0, - "use-dhcp": "Y" - } - ] - }, - "neutron-network-id": "string", - "network-name": 0, - "network-role-tag": "string", - "vlan-tag-id": 0 - } - ] - }, - "vnic-port-id": "string" - } - ] - }, - "vlan-assignment-policy-name": "string", - "vlan-common-ip-addresses": { - "ip-addresses": { - "vipv6-address": "string", - "ipv4-address": "string", - "vipv4-address": "string", - "ipv6-address": "string" - } - }, - "network-instance-group-function": "string", - "vlan-tag-index-next": 0, - "vnic-interface-role": "string" - } - ] - }, - "vnfc-name": "string" - } - ] - }, - "instance-group-id": "string", - "instance-group-function": "string" - } - ] - }, - "vf-module-status": "string", - "vms": { - "vm": [ - { - "onap-model-information": { - "model-name": "string", - "model-version": "string", - "model-customization-uuid": "string", - "model-uuid": "string", - "model-invariant-uuid": "string" - }, - "vm-type": "string", - "vm-names": { - "vnfc-names": [ - { - "vnfc-networks": { - "vnfc-network-data": [ - { - "connection-point": { - "vlan-data": [ - { - "vlan-tag-description": "string", - "vlan-uuid": "string", - "vlan-role": "string", - "vlan-tag-id": "string" - } - ], - "port-id": "string", - "connection-point-id": "string" - }, - "vnfc-ports": { - "vnfc-port": [ - { - "vnfc-port-id": "string", - "vnic-sub-interfaces": { - "sub-interface-network-data": [ - { - "network-role": "string", - "floating-ips": { - "floating-ip-v4": [ - "string" - ], - "floating-ip-v6": [ - "string" - ] - }, - "network-id": "string", - "network-information-items": { - "network-information-item": [ - { - "ip-version": "string", - "network-ips": { - "network-ip": [ - "string" - ] - }, - "ip-count": 0, - "use-dhcp": "Y" - } - ] - }, - "neutron-network-id": "string", - "network-name": 0, - "network-role-tag": "string", - "vlan-tag-id": 0 - } - ] - }, - "common-sub-interface-role": "string" - } - ] - }, - "vnfc-type": "string", - "vnfc-subnet": [ - { - "vnfc-subnet-role": "string", - "vnfc-ip-assignments": [ - { - "vnfc-subnet-dhcp": "Y", - "vnfc-address-family": "ipv4", - "vnfc-subnet-ip": [ - { - "vnfc-ip-address": "string", - "vnfc-client-key": "string", - "ip-type": "FIXED" - } - ], - "vnfc-subnet-ip-count": 0 - } - ] - } - ], - "vnfc-network-role": "string" - } - ] - }, - "vnfc-name": "string" - } - ], - "vm-name": [ - "string" - ] - }, - "vm-type-tag": "string", - "vm-count": 0, - "vm-networks": { - "vm-network": [ - { - "related-networks": { - "related-network": [ - { - "vlan-tags": { - "is-private": true, - "vlan-interface": "string", - "upper-tag-id": 0, - "lower-tag-id": 0 - }, - "network-role": "string", - "network-id": "string" - } - ] - }, - "network-role": "string", - "is-trunked": true, - "floating-ips": { - "floating-ip-v4": [ - "string" - ], - "floating-ip-v6": [ - "string" - ] - }, - "sriov-parameters": { - "application-tags": { - "stags": { - "stag": [ - "string" - ], - "s-tag": [ - "string" - ] - }, - "ctags": { - "ctag": [ - "string" - ], - "c-tag": [ - "string" - ] - }, - "s-tags": { - "stag": [ - "string" - ], - "s-tag": [ - "string" - ] - }, - "c-tags": { - "ctag": [ - "string" - ], - "c-tag": [ - "string" - ] - } - }, - "heat-vlan-filters": { - "heat-vlan-filter": [ - "string" - ] - } - }, - "network-information-items": { - "network-information-item": [ - { - "ip-version": "string", - "network-ips": { - "network-ip": [ - "string" - ] - }, - "ip-count": 0, - "use-dhcp": "Y" - } - ] - }, - "mac-addresses": { - "mac-address": [ - "string" - ] - }, - "network-role-tag": "string", - "segmentation-id": "string", - "interface-route-prefixes": { - "interface-route-prefix": [ - "string" - ] - } - } - ] - }, - "nfc-naming-code": "string" - } - ] - }, - "dhcp-subnet-assignments": { - "dhcp-subnet-assignment": [ - { - "network-role": "string", - "neutron-subnet-id": "string", - "ip-version": "string" - } - ] - } - }, - "vf-module-topology-identifier": { - "vf-module-name": "string", - "vf-module-id": "string", - "vf-module-type": "string" - }, - "vf-module-parameters": { - "param": [ - { - "name": "string", - "resource-resolution-data": { - "payload": "string", - "resource-key": [ - { - "name": "string", - "value": "string" - } - ], - "capability-name": "string", - "status": "string" - }, - "value": "string" - } - ] - }, - "sdnc-generated-cloud-resources": true - }, - "vnf-resource-assignments": { - "availability-zones": { - "max-count": 0, - "availability-zone": [ - "string" - ] - }, - "vnf-status": "string", - "vnf-networks": { - "vnf-network": [ - { - "related-networks": { - "related-network": [ - { - "vlan-tags": { - "is-private": true, - "vlan-interface": "string", - "upper-tag-id": 0, - "lower-tag-id": 0 - }, - "network-role": "string", - "network-id": "string" - } - ] - }, - "network-role": "string", - "is-trunked": true, - "network-id": "string", - "subnets-data": { - "subnet-data": [ - { - "network-start-address": "string", - "subnet-role": "string", - "cidr-mask": "string", - "gateway-address": "string", - "sdnc-subnet-id": "string", - "subnet-id": "string", - "ip-version": "string", - "dhcp-enabled": "Y", - "subnet-name": "string" - } - ] - }, - "contrail-network-fqdn": "string", - "network-name": "string", - "segmentation-id": "string", - "neutron-id": "string" - } - ] - } - }, - "vnf-topology-identifier-structure": { - "nf-role": "string", - "nf-function": "string", - "nf-type": "string", - "vnf-id": "string", - "nf-code": "string", - "vnf-name": "string", - "vnf-type": "string" - } - } - }, - "preload-type": null, - "preload-id": null - } - ] -} diff --git a/ms/generic-resource-api/src/test/resources/preload1-net-list-item.json b/ms/generic-resource-api/src/test/resources/preload1-net-list-item.json new file mode 100644 index 0000000..4a91388 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload1-net-list-item.json @@ -0,0 +1,81 @@ +{ + "preload-id": "preload1", + "preload-type": "network", + "preload-data": { + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": false, + "is-provider-network": false, + "is-shared-network": false, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload1", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + } + } +} + diff --git a/ms/generic-resource-api/src/test/resources/preload1-net-model-info.json b/ms/generic-resource-api/src/test/resources/preload1-net-model-info.json new file mode 100644 index 0000000..586915a --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload1-net-model-info.json @@ -0,0 +1,84 @@ +{ + "preload-list": [ + { + "preload-id": "preload1", + "preload-type": "network", + "preload-data": { + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": true, + "is-provider-network": true, + "is-shared-network": true, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload1", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + } + } + } + ] +} diff --git a/ms/generic-resource-api/src/test/resources/preload1-net-preload-data.json b/ms/generic-resource-api/src/test/resources/preload1-net-preload-data.json new file mode 100644 index 0000000..74da3de --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload1-net-preload-data.json @@ -0,0 +1,78 @@ +{ + + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": false, + "is-provider-network": false, + "is-shared-network": false, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload1", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + } +} + diff --git a/ms/generic-resource-api/src/test/resources/preload1-rpc-network.json b/ms/generic-resource-api/src/test/resources/preload1-rpc-network.json new file mode 100644 index 0000000..04bea9e --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload1-rpc-network.json @@ -0,0 +1,91 @@ +{ + "input": { + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": true, + "is-provider-network": true, + "is-shared-network": true, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload1", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + }, + "request-information": { + "notification-url": "http://dev.null.com", + "order-number": "123456", + "order-version": "2010.06", + "request-action": "CreateNetworkInstance", + "request-id": "REQ123456", + "source": "curl" + }, + "sdnc-request-header": { + "svc-action": "reserve", + "svc-notification-url": "http://dev.null.com", + "svc-request-id": "SVCREQ123456" + } + } +} diff --git a/ms/generic-resource-api/src/test/resources/preload1-rpc-vfmodule.json b/ms/generic-resource-api/src/test/resources/preload1-rpc-vfmodule.json new file mode 100644 index 0000000..12553b0 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload1-rpc-vfmodule.json @@ -0,0 +1,375 @@ +{ + "input": { + "preload-vf-module-topology-information": { + "vf-module-topology": { + "aic-clli": "AIC12345", + "aic-cloud-region": "Cloud9", + "cloud-owner": "aic", + "onap-model-information": { + "model-customization-uuid": "123123123", + "model-invariant-uuid": "123123123", + "model-name": "frankfurt", + "model-uuid": "121212", + "model-version": "frankfurt" + }, + "sdnc-generated-cloud-resources": true, + "tenant": "tenant", + "vf-module-assignments": { + "dhcp-subnet-assignments": { + "dhcp-subnet-assignment": [ + { + "ip-version": "ipv4", + "network-role": "netrole", + "neutron-subnet-id": "sub1" + } + ] + }, + "vf-module-status": "Active", + "vlan-vnfc-instance-groups": { + "vlan-vnfc-instance-group": [ + { + "instance-group-function": "function", + "instance-group-id": "groupid", + "vnf-id": "123", + "vnfcs": { + "vnfc": [ + { + "vnfc-name": "vnc1", + "vnic-groups": { + "vnic-group": [ + { + "network-instance-group-function": "func1", + "vlan-assignment-policy-name": "policy1", + "vlan-common-ip-addresses": { + "ip-addresses": { + "ipv4-address": "10.1.2.1" + } + }, + "vlan-tag-index-next": 0, + "vlan-vnics": { + "vlan-vnic": [ + { + "vnic-port-id": "8080", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "floating-ips": { + "floating-ip-v4": [ + "10.1.2.1" + ] + }, + "network-id": "string", + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "10.1.2.2" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-name": 0, + "network-role": "role1", + "network-role-tag": "tag1", + "neutron-network-id": "net1", + "vlan-tag-id": 0 + } + ] + } + } + ] + }, + "vnic-interface-role": "vnicrole1" + } + ] + } + } + ] + } + } + ] + }, + "vms": { + "vm": [ + { + "nfc-naming-code": "name1", + "onap-model-information": { + "model-customization-uuid": "456456456", + "model-invariant-uuid": "456456456", + "model-name": "model2", + "model-uuid": "678678678", + "model-version": "version2" + }, + "vm-count": 0, + "vm-names": { + "vm-name": [ + "vm1" + ], + "vnfc-names": [ + { + "vnfc-name": "vnc1", + "vnfc-networks": { + "vnfc-network-data": [ + { + "connection-point": { + "connection-point-id": "conn1", + "port-id": "8181", + "vlan-data": [ + { + "vlan-role": "role2", + "vlan-tag-description": "tag2", + "vlan-tag-id": "1", + "vlan-uuid": "78789789" + } + ] + }, + "vnfc-network-role": "role3", + "vnfc-ports": { + "vnfc-port": [ + { + "common-sub-interface-role": "subrole1", + "vnfc-port-id": "8787", + "vnic-sub-interfaces": { + "sub-interface-network-data": [ + { + "floating-ips": { + "floating-ip-v4": [ + "10.1.3.10" + ] + }, + "network-id": "net2", + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "10.1.3.4" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-name": 0, + "network-role": "netrole4", + "network-role-tag": "tag5", + "neutron-network-id": "nnet5", + "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": "10.1.7.1" + } + ], + "vnfc-subnet-ip-count": 0 + } + ], + "vnfc-subnet-role": "string" + } + ], + "vnfc-type": "string" + } + ] + } + } + ] + }, + "vm-networks": { + "vm-network": [ + { + "floating-ips": { + "floating-ip-v4": [ + "10.1.9.1" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "10" + ] + }, + "is-trunked": true, + "mac-addresses": { + "mac-address": [ + "cafe:beef" + ] + }, + "network-information-items": { + "network-information-item": [ + { + "ip-count": 0, + "ip-version": "ipv4", + "network-ips": { + "network-ip": [ + "10.2.3.10" + ] + }, + "use-dhcp": "Y" + } + ] + }, + "network-role": "netrole9", + "network-role-tag": "tag9", + "related-networks": { + "related-network": [ + { + "network-id": "net9", + "network-role": "netrole9", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "vlan0" + } + } + ] + }, + "segmentation-id": "seg1", + "sriov-parameters": { + "application-tags": { + "c-tags": { + "c-tag": [ + "ctag1" + ] + }, + "s-tags": { + "s-tag": [ + "stag1" + ] + } + }, + "heat-vlan-filters": { + "heat-vlan-filter": [ + "10" + ] + } + } + } + ] + }, + "vm-type": "vmtype1", + "vm-type-tag": "vmtag1" + } + ] + } + }, + "vf-module-parameters": { + "param": [ + { + "name": "vfmodname", + "resource-resolution-data": { + "capability-name": "cap1", + "payload": "payload1", + "resource-key": [ + { + "name": "key1", + "value": "value1" + } + ], + "status": "active" + }, + "value": "value1" + } + ] + }, + "vf-module-topology-identifier": { + "vf-module-id": "vfmodule1", + "vf-module-name": "vfmodule1", + "vf-module-type": "router" + } + }, + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "zone1" + ], + "max-count": 0 + }, + "vnf-networks": { + "vnf-network": [ + { + "contrail-network-fqdn": "skynet.net", + "is-trunked": true, + "network-id": "net1", + "network-name": "net1", + "network-role": "netrole1", + "neutron-id": "neutron1", + "related-networks": { + "related-network": [ + { + "network-id": "net2", + "network-role": "netrole2", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "vlan2" + } + } + ] + }, + "segmentation-id": "seg2", + "subnets-data": { + "subnet-data": [ + { + "cidr-mask": "255.255", + "dhcp-enabled": "Y", + "gateway-address": "10.1.2.254", + "ip-version": "ipv4", + "network-start-address": "10.1.2.1", + "sdnc-subnet-id": "sub1", + "subnet-id": "sub1", + "subnet-name": "sub1", + "subnet-role": "subrole1" + } + ] + } + } + ] + }, + "vnf-status": "active" + }, + "vnf-topology-identifier-structure": { + "nf-code": "code1", + "nf-function": "function1", + "nf-role": "role1", + "nf-type": "type1", + "vnf-id": "preload1", + "vnf-name": "vnf1", + "vnf-type": "vnftype1" + } + }, + "request-information": { + "notification-url": "http://dev.null", + "order-number": "order123", + "order-version": "1", + "request-action": "CreateNetworkInstance", + "request-id": "req001", + "source": "curl" + }, + "sdnc-request-header": { + "svc-action": "reserve", + "svc-notification-url": "http://dev.null", + "svc-request-id": "svcreq001" + } + } +} diff --git a/ms/generic-resource-api/src/test/resources/preload1.json b/ms/generic-resource-api/src/test/resources/preload1.json deleted file mode 100644 index cf504e8..0000000 --- a/ms/generic-resource-api/src/test/resources/preload1.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "preload-list": [ - { - "preload-id": "preload1", - "preload-type": "network", - "preload-data": { - "preload-network-topology-information": { - "host-routes": [ - { - "next-hop": "10.1.12.1", - "route-prefix": "12" - } - ], - "is-external-network": true, - "is-provider-network": true, - "is-shared-network": true, - "network-policy": [ - { - "network-policy-fqdn": "policy-sdnc.onap.org", - "network-policy-id": "123" - } - ], - "network-topology-identifier-structure": { - "eipam-v4-address-plan": "plan9", - "eipam-v6-address-plan": "plan9v6", - "is-trunked": true, - "network-id": "321", - "network-instance-group-id": "abc123", - "network-name": "syfy", - "network-role": "secret", - "network-technology": "soupcan", - "network-type": "fake", - "related-networks": { - "related-network": [ - { - "network-id": "skynet", - "network-role": "master", - "vlan-tags": { - "is-private": true, - "lower-tag-id": 0, - "upper-tag-id": 0, - "vlan-interface": "le0" - } - } - ] - }, - "segmentation-id": "seg1" - }, - "physical-network-name": "skynet", - "route-table-reference": [ - { - "route-table-reference-fqdn": "sky.net", - "route-table-reference-id": "ref1" - } - ], - "subnets": [ - { - "addr-from-start": "Y", - "cidr-mask": "255.255.0.0", - "dhcp-enabled": "Y", - "dhcp-end-address": "10.1.2.254", - "dhcp-start-address": "10.1.2.1", - "gateway-address": "10.1.2.255", - "ip-version": "ipv4", - "start-address": "10.1.2.1", - "subnet-name": "subnet1", - "subnet-role": "puppies", - "subnet-sequence": 0 - } - ], - "vpn-bindings": [ - { - "aic-zone": "zone1", - "global-route-target": "string", - "route-target-role": "string", - "vpn-binding-id": "string", - "vpn-name": "string" - } - ] - } - } - } - ] -} diff --git a/ms/generic-resource-api/src/test/resources/preload2-net-list-item.json b/ms/generic-resource-api/src/test/resources/preload2-net-list-item.json new file mode 100644 index 0000000..65a7bc4 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload2-net-list-item.json @@ -0,0 +1,81 @@ +{ + "preload-id": "preload2", + "preload-type": "network", + "preload-data": { + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": true, + "is-provider-network": true, + "is-shared-network": true, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload2", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + } + } +} + diff --git a/ms/generic-resource-api/src/test/resources/preload2-net-model-info.json b/ms/generic-resource-api/src/test/resources/preload2-net-model-info.json new file mode 100644 index 0000000..2b7b12e --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/preload2-net-model-info.json @@ -0,0 +1,84 @@ +{ + "preload-list": [ + { + "preload-id": "preload2", + "preload-type": "network", + "preload-data": { + "preload-network-topology-information": { + "host-routes": [ + { + "next-hop": "10.1.12.1", + "route-prefix": "12" + } + ], + "is-external-network": true, + "is-provider-network": true, + "is-shared-network": true, + "network-policy": [ + { + "network-policy-fqdn": "policy-sdnc.onap.org", + "network-policy-id": "123" + } + ], + "network-topology-identifier-structure": { + "eipam-v4-address-plan": "plan9", + "eipam-v6-address-plan": "plan9v6", + "is-trunked": true, + "network-id": "preload2", + "network-instance-group-id": "abc123", + "network-name": "syfy", + "network-role": "secret", + "network-technology": "soupcan", + "network-type": "fake", + "related-networks": { + "related-network": [ + { + "network-id": "skynet", + "network-role": "master", + "vlan-tags": { + "is-private": true, + "lower-tag-id": 0, + "upper-tag-id": 0, + "vlan-interface": "le0" + } + } + ] + }, + "segmentation-id": "seg1" + }, + "physical-network-name": "skynet", + "route-table-reference": [ + { + "route-table-reference-fqdn": "sky.net", + "route-table-reference-id": "ref1" + } + ], + "subnets": [ + { + "addr-from-start": "Y", + "cidr-mask": "255.255.0.0", + "dhcp-enabled": "Y", + "dhcp-end-address": "10.1.2.254", + "dhcp-start-address": "10.1.2.1", + "gateway-address": "10.1.2.255", + "ip-version": "ipv4", + "start-address": "10.1.2.1", + "subnet-name": "subnet1", + "subnet-role": "puppies", + "subnet-sequence": 0 + } + ], + "vpn-bindings": [ + { + "aic-zone": "zone1", + "global-route-target": "string", + "route-target-role": "string", + "vpn-binding-id": "string", + "vpn-name": "string" + } + ] + } + } + } + ] +} diff --git a/ms/generic-resource-api/src/test/resources/service1-servicedata.json b/ms/generic-resource-api/src/test/resources/service1-servicedata.json new file mode 100644 index 0000000..6fe0ef7 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/service1-servicedata.json @@ -0,0 +1,221 @@ +{ + "request-information": { + "request-id": "f5554477-51c7-4f8e-9183-f8968f3f86bf", + "request-action": "CreateServiceInstance", + "source": "MSO" + }, + "service-request-input": { + "service-instance-name": "NGINX-INGRESS-1" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "service-topology": { + "service-topology-identifier": { + "service-instance-id": "service1", + "service-instance-name": "NGINX-INGRESS-1", + "service-type": "service-nginx-ingress-1", + "global-customer-id": "Demonstration" + }, + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + } + }, + "service-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "assign", + "last-action": "CreateServiceInstance" + }, + "sdnc-request-header": { + "svc-action": "assign", + "svc-request-id": "6d06a832-69da-4369-9d99-049767a39400" + }, + "vnfs": { + "vnf": [ + { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-data": { + "vnf-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate", + "last-action": "CreateVnfInstance" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "acf0c0db-106f-42e4-b77b-191e9d229eb9", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/b8f92243-85cb-4954-970d-7e0159b9a48b" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "request-information": { + "request-id": "c382d6d1-2108-4c39-ab7a-c3e67cdbc749", + "request-action": "CreateVnfInstance", + "source": "MSO" + }, + "vnf-request-input": { + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "vnf-topology": { + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "tenant": "k8s_tenant_1", + "aic-clli": "complexMC", + "aic-cloud-region": "k8s_region_1", + "vnf-topology-identifier-structure": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "k8s_availability_zone_1" + ] + } + } + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-data": { + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "vf-module-topology": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-parameters": { + "param": [ + { + "name": "availability_zone_0", + "value": "k8s_availability_zone_1" + }, + { + "name": "k8s-rb-profile-name", + "value": "default" + } + ] + }, + "tenant": "k8s_tenant_1", + "sdnc-generated-cloud-resources": true, + "aic-clli": "complexMC", + "vf-module-topology-identifier": { + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb" + }, + "aic-cloud-region": "k8s_region_1" + }, + "vf-module-request-input": { + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "bf81d48a-d5f9-42f2-bc49-9277f0e2a836", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/64780567-ecf5-41c9-af36-bb06f8ae0e5d" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vf-module-information": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "from-preload": true + }, + "request-information": { + "request-id": "051f3665-002c-4e3c-b62e-f8c0b48ef12e", + "request-action": "CreateVfModuleInstance", + "source": "MSO" + }, + "vf-module-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate" + } + } + } + ] + } + } + } + ] + } +} + + + diff --git a/ms/generic-resource-api/src/test/resources/service1-serviceitem.json b/ms/generic-resource-api/src/test/resources/service1-serviceitem.json new file mode 100644 index 0000000..c950377 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/service1-serviceitem.json @@ -0,0 +1,233 @@ +{ + "service-instance-id": "service1", + "service-data": { + "request-information": { + "request-id": "f5554477-51c7-4f8e-9183-f8968f3f86bf", + "request-action": "CreateServiceInstance", + "source": "MSO" + }, + "service-request-input": { + "service-instance-name": "NGINX-INGRESS-1" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "service-topology": { + "service-topology-identifier": { + "service-instance-id": "service1", + "service-instance-name": "NGINX-INGRESS-1", + "service-type": "service-nginx-ingress-1", + "global-customer-id": "Demonstration" + }, + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + } + }, + "service-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "assign", + "last-action": "CreateServiceInstance" + }, + "sdnc-request-header": { + "svc-action": "assign", + "svc-request-id": "6d06a832-69da-4369-9d99-049767a39400" + }, + "vnfs": { + "vnf": [ + { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-data": { + "vnf-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate", + "last-action": "CreateVnfInstance" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "acf0c0db-106f-42e4-b77b-191e9d229eb9", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/b8f92243-85cb-4954-970d-7e0159b9a48b" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "request-information": { + "request-id": "c382d6d1-2108-4c39-ab7a-c3e67cdbc749", + "request-action": "CreateVnfInstance", + "source": "MSO" + }, + "vnf-request-input": { + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "vnf-topology": { + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "tenant": "k8s_tenant_1", + "aic-clli": "complexMC", + "aic-cloud-region": "k8s_region_1", + "vnf-topology-identifier-structure": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "k8s_availability_zone_1" + ] + } + } + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-data": { + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "vf-module-topology": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-parameters": { + "param": [ + { + "name": "availability_zone_0", + "value": "k8s_availability_zone_1" + }, + { + "name": "k8s-rb-profile-name", + "value": "default" + } + ] + }, + "tenant": "k8s_tenant_1", + "sdnc-generated-cloud-resources": true, + "aic-clli": "complexMC", + "vf-module-topology-identifier": { + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb" + }, + "aic-cloud-region": "k8s_region_1" + }, + "vf-module-request-input": { + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "bf81d48a-d5f9-42f2-bc49-9277f0e2a836", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/64780567-ecf5-41c9-af36-bb06f8ae0e5d" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vf-module-information": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "from-preload": true + }, + "request-information": { + "request-id": "051f3665-002c-4e3c-b62e-f8c0b48ef12e", + "request-action": "CreateVfModuleInstance", + "source": "MSO" + }, + "vf-module-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate" + } + } + } + ] + } + } + } + ] + } + }, + "service-status": { + "final-indicator": "Y", + "rpc-action": "activate", + "rpc-name": "vf-module-topology-operation", + "response-code": "200", + "response-timestamp": "2020-06-24T13:06:24.525Z", + "response-message": "", + "action": "CreateVfModuleInstance", + "request-status": "synccomplete" + } +} + + diff --git a/ms/generic-resource-api/src/test/resources/service1-servicestatus.json b/ms/generic-resource-api/src/test/resources/service1-servicestatus.json new file mode 100644 index 0000000..ca763d3 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/service1-servicestatus.json @@ -0,0 +1,10 @@ +{ + "final-indicator": "Y", + "rpc-action": "activate", + "rpc-name": "vf-module-topology-operation", + "response-code": "200", + "response-timestamp": "2020-06-24T13:06:24.525Z", + "response-message": "", + "action": "CreateVfModuleInstance", + "request-status": "synccomplete" +} \ No newline at end of file diff --git a/ms/generic-resource-api/src/test/resources/service1.json b/ms/generic-resource-api/src/test/resources/service1.json new file mode 100644 index 0000000..f280ae6 --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/service1.json @@ -0,0 +1,236 @@ +{ + "service": [ + { + "service-instance-id": "service1", + "service-data": { + "request-information": { + "request-id": "f5554477-51c7-4f8e-9183-f8968f3f86bf", + "request-action": "CreateServiceInstance", + "source": "MSO" + }, + "service-request-input": { + "service-instance-name": "NGINX-INGRESS-1" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "service-topology": { + "service-topology-identifier": { + "service-instance-id": "service1", + "service-instance-name": "NGINX-INGRESS-1", + "service-type": "service-nginx-ingress-1", + "global-customer-id": "Demonstration" + }, + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + } + }, + "service-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "assign", + "last-action": "CreateServiceInstance" + }, + "sdnc-request-header": { + "svc-action": "assign", + "svc-request-id": "6d06a832-69da-4369-9d99-049767a39400" + }, + "vnfs": { + "vnf": [ + { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-data": { + "vnf-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate", + "last-action": "CreateVnfInstance" + }, + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "acf0c0db-106f-42e4-b77b-191e9d229eb9", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/b8f92243-85cb-4954-970d-7e0159b9a48b" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "request-information": { + "request-id": "c382d6d1-2108-4c39-ab7a-c3e67cdbc749", + "request-action": "CreateVnfInstance", + "source": "MSO" + }, + "vnf-request-input": { + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "vnf-topology": { + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "tenant": "k8s_tenant_1", + "aic-clli": "complexMC", + "aic-cloud-region": "k8s_region_1", + "vnf-topology-identifier-structure": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "k8s_availability_zone_1" + ] + } + } + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-data": { + "service-information": { + "service-id": "service1", + "onap-model-information": { + "model-name": "service-nginx-ingress-1", + "model-invariant-uuid": "0fe6193d-2d65-4b8e-a4ee-a07821566b5e", + "model-version": "1.0", + "model-uuid": "48223a6a-f5e1-4354-95eb-f5ea014fc9df" + }, + "service-instance-id": "service1", + "global-customer-id": "Demonstration", + "subscription-service-type": "service-nginx-ingress-1" + }, + "vf-module-topology": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-parameters": { + "param": [ + { + "name": "availability_zone_0", + "value": "k8s_availability_zone_1" + }, + { + "name": "k8s-rb-profile-name", + "value": "default" + } + ] + }, + "tenant": "k8s_tenant_1", + "sdnc-generated-cloud-resources": true, + "aic-clli": "complexMC", + "vf-module-topology-identifier": { + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb" + }, + "aic-cloud-region": "k8s_region_1" + }, + "vf-module-request-input": { + "vf-module-name": "Python_ONAP_SDK_vf_module_instance_678cc889-0c89-40f3-9f5b-1f475d5c4ebb", + "tenant": "k8s_tenant_1", + "cloud-owner": "k8sCloudOwner", + "aic-cloud-region": "k8s_region_1" + }, + "sdnc-request-header": { + "svc-action": "activate", + "svc-request-id": "bf81d48a-d5f9-42f2-bc49-9277f0e2a836", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/64780567-ecf5-41c9-af36-bb06f8ae0e5d" + }, + "vnf-information": { + "vnf-id": "fae319cc-68d6-496f-be1e-a09e133c71d4", + "onap-model-information": { + "model-name": "nginx-ingress-1", + "model-invariant-uuid": "ebd1565b-a98f-4d77-9b91-6aefd51d040c", + "model-version": "1.0", + "model-customization-uuid": "69cff101-d1f2-4bf3-9697-57f52ba3c5dd", + "model-uuid": "dfeccc32-2459-43bf-bfdd-36567e696090" + }, + "vnf-type": "service-nginx-ingress-1/nginx-ingress-1 0", + "vnf-name": "Python_ONAP_SDK_vnf_instance_2aff902a-4714-4d08-942d-d97b3a3b87c2" + }, + "vf-module-information": { + "onap-model-information": { + "model-name": "NginxIngress1..nginx-ingress..module-0", + "model-invariant-uuid": "caa22b8e-e0de-4d2c-9048-9a71d39afd91", + "model-version": "1", + "model-customization-uuid": "d6403fe2-ebe4-4fce-bec2-0218f61b2564", + "model-uuid": "e5d2fe74-9534-4a7c-9a1b-f49ecf1105e3" + }, + "vf-module-id": "269bda16-f40c-41a9-baef-e8905ab2b70e", + "vf-module-type": "NginxIngress1..nginx-ingress..module-0", + "from-preload": true + }, + "request-information": { + "request-id": "051f3665-002c-4e3c-b62e-f8c0b48ef12e", + "request-action": "CreateVfModuleInstance", + "source": "MSO" + }, + "vf-module-level-oper-status": { + "order-status": "Created", + "last-rpc-action": "activate" + } + } + } + ] + } + } + } + ] + } + }, + "service-status": { + "final-indicator": "Y", + "rpc-action": "activate", + "rpc-name": "vf-module-topology-operation", + "response-code": "200", + "response-timestamp": "2020-06-24T13:06:24.525Z", + "response-message": "", + "action": "CreateVfModuleInstance", + "request-status": "synccomplete" + } + } + ] +} + diff --git a/ms/generic-resource-api/src/test/resources/svclogic.properties b/ms/generic-resource-api/src/test/resources/svclogic.properties new file mode 100644 index 0000000..b57c43d --- /dev/null +++ b/ms/generic-resource-api/src/test/resources/svclogic.properties @@ -0,0 +1,29 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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========================================================= +### + +org.onap.ccsdk.sli.dbtype = jdbc +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.database = sdnctl +org.onap.ccsdk.sli.jdbc.user = sdnc +org.onap.ccsdk.sli.jdbc.password = abc123 + +serviceLogicDirectory=src/test/resources -- cgit 1.2.3-korg