diff options
author | Brandon, Bruce (bb2697) <bb2697@att.com> | 2018-07-26 13:14:54 +0000 |
---|---|---|
committer | Brandon, Bruce (bb2697) <bb2697@att.com> | 2018-07-26 14:14:35 +0000 |
commit | 0e6f956f81b67e2e18c5972561552da55ea9838c (patch) | |
tree | 651a8c4b9a1770fc966bf51344eff18967ddd0f8 /generic-resource-api/provider/src/test/java | |
parent | 27b190ba58a8c66c7c807f7af3a72c2e0455401f (diff) |
Generic resource API catch up
Adding several Generic Resource API capabilities to Yang, provider, and tests
Change-Id: I9d6a3e1494ba35b2e98370ca5b2c4ff8270981af
Issue-ID: SDNC-271
Signed-off-by: Brandon, Bruce (bb2697) <bb2697@att.com>
Diffstat (limited to 'generic-resource-api/provider/src/test/java')
6 files changed, 184 insertions, 118 deletions
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java index b05f1b27..6e0f1a2e 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java @@ -7,8 +7,8 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME; import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE; import static org.onap.sdnc.northbound.util.MDSALUtil.build; import static org.onap.sdnc.northbound.util.MDSALUtil.exec; -import static org.onap.sdnc.northbound.util.MDSALUtil.networkTopologyIdentifierBuilder; -import static org.onap.sdnc.northbound.util.MDSALUtil.networkTopologyInformationBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.networkTopologyIdentifierStructureBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.preloadNetworkTopologyInformationBuilder; import static org.onap.sdnc.northbound.util.MDSALUtil.preloadNetworkTopologyOperationInput; import static org.onap.sdnc.northbound.util.MDSALUtil.preloadNetworkTopologyOperationOutput; import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation; @@ -41,7 +41,7 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes } @Test - public void should_fail_when_invalid_vnf_topology() throws Exception { + public void should_fail_when_invalid_network_topology() throws Exception { PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput()); @@ -49,25 +49,7 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult); assertEquals("403", output.getResponseCode()); - assertEquals("input is null", output.getResponseMessage()); - assertEquals("Y", output.getAckFinalIndicator()); - } - - - @Test - public void should_fail_when_invalid_preload_data() throws Exception { - - PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput() - .setNetworkTopologyInformation(build(networkTopologyInformationBuilder() - .setNetworkTopologyIdentifier(build(networkTopologyIdentifierBuilder() - .setNetworkName("test-network-name"))))) - ); - - PreloadNetworkTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadNetworkTopologyOperation, input, RpcResult::getResult); - - assertEquals("403", output.getResponseCode()); - assertEquals("invalid input: network-name or network-type is null or empty", output.getResponseMessage()); + assertEquals("invalid input, null or empty preload-network-topology-information", output.getResponseMessage()); assertEquals("Y", output.getAckFinalIndicator()); } @@ -76,11 +58,11 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes public void should_fail_when_client_execution_failed() throws Exception { svcClient.mockHasGraph(true); - svcClient.mockExecuteWoServiceData(new RuntimeException("test exception")); + svcClient.mockExecuteWoServiceDataPreload(new RuntimeException("test exception")); PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput() - .setNetworkTopologyInformation(build(networkTopologyInformationBuilder() - .setNetworkTopologyIdentifier(build(networkTopologyIdentifierBuilder() + .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder() + .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder() .setNetworkName("test-network-name") .setNetworkType("test-network-type"))))) ); @@ -99,8 +81,8 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes svcClient.mockHasGraph(false); PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput() - .setNetworkTopologyInformation(build(networkTopologyInformationBuilder() - .setNetworkTopologyIdentifier(build(networkTopologyIdentifierBuilder() + .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder() + .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder() .setNetworkName("test-network-name") .setNetworkType("test-network-type"))))) ); @@ -127,8 +109,8 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes genericResourceApiProvider.setDataBroker(spyDataBroker); PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput() - .setNetworkTopologyInformation(build(networkTopologyInformationBuilder() - .setNetworkTopologyIdentifier(build(networkTopologyIdentifierBuilder() + .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder() + .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder() .setNetworkName("test-network-name") .setNetworkType("test-network-type"))))) ); @@ -149,8 +131,8 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes svcClient.mockExecute(svcResultProp); PreloadNetworkTopologyOperationInput input = build(preloadNetworkTopologyOperationInput() - .setNetworkTopologyInformation(build(networkTopologyInformationBuilder() - .setNetworkTopologyIdentifier(build(networkTopologyIdentifierBuilder() + .setPreloadNetworkTopologyInformation(build(preloadNetworkTopologyInformationBuilder() + .setNetworkTopologyIdentifierStructure(build(networkTopologyIdentifierStructureBuilder() .setNetworkName("test-network-name") .setNetworkType("test-network-type"))))) .setSdncRequestHeader(build(sdncRequestHeader() diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java index 8a854a91..8ab5e1f7 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java @@ -7,12 +7,14 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME; import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE; import static org.onap.sdnc.northbound.util.MDSALUtil.build; import static org.onap.sdnc.northbound.util.MDSALUtil.exec; -import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVnfTopologyOperationInput; -import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVnfTopologyOperationOutput; +import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyOperationInput; +import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyOperationOutput; import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation; import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader; -import static org.onap.sdnc.northbound.util.MDSALUtil.vnfTopologyIdentifierBuilder; -import static org.onap.sdnc.northbound.util.MDSALUtil.vnfTopologyInformationBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.vnfTopologyIdentifierStructureBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyInformationBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyBuilder; +import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyIdentifierBuilder; import org.junit.Before; import org.junit.Test; @@ -23,8 +25,8 @@ import org.onap.sdnc.northbound.util.PropBuilder; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInput; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationOutput; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction; import org.opendaylight.yangtools.yang.common.RpcResult; @@ -32,7 +34,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; @RunWith(MockitoJUnitRunner.class) public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProviderTest { - private static final String SVC_OPERATION = "preload-vnf-topology-operation"; + private static final String SVC_OPERATION = "preload-vf-module-topology-operation"; @Before public void setUp() throws Exception { @@ -43,13 +45,13 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid @Test public void should_fail_when_invalid_vnf_topology() throws Exception { - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput()); + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput()); - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("403", output.getResponseCode()); - assertEquals("invalid input: input is null", output.getResponseMessage()); + assertEquals("invalid input, null or empty preload-vf-module-topology-information.vf-module-topology.vf-module-topology-identifier.vf-module-name", output.getResponseMessage()); assertEquals("Y", output.getAckFinalIndicator()); } @@ -57,17 +59,17 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid @Test public void should_fail_when_invalid_preload_data() throws Exception { - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput() - .setVnfTopologyInformation(build(vnfTopologyInformationBuilder() - .setVnfTopologyIdentifier(build(vnfTopologyIdentifierBuilder() + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput() + .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder() + .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder() .setVnfName("test-vnf-name"))))) ); - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("403", output.getResponseCode()); - assertEquals("invalid input: vnf-name or vnf-type is null or empty", output.getResponseMessage()); + assertEquals("invalid input, null or empty preload-vf-module-topology-information.vf-module-topology.vf-module-topology-identifier.vf-module-name", output.getResponseMessage()); assertEquals("Y", output.getAckFinalIndicator()); } @@ -76,17 +78,29 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid public void should_fail_when_client_execution_failed() throws Exception { svcClient.mockHasGraph(true); - svcClient.mockExecuteWoServiceData(new RuntimeException("test exception")); - - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput() - .setVnfTopologyInformation(build(vnfTopologyInformationBuilder() - .setVnfTopologyIdentifier(build(vnfTopologyIdentifierBuilder() - .setVnfName("test-vnf-name") - .setVnfType("test-vnf-type"))))) - ); - - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + svcClient.mockExecuteWoServiceDataPreload(new RuntimeException("test exception")); + + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput() + .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder() + .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder() + .setVnfName("test-vnf-name") + .setVnfType("test-vnf-type"))) + .setVfModuleTopology(build(vfModuleTopologyBuilder() + .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder() + .setVfModuleName("vf-module-name")) + ))))) + .setSdncRequestHeader(build(sdncRequestHeader() + .setSvcRequestId("test-svc-request-id") + .setSvcAction(SvcAction.Assign) + )) + .setRequestInformation(build(requestInformation() + .setRequestId("test-request-id") + .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance) + )) + ); + + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("500", output.getResponseCode()); assertEquals("test exception", output.getResponseMessage()); @@ -98,15 +112,27 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid svcClient.mockHasGraph(false); - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput() - .setVnfTopologyInformation(build(vnfTopologyInformationBuilder() - .setVnfTopologyIdentifier(build(vnfTopologyIdentifierBuilder() - .setVnfName("test-vnf-name") - .setVnfType("test-vnf-type"))))) - ); - - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput() + .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder() + .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder() + .setVnfName("test-vnf-name") + .setVnfType("test-vnf-type"))) + .setVfModuleTopology(build(vfModuleTopologyBuilder() + .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder() + .setVfModuleName("vf-module-name")) + ))))) + .setSdncRequestHeader(build(sdncRequestHeader() + .setSvcRequestId("test-svc-request-id") + .setSvcAction(SvcAction.Assign) + )) + .setRequestInformation(build(requestInformation() + .setRequestId("test-request-id") + .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance) + )) + ); + + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("503", output.getResponseCode()); assertEquals(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + SVC_OPERATION + "'", output.getResponseMessage()); @@ -126,15 +152,27 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction); genericResourceApiProvider.setDataBroker(spyDataBroker); - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput() - .setVnfTopologyInformation(build(vnfTopologyInformationBuilder() - .setVnfTopologyIdentifier(build(vnfTopologyIdentifierBuilder() - .setVnfName("test-vnf-name") - .setVnfType("test-vnf-type"))))) - ); - - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput() + .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder() + .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder() + .setVnfName("test-vnf-name") + .setVnfType("test-vnf-type"))) + .setVfModuleTopology(build(vfModuleTopologyBuilder() + .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder() + .setVfModuleName("vf-module-name")) + ))))) + .setSdncRequestHeader(build(sdncRequestHeader() + .setSvcRequestId("test-svc-request-id") + .setSvcAction(SvcAction.Assign) + )) + .setRequestInformation(build(requestInformation() + .setRequestId("test-request-id") + .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance) + )) + ); + + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("500", output.getResponseCode()); assertEquals("test exception", output.getResponseMessage()); @@ -148,11 +186,15 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid PropBuilder svcResultProp = svcClient.createExecuteOKResult(); svcClient.mockExecute(svcResultProp); - PreloadVnfTopologyOperationInput input = build(preloadVnfTopologyOperationInput() - .setVnfTopologyInformation(build(vnfTopologyInformationBuilder() - .setVnfTopologyIdentifier(build(vnfTopologyIdentifierBuilder() + PreloadVfModuleTopologyOperationInput input = build(preloadVfModuleTopologyOperationInput() + .setPreloadVfModuleTopologyInformation(build(preloadVfModuleTopologyInformationBuilder() + .setVnfTopologyIdentifierStructure(build(vnfTopologyIdentifierStructureBuilder() .setVnfName("test-vnf-name") - .setVnfType("test-vnf-type"))))) + .setVnfType("test-vnf-type"))) + .setVfModuleTopology(build(vfModuleTopologyBuilder() + .setVfModuleTopologyIdentifier(build(vfModuleTopologyIdentifierBuilder() + .setVfModuleName("vf-module-name")) + ))))) .setSdncRequestHeader(build(sdncRequestHeader() .setSvcRequestId("test-svc-request-id") .setSvcAction(SvcAction.Assign) @@ -163,19 +205,19 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid )) ); - PreloadVnfTopologyOperationOutput output = - exec(genericResourceApiProvider::preloadVnfTopologyOperation, input, RpcResult::getResult); + PreloadVfModuleTopologyOperationOutput output = + exec(genericResourceApiProvider::preloadVfModuleTopologyOperation, input, RpcResult::getResult); assertEquals("200", output.getResponseCode()); assertEquals("Y", output.getAckFinalIndicator()); - PreloadVnfTopologyOperationOutput expectedOutput = createExpectedOutput(svcResultProp, input); + PreloadVfModuleTopologyOperationOutput expectedOutput = createExpectedOutput(svcResultProp, input); assertEquals(expectedOutput, output); } - private PreloadVnfTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp, - PreloadVnfTopologyOperationInput input) { - return build(preloadVnfTopologyOperationOutput() + private PreloadVfModuleTopologyOperationOutput createExpectedOutput(PropBuilder svcResultProp, + PreloadVfModuleTopologyOperationInput input) { + return build(preloadVfModuleTopologyOperationOutput() .setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()) .setResponseCode(svcResultProp.get(svcClient.errorCode)) .setAckFinalIndicator(svcResultProp.get(svcClient.ackFinal)) diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java index facf71d6..2cadbfeb 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java @@ -12,6 +12,8 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation; import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader; import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder; import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation; +import static org.onap.sdnc.northbound.util.MDSALUtil.vnfResponseInformation; +import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleResponseInformation; import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleInformationBuilder; import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyOperationInput; import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyOperationOutput; @@ -225,8 +227,16 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider .setResponseMessage(propBuilder.get(svcClient.errorMessage)) .setServiceResponseInformation(build(serviceResponseInformation() .setInstanceId(input.getServiceInformation().getServiceInstanceId()) - .setObjectPath(propBuilder.get(svcClient.serviceObjectPath)) - )) + .setObjectPath(propBuilder.get(svcClient.serviceObjectPath))) + ) + .setVnfResponseInformation(build(vnfResponseInformation() + .setInstanceId(input.getVnfInformation().getVnfId()) + .setObjectPath(propBuilder.get(svcClient.vnfObjectPath))) + ) + .setVfModuleResponseInformation(build(vfModuleResponseInformation() + .setInstanceId(input.getVfModuleInformation().getVfModuleId()) + .setObjectPath(propBuilder.get(svcClient.vfModuleObjectPath))) + ) ); } } diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java index 645cbf29..7e657dc3 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java @@ -198,6 +198,10 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest .setInstanceId(vnfTopologyOperationInput.getServiceInformation().getServiceInstanceId()) .setObjectPath(svcResultProp.get(svcClient.serviceObjectPath)) )) + .setVnfResponseInformation(build(vnfResponseInformation() + .setInstanceId(vnfTopologyOperationInput.getVnfInformation().getVnfId()) + .setObjectPath(svcResultProp.get(svcClient.vnfObjectPath)) + )) ); } } diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java index 784717d9..36c6c7ff 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java @@ -29,6 +29,7 @@ import static org.onap.sdnc.northbound.util.PropBuilder.propBuilder; import java.util.Properties; import org.onap.sdnc.northbound.GenericResourceApiSvcLogicServiceClient; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder; @@ -44,18 +45,17 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil { private final String VERSION = null; private String scvOperation = null; - public final String errorCode = "error-code"; public final String errorMessage = "error-message"; public final String ackFinal = "ack-final"; public final String serviceObjectPath = "service-object-path"; public final String networkObjectPath = "network-object-path"; + public final String vnfObjectPath = "vnf-object-path"; + public final String vfModuleObjectPath = "vf-module-object-path"; public final String networkId = "networkId"; - private final GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient; - public GenericResourceApiSvcLogicServiceClientMockUtil( GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient) { this.mockGenericResourceApiSvcLogicServiceClient = mockGenericResourceApiSvcLogicServiceClient; @@ -98,8 +98,9 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil { .set(ackFinal, "Y") .set(serviceObjectPath, "serviceObjectPath: XYZ") .set(networkObjectPath, "networkObjectPath: XYZ") + .set(vnfObjectPath, "vnfObjectPath: XYZ") + .set(vfModuleObjectPath, "vfModuleObjectPath: XYZ") .set(networkId, "networkId: XYZ"); - } @@ -161,5 +162,19 @@ public class GenericResourceApiSvcLogicServiceClientMockUtil { ).thenThrow(exception); } + public void mockExecuteWoServiceDataPreload(RuntimeException exception) throws Exception { + when( + mockGenericResourceApiSvcLogicServiceClient + .execute( + eq(MODULE), + eq(scvOperation), + eq(VERSION), + eq(MODE), + isA(PreloadDataBuilder.class), + isA(Properties.class) + ) + ).thenThrow(exception); + } + } diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java index 4b970475..9ed690ca 100644 --- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java +++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/MDSALUtil.java @@ -34,8 +34,8 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder; @@ -51,8 +51,9 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.NetworkTopologyIdentifierBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.information.NetworkTopologyInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.structure.NetworkTopologyIdentifierStructureBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.network.topology.information.PreloadNetworkTopologyInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.vf.module.topology.information.PreloadVfModuleTopologyInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.security.zone.response.information.SecurityZoneResponseInformationBuilder; @@ -64,10 +65,12 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.tunnelxconn.response.information.TunnelxconnResponseInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.VfModuleTopologyBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.identifier.VfModuleTopologyIdentifierBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder; import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.VnfTopologyIdentifierBuilder; -import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.information.VnfTopologyInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.structure.VnfTopologyIdentifierStructureBuilder; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.common.RpcResult; @@ -99,12 +102,12 @@ import org.opendaylight.yangtools.yang.common.RpcResult; */ public class MDSALUtil { - public static PreloadVnfTopologyOperationInputBuilder preloadVnfTopologyOperationInput() { - return new PreloadVnfTopologyOperationInputBuilder(); + public static PreloadVfModuleTopologyOperationInputBuilder preloadVfModuleTopologyOperationInput() { + return new PreloadVfModuleTopologyOperationInputBuilder(); } - public static PreloadVnfTopologyOperationOutputBuilder preloadVnfTopologyOperationOutput() { - return new PreloadVnfTopologyOperationOutputBuilder(); + public static PreloadVfModuleTopologyOperationOutputBuilder preloadVfModuleTopologyOperationOutput() { + return new PreloadVfModuleTopologyOperationOutputBuilder(); } public static PreloadNetworkTopologyOperationInputBuilder preloadNetworkTopologyOperationInput() { @@ -184,7 +187,7 @@ public class MDSALUtil { public static ServiceResponseInformationBuilder serviceResponseInformation() { return new ServiceResponseInformationBuilder(); } - + public static SecurityZoneResponseInformationBuilder securityZoneResponseInformation() { return new SecurityZoneResponseInformationBuilder(); } @@ -205,24 +208,20 @@ public class MDSALUtil { return new VnfResponseInformationBuilder(); } - public static ServiceInformationBuilder serviceInformationBuilder() { - return new ServiceInformationBuilder(); - } - - public static VnfTopologyInformationBuilder vnfTopologyInformationBuilder() { - return new VnfTopologyInformationBuilder(); + public static VfModuleResponseInformationBuilder vfModuleResponseInformation() { + return new VfModuleResponseInformationBuilder(); } - public static NetworkTopologyInformationBuilder networkTopologyInformationBuilder() { - return new NetworkTopologyInformationBuilder(); + public static ServiceInformationBuilder serviceInformationBuilder() { + return new ServiceInformationBuilder(); } - public static NetworkTopologyIdentifierBuilder networkTopologyIdentifierBuilder(){ - return new NetworkTopologyIdentifierBuilder(); + public static PreloadNetworkTopologyInformationBuilder preloadNetworkTopologyInformationBuilder() { + return new PreloadNetworkTopologyInformationBuilder(); } - public static VnfTopologyIdentifierBuilder vnfTopologyIdentifierBuilder() { - return new VnfTopologyIdentifierBuilder(); + public static NetworkTopologyIdentifierStructureBuilder networkTopologyIdentifierStructureBuilder(){ + return new NetworkTopologyIdentifierStructureBuilder(); } public static VnfInformationBuilder vnfInformationBuilder() { @@ -237,12 +236,10 @@ public class MDSALUtil { return new ServiceBuilder(); } - public static ServiceDataBuilder serviceData() { return new ServiceDataBuilder(); } - public static ServiceStatusBuilder serviceStatus() { return new ServiceStatusBuilder(); } @@ -259,6 +256,22 @@ public class MDSALUtil { return new NetworkTopologyOperationOutputBuilder(); } + public static VnfTopologyIdentifierStructureBuilder vnfTopologyIdentifierStructureBuilder() { + return new VnfTopologyIdentifierStructureBuilder(); + } + + public static PreloadVfModuleTopologyInformationBuilder preloadVfModuleTopologyInformationBuilder() { + return new PreloadVfModuleTopologyInformationBuilder(); + } + + public static VfModuleTopologyBuilder vfModuleTopologyBuilder() { + return new VfModuleTopologyBuilder(); + } + + public static VfModuleTopologyIdentifierBuilder vfModuleTopologyIdentifierBuilder() { + return new VfModuleTopologyIdentifierBuilder(); + } + public static NetworkResponseInformationBuilder networkResponseInformation() { return new NetworkResponseInformationBuilder(); } |