diff options
author | Brad Benesch <brad.benesch@amdocs.com> | 2018-07-12 14:26:26 -0400 |
---|---|---|
committer | Brad Benesch <brad.benesch@amdocs.com> | 2018-07-23 15:02:36 -0400 |
commit | 92c73de0f57aee2ada5f5c85b960c4c8ce7adf85 (patch) | |
tree | 66038237e070b13a82b1ceb7e7b0d98ba15fe576 /pomba/service-decomposition/src/test | |
parent | 17ac3b089df1cc33ced623ab4150edcacd4381c6 (diff) |
Initial code for network discovery microservice
Issue-ID: SDNC-317
Change-Id: I09d44de02283079471de0084da07793cb3d7820c
Signed-off-by: Brad Benesch <brad.benesch@amdocs.com>
Diffstat (limited to 'pomba/service-decomposition/src/test')
11 files changed, 1707 insertions, 0 deletions
diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/AAIConfigurationTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/AAIConfigurationTest.java new file mode 100644 index 0000000..9b0d6e2 --- /dev/null +++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/AAIConfigurationTest.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ + +package org.onap.sdnc.apps.pomba.servicedecomposition.componenttest.mockito; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Test; +import org.onap.sdnc.apps.pomba.servicedecomposition.AAIConfiguration; + +public class AAIConfigurationTest { + + AAIConfiguration aaiConfiguration = mock(AAIConfiguration.class); + + @Test + public void testGetUrl() { + String url = "www.google.com"; + when(aaiConfiguration.getURL()).thenReturn(url); + assertEquals(aaiConfiguration.getURL().toString(), "www.google.com"); + } + + @Test + public void testGetServiceInstancePath() { + String msg = "Hello User!"; + when(aaiConfiguration.getServiceInstancePath()).thenReturn(msg); + assertEquals(aaiConfiguration.getServiceInstancePath().toString(), "Hello User!"); + } +} diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/JerseyConfigurationTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/JerseyConfigurationTest.java new file mode 100644 index 0000000..8055f0a --- /dev/null +++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/JerseyConfigurationTest.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ + +package org.onap.sdnc.apps.pomba.servicedecomposition.componenttest.mockito; + +import static junit.framework.TestCase.assertEquals; + +import javax.ws.rs.client.Client; +import org.junit.Test; +import org.onap.sdnc.apps.pomba.servicedecomposition.JerseyConfiguration; + +public class JerseyConfigurationTest { + + @Test + public void runTest() { + JerseyConfiguration jerseyConfiguration = new JerseyConfiguration(); + Client client = jerseyConfiguration.jerseyClient(); + String protocol = client.getSslContext().getProtocol(); + assertEquals(protocol, "TLS"); + } +} diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/WebConfigurationTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/WebConfigurationTest.java new file mode 100644 index 0000000..9728a48 --- /dev/null +++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/componenttest/mockito/WebConfigurationTest.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ + +package org.onap.sdnc.apps.pomba.servicedecomposition.componenttest.mockito; + +import static junit.framework.TestCase.assertEquals; + +import org.junit.Test; +import org.onap.sdnc.apps.pomba.servicedecomposition.WebConfiguration; +import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +public class WebConfigurationTest { + @Test + public void runTest() { + WebConfiguration webConfiguration = new WebConfiguration(); + WebMvcConfigurerAdapter webMvcConfigurerAdapter = webConfiguration.forwardToIndex(); + ViewResolverRegistry registry = new ViewResolverRegistry(); + webMvcConfigurerAdapter.configureViewResolvers(registry); + assertEquals(registry.hasRegistrations(), false); + } + +} diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java new file mode 100644 index 0000000..ba20a88 --- /dev/null +++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/ServiceDecompositionTest.java @@ -0,0 +1,245 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ + +package org.onap.sdnc.apps.pomba.servicedecomposition.test; + +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.notFound; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Base64; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.sdnc.apps.pomba.servicedecomposition.service.rs.RestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class }) +@WebAppConfiguration +@SpringBootTest +@TestPropertySource(properties = { + "aai.httpProtocol=http", + "aai.host=localhost", + "aai.port=8081", + "basicAuth.username=admin", + "basicAuth.password=admin" + }) +public class ServiceDecompositionTest { + + private static final String AUTH = "Basic " + Base64.getEncoder().encodeToString("admin:admin".getBytes()); + + // TODO missing code coverage for VNFC resources + + @Rule + public WireMockRule aai = new WireMockRule(wireMockConfig().port(8081)); + + @Autowired + private RestService service; + + /** + * Simulation of the firewall demo service, using json captured from real A&AI queries. + * The resource relationship looks something like. + * <pre> + * service instance + * +- generic-vnf 1 + * | +- vserver + * +- generic-vnf 2 + * +- network 1 + * +- network 2 + * </pre> + */ + @Test + public void testDemoFirewallService() throws Exception { + // setup A&AI responses + addResponse( + "/aai/v13/nodes/service-instance/c6456519-6acf-4adb-997c-3c363dd4caaf", + "junit/aai-service-instance.json"); + addResponse( + "/aai/v13/network/generic-vnfs/generic-vnf/6700c313-fbb7-4cf9-ac70-0293ec56df68?depth=2", + "junit/aai-generic-vnf1.json"); + addResponse( + "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39?depth=2", + "junit/aai-generic-vnf2.json"); + addResponse( + "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant" + + "/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "junit/aai-vserver.json"); + addResponse( + "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870", + "junit/aai-l3-network1.json"); + addResponse( + "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951872", + "junit/aai-l3-network2.json"); + + final String serviceInstanceId = "c6456519-6acf-4adb-997c-3c363dd4caaf"; + final String vnfId1 = "6700c313-fbb7-4cf9-ac70-0293ec56df68"; + final String vnfId2 = "8a9ddb25-2e79-449c-a40d-5011bac0da39"; + final String vserverId = "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a"; + final String networkId1 = "HNP1d77c-1094-41ec-b7f3-94bb30951870"; + final String networkId2 = "HNP1d77c-1094-41ec-b7f3-94bb30951872"; + + HttpServletRequest httpRequest = new TestHttpServletRequest(); + Response response = this.service.getContext(httpRequest, AUTH, "network-discovery-context-builder", null, + serviceInstanceId); + assertEquals(200, response.getStatus()); + + JSONObject serviceInstance = new JSONObject((String)response.getEntity()); + + // verify two generic-vnfs added to service instance data + verifyResource(serviceInstance, "generic-vnfs", "vnf-id", vnfId1); + verifyResource(serviceInstance, "generic-vnfs", "vnf-id", vnfId2); + + JSONArray vnfs = serviceInstance.getJSONArray("generic-vnfs"); + for (int i = 0; i < vnfs.length(); i++) { + JSONObject vnf = vnfs.getJSONObject(i); + String vnfId = vnf.getString("vnf-id"); + switch (vnfId) { + case vnfId1: + // verify vserver resource + verifyResource(vnf, "vservers", "vserver-id", vserverId); + break; + case vnfId2: + // verify network resources + verifyResource(vnf, "l3-networks", "network-id", networkId1); + verifyResource(vnf, "l3-networks", "network-id", networkId2); + break; + default: + fail("Unexpected generic-vnf " + vnfId); + } + } + } + + @Test + public void testNoAuthHeader() throws Exception { + String fromAppId = "junit"; + String transactionId = null; + String serviceInstanceId = "aServiceInstanceId"; + // no Authorization header + Response response = this.service.getContext(new TestHttpServletRequest(), null, fromAppId, transactionId, + serviceInstanceId); + assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus()); + // should get WWW-Authenticate header in response + assertTrue(response.getHeaderString(HttpHeaders.WWW_AUTHENTICATE).startsWith("Basic realm")); + } + + @Test + public void testUnauthorized() throws Exception { + // bad credentials + String authorization = "Basic " + Base64.getEncoder().encodeToString("aaa:bbb".getBytes()); + String fromAppId = "junit"; + String transactionId = null; + String serviceInstanceId = "aServiceInstanceId"; + + Response response = this.service.getContext(new TestHttpServletRequest(), authorization, fromAppId, + transactionId, serviceInstanceId); + assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus()); + // should not get WWW-Authenticate header in response + assertNull(response.getHeaderString(HttpHeaders.WWW_AUTHENTICATE)); + } + + /** Fail if calling app name is missing. */ + @Test + public void verifyFromAppId() throws Exception { + String fromAppId = null; + String transactionId = null; + String serviceInstanceId = "someValue"; + + Response response = this.service.getContext(new TestHttpServletRequest(), AUTH, fromAppId, transactionId, + serviceInstanceId); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertTrue(((String)response.getEntity()).contains(ONAPLogConstants.Headers.PARTNER_NAME)); + } + + /** Fail if service instance id is missing. */ + @Test + public void verifyServiceInstanceId() throws Exception { + String fromAppId = "junit"; + String transactionId = null; + String serviceInstanceId = null; + + Response response = this.service.getContext(new TestHttpServletRequest(), AUTH, fromAppId, transactionId, + serviceInstanceId); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertTrue(((String)response.getEntity()).contains("service-instance-id")); + } + + /** Unknown service-instance-id return HTTP 404. */ + @Test + public void testInvalidServiceId() throws Exception { + aai.stubFor(get("/aai/v13/nodes/service-instance/noSuchServiceId").willReturn(notFound())); + + Response response = + this.service.getContext(new TestHttpServletRequest(), AUTH, "junit", null, "noSuchServiceId"); + + assertEquals(Status.NOT_FOUND.getStatusCode(), response.getStatus()); + } + + private void verifyResource(JSONObject parent, String arrayName, String field, String value) { + JSONArray array = parent.getJSONArray(arrayName); + for (int i = 0; i < array.length(); i++) { + JSONObject item = array.getJSONObject(i); + if (value.equals(item.getString(field))) { + return; + } + } + fail("Did not find " + field + "=" + value + " in " + arrayName + " array"); + } + + + private void addResponse(String path, String classpathResource) throws IOException { + String payload = readFully(ClassLoader.getSystemResourceAsStream(classpathResource)); + aai.stubFor(get(path).willReturn(okJson(payload))); + } + + + private String readFully(InputStream in) throws IOException { + char[] cbuf = new char[1024]; + StringBuilder content = new StringBuilder(); + try (InputStreamReader reader = new InputStreamReader(in, "UTF-8")) { + int count; + while ((count = reader.read(cbuf)) >= 0) { + content.append(cbuf, 0, count); + } + } + return content.toString(); + } +} diff --git a/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/TestHttpServletRequest.java b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/TestHttpServletRequest.java new file mode 100644 index 0000000..fc00a61 --- /dev/null +++ b/pomba/service-decomposition/src/test/java/org/onap/sdnc/apps/pomba/servicedecomposition/test/TestHttpServletRequest.java @@ -0,0 +1,392 @@ +/* + * ============LICENSE_START=================================================== + * Copyright (c) 2018 Amdocs + * ============================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END===================================================== + */ + +package org.onap.sdnc.apps.pomba.servicedecomposition.test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Map; +import javax.servlet.AsyncContext; +import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpUpgradeHandler; +import javax.servlet.http.Part; + +public class TestHttpServletRequest implements HttpServletRequest { + @Override + public String getHeader(String name) { + return null; + } + + @Override + public String getRemoteAddr() { + return "localhost"; + } + + @Override + public String getServerName() { + return "localhost"; + } + + @Override + public String getRequestURI() { + return "/test"; + } + + + @Override + public Object getAttribute(String name) { + throw new UnsupportedOperationException("getAttribute"); + } + + @Override + public Enumeration<String> getAttributeNames() { + throw new UnsupportedOperationException("getAttributeNames"); + } + + @Override + public String getCharacterEncoding() { + throw new UnsupportedOperationException("getCharacterEncoding"); + } + + @Override + public void setCharacterEncoding(String env) throws UnsupportedEncodingException { + throw new UnsupportedOperationException("setCharacterEncoding"); + } + + @Override + public int getContentLength() { + throw new UnsupportedOperationException("getContentLength"); + } + + @Override + public long getContentLengthLong() { + throw new UnsupportedOperationException("getContentLengthLong"); + } + + @Override + public String getContentType() { + throw new UnsupportedOperationException("getContentType"); + } + + @Override + public ServletInputStream getInputStream() throws IOException { + throw new UnsupportedOperationException("getInputStream"); + } + + @Override + public String getParameter(String name) { + throw new UnsupportedOperationException("getParameter"); + } + + @Override + public Enumeration<String> getParameterNames() { + throw new UnsupportedOperationException("getParameterNames"); + } + + @Override + public String[] getParameterValues(String name) { + throw new UnsupportedOperationException("getParameterValues"); + } + + @Override + public Map<String, String[]> getParameterMap() { + throw new UnsupportedOperationException("getParameterMap"); + } + + @Override + public String getProtocol() { + throw new UnsupportedOperationException("getProtocol"); + } + + @Override + public String getScheme() { + throw new UnsupportedOperationException("getScheme"); + } + + @Override + public int getServerPort() { + throw new UnsupportedOperationException("getServerPort"); + } + + @Override + public BufferedReader getReader() throws IOException { + throw new UnsupportedOperationException("getReader"); + } + + @Override + public String getRemoteHost() { + throw new UnsupportedOperationException("getRemoteHost"); + } + + @Override + public void setAttribute(String name, Object obj) { + throw new UnsupportedOperationException("setAttribute"); + } + + @Override + public void removeAttribute(String name) { + throw new UnsupportedOperationException("removeAttribute"); + } + + @Override + public Locale getLocale() { + throw new UnsupportedOperationException("getLocale"); + } + + @Override + public Enumeration<Locale> getLocales() { + throw new UnsupportedOperationException("getLocales"); + } + + @Override + public boolean isSecure() { + throw new UnsupportedOperationException("isSecure"); + } + + @Override + public RequestDispatcher getRequestDispatcher(String path) { + throw new UnsupportedOperationException("getRequestDispatcher"); + } + + @Override + public String getRealPath(String path) { + throw new UnsupportedOperationException("getRealPath"); + } + + @Override + public int getRemotePort() { + throw new UnsupportedOperationException("getRemotePort"); + } + + @Override + public String getLocalName() { + throw new UnsupportedOperationException("getLocalName"); + } + + @Override + public String getLocalAddr() { + throw new UnsupportedOperationException("getLocalAddr"); + } + + @Override + public int getLocalPort() { + throw new UnsupportedOperationException("getLocalPort"); + } + + @Override + public ServletContext getServletContext() { + throw new UnsupportedOperationException("getServletContext"); + } + + @Override + public AsyncContext startAsync() throws IllegalStateException { + throw new UnsupportedOperationException("startAsync"); + } + + @Override + public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) + throws IllegalStateException { + throw new UnsupportedOperationException("startAsync"); + } + + @Override + public boolean isAsyncStarted() { + throw new UnsupportedOperationException("isAsyncStarted"); + } + + @Override + public boolean isAsyncSupported() { + throw new UnsupportedOperationException("isAsyncSupported"); + } + + @Override + public AsyncContext getAsyncContext() { + throw new UnsupportedOperationException("getAsyncContext"); + } + + @Override + public DispatcherType getDispatcherType() { + throw new UnsupportedOperationException("getDispatcherType"); + } + + @Override + public String getAuthType() { + throw new UnsupportedOperationException("getAuthType"); + } + + @Override + public Cookie[] getCookies() { + throw new UnsupportedOperationException("getCookies"); + } + + @Override + public long getDateHeader(String name) { + throw new UnsupportedOperationException("getDateHeader"); + } + + @Override + public Enumeration<String> getHeaders(String name) { + throw new UnsupportedOperationException("getHeaders"); + } + + @Override + public Enumeration<String> getHeaderNames() { + throw new UnsupportedOperationException("getHeaderNames"); + } + + @Override + public int getIntHeader(String name) { + throw new UnsupportedOperationException("getIntHeader"); + } + + @Override + public String getMethod() { + throw new UnsupportedOperationException("getMethod"); + } + + @Override + public String getPathInfo() { + throw new UnsupportedOperationException("getPathInfo"); + } + + @Override + public String getPathTranslated() { + throw new UnsupportedOperationException("getPathTranslated"); + } + + @Override + public String getContextPath() { + throw new UnsupportedOperationException("getContextPath"); + } + + @Override + public String getQueryString() { + throw new UnsupportedOperationException("getQueryString"); + } + + @Override + public String getRemoteUser() { + throw new UnsupportedOperationException("getRemoteUser"); + } + + @Override + public boolean isUserInRole(String role) { + throw new UnsupportedOperationException("isUserInRole"); + } + + @Override + public Principal getUserPrincipal() { + throw new UnsupportedOperationException("getUserPrincipal"); + } + + @Override + public String getRequestedSessionId() { + throw new UnsupportedOperationException("getRequestedSessionId"); + } + + @Override + public StringBuffer getRequestURL() { + throw new UnsupportedOperationException("getRequestURL"); + } + + @Override + public String getServletPath() { + throw new UnsupportedOperationException("getServletPath"); + } + + @Override + public HttpSession getSession(boolean create) { + throw new UnsupportedOperationException("getSession"); + } + + @Override + public HttpSession getSession() { + throw new UnsupportedOperationException("getSession"); + } + + @Override + public String changeSessionId() { + throw new UnsupportedOperationException("changeSessionId"); + } + + @Override + public boolean isRequestedSessionIdValid() { + throw new UnsupportedOperationException("isRequestedSessionIdValid"); + } + + @Override + public boolean isRequestedSessionIdFromCookie() { + throw new UnsupportedOperationException("isRequestedSessionIdFromCookie"); + } + + @Override + public boolean isRequestedSessionIdFromURL() { + throw new UnsupportedOperationException("isRequestedSessionIdFromURL"); + } + + @Override + public boolean isRequestedSessionIdFromUrl() { + throw new UnsupportedOperationException("isRequestedSessionIdFromUrl"); + } + + @Override + public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { + throw new UnsupportedOperationException("authenticate"); + } + + @Override + public void login(String username, String password) throws ServletException { + throw new UnsupportedOperationException("login"); + } + + @Override + public void logout() throws ServletException { + throw new UnsupportedOperationException("logout"); + } + + @Override + public Collection<Part> getParts() throws IOException, ServletException { + throw new UnsupportedOperationException("getParts"); + } + + @Override + public Part getPart(String name) throws IOException, ServletException { + throw new UnsupportedOperationException("getPart"); + } + + @Override + public <T extends HttpUpgradeHandler> T upgrade(Class<T> httpUpgradeHandlerClass) + throws IOException, ServletException { + throw new UnsupportedOperationException("upgrade"); + } +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf1.json b/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf1.json new file mode 100644 index 0000000..5c8bf3e --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf1.json @@ -0,0 +1,84 @@ +{ + "vnf-id": "6700c313-fbb7-4cf9-ac70-0293ec56df68", + "vnf-name": "PacketGenerator-1", + "vnf-type": "vFW-vSINK-service/vPKG 0", + "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1527638176989", + "model-invariant-id": "99f1fd3f-845c-48f5-a0ba-11fbde6ae557", + "model-version-id": "a5565bf4-d55a-4964-8fbc-6a7674a2e676", + "model-customization-id": "4cc1e555-361f-4d69-ae21-9f371ea9f40c", + "nf-type": "", + "nf-function": "", + "nf-role": "", + "nf-naming-code": "", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/c6456519-6acf-4adb-997c-3c363dd4caaf", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "Demonstration" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "vFWCL" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "c6456519-6acf-4adb-997c-3c363dd4caaf" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "Firewall1" + } + ] + }, + { + "related-to": "vserver", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant/b49b830686654191bb1e952a74b014ad/vservers/vserver/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "b49b830686654191bb1e952a74b014ad" + }, + { + "relationship-key": "vserver.vserver-id", + "relationship-value": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a" + } + ] + } + ] + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "0f792076-f5b3-4251-9fcc-c4d5afae0eb1", + "vf-module-name": "vPacketGen-VNF-1128-3", + "heat-stack-id": "vPacketGen-VNF-1128-3/df34f5d6-ed39-4184-b785-51c37cfa8ac2", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1527641224058", + "model-invariant-id": "2a8844a8-f5f7-46dd-a732-472c6972a28e", + "model-version-id": "d6d4a002-a584-4640-bdce-a50e9bce552b", + "model-customization-id": "49c8f521-e5ee-4095-bb87-4090166e49ab", + "module-index": 0 + } + ] + } +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf2.json b/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf2.json new file mode 100644 index 0000000..f96431e --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-generic-vnf2.json @@ -0,0 +1,96 @@ +{ + "vnf-id": "8a9ddb25-2e79-449c-a40d-5011bac0da39", + "vnf-name": "Firewall-1", + "vnf-type": "vFW-vSINK-service/vFWvSINK 0", + "service-id": "8ea56b0d-459d-4668-b363-c9567432d8b7", + "prov-status": "PREPROV", + "orchestration-status": "Created", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1527637940029", + "model-invariant-id": "59dd4d63-8f21-406c-98c0-3b057bb86820", + "model-version-id": "e2d52f32-a952-46f5-800c-c250903625d6", + "model-customization-id": "3b822416-475d-4e1c-aac3-2544b0a0fdfc", + "nf-type": "", + "nf-function": "", + "nf-role": "", + "nf-naming-code": "", + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL/service-instances/service-instance/c6456519-6acf-4adb-997c-3c363dd4caaf", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "Demonstration" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "vFWCL" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "c6456519-6acf-4adb-997c-3c363dd4caaf" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "Firewall1" + } + ] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951870", + "relationship-data": [ + { + "relationship-key": "l3-network.network-id", + "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951870" + } + ], + "related-to-property": [ + { + "property-key": "l3-network.network-name", + "property-value": "HNPORTALOAM.OAM" + } + ] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/l3-networks/l3-network/HNP1d77c-1094-41ec-b7f3-94bb30951872", + "relationship-data": [ + { + "relationship-key": "l3-network.network-id", + "relationship-value": "HNP1d77c-1094-41ec-b7f3-94bb30951872" + } + ], + "related-to-property": [ + { + "property-key": "l3-network.network-name", + "property-value": "HNPORTAL_SRIOV_2" + } + ] + } + ] + }, + "vf-modules": { + "vf-module": [ + { + "vf-module-id": "1563b649-9e05-4288-b7d9-e3639a54ace6", + "vf-module-name": "vFW_SINC_Module-2", + "heat-stack-id": "vFW_SINC_Module-2/41c4533a-748d-4cf4-a8d3-eccdd0aeb0d4", + "orchestration-status": "active", + "is-base-vf-module": true, + "resource-version": "1527638439198", + "model-invariant-id": "74bc1518-282d-4148-860f-8892b6369456", + "model-version-id": "4e3d28cf-d654-41af-a47b-04b4bd0ac58e", + "model-customization-id": "cc51ab7d-9b03-4bd6-9104-09df0c7c7907", + "module-index": 0 + } + ] + } +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-l3-network1.json b/pomba/service-decomposition/src/test/resources/junit/aai-l3-network1.json new file mode 100644 index 0000000..993e6ca --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-l3-network1.json @@ -0,0 +1,16 @@ +{ + "network-id": "HNP1d77c-1094-41ec-b7f3-94bb30951870", + "network-name": "HNPORTALOAM.OAM", + "network-type": "OVS_PROVIDER_VLAN", + "network-role": "HNPORTALOAM.OAM", + "network-technology": "ovs", + "neutron-network-id": "491c7cef-a3f4-4990-883e-b0af397466d0", + "is-bound-to-vpn": false, + "service-id": "V7611HNP-1222-48f1-8085-94aef0c6ef3d51870", + "network-role-instance": 0, + "resource-version": "1526558298075", + "orchestration-status": "active", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-l3-network2.json b/pomba/service-decomposition/src/test/resources/junit/aai-l3-network2.json new file mode 100644 index 0000000..6008a7c --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-l3-network2.json @@ -0,0 +1,634 @@ +{ + "network-id": "HNP1d77c-1094-41ec-b7f3-94bb30951872", + "network-name": "oam-net", + "network-type": "Tenant_Layer_3", + "network-role": "role-2", + "network-technology": "Contrail", + "is-bound-to-vpn": false, + "service-id": "", + "resource-version": "1489409337521", + "orchestration-status": "active", + "model-invariant-id": "aaa", + "model-customization-id": "f8d1d77c-5875-41ec-b7f3-94bb30936807", + "physical-network-name": "", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/lmr-dev-service-instance-1/service-data/networks/network/7fda3d47-bf58-4d72-a8a9-6e67ed5e28cb", + "relationship-list": { + "relationship": [ + { + "related-to": "vf-module", + "relationship-label": "org.onap.relationships.inventory.DependsOn", + "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/vnf-id-1/vf-modules/vf-module/vf-module-1", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "vnf-id-1" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "vf-module-1" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/clb1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "clb1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/anmca", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "anmca" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mor1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mor1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/LNN1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "LNN1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RLG1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RLG1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/STL1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "STL1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/milit", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "milit" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/NWO1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "NWO1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/Docs_Ottawa4", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Docs_Ottawa4" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/bng1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "bng1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SNFC", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "SNFC" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/FRO1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "FRO1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/vnf-id-1", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "vnf-id-1" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "zclb1nf-code-166" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/Docs_Ottawa5", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Docs_Ottawa5" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/TOJ1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "TOJ1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/TOR1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "TOR1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/LIV1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "LIV1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AMS1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "AMS1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/CLB1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "CLB1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/KNV1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "KNV1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SNT1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "SNT1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/REN1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "REN1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/JCS1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "JCS1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/BTR1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "BTR1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/IPL1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "IPL1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/brl1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "brl1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDG2", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "SDG2" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDG3", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "SDG3" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDG1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "SDG1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/alt1", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "alt1" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ] + } + ] + } +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-service-instance.json b/pomba/service-decomposition/src/test/resources/junit/aai-service-instance.json new file mode 100644 index 0000000..aea4d23 --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-service-instance.json @@ -0,0 +1,43 @@ +{ + "service-instance-id": "c6456519-6acf-4adb-997c-3c363dd4caaf", + "service-instance-name": "Firewall1", + "model-invariant-id": "0c5a20de-87ad-442c-9190-f38ab0a6bb7f", + "model-version-id": "d3d6cf83-d03a-43cc-99ff-206d40bb9a72", + "resource-version": "1527637758480", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/6700c313-fbb7-4cf9-ac70-0293ec56df68", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "6700c313-fbb7-4cf9-ac70-0293ec56df68" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "PacketGenerator-1" + } + ] + }, + { + "related-to": "generic-vnf", + "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "8a9ddb25-2e79-449c-a40d-5011bac0da39" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "Firewall-1" + } + ] + } + ] + } +} diff --git a/pomba/service-decomposition/src/test/resources/junit/aai-vserver.json b/pomba/service-decomposition/src/test/resources/junit/aai-vserver.json new file mode 100644 index 0000000..f1cf076 --- /dev/null +++ b/pomba/service-decomposition/src/test/resources/junit/aai-vserver.json @@ -0,0 +1,78 @@ +{ + "vserver-id": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "vserver-name": "Firewall-0", + "vserver-name2": "Firewall-0", + "prov-status": "ACTIVE", + "vserver-selflink": "http://10.12.25.2:8774/v2.1/b49b830686654191bb1e952a74b014ad/servers/b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74a", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1528481820321", + "relationship-list": { + "relationship": [ + { + "related-to": "generic-vnf", + "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/8a9ddb25-2e79-449c-a40d-5011bac0da39", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "8a9ddb25-2e79-449c-a40d-5011bac0da39" + } + ], + "related-to-property": [ + { + "property-key": "generic-vnf.vnf-name", + "property-value": "Firewall-1" + } + ] + }, + { + "related-to": "flavor", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "flavor.flavor-id", + "relationship-value": "764efb04-5a46-4806-a766-2bdd24559f39" + } + ], + "related-to-property": [ + { + "property-key": "flavor.flavor-name", + "property-value": "m1.medium" + } + ] + }, + { + "related-to": "image", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/images/image/42fd42f8-cf81-4f4c-a552-d4b124f83b0b", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "RegionOne" + }, + { + "relationship-key": "image.image-id", + "relationship-value": "42fd42f8-cf81-4f4c-a552-d4b124f83b0b" + } + ], + "related-to-property": [ + { + "property-key": "image.image-name", + "property-value": "unknown" + } + ] + } + ] + } +} |