aboutsummaryrefslogtreecommitdiffstats
path: root/vnfapi/provider
diff options
context:
space:
mode:
Diffstat (limited to 'vnfapi/provider')
-rw-r--r--vnfapi/provider/pom.xml95
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java270
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java2327
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java295
-rw-r--r--vnfapi/provider/src/main/resources/OSGI-INF/blueprint/vnfapi-blueprint.xml34
-rw-r--r--vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml34
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClientTest.java437
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VfModuleTopologyOperationTest.java388
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java70
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java368
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java41
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfTopologyOperationRPCTest.java174
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfapiProviderTestBase.java1416
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/DataBrokerUtil.java94
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/MDSALUtil.java113
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/PropBuilder.java62
-rw-r--r--vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/VNFSDNSvcLogicServiceClientMockUtil.java130
-rw-r--r--vnfapi/provider/src/test/resources/proplist.properties22
-rw-r--r--vnfapi/provider/src/test/resources/simplelogger.properties23
19 files changed, 0 insertions, 6393 deletions
diff --git a/vnfapi/provider/pom.xml b/vnfapi/provider/pom.xml
deleted file mode 100644
index 4e07b297..00000000
--- a/vnfapi/provider/pom.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>2.1.1</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>vnfapi-provider</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>sdnc-northbound :: vnfapi :: ${project.artifactId}</name>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>vnfapi-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-test-model</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <type>test-jar</type>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
deleted file mode 100644
index 275948ab..00000000
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-public class VNFSDNSvcLogicServiceClient {
- static final String FAILURE_RESULT = "failure";
- static final String SVC_LOGIC_STATUS_KEY = "SvcLogic.status";
- private static final String TO_SLI_MSG = "Parameters passed to SLI";
- private static final String FROM_SLI_MSG = "Parameters returned by SLI";
-
- private final Logger logger = LoggerFactory.getLogger(VNFSDNSvcLogicServiceClient.class);
-
- private final SvcLogicService svcLogic;
-
- public VNFSDNSvcLogicServiceClient(final SvcLogicService svcLogicService) {
- this.svcLogic = svcLogicService;
- }
-
- public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
- return svcLogic.hasGraph(module, rpc, version, mode);
- }
-
- public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- ServiceDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- PreloadDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- //1610 vnf-instance
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VnfInstanceServiceDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- //1610 vnf-instance
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VnfInstanceServiceDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- //1610 vf-module
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VfModuleServiceDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- //1610 vf-module
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VfModuleServiceDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- //1610 vnf-instance-preload
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VnfInstancePreloadDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- //1610 vnf-instance-preload
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VnfInstancePreloadDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- //1610 vf-module-preload
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VfModulePreloadDataBuilder serviceData)
- throws SvcLogicException {
- return execute(module, rpc, version, mode, serviceData, new Properties());
- }
-
- //1610 vf-module-preload
- public Properties execute(String module,
- String rpc,
- String version,
- String mode,
- VfModulePreloadDataBuilder serviceData,
- Properties properties)
- throws SvcLogicException {
-
- Properties props = VnfSdnUtil.toProperties(properties, serviceData);
- printDebugLog(props, TO_SLI_MSG);
-
- Properties respProps = svcLogic.execute(module, rpc, version, mode, props);
- printDebugLog(respProps, FROM_SLI_MSG);
-
- if (respProps == null
- || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) {
- return respProps;
- }
-
- VnfSdnUtil.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- private void printDebugLog(Properties properties, String msg) {
- if (!logger.isDebugEnabled()) {
- return;
- }
- if (properties == null) {
- logger.debug(msg, "properties is null");
- return;
- }
-
- logger.debug(msg);
- for (Object key : properties.keySet()) {
- String paramName = (String) key;
- logger.debug(paramName, " = ", properties.getProperty(paramName));
- }
- }
-
-}
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java
deleted file mode 100644
index c14db885..00000000
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfApiProvider.java
+++ /dev/null
@@ -1,2327 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.base.Optional;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModules;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstances;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfs;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VNFAPIService;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModules;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstances;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.Vnfs;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader.SvcAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus.RequestStatus;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus.RpcAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus.RpcName;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus.VnfsdnAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus.VnfsdnSubaction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.Future;
-
-/**
- * Defines a base implementation for your provider. This class extends from a helper class which provides storage for
- * the most commonly used components of the MD-SAL. Additionally the base class provides some basic logging and
- * initialization / clean up methods.
- */
-
-public class VnfApiProvider implements AutoCloseable, VNFAPIService {
-
- protected DataBroker dataBroker;
- protected NotificationPublishService notificationService;
- protected RpcProviderRegistry rpcRegistry;
- protected BindingAwareBroker.RpcRegistration<VNFAPIService> rpcRegistration;
- private final Logger log = LoggerFactory.getLogger(VnfApiProvider.class);
- private final ExecutorService executor;
-
- private static final String PRELOAD_DATA = "] PreloadData: ";
- private static final String SENDING_SUCCESS_RPC = "Sending Success rpc result due to external error";
- public static final String REASON = "', Reason: '";
- public static final String ERROR_CODE = "] error code: '";
- public static final String INVALID_INPUT_INVALID_PRELOAD_TYPE = "invalid input, invalid preload-type";
- public static final String BECAUSE_OF_INVALID_PRELOAD_TYPE = " because of invalid preload-type";
- public static final String INVALID_INPUT_NULL_OR_EMPTY_SERVICE_INSTANCE_ID = "invalid input, null or empty service-instance-id";
- public static final String BECAUSE_OF_INVALID_INPUT_NULL_OR_EMPTY_SERVICE_INSTANCE_ID = " because of invalid input, null or empty service-instance-id";
- private static final String APP_NAME = "vnfapi";
- private static final String VNF_API = "VNF-API";
- private static final String OPERATIONAL_DATA = "operational-data";
- private static final String READ_MD_SAL_STR = "Read MD-SAL (";
- private static final String DATA_FOR_STR = ") data for [";
- private static final String SERVICE_DATA_STR = "] ServiceData: ";
- private static final String NO_DATA_FOUND_STR = "No data found in MD-SAL (";
- private static final String EXCEPTION_READING_MD_SAL_STR = "Caught Exception reading MD-SAL (";
- private static final String FOR_STR = ") for [";
- private static final String INVALID_INPUT_VF_MODULE_STR = "invalid input, null or empty vf-module-id";
- private static final String UPDATED_MD_SAL_STR = "Updated MD-SAL for ";
- private static final String RETURNED_SUCCESS_STR = "Returned SUCCESS for ";
- private static final String UPDATING_OPERATIONAL_TREE_STR = "Updating OPERATIONAL tree.";
- private static final String UPDATING_MD_SAL_STR = "Updating MD-SAL for ";
- private static final String CAUGHT_EXCEPTION_STR = "Caught Exception updating MD-SAL for ";
- private static final String RETURNED_FAILED_STR = "Returned FAILED for ";
- private static final String ADDING_INPUT_DATA_STR = "Adding INPUT data for ";
- private static final String ADDING_OPERATIONAL_DATA_STR = "Adding OPERATIONAL data for ";
- private static final String OPERATIONAL_DATA_STR = "] operational-data: ";
- private static final String ADDING_CONFIG_DATA_STR = "Adding CONFIG data for ";
- private static final String INPUT_STR = "] input: ";
- private static final String CALLED_STR = " called.";
- private static final String EXITING_STR = "exiting ";
- private static final String INVALID_INPUT_VNF_INSTANCE_STR = "invalid input, null or empty vnf-instance-id";
-
- private VNFSDNSvcLogicServiceClient svcLogicClient;
-
- public VnfApiProvider(DataBroker dataBroker2, NotificationPublishService notificationPublishService,
- RpcProviderRegistry rpcProviderRegistry, VNFSDNSvcLogicServiceClient client) {
- log.info("Creating provider for " + APP_NAME);
- executor = Executors.newFixedThreadPool(1);
- dataBroker = dataBroker2;
- notificationService = notificationPublishService;
- rpcRegistry = rpcProviderRegistry;
- svcLogicClient = client;
- initialize();
- }
-
- private void initialize() {
- log.info("Initializing provider for " + APP_NAME);
- // Create the top level containers
- createContainers();
- try {
- VnfSdnUtil.loadProperties();
- } catch (Exception e) {
- log.error("Caught Exception while trying to load properties file: ", e);
- }
-
- log.info("Initialization complete for " + APP_NAME);
- }
-
- private void createContainers() {
- final WriteTransaction t = dataBroker.newReadWriteTransaction();
-
- // Create the Vnfs container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Vnfs.class), new VnfsBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Vnfs.class), new VnfsBuilder().build());
-
- // Create the PreloadVnfs container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfs.class),
- new PreloadVnfsBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfs.class),
- new PreloadVnfsBuilder().build());
-
- // 1610 Create the PreloadVnfInstances container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfInstances.class),
- new PreloadVnfInstancesBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfInstances.class),
- new PreloadVnfInstancesBuilder().build());
-
- // 1610 Create the VnfInstances container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VnfInstances.class),
- new VnfInstancesBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(VnfInstances.class),
- new VnfInstancesBuilder().build());
-
- // 1610 Create the PreloadVfModules container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVfModules.class),
- new PreloadVfModulesBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVfModules.class),
- new PreloadVfModulesBuilder().build());
-
- // 1610 Create the VfModules container
- t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VfModules.class),
- new VfModulesBuilder().build());
- t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(VfModules.class),
- new VfModulesBuilder().build());
-
- try {
- CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
- checkedFuture.get();
- log.info("Create Containers succeeded!: ");
-
- } catch (InterruptedException | ExecutionException e) {
- log.error("Create Containers Failed: " + e);
- }
- }
-
- @Override
- public void close() throws Exception {
- log.info("Closing provider for " + APP_NAME);
- executor.shutdown();
- rpcRegistration.close();
- log.info("Successfully closed provider for " + APP_NAME);
- }
-
-
- private static class Iso8601Util {
-
-
- private static TimeZone tz = TimeZone.getTimeZone("UTC");
- private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
-
- private Iso8601Util() {
- }
-
- static {
- df.setTimeZone(tz);
- }
-
- private static String now() {
- return df.format(new Date());
- }
- }
-
- private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, String errorCode, String errorMessage,
- String ackFinal) {
- serviceStatusBuilder.setResponseCode(errorCode);
- serviceStatusBuilder.setResponseMessage(errorMessage);
- serviceStatusBuilder.setFinalIndicator(ackFinal);
- serviceStatusBuilder.setResponseTimestamp(Iso8601Util.now());
- }
-
- private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, RequestInformation requestInformation) {
- if (requestInformation != null && requestInformation.getRequestAction() != null) {
- switch (requestInformation.getRequestAction()) {
- case VNFActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VNFActivateRequest);
- break;
- case ChangeVNFActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVNFActivateRequest);
- break;
- case DisconnectVNFRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVNFRequest);
- break;
- case PreloadVNFRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVNFRequest);
- break;
- case DeletePreloadVNFRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DeletePreloadVNFRequest);
- break;
- // 1610 vnf-instance Requests
- case VnfInstanceActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VnfInstanceActivateRequest);
- break;
- case ChangeVnfInstanceActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVnfInstanceActivateRequest);
- break;
- case DisconnectVnfInstanceRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVnfInstanceRequest);
- break;
- case PreloadVnfInstanceRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVnfInstanceRequest);
- break;
- // 1610 vf-module Requests
- case VfModuleActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VfModuleActivateRequest);
- break;
- case ChangeVfModuleActivateRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVfModuleActivateRequest);
- break;
- case DisconnectVfModuleRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVfModuleRequest);
- break;
- case PreloadVfModuleRequest:
- serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVfModuleRequest);
- break;
- default:
- log.error("Unknown RequestAction: " + requestInformation.getRequestAction());
- break;
- }
- }
- if (requestInformation != null && requestInformation.getRequestSubAction() != null) {
- switch (requestInformation.getRequestSubAction()) {
- case SUPP:
- serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.SUPP);
- break;
- case CANCEL:
- serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.CANCEL);
- break;
- default:
- log.error("Unknown RequestSubAction: " + requestInformation.getRequestSubAction());
- break;
- }
- }
- }
-
- private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, SdncRequestHeader requestHeader) {
- if (requestHeader != null && requestHeader.getSvcAction() != null) {
- switch (requestHeader.getSvcAction()) {
- case Reserve:
- serviceStatusBuilder.setRpcAction(RpcAction.Reserve);
- break;
- case Activate:
- serviceStatusBuilder.setRpcAction(RpcAction.Activate);
- break;
- case Assign:
- serviceStatusBuilder.setRpcAction(RpcAction.Assign);
- break;
- case Delete:
- serviceStatusBuilder.setRpcAction(RpcAction.Delete);
- break;
- case Changeassign:
- serviceStatusBuilder.setRpcAction(RpcAction.Changeassign);
- break;
- case Changedelete:
- serviceStatusBuilder.setRpcAction(RpcAction.Changedelete);
- break;
- case Rollback:
- serviceStatusBuilder.setRpcAction(RpcAction.Rollback);
- break;
- default:
- log.error("Unknown SvcAction: " + requestHeader.getSvcAction());
- break;
- }
- }
- }
-
- private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder) {
- // default to config
- getServiceData(siid, serviceDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
-
- private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder, LogicalDatastoreType type) {
- // See if any data exists yet for this siid, if so grab it.
- InstanceIdentifier<VnfList> serviceInstanceIdentifier = InstanceIdentifier
- .builder(Vnfs.class)
- .child(VnfList.class, new VnfListKey(siid))
- .build();
-
- Optional<VnfList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, serviceInstanceIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + siid + "] ", e);
- }
-
- if (data.isPresent()) {
- ServiceData serviceData = (ServiceData) data.get().getServiceData();
- if (serviceData != null) {
- log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + siid + SERVICE_DATA_STR + serviceData);
- serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader());
- serviceDataBuilder.setRequestInformation(serviceData.getRequestInformation());
- serviceDataBuilder.setServiceInformation(serviceData.getServiceInformation());
- serviceDataBuilder.setVnfRequestInformation(serviceData.getVnfRequestInformation());
- serviceDataBuilder.setVnfId(serviceData.getVnfId());
- serviceDataBuilder.setVnfTopologyInformation(serviceData.getVnfTopologyInformation());
- serviceDataBuilder.setOperStatus(serviceData.getOperStatus());
- } else {
- log.info("No service-data found in MD-SAL (" + type + FOR_STR + siid + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + siid + "] ");
- }
- }
-
- //1610 vnf-instance
- private void getVnfInstanceServiceData(String siid, VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder) {
- // default to config
- getVnfInstanceServiceData(siid, vnfInstanceServiceDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
- //1610 vnf-instance
- private void getVnfInstanceServiceData(String siid, VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder,
- LogicalDatastoreType type) {
- // See if any data exists yet for this siid, if so grab it.
- InstanceIdentifier<VnfInstanceList> vnfInstanceIdentifier = InstanceIdentifier
- .builder(VnfInstances.class)
- .child(VnfInstanceList.class, new VnfInstanceListKey(siid))
- .build();
-
- Optional<VnfInstanceList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, vnfInstanceIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + siid + "] ", e);
- }
-
- if (data.isPresent()) {
- VnfInstanceServiceData vnfInstanceServiceData = data.get().getVnfInstanceServiceData();
- if (vnfInstanceServiceData != null) {
- log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + siid + "] VnfInstanceServiceData: "
- + vnfInstanceServiceData);
- vnfInstanceServiceDataBuilder.setSdncRequestHeader(vnfInstanceServiceData.getSdncRequestHeader());
- vnfInstanceServiceDataBuilder.setRequestInformation(vnfInstanceServiceData.getRequestInformation());
- vnfInstanceServiceDataBuilder.setServiceInformation(vnfInstanceServiceData.getServiceInformation());
- vnfInstanceServiceDataBuilder
- .setVnfInstanceRequestInformation(vnfInstanceServiceData.getVnfInstanceRequestInformation());
- vnfInstanceServiceDataBuilder.setVnfInstanceId(vnfInstanceServiceData.getVnfInstanceId());
- vnfInstanceServiceDataBuilder
- .setVnfInstanceTopologyInformation(vnfInstanceServiceData.getVnfInstanceTopologyInformation());
- vnfInstanceServiceDataBuilder.setOperStatus(vnfInstanceServiceData.getOperStatus());
- } else {
- log.info("No vnf-instance-service-data found in MD-SAL (" + type + FOR_STR + siid + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + siid + "] ");
- }
- }
-
- //1610 vf-module
- private void getVfModuleServiceData(String siid, VfModuleServiceDataBuilder vfModuleServiceDataBuilder) {
- // default to config
- getVfModuleServiceData(siid, vfModuleServiceDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
- //1610 vf-module
- private void getVfModuleServiceData(String siid, VfModuleServiceDataBuilder vfModuleServiceDataBuilder,
- LogicalDatastoreType type) {
- // See if any data exists yet for this siid, if so grab it.
- InstanceIdentifier<VfModuleList> vfModuleIdentifier = InstanceIdentifier
- .builder(VfModules.class)
- .child(VfModuleList.class, new VfModuleListKey(siid))
- .build();
-
- Optional<VfModuleList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, vfModuleIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + siid + "] ", e);
- }
-
- if (data.isPresent()) {
- VfModuleServiceData vfModuleServiceData = data.get().getVfModuleServiceData();
- if (vfModuleServiceData != null) {
- log.info(
- READ_MD_SAL_STR + type + DATA_FOR_STR + siid + "] VfModuleServiceData: " + vfModuleServiceData);
- vfModuleServiceDataBuilder.setSdncRequestHeader(vfModuleServiceData.getSdncRequestHeader());
- vfModuleServiceDataBuilder.setRequestInformation(vfModuleServiceData.getRequestInformation());
- vfModuleServiceDataBuilder.setServiceInformation(vfModuleServiceData.getServiceInformation());
- vfModuleServiceDataBuilder
- .setVfModuleRequestInformation(vfModuleServiceData.getVfModuleRequestInformation());
- vfModuleServiceDataBuilder.setVfModuleId(vfModuleServiceData.getVfModuleId());
- vfModuleServiceDataBuilder
- .setVfModuleTopologyInformation(vfModuleServiceData.getVfModuleTopologyInformation());
- vfModuleServiceDataBuilder.setOperStatus(vfModuleServiceData.getOperStatus());
- } else {
- log.info("No vf-module-service-data found in MD-SAL (" + type + FOR_STR + siid + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + siid + "] ");
- }
- }
-
-
- private void getPreloadData(String vnfName, String vnfType, PreloadDataBuilder preloadDataBuilder) {
- // default to config
- getPreloadData(vnfName, vnfType, preloadDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
- private void getPreloadData(String preloadName, String preloadType, PreloadDataBuilder preloadDataBuilder,
- LogicalDatastoreType type) {
- // See if any data exists yet for this name/type, if so grab it.
- InstanceIdentifier<VnfPreloadList> preloadInstanceIdentifier = InstanceIdentifier
- .builder(PreloadVnfs.class)
- .child(VnfPreloadList.class, new VnfPreloadListKey(preloadName, preloadType))
- .build();
-
- Optional<VnfPreloadList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, preloadInstanceIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + preloadName + "," + preloadType + "] ", e);
- }
-
- if (data.isPresent()) {
- PreloadData preloadData = (PreloadData) data.get().getPreloadData();
- if (preloadData != null) {
- log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + preloadName + "," + preloadType + PRELOAD_DATA
- + preloadData);
- preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation());
- preloadDataBuilder.setNetworkTopologyInformation(preloadData.getNetworkTopologyInformation());
- preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
- } else {
- log.info(
- "No preload-data found in MD-SAL (" + type + FOR_STR + preloadName + "," + preloadType + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + preloadName + "," + preloadType + "] ");
- }
- }
-
- //1610 preload-vnf-instance
- private void getVnfInstancePreloadData(String vnfName, String vnfType,
- VnfInstancePreloadDataBuilder preloadDataBuilder) {
- // default to config
- getVnfInstancePreloadData(vnfName, vnfType, preloadDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
- //1610 preload-vnf-instance
- private void getVnfInstancePreloadData(String preloadName, String preloadType,
- VnfInstancePreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type) {
- // See if any data exists yet for this name/type, if so grab it.
- InstanceIdentifier<VnfInstancePreloadList> preloadInstanceIdentifier = InstanceIdentifier
- .builder(PreloadVnfInstances.class)
- .child(VnfInstancePreloadList.class, new VnfInstancePreloadListKey(preloadName, preloadType))
- .build();
-
- Optional<VnfInstancePreloadList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, preloadInstanceIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + preloadName + "," + preloadType + "] ", e);
- }
-
- if (data.isPresent()) {
- VnfInstancePreloadData preloadData = (VnfInstancePreloadData) data.get().getVnfInstancePreloadData();
- if (preloadData != null) {
- log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + preloadName + "," + preloadType
- + "] VnfInstancePreloadData: " + preloadData);
- preloadDataBuilder.setVnfInstanceTopologyInformation(preloadData.getVnfInstanceTopologyInformation());
- preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
- } else {
- log.info("No vnf-instance-preload-data found in MD-SAL (" + type + FOR_STR + preloadName + ","
- + preloadType + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + preloadName + "," + preloadType + "] ");
- }
- }
-
- // 1610 preload-vf-module
- private void getVfModulePreloadData(String vnfName, String vnfType,
- VfModulePreloadDataBuilder preloadDataBuilder) {
- // default to config
- getVfModulePreloadData(vnfName, vnfType, preloadDataBuilder, LogicalDatastoreType.CONFIGURATION);
- }
-
- private void getVfModulePreloadData(String preloadName, String preloadType,
- VfModulePreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type) {
- // See if any data exists yet for this name/type, if so grab it.
- InstanceIdentifier<VfModulePreloadList> preloadInstanceIdentifier = InstanceIdentifier
- .builder(PreloadVfModules.class)
- .child(VfModulePreloadList.class, new VfModulePreloadListKey(preloadName, preloadType))
- .build();
-
- Optional<VfModulePreloadList> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, preloadInstanceIdentifier).get();
- } catch (final InterruptedException | ExecutionException e) {
- log.error(EXCEPTION_READING_MD_SAL_STR + type + FOR_STR + preloadName + "," + preloadType + "] ", e);
- }
-
- if (data.isPresent()) {
- VfModulePreloadData preloadData = (VfModulePreloadData) data.get().getVfModulePreloadData();
- if (preloadData != null) {
- log.info(READ_MD_SAL_STR + type + DATA_FOR_STR + preloadName + "," + preloadType
- + "] VfModulePreloadData: " + preloadData);
- preloadDataBuilder.setVfModuleTopologyInformation(preloadData.getVfModuleTopologyInformation());
- preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
- } else {
- log.info(
- "No preload-data found in MD-SAL (" + type + FOR_STR + preloadName + "," + preloadType + "] ");
- }
- } else {
- log.info(NO_DATA_FOUND_STR + type + FOR_STR + preloadName + "," + preloadType + "] ");
- }
- }
-
- private void deleteVnfList(final VnfList entry, LogicalDatastoreType storeType) {
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VnfList> path = InstanceIdentifier
- .builder(Vnfs.class)
- .child(VnfList.class, entry.key())
- .build();
-
- int optimisticLockTries = 2;
- boolean tryAgain = true;
- while (tryAgain) {
- tryAgain = false;
- try {
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- tx.delete(storeType, path);
- tx.submit().checkedGet();
- log.debug("DataStore delete succeeded");
- } catch (OptimisticLockFailedException e) {
- if (--optimisticLockTries <= 0) {
- log.debug("Got OptimisticLockFailedException on last try - failing ");
- throw new IllegalStateException(e);
- }
- log.debug("Got OptimisticLockFailedException - trying again ");
- tryAgain = true;
-
- } catch (final TransactionCommitFailedException e) {
- Throwable eCause = e.getCause();
-
- if (eCause instanceof org.opendaylight.mdsal.common.api.TransactionCommitFailedException) {
- log.debug("Nested TransactionCommitFailed exception - getting next cause");
- eCause = eCause.getCause();
- } else {
- log.debug("Got TransactionCommitFailedException, caused by {}", eCause.getClass().getName());
- }
-
- if (eCause instanceof ModifiedNodeDoesNotExistException) {
- log.debug("Ignoring ModifiedNodeDoesNotExistException");
- break;
- }
-
- log.debug("Delete DataStore failed due to exception", eCause);
- throw new IllegalStateException(e);
- }
- }
- }
-
- private void saveVnfList(final VnfList entry, boolean merge, LogicalDatastoreType storeType) {
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VnfList> path = InstanceIdentifier
- .builder(Vnfs.class)
- .child(VnfList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- //1610 vnf-instance
- private void saveVnfInstanceList(final VnfInstanceList entry, boolean merge, LogicalDatastoreType storeType) {
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VnfInstanceList> path = InstanceIdentifier
- .builder(VnfInstances.class)
- .child(VnfInstanceList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- //1610 vf-module
- private void saveVfModuleList(final VfModuleList entry, boolean merge, LogicalDatastoreType storeType) {
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VfModuleList> path = InstanceIdentifier
- .builder(VfModules.class)
- .child(VfModuleList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- private void savePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) {
-
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VnfPreloadList> path = InstanceIdentifier
- .builder(PreloadVnfs.class)
- .child(VnfPreloadList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- //1610 preload vnf-instance
- private void saveVnfInstancePreloadList(final VnfInstancePreloadList entry, boolean merge,
- LogicalDatastoreType storeType) {
-
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VnfInstancePreloadList> path = InstanceIdentifier
- .builder(PreloadVnfInstances.class)
- .child(VnfInstancePreloadList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- //1610 preload vf-module
- private void saveVfModulePreloadList(final VfModulePreloadList entry, boolean merge,
- LogicalDatastoreType storeType) {
-
- // Each entry will be identifiable by a unique key, we have to create that identifier
- InstanceIdentifier<VfModulePreloadList> path = InstanceIdentifier
- .builder(PreloadVfModules.class)
- .child(VfModulePreloadList.class, entry.key())
- .build();
-
- tryUpdateDataStore(entry, merge, storeType, path);
- }
-
- private <T extends DataObject> void tryUpdateDataStore(T entry, boolean merge, LogicalDatastoreType storeType,
- InstanceIdentifier<T> path) {
-
- int tries = 2;
- while (true) {
- try {
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- if (merge) {
- tx.merge(storeType, path, entry);
- } else {
- tx.put(storeType, path, entry);
- }
- tx.submit().checkedGet();
- log.debug("Update DataStore succeeded");
- break;
- } catch (OptimisticLockFailedException e) {
- if (--tries <= 0) {
- log.debug("Got OptimisticLockFailedException on last try - failing ");
- throw new IllegalStateException(e);
- }
- log.debug("Got OptimisticLockFailedException - trying again ");
- } catch (final TransactionCommitFailedException e) {
- log.debug("Update DataStore failed");
- throw new IllegalStateException(e);
- }
- }
- }
-
- //Save the requestId into MDC
- private void setRequestIdAsMDC(String requestId) {
- MDC.put("RequestId", requestId);
- }
-
- //1610 vnf-instance-topology-operation
-
- private Boolean validateVnfInstanceTopologyOperationInput(VnfInstanceTopologyOperationInput input) {
- return input != null
- && input.getVnfInstanceRequestInformation() != null
- && input.getVnfInstanceRequestInformation().getVnfInstanceId() != null
- && input.getVnfInstanceRequestInformation().getVnfInstanceId().length() != 0;
- }
-
- private ListenableFuture<RpcResult<VnfInstanceTopologyOperationOutput>> buildVnfInstanceTopologyOperationOutputWithtError(
- String responseCode, String responseMessage, String ackFinalIndicator) {
- VnfInstanceTopologyOperationOutputBuilder responseBuilder = new VnfInstanceTopologyOperationOutputBuilder();
- responseBuilder.setResponseCode(responseCode);
- responseBuilder.setResponseMessage(responseMessage);
- responseBuilder.setAckFinalIndicator(ackFinalIndicator);
- return Futures.immediateFuture(RpcResultBuilder
- .<VnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build());
- }
-
- @Override
- public ListenableFuture<RpcResult<VnfInstanceTopologyOperationOutput>> vnfInstanceTopologyOperation(
- VnfInstanceTopologyOperationInput input) {
-
- final String svcOperation = "vnf-instance-topology-operation";
- VnfInstanceServiceData vnfInstanceServiceData;
- ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- VnfInstanceTopologyOperationOutputBuilder responseBuilder = new VnfInstanceTopologyOperationOutputBuilder();
-
- if (!validateVnfInstanceTopologyOperationInput(input)) {
- log.debug(EXITING_STR + svcOperation + " because of " + INVALID_INPUT_VNF_INSTANCE_STR);
- return buildVnfInstanceTopologyOperationOutputWithtError("403",
- INVALID_INPUT_VNF_INSTANCE_STR,
- "Y");
- }
-
- // Grab the service instance ID from the input buffer
- String viid = input.getVnfInstanceRequestInformation().getVnfInstanceId();
- String preloadName = input.getVnfInstanceRequestInformation().getVnfInstanceName();
- String preloadType = input.getVnfInstanceRequestInformation().getVnfModelId();
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- // Get vnf-instance-preload-data
- VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
- getVnfInstancePreloadData(preloadName, preloadType, vnfInstancePreloadDataBuilder);
-
- // Get service-data
- VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder = new VnfInstanceServiceDataBuilder();
- getVnfInstanceServiceData(viid, vnfInstanceServiceDataBuilder);
-
- // Get operational-data
- VnfInstanceServiceDataBuilder operDataBuilder = new VnfInstanceServiceDataBuilder();
- getVnfInstanceServiceData(viid, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- // Set the serviceStatus based on input
- setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
- setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
-
- //
- // setup a service-data object builder
- // ACTION vnf-topology-operationa
- // INPUT:
- // USES sdnc-request-header;
- // USES request-information;
- // USES service-information;
- // USES vnf-request-information
- // OUTPUT:
- // USES vnf-topology-response-body;
- // USES vnf-information
- // USES service-information
- //
- // container service-data
- // uses vnf-configuration-information;
- // uses oper-status;
-
- log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + viid + INPUT_STR + input);
- VnfInstanceTopologyOperationInputBuilder inputBuilder = new VnfInstanceTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
-
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + viid + OPERATIONAL_DATA_STR + operDataBuilder
- .build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- log.info(
- ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preload-data: "
- + vnfInstancePreloadDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "vnf-instance-preload-data", vnfInstancePreloadDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient
- .execute(VNF_API, svcOperation, null, "sync", vnfInstanceServiceDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- setServiceStatus(serviceStatusBuilder, errorCode, errorMessage, ackFinal);
- serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
- serviceStatusBuilder.setRpcName(RpcName.VnfInstanceTopologyOperation);
-
- if (errorCode != null && errorCode.length() != 0 && !(errorCode.equals("0") || errorCode.equals("200"))) {
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
- VnfInstanceListBuilder vnfInstanceListBuilder = new VnfInstanceListBuilder();
- vnfInstanceListBuilder.setVnfInstanceId(viid);
- vnfInstanceListBuilder.setServiceStatus(serviceStatusBuilder.build());
- try {
- saveVnfInstanceList(vnfInstanceListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + viid + "] \n", e);
- }
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
- RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- vnfInstanceServiceData = vnfInstanceServiceDataBuilder.build();
- log.info(UPDATING_MD_SAL_STR + svcOperation + " [" + viid + "] VnfInstanceServiceData: "
- + vnfInstanceServiceData);
- // svc-configuration-list
- VnfInstanceListBuilder vnfInstanceListBuilder = new VnfInstanceListBuilder();
- vnfInstanceListBuilder.setVnfInstanceServiceData(vnfInstanceServiceData);
- vnfInstanceListBuilder.setVnfInstanceId(vnfInstanceServiceData.getVnfInstanceId());
- vnfInstanceListBuilder.setServiceStatus(serviceStatusBuilder.build());
- saveVnfInstanceList(vnfInstanceListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) {
- // Only update operational tree on Delete or Activate
- if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || input.getSdncRequestHeader()
- .getSvcAction().equals(SvcAction.Activate)) {
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- saveVnfInstanceList(vnfInstanceListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- }
- }
- VnfInstanceInformationBuilder vnfInstanceInformationBuilder = new VnfInstanceInformationBuilder();
- vnfInstanceInformationBuilder.setVnfInstanceId(viid);
- responseBuilder.setVnfInstanceInformation(vnfInstanceInformationBuilder.build());
- responseBuilder.setServiceInformation(vnfInstanceServiceData.getServiceInformation());
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + viid + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
- RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + viid + "] ");
- log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + viid + "] " + responseBuilder.build());
-
- RpcResult<VnfInstanceTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return success
- return Futures.immediateFuture(rpcResult);
- }
-
- //1610 vf-module-topology-operation
- @Override
- public ListenableFuture<RpcResult<VfModuleTopologyOperationOutput>> vfModuleTopologyOperation(
- VfModuleTopologyOperationInput input) {
-
- final String svcOperation = "vf-module-topology-operation";
- VfModuleServiceData vfModuleServiceData;
- ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder();
-
- // Validate vf-module-id from vf-module-request-information
- if (input == null || input.getVfModuleRequestInformation() == null
- || input.getVfModuleRequestInformation().getVfModuleId() == null) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty vf-module-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_VF_MODULE_STR);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the vf-module-request-information.vf-module-id from the input buffer
- String vfid = input.getVfModuleRequestInformation().getVfModuleId();
- String preloadName = input.getVfModuleRequestInformation().getVfModuleName();
- String preloadType = input.getVfModuleRequestInformation().getVfModuleModelId();
-
- // Make sure we have a valid siid
- if (vfid == null || vfid.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid vf-module-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_VF_MODULE_STR);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // 1610 add vf-module-id to vnf-instance-list.vf-module-relationship-list
- String viid = input.getVfModuleRequestInformation().getVnfInstanceId();
-
- if (viid == null || viid.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid vnf-instance-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_VNF_INSTANCE_STR);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder
- .<VfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- // Get vf-module-preload-data
- VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder();
- getVfModulePreloadData(preloadName, preloadType, vfModulePreloadDataBuilder);
-
- // Get vf-module-service-data
- VfModuleServiceDataBuilder vfModuleServiceDataBuilder = new VfModuleServiceDataBuilder();
- getVfModuleServiceData(vfid, vfModuleServiceDataBuilder);
-
- // Get vf-module operation-data
- VfModuleServiceDataBuilder operDataBuilder = new VfModuleServiceDataBuilder();
- getVfModuleServiceData(vfid, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- // 1610 Need to pull vnf-instance-list.vf-module-relationship-list from MD-SAL
- VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder = new VnfInstanceServiceDataBuilder();
- getVnfInstanceServiceData(viid, vnfInstanceServiceDataBuilder);
-
- // vnf-instance operational-data
- VnfInstanceServiceDataBuilder vnfInstanceOperDataBuilder = new VnfInstanceServiceDataBuilder();
- getVnfInstanceServiceData(viid, vnfInstanceOperDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- // Set the serviceStatus based on input
- setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
- setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
-
- //
- // setup a service-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // USES request-information;
- // USES service-information;
- // USES vnf-request-information
- // OUTPUT:
- // USES vnf-information
- // USES service-information
- //
- // container service-data
-
- log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + vfid + INPUT_STR + input);
- VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
-
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + vfid + "] vf-module operational-data: "
- + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- log.info(ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] vf-module-preload-data: " + vfModulePreloadDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "vf-module-preload-data", vfModulePreloadDataBuilder);
-
- log.info("Adding vnf-instance CONFIG data for " + svcOperation + " [" + viid + "] vnf-instance-service-data: "
- + vnfInstanceServiceDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "vnf-instance-service-data", vnfInstanceServiceDataBuilder);
-
- log.info("Adding vnf-instance OPERATIONAL data for " + svcOperation + " [" + viid
- + "] vnf-instance operational-data: " + vnfInstanceOperDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "vnf-instance-operational-data", vnfInstanceOperDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
-
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient
- .execute(VNF_API, svcOperation, null, "sync", vfModuleServiceDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- setServiceStatus(serviceStatusBuilder, errorCode, errorMessage, ackFinal);
- serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
- serviceStatusBuilder.setRpcName(RpcName.VfModuleTopologyOperation);
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
- VfModuleListBuilder vfModuleListBuilder = new VfModuleListBuilder();
- vfModuleListBuilder.setVfModuleId(vfid);
- vfModuleListBuilder.setServiceStatus(serviceStatusBuilder.build());
- try {
- saveVfModuleList(vfModuleListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + vfid + "] \n", e);
- }
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
- RpcResult<VfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- // save vf-module-service-data in MD-SAL
- try {
- vfModuleServiceData = vfModuleServiceDataBuilder.build();
- log.info(
- UPDATING_MD_SAL_STR + svcOperation + " [" + vfid + "] VfModuleServiceData: " + vfModuleServiceData);
- // vf-module-list
- VfModuleListBuilder vfModuleListBuilder = new VfModuleListBuilder();
- vfModuleListBuilder.setVfModuleServiceData(vfModuleServiceData);
- vfModuleListBuilder.setVfModuleId(vfModuleServiceData.getVfModuleId());
- vfModuleListBuilder.setServiceStatus(serviceStatusBuilder.build());
- saveVfModuleList(vfModuleListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) {
- // Only update operational tree on Delete or Activate
- if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || input.getSdncRequestHeader()
- .getSvcAction().equals(SvcAction.Activate)) {
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- saveVfModuleList(vfModuleListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- }
- }
- VfModuleInformationBuilder vfModuleInformationBuilder = new VfModuleInformationBuilder();
- vfModuleInformationBuilder.setVfModuleId(vfid);
- responseBuilder.setVfModuleInformation(vfModuleInformationBuilder.build());
- responseBuilder.setServiceInformation(vfModuleServiceData.getServiceInformation());
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + vfid + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
- RpcResult<VfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info("Updated vf-module in MD-SAL for " + svcOperation + " [" + vfid + "] ");
- log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + vfid + "] " + responseBuilder.build());
-
- RpcResult<VfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return success
- return Futures.immediateFuture(rpcResult);
- }
-
- @Override
- public ListenableFuture<RpcResult<VnfTopologyOperationOutput>> vnfTopologyOperation(
- VnfTopologyOperationInput input) {
- final String svcOperation = "vnf-topology-operation";
- ServiceData serviceData;
- ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder();
-
- if (input == null || input.getServiceInformation() == null
- || input.getServiceInformation().getServiceInstanceId() == null
- || input.getServiceInformation().getServiceInstanceId().length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty service-instance-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_NULL_OR_EMPTY_SERVICE_INSTANCE_ID);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<VnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getVnfRequestInformation() == null || input.getVnfRequestInformation().getVnfId() == null
- || input.getVnfRequestInformation().getVnfId().length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty vf-module-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, null or empty vf-module-id");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<VnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the service instance ID from the input buffer
- String siid = input.getVnfRequestInformation().getVnfId();
- String preloadName = input.getVnfRequestInformation().getVnfName();
- String preloadType = input.getVnfRequestInformation().getVnfType();
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, preloadDataBuilder);
-
- ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
- getServiceData(siid, serviceDataBuilder);
-
- ServiceDataBuilder operDataBuilder = new ServiceDataBuilder();
- getServiceData(siid, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- // Set the serviceStatus based on input
- setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
- setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
-
- //
- // setup a service-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // USES request-information;
- // USES vnf-request-information
- // OUTPUT:
- // USES vnf-information
- // USES service-information
- //
- // container service-data
- // uses oper-status;
-
- log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + siid + INPUT_STR + input);
- VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
-
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + siid + OPERATIONAL_DATA_STR + operDataBuilder
- .build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- log.info(
- "Adding CONFIG data for " + svcOperation + " [" + preloadName + "," + preloadType + "] preload-data: "
- + preloadDataBuilder.build());
- VnfSdnUtil.toProperties(parms, "preload-data", preloadDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient.execute(VNF_API, svcOperation, null, "sync", serviceDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + siid, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- setServiceStatus(serviceStatusBuilder, errorCode, errorMessage, ackFinal);
- serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
- serviceStatusBuilder.setRpcName(RpcName.VnfTopologyOperation);
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
- VnfListBuilder vnfListBuilder = new VnfListBuilder();
- vnfListBuilder.setVnfId(siid);
- vnfListBuilder.setServiceStatus(serviceStatusBuilder.build());
- try {
- saveVnfList(vnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + siid + "] \n", e);
- }
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
- RpcResult<VnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- serviceData = serviceDataBuilder.build();
- log.info(UPDATING_MD_SAL_STR + svcOperation + " [" + siid + "] ServiceData: " + serviceData);
- // svc-configuration-list
- VnfListBuilder vnfListBuilder = new VnfListBuilder();
- vnfListBuilder.setServiceData(serviceData);
- vnfListBuilder.setVnfId(serviceData.getVnfId());
- siid = serviceData.getVnfId();
- vnfListBuilder.setServiceStatus(serviceStatusBuilder.build());
- saveVnfList(vnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) {
- // Only update operational tree on Delete or Activate
- if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) {
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- saveVnfList(vnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- } else if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || input
- .getSdncRequestHeader().getSvcAction().equals(SvcAction.Rollback)) {
- log.info("Delete OPERATIONAL tree.");
- deleteVnfList(vnfListBuilder.build(), LogicalDatastoreType.CONFIGURATION);
- deleteVnfList(vnfListBuilder.build(), LogicalDatastoreType.OPERATIONAL);
- }
- }
- VnfInformationBuilder vnfInformationBuilder = new VnfInformationBuilder();
- vnfInformationBuilder.setVnfId(siid);
- responseBuilder.setVnfInformation(vnfInformationBuilder.build());
- responseBuilder.setServiceInformation(serviceData.getServiceInformation());
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + siid + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
- RpcResult<VnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + siid + "] ");
- log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
-
- RpcResult<VnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<VnfTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return success
- return Futures.immediateFuture(rpcResult);
- }
-
- @Override
- public ListenableFuture<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation(
- NetworkTopologyOperationInput input) {
-
- final String svcOperation = "network-topology-operation";
- ServiceData serviceData;
- ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder();
-
- if (input == null || input.getServiceInformation() == null
- || input.getServiceInformation().getServiceInstanceId() == null
- || input.getServiceInformation().getServiceInstanceId().length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty service-instance-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_NULL_OR_EMPTY_SERVICE_INSTANCE_ID);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<NetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getNetworkRequestInformation() == null
- || input.getNetworkRequestInformation().getNetworkName() == null) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty service-instance-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_NULL_OR_EMPTY_SERVICE_INSTANCE_ID);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<NetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the service instance ID from the input buffer
- String siid;
- if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Assign)) {
- siid = input.getNetworkRequestInformation().getNetworkName();
- } else {
- siid = input.getNetworkRequestInformation().getNetworkId();
- }
- String preloadName = input.getNetworkRequestInformation().getNetworkName();
- String preloadType = input.getNetworkRequestInformation().getNetworkType();
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, preloadDataBuilder);
-
- log.info(ADDING_INPUT_DATA_STR + svcOperation + " [" + siid + INPUT_STR + input);
- NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
- String networkId = "error";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- networkId = respProps.getProperty("networkId", "0");
- }
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
-
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
-
- RpcResult<NetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- NetworkInformationBuilder networkInformationBuilder = new NetworkInformationBuilder();
- networkInformationBuilder.setNetworkId(networkId);
- responseBuilder.setNetworkInformation(networkInformationBuilder.build());
- responseBuilder.setServiceInformation(input.getServiceInformation());
- } catch (IllegalStateException e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + siid + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
- RpcResult<NetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- // return error
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + siid + "] ");
- log.info(RETURNED_SUCCESS_STR + svcOperation + " [" + siid + "] " + responseBuilder.build());
-
- RpcResult<NetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<NetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
- // return success
- return Futures.immediateFuture(rpcResult);
- }
-
- @Override
- public ListenableFuture<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
- PreloadVnfTopologyOperationInput input) {
-
- final String svcOperation = "preload-vnf-topology-operation";
- PreloadData preloadData;
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder();
-
- // Result from savePreloadData
-
- if (input == null || input.getVnfTopologyInformation() == null
- || input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null
- || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName() == null
- || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType() == null) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or empty vnf-name or vnf-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, null or empty vnf-name or vnf-type");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the name and type from the input buffer
- String preloadName = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName();
- String preloadType = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType();
-
- // Make sure we have a preload_name and preload_type
- if (preloadName == null || preloadName.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_INVALID_PRELOAD_TYPE);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (preloadType == null || preloadType.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage(INVALID_INPUT_INVALID_PRELOAD_TYPE);
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, preloadDataBuilder);
- PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- //
- // setup a preload-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // USES request-information;
- // uses vnf-topology-information;
- // OUTPUT:
- //
- // container preload-data
- log.info(
- ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
- PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
- + OPERATIONAL_DATA_STR + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
-
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
-
- VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
- preloadVnfListBuilder.setVnfName(preloadName);
- preloadVnfListBuilder.setVnfType(preloadType);
- preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
- log.error(
- RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
- + errorCode + "', Reason: '" + errorMessage + "'");
- try {
- savePreloadList(preloadVnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(
- CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- }
- log.debug(SENDING_SUCCESS_RPC);
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- preloadData = preloadDataBuilder.build();
- log.info(
- UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
- + preloadData);
- // svc-configuration-list
- VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
- preloadVnfListBuilder.setVnfName(preloadName);
- preloadVnfListBuilder.setVnfType(preloadType);
- preloadVnfListBuilder.setPreloadData(preloadData);
-
- // SDNGC-989 set merge flag to false
- savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
- + responseBuilder.build());
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(false).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
- log.info(
- RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
- .build());
-
- RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- //1610 preload-vnf-instance-topology-operation
- @Override
- public ListenableFuture<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> preloadVnfInstanceTopologyOperation(
- PreloadVnfInstanceTopologyOperationInput input) {
-
- final String svcOperation = "preload-vnf-instance-topology-operation";
- VnfInstancePreloadData vnfInstancePreloadData;
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- PreloadVnfInstanceTopologyOperationOutputBuilder responseBuilder =
- new PreloadVnfInstanceTopologyOperationOutputBuilder();
-
- if (input == null || input.getVnfInstanceTopologyInformation() == null
- || input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName() == null
- || input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId() == null) {
- log.debug(EXITING_STR + svcOperation
- + " because of invalid input, null or empty vnf-instance-name or vnf-model-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-name or vnf-model-id");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the name and type from the input buffer
- String preloadName =
- input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName();
- String preloadType = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId();
-
- // Make sure we have a preloadName and preloadType
- if (preloadName == null || preloadName.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, invalid preload-name");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (preloadType == null || preloadType.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, invalid preload-type");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
- getVnfInstancePreloadData(preloadName, preloadType, vnfInstancePreloadDataBuilder);
- VnfInstancePreloadDataBuilder operDataBuilder = new VnfInstancePreloadDataBuilder();
- getVnfInstancePreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- //
- // setup a preload-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // uses vnf-topology-information;
- // OUTPUT:
- // container preload-data
- log.info(
- ADDING_CONFIG_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
- PreloadVnfInstanceTopologyOperationInputBuilder inputBuilder =
- new PreloadVnfInstanceTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
- + OPERATIONAL_DATA_STR + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient
- .execute(VNF_API, svcOperation, null, "sync", vnfInstancePreloadDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
-
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
-
- VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder();
- vnfInstancePreloadListBuilder.setVnfInstanceName(preloadName);
- vnfInstancePreloadListBuilder.setVnfModelId(preloadType);
- vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadDataBuilder.build());
- log.error(
- RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
- + errorCode + "', Reason: '" + errorMessage + "'");
- try {
- saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), true,
- LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(
- CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- }
- log.debug(SENDING_SUCCESS_RPC);
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- vnfInstancePreloadData = vnfInstancePreloadDataBuilder.build();
- log.info(
- UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
- + vnfInstancePreloadData);
- // svc-configuration-list
- VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder();
- vnfInstancePreloadListBuilder.setVnfInstanceName(preloadName);
- vnfInstancePreloadListBuilder.setVnfModelId(preloadType);
- vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadData);
-
- // SDNGC-989 set merge flag to false
- saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), false,
- LogicalDatastoreType.CONFIGURATION);
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- saveVnfInstancePreloadList(vnfInstancePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
- + responseBuilder.build());
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(false)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
- log.info(
- RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
- .build());
-
- RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
-
- //1610 preload-vf-module-topology-operation
- @Override
- public ListenableFuture<RpcResult<PreloadVfModuleTopologyOperationOutput>> preloadVfModuleTopologyOperation(
- PreloadVfModuleTopologyOperationInput input) {
-
- final String svcOperation = "preload-vf-module-topology-operation";
- VfModulePreloadData vfModulePreloadData;
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- PreloadVfModuleTopologyOperationOutputBuilder responseBuilder =
- new PreloadVfModuleTopologyOperationOutputBuilder();
-
- // Result from savePreloadData
-
- if (input == null || input.getVfModuleTopologyInformation() == null
- || input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName() == null
- || input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId() == null) {
- log.debug(EXITING_STR + svcOperation
- + " because of invalid input, null or empty vf-module-name or vf-module-model-id");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, null or empty vf-module-name or vf-module-model-id");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the name and type from the input buffer
- String preloadName = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName();
- String preloadType = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId();
-
- // Make sure we have a preloadName and preloadType
- if (preloadName == null || preloadName.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, invalid preload-name");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
- if (preloadType == null || preloadType.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("invalid input, invalid preload-type");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder();
- getVfModulePreloadData(preloadName, preloadType, vfModulePreloadDataBuilder);
- VfModulePreloadDataBuilder operDataBuilder = new VfModulePreloadDataBuilder();
- getVfModulePreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- //
- // setup a preload-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // USES request-information;
- // uses vnf-topology-information;
- // OUTPUT:
- //
- // container preload-data
-
- log.info(
- ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
- PreloadVfModuleTopologyOperationInputBuilder inputBuilder =
- new PreloadVfModuleTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
- + OPERATIONAL_DATA_STR + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient
- .execute(VNF_API, svcOperation, null, "sync", vfModulePreloadDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
-
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
-
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
-
- VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder();
- vfModulePreloadListBuilder.setVfModuleName(preloadName);
- vfModulePreloadListBuilder.setVfModuleModelId(preloadType);
- vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadDataBuilder.build());
- log.error(
- RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
- + errorCode + "', Reason: '" + errorMessage + "'");
- try {
- saveVfModulePreloadList(vfModulePreloadListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(
- CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- }
- log.debug(SENDING_SUCCESS_RPC);
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(true)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- vfModulePreloadData = vfModulePreloadDataBuilder.build();
- log.info(
- UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
- + vfModulePreloadData);
- // svc-configuration-list
- VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder();
- vfModulePreloadListBuilder.setVfModuleName(preloadName);
- vfModulePreloadListBuilder.setVfModuleModelId(preloadType);
- vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadData);
-
- // SDNGC-989 set merge flag to false
- saveVfModulePreloadList(vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- saveVfModulePreloadList(vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
- + responseBuilder.build());
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(false)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
- log.info(
- RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
- .build());
-
- RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
-
- @Override
- public ListenableFuture<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation(
- PreloadNetworkTopologyOperationInput input) {
-
- final String svcOperation = "preload-network-topology-operation";
- PreloadData preloadData = null;
- Properties parms = new Properties();
-
- log.info(svcOperation + CALLED_STR);
- // create a new response object
- PreloadNetworkTopologyOperationOutputBuilder responseBuilder =
- new PreloadNetworkTopologyOperationOutputBuilder();
-
- // Result from savePreloadData
-
- if (input == null || input.getNetworkTopologyInformation() == null
- || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null
- || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName() == null
- || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType() == null) {
- log.debug(EXITING_STR + svcOperation + " because of invalid input, null or" +
- " empty network-name or network-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("input, null or empty network-name or network-type");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Grab the name and type from the input buffer
- String preloadName = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName();
- String preloadType = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType();
-
- // Make sure we have a preloadName and preloadType
- if (preloadName == null || preloadName.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-name");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("input, invalid preload-name");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (preloadType == null || preloadType.length() == 0) {
- log.debug(EXITING_STR + svcOperation + " because of invalid preload-type");
- responseBuilder.setResponseCode("403");
- responseBuilder.setResponseMessage("input, invalid preload-type");
- responseBuilder.setAckFinalIndicator("Y");
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- if (input.getSdncRequestHeader() != null) {
- responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
- setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
- }
-
- PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, preloadDataBuilder);
-
- PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
- getPreloadData(preloadName, preloadType, operDataBuilder, LogicalDatastoreType.OPERATIONAL);
-
- //
- // setup a preload-data object builder
- // ACTION vnf-topology-operation
- // INPUT:
- // USES request-information;
- // uses vnf-topology-information;
- // OUTPUT:
- //
- // container preload-data
- log.info(
- ADDING_INPUT_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType + INPUT_STR + input);
- PreloadNetworkTopologyOperationInputBuilder inputBuilder =
- new PreloadNetworkTopologyOperationInputBuilder(input);
- VnfSdnUtil.toProperties(parms, inputBuilder.build());
- log.info(ADDING_OPERATIONAL_DATA_STR + svcOperation + " [" + preloadName + "," + preloadType
- + OPERATIONAL_DATA_STR + operDataBuilder.build());
- VnfSdnUtil.toProperties(parms, OPERATIONAL_DATA, operDataBuilder);
-
- // Call SLI sync method
- // Get SvcLogicService reference
- Properties respProps = null;
- String errorCode = "200";
- String errorMessage = null;
- String ackFinal = "Y";
-
- try {
- if (svcLogicClient.hasGraph(VNF_API, svcOperation, null, "sync")) {
- respProps = svcLogicClient.execute(VNF_API, svcOperation, null, "sync", preloadDataBuilder, parms);
- } else {
- errorMessage = "No service logic active for VNF-API: '" + svcOperation + "'";
- errorCode = "503";
- }
- } catch (SvcLogicException e) {
- log.error("Caught exception executing service logic for " + svcOperation, e);
- errorMessage = e.getMessage();
- errorCode = "500";
- } catch (Exception e) {
- errorCode = "500";
- errorMessage = e.getMessage();
- log.error("Caught exception looking for service logic", e);
- }
-
- if (respProps != null) {
- errorCode = respProps.getProperty("error-code");
- errorMessage = respProps.getProperty("error-message");
- ackFinal = respProps.getProperty("ack-final", "Y");
- }
-
- if (errorCode != null && errorCode.length() != 0 && !("0".equals(errorCode) || "200".equals(errorCode))) {
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setResponseMessage(errorMessage);
- responseBuilder.setAckFinalIndicator(ackFinal);
-
- VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
- preloadVnfListBuilder.setVnfName(preloadName);
- preloadVnfListBuilder.setVnfType(preloadType);
- preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
- log.error(
- RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] error code: '"
- + errorCode + "', Reason: '" + errorMessage + "'");
- try {
- savePreloadList(preloadVnfListBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
- } catch (Exception e) {
- log.error(
- CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
-
- }
- log.debug(SENDING_SUCCESS_RPC);
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Got success from SLI
- try {
- preloadData = preloadDataBuilder.build();
- log.info(
- UPDATING_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] preloadData: "
- + preloadData);
- // svc-configuration-list
- VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
- preloadVnfListBuilder.setVnfName(preloadName);
- preloadVnfListBuilder.setVnfType(preloadType);
- preloadVnfListBuilder.setPreloadData(preloadData);
-
- // SDNGC-989 set merge flag to false
- savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
- log.info(UPDATING_OPERATIONAL_TREE_STR);
- savePreloadList(preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
- } catch (Exception e) {
- log.error(CAUGHT_EXCEPTION_STR + svcOperation + " [" + preloadName + "," + preloadType
- + "] \n", e);
- responseBuilder.setResponseCode("500");
- responseBuilder.setResponseMessage(e.toString());
- responseBuilder.setAckFinalIndicator("Y");
- log.error(RETURNED_FAILED_STR + svcOperation + " [" + preloadName + "," + preloadType + "] "
- + responseBuilder.build());
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(false)
- .withResult(responseBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // Update succeeded
- responseBuilder.setResponseCode(errorCode);
- responseBuilder.setAckFinalIndicator(ackFinal);
- if (errorMessage != null) {
- responseBuilder.setResponseMessage(errorMessage);
- }
- log.info(UPDATED_MD_SAL_STR + svcOperation + " [" + preloadName + "," + preloadType + "] ");
- log.info(
- RETURNED_SUCCESS_STR + svcOperation + " [" + preloadName + "," + preloadType + "] " + responseBuilder
- .build());
-
- RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
- RpcResultBuilder.<PreloadNetworkTopologyOperationOutput>status(true).withResult(responseBuilder.build())
- .build();
- return Futures.immediateFuture(rpcResult);
- }
-
-
-}
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java
deleted file mode 100644
index 64b13bd4..00000000
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/VnfSdnUtil.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class VnfSdnUtil extends MdsalHelper {
- private static final Logger LOG = LoggerFactory.getLogger(VnfSdnUtil.class);
-
- private static File odlHomePath = null;
- private static Properties properties;
-
- public static void loadProperties() {
- if (odlHomePath == null) {
- odlHomePath = new File("/opt/opendaylight/current");
-
- if (!odlHomePath.isDirectory()) {
- odlHomePath = new File("/opt/bvc/controller");
- }
- }
-
- File propFile = new File(odlHomePath.getAbsolutePath() + "/configuration/vnfapi.properties");
- String propFileName = propFile.getAbsolutePath();
- properties = new Properties();
- if (propFile.isFile() && propFile.canRead()) {
- try (InputStream input = new FileInputStream(propFile)) {
- properties.load(input);
- LOG.info("Loaded properties from " + propFileName);
- setYangMappingProperties(properties);
- } catch (IOException e) {
- LOG.error("Failed to close properties file " + propFileName + "\n", e);
- } catch (Exception e) {
- LOG.error("Failed to load properties " + propFileName + "\n", e);
- }
- }
- }
-
- static {
- // Trick class loader into loading builders. Some of
- // these will be needed later by Reflection classes, but need
- // to explicitly "new" them here to get class loader to load them.
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder
- u1 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder
- u2 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder
- u3 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder
- u4 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder
- u5 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder
- u6 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder
- u7 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder
- u8 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder
- u9 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder
- u10 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder
- u11 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder
- u12 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder
- u13 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder
- u14 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModulesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder
- u15 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder
- u16 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder
- u17 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder
- u18 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder
- u19 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder
- u20 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder
- u21 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder
- u22 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder
- u23 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder
- u24 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder
- u25 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder
- u26 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder
- u27 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder
- u28 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder
- u29 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder
- u30 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder
- u31 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.subnets.SubnetsBuilder
- u32 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.subnets.SubnetsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder
- u33 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder
- u34 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder
- u35 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder
- u36 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder
- u37 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder
- u38 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder
- u39 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModulesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder
- u40 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder
- u41 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder
- u42 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder
- u43 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder
- u44 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder
- u45 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder
- u46 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder
- u47 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder
- u48 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder
- u49 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder
- u50 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder
- u51 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder
- u52 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder
- u53 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder
- u54 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder
- u55 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder
- u56 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder
- u57 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder
- u58 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder
- u59 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder
- u60 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder
- u61 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstancesBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder
- u62 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder
- u63 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder
- u64 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder
- u65 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder
- u66 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder
- u67 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder
- u68 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder
- u69 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder
- u70 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfsBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder
- u71 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder
- u72 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder
- u73 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder
- u74 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder();
- org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder
- u75 =
- new org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder();
- }
-}
diff --git a/vnfapi/provider/src/main/resources/OSGI-INF/blueprint/vnfapi-blueprint.xml b/vnfapi/provider/src/main/resources/OSGI-INF/blueprint/vnfapi-blueprint.xml
deleted file mode 100644
index 1afd1a65..00000000
--- a/vnfapi/provider/src/main/resources/OSGI-INF/blueprint/vnfapi-blueprint.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="svcLogicService"
- interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
-
- <bean id="client" class="org.onap.sdnc.vnfapi.VNFSDNSvcLogicServiceClient">
- <argument ref="svcLogicService" />
- </bean>
-
- <reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
-
- <reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
- odl:type="default" />
-
- <reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
-
- <bean id="provider" class="org.onap.sdnc.vnfapi.VnfApiProvider">
- <argument ref="dataBroker" />
- <argument ref="notificationService" />
- <argument ref="rpcRegistry" />
- <argument ref="client" />
- </bean>
-
- <odl:rpc-implementation ref="provider"/>
-
-</blueprint> \ No newline at end of file
diff --git a/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml b/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml
deleted file mode 100644
index 1afd1a65..00000000
--- a/vnfapi/provider/src/main/resources/org/opendaylight/blueprint/vnfapi-blueprint.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="svcLogicService"
- interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
-
- <bean id="client" class="org.onap.sdnc.vnfapi.VNFSDNSvcLogicServiceClient">
- <argument ref="svcLogicService" />
- </bean>
-
- <reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
-
- <reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
- odl:type="default" />
-
- <reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
-
- <bean id="provider" class="org.onap.sdnc.vnfapi.VnfApiProvider">
- <argument ref="dataBroker" />
- <argument ref="notificationService" />
- <argument ref="rpcRegistry" />
- <argument ref="client" />
- </bean>
-
- <odl:rpc-implementation ref="provider"/>
-
-</blueprint> \ No newline at end of file
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClientTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClientTest.java
deleted file mode 100644
index 8a8dd446..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VNFSDNSvcLogicServiceClientTest.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.internal.util.reflection.Whitebox;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
-import org.slf4j.Logger;
-
-import java.util.Properties;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
-public class VNFSDNSvcLogicServiceClientTest {
- private static final String MODE = "mode";
- private static final String MODULE = "module";
- private static final String RPC = "rpc";
- private static final String VERSION = "version";
-
- private Logger mockLog = mock(Logger.class);
- private SvcLogicService mockSvcLogic = mock(SvcLogicService.class);
-
- private VNFSDNSvcLogicServiceClient svcClient;
-
- @Before
- public void setUp() throws Exception {
- svcClient = spy(new VNFSDNSvcLogicServiceClient(mockSvcLogic));
-
- Whitebox.setInternalState(svcClient, "logger", mockLog);
- Whitebox.setInternalState(svcClient, "svcLogic", mockSvcLogic);
- }
-
- @Test
- public void testConstructorWithoutSvcLogicBundle() throws Exception {
- VNFSDNSvcLogicServiceClient client = new VNFSDNSvcLogicServiceClient(mockSvcLogic);
- Assert.assertEquals("Should have set mockSvcLogic",
- mockSvcLogic, Whitebox.getInternalState(client, "svcLogic"));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testHasGraphWithException() throws Exception {
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).hasGraph(MODULE, RPC, VERSION, MODE);
- svcClient.hasGraph(MODULE, RPC, VERSION, MODE);
- }
-
- @Test
- public void testHasGraph() throws Exception {
- Mockito.doReturn(true).when(mockSvcLogic).hasGraph(MODULE, RPC, VERSION, MODE);
- Assert.assertTrue("Should return true", svcClient.hasGraph(MODULE, RPC, VERSION, MODE));
- }
-
- // --------- Test cases for ServiceDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithServiceDataBuilderWithException() throws Exception {
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithServiceDataBuilder() throws Exception {
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(ServiceDataBuilder.class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithServiceDataBuilderWithException() throws Exception {
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithServiceDataBuilderWithExecutorReturnNull() throws Exception {
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithServiceDataBuilderWithExecutorReturnFailure() throws Exception {
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
- @Test
- public void testParamExecuteWithServiceDataBuilder() throws Exception {
- Mockito.doReturn(true).when(mockLog).isDebugEnabled();
- ServiceDataBuilder mockBuilder = mock(ServiceDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty("my", "testing");
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should still return resultProps", resultProps, properties);
- }
-
- // --------- Test cases for PreloadDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithPreloadDataBuilderWithException() throws Exception {
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithPreloadDataBuilder() throws Exception {
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(PreloadDataBuilder .class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithPreloadDataBuilderWithException() throws Exception {
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithPreloadDataBuilderWithExecutorReturnNull() throws Exception {
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithPreloadDataBuilderWithExecutorReturnFailure() throws Exception {
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
- @Test
- public void testParamExecuteWithPreloadDataBuilder() throws Exception {
- Mockito.doReturn(true).when(mockLog).isDebugEnabled();
- PreloadDataBuilder mockBuilder = mock(PreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty("my", "testing");
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should still return resultProps", resultProps, properties);
- }
-
-
- // --------- Test cases for VfModulePreloadDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithVfModulePreloadDataBuilderWithException() throws Exception {
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithVfModulePreloadDataBuilder() throws Exception {
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(VfModulePreloadDataBuilder .class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithVfModulePreloadDataBuilderWithException() throws Exception {
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithVfModulePreloadDataBuilderWithExecutorReturnNull() throws Exception {
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithVfModulePreloadDataBuilderWithExecutorReturnFailure() throws Exception {
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
- @Test
- public void testParamExecuteWithVfModulePreloadDataBuilder() throws Exception {
- Mockito.doReturn(true).when(mockLog).isDebugEnabled();
- VfModulePreloadDataBuilder mockBuilder = mock(VfModulePreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty("my", "testing");
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should still return resultProps", resultProps, properties);
- }
-
- // --------- Test cases for VfModuleServiceDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithVfModuleServiceDataBuilderWithException() throws Exception {
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithVfModuleServiceDataBuilder() throws Exception {
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(VfModuleServiceDataBuilder .class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithVfModuleServiceDataBuilderWithException() throws Exception {
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithVfModuleServiceDataBuilderWithExecutorReturnNull() throws Exception {
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithVfModuleServiceDataBuilderWithExecutorReturnFailure() throws Exception {
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
- @Test
- public void testParamExecuteWithVfModuleServiceDataBuilder() throws Exception {
- Mockito.doReturn(true).when(mockLog).isDebugEnabled();
- VfModuleServiceDataBuilder mockBuilder = mock(VfModuleServiceDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty("my", "testing");
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should still return resultProps", resultProps, properties);
- }
-
- // --------- Test cases for VnfInstancePreloadDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithVnfInstancePreloadDataBuilderWithException() throws Exception {
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithVnfInstancePreloadDataBuilder() throws Exception {
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(VnfInstancePreloadDataBuilder .class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithVnfInstancePreloadDataBuilderWithException() throws Exception {
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithVnfInstancePreloadDataBuilderWithExecutorReturnNull() throws Exception {
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithVnfInstancePreloadDataBuilderWithExecutorReturnFailure() throws Exception {
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
- @Test
- public void testParamExecuteWithVnfInstancePreloadDataBuilder() throws Exception {
- Mockito.doReturn(true).when(mockLog).isDebugEnabled();
- VnfInstancePreloadDataBuilder mockBuilder = mock(VnfInstancePreloadDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty("my", "testing");
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should still return resultProps", resultProps, properties);
- }
-
- // --------- Test cases for VnfInstanceServiceDataBuilder serviceData-----------------
- @Test (expected = SvcLogicException.class)
- public void testExecuteWithVnfInstanceServiceDataBuilderWithException() throws Exception {
- VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- }
-
- @Test
- public void testExecuteWithVnfInstanceServiceDataBuilder() throws Exception {
- VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder);
- Mockito.verify(svcClient, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class),
- any(VnfInstanceServiceDataBuilder .class), any(Properties.class));
- }
-
- @Test (expected = SvcLogicException.class)
- public void testParamExecuteWithVnfInstanceServiceDataBuilderWithException() throws Exception {
- VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
- Mockito.doThrow(new SvcLogicException()).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
-
- svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- }
-
- @Test
- public void testParamExecuteWithVnfInstanceServiceDataBuilderWithExecutorReturnNull() throws Exception {
- VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertTrue("Should return null", properties == null);
- Mockito.verify(mockSvcLogic, times(1)).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- }
-
- @Test
- public void testParamExecuteWithVnfInstanceServiceDataBuilderWithExecutorReturnFailure() throws Exception {
- VnfInstanceServiceDataBuilder mockBuilder = mock(VnfInstanceServiceDataBuilder.class);
- Properties resultProps = new Properties();
- resultProps.setProperty(VNFSDNSvcLogicServiceClient.SVC_LOGIC_STATUS_KEY,
- VNFSDNSvcLogicServiceClient.FAILURE_RESULT);
- Mockito.doReturn(resultProps).when(mockSvcLogic).execute(
- any(String.class), any(String.class), any(String.class), any(String.class), any(Properties.class));
- Properties properties = svcClient.execute(MODULE, RPC, VERSION, MODE, mockBuilder, new Properties());
- Assert.assertEquals("Should return resultProps", resultProps, properties);
- }
-
-} \ No newline at end of file
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VfModuleTopologyOperationTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VfModuleTopologyOperationTest.java
deleted file mode 100644
index beefb2ff..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VfModuleTopologyOperationTest.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import com.google.common.util.concurrent.CheckedFuture;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.Mockito;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
-import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTestCustomizer;
-import org.opendaylight.controller.md.sal.binding.test.ConcurrentDataBrokerTestCustomizer;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation.RequestAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder;
-
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-
-class VfModuleExceptionThrowerConfigurator {
- private boolean shouldThrowExceptionDuringTransactionPut;
-
- public VfModuleExceptionThrowerConfigurator() {
- this.shouldThrowExceptionDuringTransactionPut = true;
- }
-
- public boolean shouldThrowExceptionDuringTransactionPut() {
- return shouldThrowExceptionDuringTransactionPut;
- }
-
- public void setShouldThrowExceptionDuringTransactionPut(boolean shouldThrowExceptionDuringTransactionPut) {
- this.shouldThrowExceptionDuringTransactionPut = shouldThrowExceptionDuringTransactionPut;
- }
-}
-
-class VfModuleDataBrokerErrorMsgConfigurator {
- static public String JAVA_LANG_RUNTIME_EXCEPTION = "java.lang.RuntimeException: ";
- static public String TRANSACTION_WRITE_ERROR = "transaction-write-error";
-}
-
-class VfModuleDataBrokerStab extends BindingDOMDataBrokerAdapter {
- VfModuleExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- public VfModuleDataBrokerStab(final DOMDataBroker domDataBroker,
- final BindingToNormalizedNodeCodec codec, VfModuleExceptionThrowerConfigurator exceptionThrowerConfigurator) {
- super(domDataBroker, codec);
- this.exceptionThrowerConfigurator = exceptionThrowerConfigurator;
-
- }
-
- @Override
- public WriteTransaction newWriteOnlyTransaction() {
- if (exceptionThrowerConfigurator.shouldThrowExceptionDuringTransactionPut()) {
- return newThrowingExceptionWriteOnlyTransaction();
- }
- return newNotThrowingExceptionWriteOnlyTransaction();
- }
-
- private WriteTransaction newThrowingExceptionWriteOnlyTransaction() {
- WriteTransaction mockWriteTransaction = Mockito.mock(WriteTransaction.class);
- Mockito.doThrow(new RuntimeException(VfModuleDataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR))
- .when(mockWriteTransaction).put(Mockito.any(), Mockito.any(), Mockito.any());
- return mockWriteTransaction;
- }
-
- private WriteTransaction newNotThrowingExceptionWriteOnlyTransaction() {
- WriteTransaction mockWriteTransaction = Mockito.mock(WriteTransaction.class);
- CheckedFuture<Void, TransactionCommitFailedException> mockCheckedFuture =
- Mockito.mock(CheckedFuture.class);
- Mockito.doNothing().when(mockWriteTransaction).put(Mockito.any(), Mockito.any(), Mockito.any());
- Mockito.doReturn(mockCheckedFuture).when(mockWriteTransaction).submit();
- return mockWriteTransaction;
- }
-}
-
-class VfModuleProviderDataBrokerTestCustomizer extends ConcurrentDataBrokerTestCustomizer {
- VfModuleExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- public VfModuleProviderDataBrokerTestCustomizer(VfModuleExceptionThrowerConfigurator exceptionThrowerConfigurator) {
- super(false);
- this.exceptionThrowerConfigurator = exceptionThrowerConfigurator;
- }
-
- public DataBroker createDataBroker() {
- return new VfModuleDataBrokerStab(createDOMDataBroker(),
- super.getBindingToNormalized(), this.exceptionThrowerConfigurator);
- }
-}
-
-@RunWith(MockitoJUnitRunner.class)
-public class VfModuleTopologyOperationTest extends VnfApiProviderTest {
- protected static final Logger LOG = LoggerFactory.getLogger(VfModuleTopologyOperationTest.class);
-
- private static final String INVALID_VFMODULEID = "invalid input, null or empty vf-module-id";
- private static final String INVALID_VNFINSTANCEID = "invalid input, null or empty vnf-instance-id";
- private static final String NO_SERVICE_LOGIC = "No service logic active for VNF-API: \'vf-module-topology-operation\'";
- private static final String VF_MODULE_ID = "vfModule1";
- private static final String VNF_INSTANCE_ID = "vnfInstance1";
- private static final String PRELOAD_NAME = "preloadName";
- private static final String PRELOAD_TYPE = "preloadType";
- private static final String ERROR_CODE = "error-code";
-
- private static final String ERROR_MESSAGE = "error-message";
- private static final String ACK_FINAL = "ack-final";
- private static final String SVC_OPERATION = "vf-module-topology-operation";
-
- private VfModuleExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- @Override
- protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
- this.exceptionThrowerConfigurator = new VfModuleExceptionThrowerConfigurator();
- return new VfModuleProviderDataBrokerTestCustomizer(this.exceptionThrowerConfigurator);
- }
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- svcClient.setScvOperation(SVC_OPERATION);
- }
-
- @Test
- public void vfModuleTopologyOperationInputIsNull() throws Exception {
- VfModuleTopologyOperationInput input = null;
- checkVfModuleTopologyOperation(input, "403", INVALID_VFMODULEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_VfModuleRequestInformationIsNull() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = new VfModuleTopologyOperationInputBuilder();
- builder.setVfModuleRequestInformation(null);
- VfModuleTopologyOperationInput input = builder.build();
- checkVfModuleTopologyOperation(input, "403", INVALID_VFMODULEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_getVfModuleRequestInformationVfModuleIdIsNull() throws Exception {
- RequestInformation reqInfo = createRequestInformation(RequestAction.PreloadVfModuleRequest);
- VfModuleRequestInformation vfModuleRequestInformation = createVfModuleRequestInformation(VNF_INSTANCE_ID, null);
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(vfModuleRequestInformation, reqInfo);
- VfModuleTopologyOperationInput input = builder.build();
- checkVfModuleTopologyOperation(input, "403", INVALID_VFMODULEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_VfModuleRequestInformationVfModuleIdIsZero() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID,""), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
- checkVfModuleTopologyOperation(input, "403", INVALID_VFMODULEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_getVfModuleRequestInformationVnfInstanceIdIsNull() throws Exception {
- RequestInformation reqInfo = createRequestInformation(RequestAction.PreloadVfModuleRequest);
- VfModuleRequestInformation vfModuleRequestInformation = createVfModuleRequestInformation(null, VF_MODULE_ID);
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(vfModuleRequestInformation, reqInfo);
- VfModuleTopologyOperationInput input = builder.build();
- checkVfModuleTopologyOperation(input, "403", INVALID_VNFINSTANCEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_VfModuleRequestInformationVnfInstanceIdIsZero() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation("",VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
- checkVfModuleTopologyOperation(input, "403", INVALID_VNFINSTANCEID);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_svcLogicClientHasGrapheReturnFalse() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
- setReturnForSvcLogicServiceClientHasGraph(false);
- checkVfModuleTopologyOperation(input, "503", NO_SERVICE_LOGIC);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_svcLogicClientExecuteThrowsSvcLogicException() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
- setReturnForSvcLogicServiceClientHasGraph(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(SvcLogicException.class);
- checkVfModuleTopologyOperation(input, "500", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_svcLogicClientExecuteThrowsException() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(Exception.class);
- checkVfModuleTopologyOperation(input, "500", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_svcLogicClientExecuteReturnsNotNull() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- Properties properties = prop().set(ERROR_CODE, "500")
- .set(ERROR_MESSAGE, ERROR_MESSAGE)
- .set(ACK_FINAL, "Y")
- .build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(properties);
- checkVfModuleTopologyOperation(input, "500", ERROR_MESSAGE);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_svcLogicClientExecuteReturnsNull() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- String expectedErrorMsg = VfModuleDataBrokerErrorMsgConfigurator.JAVA_LANG_RUNTIME_EXCEPTION
- + VfModuleDataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR;
- checkVfModuleTopologyOperation(input, "500", expectedErrorMsg);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_ActivateNoErrorDuringTransactionWriting() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.VfModuleActivateRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVfModuleTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_ChangeNoErrorDuringTransactionWriting() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.ChangeVfModuleActivateRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVfModuleTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_DisconnectNoErrorDuringTransactionWriting() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.DisconnectVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVfModuleTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_PreloadNoErrorDuringTransactionWriting() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.PreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVfModuleTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vfModuleTopologyOperationInput_DeletePreloadNoErrorDuringTransactionWriting() throws Exception {
- VfModuleTopologyOperationInputBuilder builder = createVfModuleTopologyOperationInputBuilder(createVfModuleRequestInformation(VNF_INSTANCE_ID, VF_MODULE_ID), createRequestInformation(RequestAction.DeletePreloadVfModuleRequest));
- VfModuleTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVfModuleTopologyOperation(input, "200", null);
- }
- private void checkVfModuleTopologyOperation(VfModuleTopologyOperationInput input,
- String expectedResponseCode, String expectedResponseMessage) throws ExecutionException, InterruptedException {
-
- VfModuleTopologyOperationOutput output = executeVfModuleTopologyOperation(input);
- checkVfModuleTopologyOperationOutput(output, expectedResponseCode, expectedResponseMessage);
- }
-
- private VfModuleTopologyOperationOutput executeVfModuleTopologyOperation(
- VfModuleTopologyOperationInput input) throws ExecutionException, InterruptedException {
- return vnfapiProvider
- .vfModuleTopologyOperation(input)
- .get()
- .getResult();
- }
-
- private void checkVfModuleTopologyOperationOutput(VfModuleTopologyOperationOutput result,
- String expectedResponseCode, String expectedResponseMessage) {
-
- String expectedAckFinalIndicator = "Y";
-
- Assert.assertEquals(expectedResponseCode , result.getResponseCode());
- Assert.assertEquals(expectedResponseMessage, result.getResponseMessage());
- Assert.assertEquals(expectedAckFinalIndicator, result.getAckFinalIndicator());
- }
-
- private void setReturnForSvcLogicServiceClientHasGraph(Boolean returnValue) throws Exception{
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
- .thenReturn(returnValue);
- }
-
- private void setReturnForSvcLogicServiceClientExecute(Properties properties) throws Exception{
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .execute(Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(VfModuleServiceDataBuilder.class),
- Mockito.any()))
- .thenReturn(properties);
- }
-
- private void setMockVNFSDNSvcLogicServiceClientToThrowException(Class exceptionClass) throws Exception {
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .execute(Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(VfModuleServiceDataBuilder.class),
- Mockito.any()))
- .thenThrow(exceptionClass.asSubclass(Throwable.class));
- }
-
- private VfModuleTopologyOperationInputBuilder createVfModuleTopologyOperationInputBuilder(VfModuleRequestInformation vfModuleRequestInformation, RequestInformation reqInfo) {
- VfModuleTopologyOperationInputBuilder builder = new VfModuleTopologyOperationInputBuilder();
- builder.setVfModuleRequestInformation(vfModuleRequestInformation);
- builder.setRequestInformation(reqInfo);
- return builder;
- }
-
-
-
- private VfModuleRequestInformation createVfModuleRequestInformation(String vnfInstanceId, String vfModuleId) {
- return new VfModuleRequestInformationBuilder()
- .setVnfInstanceId(vnfInstanceId)
- .setVfModuleId(vfModuleId)
- .setVfModuleName(PRELOAD_NAME)
- .setVfModuleModelId(PRELOAD_TYPE)
- .build();
- }
-
- private RequestInformation createRequestInformation(RequestAction action) {
- return new RequestInformationBuilder()
- .setRequestAction(action)
- .build();
- }
-
-
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java
deleted file mode 100644
index 458e6d41..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfApiProviderTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import org.junit.Before;
-import org.mockito.Mock;
-import org.onap.sdnc.vnfapi.util.DataBrokerUtil;
-import org.onap.sdnc.vnfapi.util.PropBuilder;
-import org.onap.sdnc.vnfapi.util.VNFSDNSvcLogicServiceClientMockUtil;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class VnfApiProviderTest extends AbstractConcurrentDataBrokerTest {
-
- protected VnfApiProvider vnfapiProvider;
- protected DataBroker dataBroker;
- protected @Mock NotificationPublishService mockNotificationPublishService;
- protected @Mock RpcProviderRegistry mockRpcProviderRegistry;
- protected @Mock VNFSDNSvcLogicServiceClient mockVNFSDNSvcLogicServiceClient;
- protected static final Logger LOG = LoggerFactory.getLogger(VnfApiProvider.class);
-
- protected DataBrokerUtil db;
- protected VNFSDNSvcLogicServiceClientMockUtil svcClient;
-
- @Before
- public void setUp() throws Exception {
- svcClient = new VNFSDNSvcLogicServiceClientMockUtil(mockVNFSDNSvcLogicServiceClient);
- dataBroker = getDataBroker();
- db = new DataBrokerUtil(dataBroker);
- try {
- vnfapiProvider = new VnfApiProvider(
- dataBroker,
- mockNotificationPublishService,
- mockRpcProviderRegistry,
- mockVNFSDNSvcLogicServiceClient
- );
- } catch (Exception e) {
- LOG.error("Caught exception on setUp", e);
- throw e;
- }
- }
-
- public static PropBuilder prop(){
- return (new PropBuilder());
- }
- } \ No newline at end of file
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java
deleted file mode 100644
index 230a394e..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfInstanceTopologyOperationTest.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import com.google.common.util.concurrent.CheckedFuture;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.Mockito;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
-import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTestCustomizer;
-import org.opendaylight.controller.md.sal.binding.test.ConcurrentDataBrokerTestCustomizer;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation.RequestAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
-
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-
-class VnfInstanceExceptionThrowerConfigurator {
- private boolean shouldThrowExceptionDuringTransactionPut;
-
- public VnfInstanceExceptionThrowerConfigurator() {
- this.shouldThrowExceptionDuringTransactionPut = true;
- }
-
- public boolean shouldThrowExceptionDuringTransactionPut() {
- return shouldThrowExceptionDuringTransactionPut;
- }
-
- public void setShouldThrowExceptionDuringTransactionPut(boolean shouldThrowExceptionDuringTransactionPut) {
- this.shouldThrowExceptionDuringTransactionPut = shouldThrowExceptionDuringTransactionPut;
- }
-}
-
-class VnfInstanceDataBrokerErrorMsgConfigurator {
- static public String JAVA_LANG_RUNTIME_EXCEPTION = "java.lang.RuntimeException: ";
- static public String TRANSACTION_WRITE_ERROR = "transaction-write-error";
-}
-
-class VnfInstanceDataBrokerStab extends BindingDOMDataBrokerAdapter {
- VnfInstanceExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- public VnfInstanceDataBrokerStab(final DOMDataBroker domDataBroker,
- final BindingToNormalizedNodeCodec codec, VnfInstanceExceptionThrowerConfigurator exceptionThrowerConfigurator) {
- super(domDataBroker, codec);
- this.exceptionThrowerConfigurator = exceptionThrowerConfigurator;
-
- }
-
- @Override
- public WriteTransaction newWriteOnlyTransaction() {
- if (exceptionThrowerConfigurator.shouldThrowExceptionDuringTransactionPut()) {
- return newThrowingExceptionWriteOnlyTransaction();
- }
- return newNotThrowingExceptionWriteOnlyTransaction();
- }
-
- private WriteTransaction newThrowingExceptionWriteOnlyTransaction() {
- WriteTransaction mockWriteTransaction = Mockito.mock(WriteTransaction.class);
- Mockito.doThrow(new RuntimeException(VnfInstanceDataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR))
- .when(mockWriteTransaction).put(Mockito.any(), Mockito.any(), Mockito.any());
- return mockWriteTransaction;
- }
-
- private WriteTransaction newNotThrowingExceptionWriteOnlyTransaction() {
- WriteTransaction mockWriteTransaction = Mockito.mock(WriteTransaction.class);
- CheckedFuture<Void, TransactionCommitFailedException> mockCheckedFuture =
- Mockito.mock(CheckedFuture.class);
- Mockito.doNothing().when(mockWriteTransaction).put(Mockito.any(), Mockito.any(), Mockito.any());
- Mockito.doReturn(mockCheckedFuture).when(mockWriteTransaction).submit();
- return mockWriteTransaction;
- }
-}
-
-class VnfInstanceProviderDataBrokerTestCustomizer extends ConcurrentDataBrokerTestCustomizer {
- VnfInstanceExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- public VnfInstanceProviderDataBrokerTestCustomizer(VnfInstanceExceptionThrowerConfigurator exceptionThrowerConfigurator) {
- super(false);
- this.exceptionThrowerConfigurator = exceptionThrowerConfigurator;
- }
-
- public DataBroker createDataBroker() {
- return new VnfInstanceDataBrokerStab(createDOMDataBroker(),
- super.getBindingToNormalized(), this.exceptionThrowerConfigurator);
- }
-}
-
-@RunWith(MockitoJUnitRunner.class)
-public class VnfInstanceTopologyOperationTest extends VnfApiProviderTest {
- protected static final Logger LOG = LoggerFactory.getLogger(VnfInstanceTopologyOperationTest.class);
-
- private static final String INVALID_INPUT = "invalid input, null or empty vnf-instance-id";
- private static final String NO_SERVICE_LOGIC = "No service logic active for VNF-API: \'vnf-instance-topology-operation\'";
- private static final String VIID = "viid";
- private static final String PRELOAD_NAME = "preloadName";
- private static final String PRELOAD_TYPE = "preloadType";
- private static final String ERROR_CODE = "error-code";
- private static final String ERROR_MESSAGE = "error-message";
- private static final String ACK_FINAL = "ack-final";
- private static final String SVC_OPERATION = "vnf-topology-operation";
-
- private VnfInstanceExceptionThrowerConfigurator exceptionThrowerConfigurator;
-
- @Override
- protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
- this.exceptionThrowerConfigurator = new VnfInstanceExceptionThrowerConfigurator();
- return new VnfInstanceProviderDataBrokerTestCustomizer(this.exceptionThrowerConfigurator);
- }
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- svcClient.setScvOperation(SVC_OPERATION);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInputIsNull() throws Exception {
- VnfInstanceTopologyOperationInput input = null;
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationIsNull() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(null);
- VnfInstanceTopologyOperationInput input = builder.build();
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_getVnfInstanceRequestInformationVnfInstanceIdIsNull() throws Exception {
- RequestInformation reqInfo = createRequestInformation(RequestAction.PreloadVnfInstanceRequest);
- VnfInstanceRequestInformation vnfInstanceRequestInformation = createVnfInstanceRequestInformation(null);
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(vnfInstanceRequestInformation, reqInfo);
- VnfInstanceTopologyOperationInput input = builder.build();
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_VnfInstanceRequestInformationVnfInstanceIdIsZero() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(""), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
- checkVnfInstanceTopologyOperation(input, "403", INVALID_INPUT);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientHasGrapheReturnFalse() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
- setReturnForSvcLogicServiceClientHasGraph(false);
- checkVnfInstanceTopologyOperation(input, "503", NO_SERVICE_LOGIC);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsSvcLogicException() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
- setReturnForSvcLogicServiceClientHasGraph(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(SvcLogicException.class);
- checkVnfInstanceTopologyOperation(input, "500", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteThrowsException() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setMockVNFSDNSvcLogicServiceClientToThrowException(Exception.class);
- checkVnfInstanceTopologyOperation(input, "500", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteReturnsNotNull() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- Properties properties = prop().set(ERROR_CODE, "500")
- .set(ERROR_MESSAGE, ERROR_MESSAGE)
- .set(ACK_FINAL, "Y")
- .build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(properties);
- checkVnfInstanceTopologyOperation(input, "500", ERROR_MESSAGE);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_svcLogicClientExecuteReturnsNull() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- String expectedErrorMsg = VnfInstanceDataBrokerErrorMsgConfigurator.JAVA_LANG_RUNTIME_EXCEPTION
- + VnfInstanceDataBrokerErrorMsgConfigurator.TRANSACTION_WRITE_ERROR;
- checkVnfInstanceTopologyOperation(input, "500", expectedErrorMsg);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_ActivateNoErrorDuringTransactionWriting() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.VnfInstanceActivateRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVnfInstanceTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_ChangeNoErrorDuringTransactionWriting() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.ChangeVnfInstanceActivateRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVnfInstanceTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_DisconnectNoErrorDuringTransactionWriting() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.DisconnectVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVnfInstanceTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_PreloadNoErrorDuringTransactionWriting() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.PreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVnfInstanceTopologyOperation(input, "200", null);
- }
-
- @Test
- public void vnfInstanceTopologyOperationInput_DeletePreloadNoErrorDuringTransactionWriting() throws Exception {
- VnfInstanceTopologyOperationInputBuilder builder = createVnfInstanceTopologyOperationInputBuilder(createVnfInstanceRequestInformation(VIID), createRequestInformation(RequestAction.DeletePreloadVnfInstanceRequest));
- VnfInstanceTopologyOperationInput input = builder.build();
-
- setReturnForSvcLogicServiceClientHasGraph(true);
- setReturnForSvcLogicServiceClientExecute(null);
- exceptionThrowerConfigurator.setShouldThrowExceptionDuringTransactionPut(false);
- checkVnfInstanceTopologyOperation(input, "200", null);
- }
- private void checkVnfInstanceTopologyOperation(VnfInstanceTopologyOperationInput input,
- String expectedResponseCode, String expectedResponseMessage) throws ExecutionException, InterruptedException {
-
- VnfInstanceTopologyOperationOutput output = executeVnfInstanceTopologyOperation(input);
- checkVnfInstanceTopologyOperationOutput(output, expectedResponseCode, expectedResponseMessage);
- }
-
- private VnfInstanceTopologyOperationOutput executeVnfInstanceTopologyOperation(
- VnfInstanceTopologyOperationInput input) throws ExecutionException, InterruptedException {
- return vnfapiProvider
- .vnfInstanceTopologyOperation(input)
- .get()
- .getResult();
- }
-
- private void checkVnfInstanceTopologyOperationOutput(VnfInstanceTopologyOperationOutput result,
- String expectedResponseCode, String expectedResponseMessage) {
-
- String expectedAckFinalIndicator = "Y";
-
- Assert.assertEquals(expectedResponseCode , result.getResponseCode());
- Assert.assertEquals(expectedResponseMessage, result.getResponseMessage());
- Assert.assertEquals(expectedAckFinalIndicator, result.getAckFinalIndicator());
- }
-
- private void setReturnForSvcLogicServiceClientHasGraph(Boolean returnValue) throws Exception{
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .hasGraph(Mockito.any(),Mockito.any(), Mockito.any(),Mockito.any()))
- .thenReturn(returnValue);
- }
-
- private void setReturnForSvcLogicServiceClientExecute(Properties properties) throws Exception{
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .execute(Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(VnfInstanceServiceDataBuilder.class),
- Mockito.any()))
- .thenReturn(properties);
- }
-
- private void setMockVNFSDNSvcLogicServiceClientToThrowException(Class exceptionClass) throws Exception {
- Mockito.when(mockVNFSDNSvcLogicServiceClient
- .execute(Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(),
- Mockito.any(VnfInstanceServiceDataBuilder.class),
- Mockito.any()))
- .thenThrow(exceptionClass.asSubclass(Throwable.class));
- }
-
- private VnfInstanceTopologyOperationInputBuilder createVnfInstanceTopologyOperationInputBuilder(VnfInstanceRequestInformation vnfInstanceRequestInformation, RequestInformation reqInfo) {
- VnfInstanceTopologyOperationInputBuilder builder = new VnfInstanceTopologyOperationInputBuilder();
- builder.setVnfInstanceRequestInformation(vnfInstanceRequestInformation);
- builder.setRequestInformation(reqInfo);
- return builder;
- }
-
-
-
- private VnfInstanceRequestInformation createVnfInstanceRequestInformation(String vnfInstanceId) {
- return new VnfInstanceRequestInformationBuilder()
- .setVnfInstanceId(vnfInstanceId)
- .setVnfInstanceName(PRELOAD_NAME)
- .setVnfModelId(PRELOAD_TYPE)
- .build();
- }
-
- private RequestInformation createRequestInformation(RequestAction action) {
- return new RequestInformationBuilder()
- .setRequestAction(action)
- .build();
- }
-
-
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java
deleted file mode 100644
index 3f486f62..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfSdnUtilTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-package org.onap.sdnc.vnfapi;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.powermock.reflect.Whitebox;
-
-public class VnfSdnUtilTest {
-
- private VnfSdnUtil vnfSdnUtil;
-
- @Before public void setUp() throws Exception {
- vnfSdnUtil = new VnfSdnUtil();
- }
-
- @Test public void loadProperties() throws Exception {
- vnfSdnUtil.loadProperties();
- Object properties = Whitebox.getInternalState(VnfSdnUtil.class, "properties");
- Assert.assertNotNull(properties);
- }
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfTopologyOperationRPCTest.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfTopologyOperationRPCTest.java
deleted file mode 100644
index 422a6adb..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfTopologyOperationRPCTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.sdnc.vnfapi.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader.SvcAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfList;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.build;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.exec;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.sdncRequestHeader;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.serviceData;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.serviceInformation;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.vnfInformation;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.vnfList;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.vnfRequestInformation;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.vnfTopologyOperationInput;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.vnfTopologyOperationOutput;
-
-
-/**
- * This class test the VnfTopologyOperation mdsal RPC.
- */
-@RunWith(MockitoJUnitRunner.class)
-public class VnfTopologyOperationRPCTest extends VnfApiProviderTest {
-
-
- final String SVC_OPERATION = "vnf-topology-operation";
-
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- svcClient.setScvOperation(SVC_OPERATION);
- }
-
-
- /**
- * Verify VnfTopologyOperation RPC executes Delete VNFList entry
- * {@link VnfTopologyOperationOutput} and persisted the expected {@link VnfList} in the {@link DataBroker}
- */
- @Test
- public void testVnfTopologyOperationRPC_Delete_VNFList_Entry_Success() throws Exception {
-
-
- //mock svcClient to perform a successful execution with the expected parameters
- svcClient.mockHasGraph(true);
- PropBuilder svcResultProp = svcClient.createExecuteOKResult();
- svcClient.mockExecute(svcResultProp);
-
- // create the VnfTopologyOperationInput from the template
- VnfTopologyOperationInput vnfTopologyOperationInput = createVTOI();
-
- //persist a vnfList entry in the dataBroker
- persistVnfListBroker(vnfTopologyOperationInput);
-
- //execute the mdsal exec
- VnfTopologyOperationOutput actualVnfTopologyOperationOutput = exec(
- vnfapiProvider::vnfTopologyOperation
- , vnfTopologyOperationInput
- , RpcResult::getResult
- );
-
-
- //verify the returned VnfTopologyOperationOutput
- VnfTopologyOperationOutput expectedVnfTopologyOperationOutput = createExpectedVTOO(svcResultProp,vnfTopologyOperationInput);
- Assert.assertEquals(expectedVnfTopologyOperationOutput,actualVnfTopologyOperationOutput);
-
-
- //verify the persisted VnfList
- VnfList actualVnfList = db.read(vnfTopologyOperationInput.getVnfRequestInformation().getVnfId(), LogicalDatastoreType.CONFIGURATION);
- VnfList expectedVnfList = null;
- Assert.assertEquals(expectedVnfList,actualVnfList);
-
- LOG.debug("done");
- }
-
-
- public VnfTopologyOperationInput createVTOI(){
- return build(vnfTopologyOperationInput()
- .setServiceInformation(
- build(serviceInformation()
- .setServiceId("serviceId: xyz")
- .setServiceInstanceId("serviceInstanceId: xyz")
- .setServiceType("serviceType: xyz")
- .setSubscriberName("subscriberName: xyz")
- )
- )
- .setVnfRequestInformation(
- build(vnfRequestInformation()
- .setVnfId("vnfId: xyz")
- .setVnfName("vnfName: xyz")//defect if missing
- .setVnfType("vnfType: xyz")//defect if missing
-
-
- )
- )
- .setSdncRequestHeader(
- build(sdncRequestHeader()
- .setSvcAction(SvcAction.Delete)
- )
- )
- );
-
- }
-
-
-
- private VnfList persistVnfListBroker(
- VnfTopologyOperationInput vnfTopologyOperationInput
- ) throws Exception{
- VnfList service = build(
- vnfList()
- .setVnfId(vnfTopologyOperationInput.getVnfRequestInformation().getVnfId())
- .setServiceData(
- build(serviceData()
- .setVnfId(vnfTopologyOperationInput.getVnfRequestInformation().getVnfId())
- )
- )
- );
- db.write(true,service, LogicalDatastoreType.CONFIGURATION);
- return service;
- }
-
-
-
-
-
- private VnfTopologyOperationOutput createExpectedVTOO(PropBuilder expectedSvcResultProp,VnfTopologyOperationInput expectedVnfTopologyOperationInput){
- return build(
- vnfTopologyOperationOutput()
- .setSvcRequestId(expectedVnfTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
- .setResponseCode(expectedSvcResultProp.get(svcClient.errorCode))
- .setAckFinalIndicator(expectedSvcResultProp.get(svcClient.ackFinal))
- .setResponseMessage(expectedSvcResultProp.get(svcClient.errorMessage))
- .setVnfInformation(build(vnfInformation()
- .setVnfId(expectedVnfTopologyOperationInput.getVnfRequestInformation().getVnfId())
- ))
- );
- }
-
-
-
-
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfapiProviderTestBase.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfapiProviderTestBase.java
deleted file mode 100644
index 92346047..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/VnfapiProviderTestBase.java
+++ /dev/null
@@ -1,1416 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-package org.onap.sdnc.vnfapi;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.NetworkTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVfModules;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfInstances;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfs;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VNFAPIService;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VfModules;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfInstances;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.Vnfs;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifier;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatus;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiers;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiers;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceData;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListKey;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifier;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformation;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.powermock.reflect.Whitebox;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
-public class VnfapiProviderTestBase {
- @Rule public MockitoRule rule = MockitoJUnit.rule();
-
- @Mock private DataBroker dataBroker;
- @Mock private NotificationPublishService notificationPublishService;
- @Mock private RpcProviderRegistry rpcProviderRegistry;
- @Mock private VNFSDNSvcLogicServiceClient vnfsdnSvcLogicServiceClient;
- @Mock private ReadWriteTransaction readWriteTransactionInCreateContainer;
- @Mock private ReadWriteTransaction readWriteTransactionInDataChanged;
- @Mock private CheckedFuture<Void, TransactionCommitFailedException> checkedFuture;
-
- private VnfApiProvider vnfapiProvider;
- private String vfModuleName;
- private String vfModuleModelId;
- private String vnfInstanceId;
- private String vnfInstanceName;
- private String vnfModelId;
- private String svcRequestId;
- private String serviceInstanceId;
- private String vnfName;
- private String vnfType;
- private String vfModuleId;
-
- @Before public void setUp() throws Exception {
- doReturn(readWriteTransactionInCreateContainer).when(dataBroker).newReadWriteTransaction();
- doReturn(checkedFuture).when(readWriteTransactionInCreateContainer).submit();
- // mock readOnlyTransaction
- ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);
- doReturn(readOnlyTransaction).when(dataBroker).newReadOnlyTransaction();
- doReturn(checkedFuture).when(readOnlyTransaction).read(any(), any());
- // mock writeTransaction
- WriteTransaction writeTransaction = mock(WriteTransaction.class);
- doReturn(writeTransaction).when(dataBroker).newWriteOnlyTransaction();
- doReturn(checkedFuture).when(writeTransaction).submit();
-
- vnfapiProvider = spy(new VnfApiProvider(dataBroker, notificationPublishService, rpcProviderRegistry,
- vnfsdnSvcLogicServiceClient));
- }
-
- @After public void tearDown() throws Exception {
-
- }
-
- @Test public void close() throws Exception {
- ExecutorService executor = Whitebox.getInternalState(vnfapiProvider, "executor");
- BindingAwareBroker.RpcRegistration<VNFAPIService> vnfapiServiceRpcRegistration =
- mock(BindingAwareBroker.RpcRegistration.class);
- vnfapiProvider.rpcRegistration = vnfapiServiceRpcRegistration;
-
- vnfapiProvider.close();
-
- Assert.assertTrue(executor.isShutdown());
- verify(vnfapiServiceRpcRegistration, times(1)).close();
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVnfInstanceRequestInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void vnfInstanceTopologyOperationErrorOne() throws Exception {
- VnfInstanceTopologyOperationInput vnfInstanceTopologyOperationInput =
- mock(VnfInstanceTopologyOperationInput.class);
- doReturn(null).when(vnfInstanceTopologyOperationInput).getVnfInstanceRequestInformation();
-
- Future<RpcResult<VnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfInstanceTopologyOperation(vnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vnf-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>viid == null</code>
- *
- * @throws Exception
- */
- @Test public void vnfInstanceTopologyOperationErrorTwo() throws Exception {
- vnfInstanceId = "";
- vnfInstanceName = "vnf-instance-name";
- vnfModelId = "vnf-model-id";
- VnfInstanceTopologyOperationInput vnfInstanceTopologyOperationInput =
- mock(VnfInstanceTopologyOperationInput.class);
- VnfInstanceRequestInformation vnfInstanceRequestInformation = mock(VnfInstanceRequestInformation.class);
- doReturn(vnfInstanceName).when(vnfInstanceRequestInformation).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceRequestInformation).getVnfModelId();
- doReturn(vnfInstanceId).when(vnfInstanceRequestInformation).getVnfInstanceId();
- doReturn(vnfInstanceRequestInformation).when(vnfInstanceTopologyOperationInput)
- .getVnfInstanceRequestInformation();
-
- Future<RpcResult<VnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfInstanceTopologyOperation(vnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vnf-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API",SVC_OPERATION,null,"sync" = false</code>
- *
- * @throws Exception
- */
- @Test public void vnfInstanceTopologyOperationErrorThree() throws Exception {
- vnfInstanceId = "vnf-instance-id";
- vnfInstanceName = "vnf-instance-name";
- vnfModelId = "vnf-model-id";
- svcRequestId = "svc-request-id";
-
- VnfInstanceTopologyOperationInput vnfInstanceTopologyOperationInput =
- mock(VnfInstanceTopologyOperationInput.class);
- VnfInstanceRequestInformation vnfInstanceRequestInformation = mock(VnfInstanceRequestInformation.class);
- doReturn(vnfInstanceId).when(vnfInstanceRequestInformation).getVnfInstanceId();
- doReturn(vnfInstanceName).when(vnfInstanceRequestInformation).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceRequestInformation).getVnfModelId();
- doReturn(vnfInstanceRequestInformation).when(vnfInstanceTopologyOperationInput)
- .getVnfInstanceRequestInformation();
-
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vnfInstanceTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
-
- Future<RpcResult<VnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfInstanceTopologyOperation(vnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void vnfInstanceTopologyOperationSuccess() throws Exception {
- vnfInstanceId = "vnf-instance-id";
- vnfInstanceName = "vnf-instance-name";
- vnfModelId = "vnf-model-id";
- svcRequestId = "svc-request-id";
-
- VnfInstanceTopologyOperationInput vnfInstanceTopologyOperationInput =
- mock(VnfInstanceTopologyOperationInput.class);
- VnfInstanceRequestInformation vnfInstanceRequestInformation = mock(VnfInstanceRequestInformation.class);
- doReturn(vnfInstanceId).when(vnfInstanceRequestInformation).getVnfInstanceId();
- doReturn(vnfInstanceName).when(vnfInstanceRequestInformation).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceRequestInformation).getVnfModelId();
- doReturn(vnfInstanceRequestInformation).when(vnfInstanceTopologyOperationInput)
- .getVnfInstanceRequestInformation();
-
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vnfInstanceTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(SdncRequestHeader.SvcAction.Activate).when(sdncRequestHeader).getSvcAction();
- ReadOnlyTransaction readOnlyTransaction = mock(ReadOnlyTransaction.class);
- doReturn(readOnlyTransaction).when(dataBroker).newReadOnlyTransaction();
- doReturn(checkedFuture).when(readOnlyTransaction).read(any(), any());
- WriteTransaction writeTransaction = mock(WriteTransaction.class);
- doReturn(writeTransaction).when(dataBroker).newWriteOnlyTransaction();
- doReturn(checkedFuture).when(writeTransaction).submit();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<VnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfInstanceTopologyOperation(vnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVfModuleTopologyInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void vfModuleTopologyOperationErrorOne() throws Exception {
- VfModuleTopologyOperationInput vfModuleTopologyOperationInput = mock(VfModuleTopologyOperationInput.class);
- doReturn(null).when(vfModuleTopologyOperationInput).getVfModuleRequestInformation();
- Future<RpcResult<VfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vfModuleTopologyOperation(vfModuleTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vf-module-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>vfid = ""</code>
- * And
- * <p>
- * <code>viid = ""</code>
- *
- * @throws Exception
- */
- @Test public void vfModuleTopologyOperationErrorTwo() throws Exception {
- // vifd = ""
- vfModuleName = "vfModuleName";
- vfModuleModelId = "vfModuleModelId";
- vfModuleId = "";
- vnfInstanceId = "";
- VfModuleTopologyOperationInput vfModuleTopologyOperationInput = mock(VfModuleTopologyOperationInput.class);
- VfModuleRequestInformation vfModuleRequestInformation = mock(VfModuleRequestInformation.class);
- doReturn(vfModuleRequestInformation).when(vfModuleTopologyOperationInput).getVfModuleRequestInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleId).when(vfModuleRequestInformation).getVfModuleId();
-
- Future<RpcResult<VfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vfModuleTopologyOperation(vfModuleTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vf-module-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
-
- // viid = ""
- vfModuleId = "vfModuleId";
- doReturn(vfModuleId).when(vfModuleRequestInformation).getVfModuleId();
- doReturn(vnfInstanceId).when(vfModuleRequestInformation).getVnfInstanceId();
- rpcResultFuture = vnfapiProvider.vfModuleTopologyOperation(vfModuleTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vnf-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") = false</code>
- *
- * @throws Exception
- */
- @Test public void vfModuleTopologyOperationErrorThree() throws Exception {
- // vifd = ""
- vfModuleName = "vfModuleName";
- vfModuleModelId = "vfModuleModelId";
- vfModuleId = "vfModuleId";
- vnfInstanceId = "vnfInstanceId";
- VfModuleTopologyOperationInput vfModuleTopologyOperationInput = mock(VfModuleTopologyOperationInput.class);
- VfModuleRequestInformation vfModuleRequestInformation = mock(VfModuleRequestInformation.class);
- doReturn(vfModuleRequestInformation).when(vfModuleTopologyOperationInput).getVfModuleRequestInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleId).when(vfModuleRequestInformation).getVfModuleId();
- doReturn(vnfInstanceId).when(vfModuleRequestInformation).getVnfInstanceId();
- // mock sdncRequestHeader
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vfModuleTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
-
- Future<RpcResult<VfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vfModuleTopologyOperation(vfModuleTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void vfModuleTopologyOperationSuccess() throws Exception {
- vfModuleName = "vfModuleName";
- vfModuleModelId = "vfModuleModelId";
- vfModuleId = "vfModuleId";
- vnfInstanceId = "vnfInstanceId";
- VfModuleTopologyOperationInput vfModuleTopologyOperationInput = mock(VfModuleTopologyOperationInput.class);
- VfModuleRequestInformation vfModuleRequestInformation = mock(VfModuleRequestInformation.class);
- doReturn(vfModuleRequestInformation).when(vfModuleTopologyOperationInput).getVfModuleRequestInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleId).when(vfModuleRequestInformation).getVfModuleId();
- doReturn(vnfInstanceId).when(vfModuleRequestInformation).getVnfInstanceId();
- // mock sdncRequestHeader
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vfModuleTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<VfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vfModuleTopologyOperation(vfModuleTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getServiceInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void vnfTopologyOperationErrorOne() throws Exception {
- VnfTopologyOperationInput vnfTopologyOperationInput = mock(VnfTopologyOperationInput.class);
- doReturn(null).when(vnfTopologyOperationInput).getServiceInformation();
-
- Future<RpcResult<VnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfTopologyOperation(vnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty service-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVnfRequestInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void vnfTopologyOperationErrorTwo() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- VnfTopologyOperationInput vnfTopologyOperationInput = mock(VnfTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInformation).when(vnfTopologyOperationInput).getServiceInformation();
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
-
- Future<RpcResult<VnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfTopologyOperation(vnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vf-module-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") == false</code>
- *
- * @throws Exception
- */
- @Test public void vnfTopologyOperationErrorThree() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- String vnfId = "vnfId";
- VnfTopologyOperationInput vnfTopologyOperationInput = mock(VnfTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInformation).when(vnfTopologyOperationInput).getServiceInformation();
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
-
- VnfRequestInformation vnfRequestInformation = mock(VnfRequestInformation.class);
- doReturn(vnfRequestInformation).when(vnfTopologyOperationInput).getVnfRequestInformation();
- doReturn(vnfId).when(vnfRequestInformation).getVnfId();
-
- Future<RpcResult<VnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfTopologyOperation(vnfTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void vnfTopologyOperationSuccess() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- String vnfId = "vnfId";
- VnfTopologyOperationInput vnfTopologyOperationInput = mock(VnfTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInformation).when(vnfTopologyOperationInput).getServiceInformation();
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
-
- VnfRequestInformation vnfRequestInformation = mock(VnfRequestInformation.class);
- doReturn(vnfRequestInformation).when(vnfTopologyOperationInput).getVnfRequestInformation();
- doReturn(vnfId).when(vnfRequestInformation).getVnfId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<VnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfTopologyOperation(vnfTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getServiceInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void networkTopologyOperationErrorOne() throws Exception {
- VnfTopologyOperationInput vnfTopologyOperationInput = mock(VnfTopologyOperationInput.class);
- doReturn(null).when(vnfTopologyOperationInput).getServiceInformation();
-
- Future<RpcResult<VnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.vnfTopologyOperation(vnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty service-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getNetworkRequestInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void networkTopologyOperationErrorTwo() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- NetworkTopologyOperationInput networkTopologyOperation = mock(NetworkTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
- doReturn(serviceInformation).when(networkTopologyOperation).getServiceInformation();
-
- Future<RpcResult<NetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.networkTopologyOperation(networkTopologyOperation);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty service-instance-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") == false</code>
- *
- * @throws Exception
- */
- @Test public void networkTopologyOperationErrorThree() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- NetworkTopologyOperationInput networkTopologyOperationInput = mock(NetworkTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
- doReturn(serviceInformation).when(networkTopologyOperationInput).getServiceInformation();
-
- NetworkRequestInformation networkRequestInformation = mock(NetworkRequestInformation.class);
- doReturn(networkRequestInformation).when(networkTopologyOperationInput).getNetworkRequestInformation();
- doReturn("NetworkName").when(networkRequestInformation).getNetworkName();
-
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(SdncRequestHeader.SvcAction.Assign).when(sdncRequestHeader).getSvcAction();
- doReturn(sdncRequestHeader).when(networkTopologyOperationInput).getSdncRequestHeader();
-
- Future<RpcResult<NetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.networkTopologyOperation(networkTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void networkTopologyOperationSuccess() throws Exception {
- serviceInstanceId = "serviceInstanceId";
- NetworkTopologyOperationInput networkTopologyOperationInput = mock(NetworkTopologyOperationInput.class);
- ServiceInformation serviceInformation = mock(ServiceInformation.class);
- doReturn(serviceInstanceId).when(serviceInformation).getServiceInstanceId();
- doReturn(serviceInformation).when(networkTopologyOperationInput).getServiceInformation();
- //mock networkRequestInformation
- NetworkRequestInformation networkRequestInformation = mock(NetworkRequestInformation.class);
- doReturn(networkRequestInformation).when(networkTopologyOperationInput).getNetworkRequestInformation();
- doReturn("NetworkName").when(networkRequestInformation).getNetworkName();
- //mock sdncRequestHeader
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(SdncRequestHeader.SvcAction.Assign).when(sdncRequestHeader).getSvcAction();
- doReturn(sdncRequestHeader).when(networkTopologyOperationInput).getSdncRequestHeader();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<NetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.networkTopologyOperation(networkTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVnfTopologyInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfTopologyOperationErrorOne() throws Exception {
- PreloadVnfTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVnfTopologyOperationInput.class);
- doReturn(null).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
-
- Future<RpcResult<PreloadVnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vnf-name or vnf-type",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>preload_name.length() == 0</code>
- * And
- * <code>preload_type.length() == 0</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfTopologyOperationErrorTwo() throws Exception {
- // preload_name.length() == 0
- vnfName = "";
- vnfType = "vfModuleModelId";
- PreloadVnfTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVnfTopologyOperationInput.class);
- doReturn(null).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
-
- VnfTopologyInformation vnfTopologyInformation = mock(VnfTopologyInformation.class);
- doReturn(vnfTopologyInformation).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
- VnfTopologyIdentifier vnfTopologyIdentifier = mock(VnfTopologyIdentifier.class);
- doReturn(vnfName).when(vnfTopologyIdentifier).getVnfName();
- doReturn(vnfType).when(vnfTopologyIdentifier).getVnfType();
- doReturn(vnfTopologyIdentifier).when(vnfTopologyInformation).getVnfTopologyIdentifier();
-
- Future<RpcResult<PreloadVnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-name",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
-
- // preload_type.length() == 0
- vnfName = "vnfName";
- vnfType = "";
- doReturn(vnfName).when(vnfTopologyIdentifier).getVnfName();
- doReturn(vnfType).when(vnfTopologyIdentifier).getVnfType();
-
- rpcResultFuture = vnfapiProvider.preloadVnfTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-type",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") = false</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfTopologyOperationErrorThree() throws Exception {
- // preload_name.length() == 0
- vnfName = "vnfName";
- vnfType = "vfModuleModelId";
- PreloadVnfTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVnfTopologyOperationInput.class);
- doReturn(null).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
-
- VnfTopologyInformation vnfTopologyInformation = mock(VnfTopologyInformation.class);
- doReturn(vnfTopologyInformation).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
- VnfTopologyIdentifier vnfTopologyIdentifier = mock(VnfTopologyIdentifier.class);
- doReturn(vnfName).when(vnfTopologyIdentifier).getVnfName();
- doReturn(vnfType).when(vnfTopologyIdentifier).getVnfType();
- doReturn(vnfTopologyIdentifier).when(vnfTopologyInformation).getVnfTopologyIdentifier();
-
- Future<RpcResult<PreloadVnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void preloadVnfTopologyOperationSuccess() throws Exception {
- // preload_name.length() == 0
- vnfName = "vnfName";
- vnfType = "vfModuleModelId";
- PreloadVnfTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVnfTopologyOperationInput.class);
- doReturn(null).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
-
- VnfTopologyInformation vnfTopologyInformation = mock(VnfTopologyInformation.class);
- doReturn(vnfTopologyInformation).when(preloadVnfTopologyOperationInput).getVnfTopologyInformation();
- VnfTopologyIdentifier vnfTopologyIdentifier = mock(VnfTopologyIdentifier.class);
- doReturn(vnfName).when(vnfTopologyIdentifier).getVnfName();
- doReturn(vnfType).when(vnfTopologyIdentifier).getVnfType();
- doReturn(vnfTopologyIdentifier).when(vnfTopologyInformation).getVnfTopologyIdentifier();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<PreloadVnfTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVnfInstanceTopologyInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfInstanceTopologyOperationErrorOne() throws Exception {
- PreloadVnfInstanceTopologyOperationInput preloadVnfInstanceTopologyOperationInput =
- mock(PreloadVnfInstanceTopologyOperationInput.class);
- doReturn(null).when(preloadVnfInstanceTopologyOperationInput).getVnfInstanceTopologyInformation();
- Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfInstanceTopologyOperation(preloadVnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vnf-instance-name or vnf-model-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>preload_name = ""</code>
- * And
- * <code>preload_type = ""</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfInstanceTopologyOperationErrorTwo() throws Exception {
- // preload_type = ""
- vnfInstanceName = "vnfInstanceName";
- vnfModelId = "";
- PreloadVnfInstanceTopologyOperationInput preloadVnfInstanceTopologyOperationInput =
- mock(PreloadVnfInstanceTopologyOperationInput.class);
- VnfInstanceTopologyInformation vnfInstanceTopologyInformation = mock(VnfInstanceTopologyInformation.class);
- doReturn(vnfInstanceTopologyInformation).when(preloadVnfInstanceTopologyOperationInput)
- .getVnfInstanceTopologyInformation();
- VnfInstanceIdentifiers vnfInstanceIdentifiers = mock(VnfInstanceIdentifiers.class);
- doReturn(vnfInstanceName).when(vnfInstanceIdentifiers).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceIdentifiers).getVnfModelId();
- doReturn(vnfInstanceIdentifiers).when(vnfInstanceTopologyInformation).getVnfInstanceIdentifiers();
-
- Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfInstanceTopologyOperation(preloadVnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-type",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
-
- //preload_name == ""
- vnfInstanceName = "";
- vnfModelId = "vnfModelId";
- doReturn(vnfInstanceName).when(vnfInstanceIdentifiers).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceIdentifiers).getVnfModelId();
-
- rpcResultFuture = vnfapiProvider.preloadVnfInstanceTopologyOperation(preloadVnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-name",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") = false</code>
- *
- * @throws Exception
- */
- @Test public void preloadVnfInstanceTopologyOperationErrorThree() throws Exception {
- // preload_type = ""
- vnfInstanceName = "vnfInstanceName";
- vnfModelId = "vnfModelId";
- PreloadVnfInstanceTopologyOperationInput preloadVnfInstanceTopologyOperationInput =
- mock(PreloadVnfInstanceTopologyOperationInput.class);
- VnfInstanceTopologyInformation vnfInstanceTopologyInformation = mock(VnfInstanceTopologyInformation.class);
- doReturn(vnfInstanceTopologyInformation).when(preloadVnfInstanceTopologyOperationInput)
- .getVnfInstanceTopologyInformation();
- VnfInstanceIdentifiers vnfInstanceIdentifiers = mock(VnfInstanceIdentifiers.class);
- doReturn(vnfInstanceName).when(vnfInstanceIdentifiers).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceIdentifiers).getVnfModelId();
- doReturn(vnfInstanceIdentifiers).when(vnfInstanceTopologyInformation).getVnfInstanceIdentifiers();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(preloadVnfInstanceTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
-
- Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfInstanceTopologyOperation(preloadVnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void preloadVnfInstanceTopologyOperationSuccess() throws Exception {
- // preload_type = ""
- vnfInstanceName = "vnfInstanceName";
- vnfModelId = "vnfModelId";
- PreloadVnfInstanceTopologyOperationInput preloadVnfInstanceTopologyOperationInput =
- mock(PreloadVnfInstanceTopologyOperationInput.class);
- VnfInstanceTopologyInformation vnfInstanceTopologyInformation = mock(VnfInstanceTopologyInformation.class);
- doReturn(vnfInstanceTopologyInformation).when(preloadVnfInstanceTopologyOperationInput)
- .getVnfInstanceTopologyInformation();
- VnfInstanceIdentifiers vnfInstanceIdentifiers = mock(VnfInstanceIdentifiers.class);
- doReturn(vnfInstanceName).when(vnfInstanceIdentifiers).getVnfInstanceName();
- doReturn(vnfModelId).when(vnfInstanceIdentifiers).getVnfModelId();
- doReturn(vnfInstanceIdentifiers).when(vnfInstanceTopologyInformation).getVnfInstanceIdentifiers();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(preloadVnfInstanceTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVnfInstanceTopologyOperation(preloadVnfInstanceTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getVfModuleTopologyInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void preloadVfModuleTopologyOperationErrorOne() throws Exception {
- PreloadVfModuleTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVfModuleTopologyOperationInput.class);
- doReturn(null).when(preloadVnfTopologyOperationInput).getVfModuleTopologyInformation();
-
- Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVfModuleTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, null or empty vf-module-name or vf-module-model-id",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>preload_name = ""</code>
- * And
- * <code>preload_type = ""</code>
- *
- * @throws Exception
- */
- @Test public void preloadVfModuleTopologyOperationErrorTwo() throws Exception {
- // preload_name = ""
- vfModuleName = "";
- vfModuleModelId = "vfModuleModelId";
- PreloadVfModuleTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVfModuleTopologyOperationInput.class);
- VfModuleTopologyInformation vfModuleTopologyInformation = mock(VfModuleTopologyInformation.class);
- doReturn(vfModuleTopologyInformation).when(preloadVnfTopologyOperationInput).getVfModuleTopologyInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleIdentifiers).when(vfModuleTopologyInformation).getVfModuleIdentifiers();
-
- Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVfModuleTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-name",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
-
- // preload_type = ""
- vfModuleName = "vfModuleName";
- vfModuleModelId = "";
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
-
- rpcResultFuture = vnfapiProvider.preloadVfModuleTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("invalid input, invalid preload-type",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API", SVC_OPERATION, null, "sync") = false</code>
- *
- * @throws Exception
- */
- @Test public void preloadVfModuleTopologyOperationErrorThree() throws Exception {
- // preload_name = ""
- vfModuleName = "vfModuleName";
- vfModuleModelId = "vfModuleModelId";
- PreloadVfModuleTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVfModuleTopologyOperationInput.class);
- VfModuleTopologyInformation vfModuleTopologyInformation = mock(VfModuleTopologyInformation.class);
- doReturn(vfModuleTopologyInformation).when(preloadVnfTopologyOperationInput).getVfModuleTopologyInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleIdentifiers).when(vfModuleTopologyInformation).getVfModuleIdentifiers();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(preloadVnfTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
-
- Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVfModuleTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void preloadVfModuleTopologyOperationSuccess() throws Exception {
- // preload_name = ""
- vfModuleName = "vfModuleName";
- vfModuleModelId = "vfModuleModelId";
- PreloadVfModuleTopologyOperationInput preloadVnfTopologyOperationInput =
- mock(PreloadVfModuleTopologyOperationInput.class);
- VfModuleTopologyInformation vfModuleTopologyInformation = mock(VfModuleTopologyInformation.class);
- doReturn(vfModuleTopologyInformation).when(preloadVnfTopologyOperationInput).getVfModuleTopologyInformation();
- VfModuleIdentifiers vfModuleIdentifiers = mock(VfModuleIdentifiers.class);
- doReturn(vfModuleName).when(vfModuleIdentifiers).getVfModuleName();
- doReturn(vfModuleModelId).when(vfModuleIdentifiers).getVfModuleModelId();
- doReturn(vfModuleIdentifiers).when(vfModuleTopologyInformation).getVfModuleIdentifiers();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(preloadVnfTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadVfModuleTopologyOperation(preloadVnfTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>input.getNetworkTopologyInformation() == null</code>
- *
- * @throws Exception
- */
- @Test public void preloadNetworkTopologyOperationErrorOne() throws Exception {
- PreloadNetworkTopologyOperationInput PreloadNetworkTopologyOperationInput =
- mock(PreloadNetworkTopologyOperationInput.class);
- doReturn(null).when(PreloadNetworkTopologyOperationInput).getNetworkTopologyInformation();
-
- Future<RpcResult<PreloadNetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("input, null or empty network-name or network-type",
- rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>preload_name == ""</code>
- * ANd
- * <code>preload_type == ""ss</code>
- *
- * @throws Exception
- */
- @Test public void preloadNetworkTopologyOperationErrorTwo() throws Exception {
- String networkName = "";
- String networkType = "NetworkType";
- PreloadNetworkTopologyOperationInput PreloadNetworkTopologyOperationInput =
- mock(PreloadNetworkTopologyOperationInput.class);
- NetworkTopologyInformation networkTopologyInformation = mock(NetworkTopologyInformation.class);
- doReturn(networkTopologyInformation).when(PreloadNetworkTopologyOperationInput).getNetworkTopologyInformation();
- NetworkTopologyIdentifier networkTopologyIdentifier = mock(NetworkTopologyIdentifier.class);
- doReturn(networkTopologyIdentifier).when(networkTopologyInformation).getNetworkTopologyIdentifier();
- doReturn(networkName).when(networkTopologyIdentifier).getNetworkName();
- doReturn(networkType).when(networkTopologyIdentifier).getNetworkType();
-
- Future<RpcResult<PreloadNetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("input, invalid preload-name", rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
-
- networkName = "NetworkName";
- networkType = "";
- doReturn(networkName).when(networkTopologyIdentifier).getNetworkName();
- doReturn(networkType).when(networkTopologyIdentifier).getNetworkType();
-
- rpcResultFuture = vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("403", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("input, invalid preload-type", rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Error case:
- * <p>
- * <code>svcLogicClient.hasGraph("VNF-API",SVC_OPERATION,null,"sync" = false</code>
- *
- * @throws Exception
- */
- @Test public void preloadNetworkTopologyOperationErrorThree() throws Exception {
- String networkName = "NetworkName";
- String networkType = "NetworkType";
- PreloadNetworkTopologyOperationInput PreloadNetworkTopologyOperationInput =
- mock(PreloadNetworkTopologyOperationInput.class);
- NetworkTopologyInformation networkTopologyInformation = mock(NetworkTopologyInformation.class);
- doReturn(networkTopologyInformation).when(PreloadNetworkTopologyOperationInput).getNetworkTopologyInformation();
- NetworkTopologyIdentifier networkTopologyIdentifier = mock(NetworkTopologyIdentifier.class);
- doReturn(networkTopologyIdentifier).when(networkTopologyInformation).getNetworkTopologyIdentifier();
- doReturn(networkName).when(networkTopologyIdentifier).getNetworkName();
- doReturn(networkType).when(networkTopologyIdentifier).getNetworkType();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(PreloadNetworkTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
-
- Future<RpcResult<PreloadNetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("503", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertTrue(
- rpcResultFuture.get().getResult().getResponseMessage().contains("No service logic active for VNF-API"));
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void preloadNetworkTopologyOperationErrorFour() throws Exception {
- String networkName = "NetworkName";
- String networkType = "NetworkType";
- PreloadNetworkTopologyOperationInput PreloadNetworkTopologyOperationInput =
- mock(PreloadNetworkTopologyOperationInput.class);
- NetworkTopologyInformation networkTopologyInformation = mock(NetworkTopologyInformation.class);
- doReturn(networkTopologyInformation).when(PreloadNetworkTopologyOperationInput).getNetworkTopologyInformation();
- NetworkTopologyIdentifier networkTopologyIdentifier = mock(NetworkTopologyIdentifier.class);
- doReturn(networkTopologyIdentifier).when(networkTopologyInformation).getNetworkTopologyIdentifier();
- doReturn(networkName).when(networkTopologyIdentifier).getNetworkName();
- doReturn(networkType).when(networkTopologyIdentifier).getNetworkType();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(PreloadNetworkTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
- doReturn(null).when(dataBroker).newWriteOnlyTransaction();
-
- Future<RpcResult<PreloadNetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("500", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals("java.lang.NullPointerException", rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- /**
- * Test Success case
- *
- * @throws Exception
- */
- @Test public void preloadNetworkTopologyOperationSuccess() throws Exception {
- String networkName = "NetworkName";
- String networkType = "NetworkType";
- PreloadNetworkTopologyOperationInput PreloadNetworkTopologyOperationInput =
- mock(PreloadNetworkTopologyOperationInput.class);
- NetworkTopologyInformation networkTopologyInformation = mock(NetworkTopologyInformation.class);
- doReturn(networkTopologyInformation).when(PreloadNetworkTopologyOperationInput).getNetworkTopologyInformation();
- NetworkTopologyIdentifier networkTopologyIdentifier = mock(NetworkTopologyIdentifier.class);
- doReturn(networkTopologyIdentifier).when(networkTopologyInformation).getNetworkTopologyIdentifier();
- doReturn(networkName).when(networkTopologyIdentifier).getNetworkName();
- doReturn(networkType).when(networkTopologyIdentifier).getNetworkType();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(PreloadNetworkTopologyOperationInput).getSdncRequestHeader();
- doReturn(svcRequestId).when(sdncRequestHeader).getSvcRequestId();
- doReturn(true).when(vnfsdnSvcLogicServiceClient).hasGraph(any(), any(), any(), any());
-
- Future<RpcResult<PreloadNetworkTopologyOperationOutput>> rpcResultFuture =
- vnfapiProvider.preloadNetworkTopologyOperation(PreloadNetworkTopologyOperationInput);
-
- Assert.assertEquals("200", rpcResultFuture.get().getResult().getResponseCode());
- Assert.assertEquals(null, rpcResultFuture.get().getResult().getResponseMessage());
- Assert.assertEquals("Y", rpcResultFuture.get().getResult().getAckFinalIndicator());
- }
-
- @Test public void getVfModuleServiceData() throws Exception {
- // Three parameters: siid, vfModuleServiceDataBuilder, LogicalDatastoreType
- String ssid = "ssid";
- VfModuleServiceDataBuilder vfModuleServiceDataBuilder = spy(new VfModuleServiceDataBuilder());
- Optional<VfModuleList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
- VfModuleList vfModuleList = mock(VfModuleList.class);
- doReturn(vfModuleList).when(optional).get();
- VfModuleServiceData vfModuleServiceData = mock(VfModuleServiceData.class);
- doReturn(vfModuleServiceData).when(vfModuleList).getVfModuleServiceData();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vfModuleServiceData).getSdncRequestHeader();
-
- Whitebox.invokeMethod(vnfapiProvider, "getVfModuleServiceData", ssid, vfModuleServiceDataBuilder,
- LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(sdncRequestHeader, vfModuleServiceDataBuilder.getSdncRequestHeader());
-
- //With Two parameters: siid, vfModuleServiceDataBuilder
- Whitebox.invokeMethod(vnfapiProvider, "getVfModuleServiceData", ssid, vfModuleServiceDataBuilder);
-
- Assert.assertEquals(sdncRequestHeader, vfModuleServiceDataBuilder.getSdncRequestHeader());
- }
-
- @Test public void getPreloadData() throws Exception {
- // Four parameters:
- // String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type
- PreloadDataBuilder preloadDataBuilder = spy(new PreloadDataBuilder());
- // mock optional
- Optional<VnfPreloadList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
-
- VnfPreloadList vnfPreloadList = mock(VnfPreloadList.class);
- doReturn(vnfPreloadList).when(optional).get();
- PreloadData preloadData = mock(PreloadData.class);
- doReturn(preloadData).when(vnfPreloadList).getPreloadData();
-
- VnfTopologyInformation vnfTopologyInformation = mock(VnfTopologyInformation.class);
- doReturn(vnfTopologyInformation).when(preloadData).getVnfTopologyInformation();
-
- Whitebox.invokeMethod(vnfapiProvider, "getPreloadData", "preloadName", "preloadType", preloadDataBuilder,
- LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(vnfTopologyInformation, preloadDataBuilder.getVnfTopologyInformation());
-
- // Three parameters:
- // String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type
- Whitebox.invokeMethod(vnfapiProvider, "getPreloadData", "preloadName", "preloadType", preloadDataBuilder);
-
- Assert.assertEquals(vnfTopologyInformation, preloadDataBuilder.getVnfTopologyInformation());
- }
-
- @Test public void getVnfInstancePreloadData() throws Exception {
- // Four parameters:
- // String preload_name, String preload_type, VnfInstancePreloadDataBuilder preloadDataBuilder,
- // LogicalDatastoreType type
- VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = spy(new VnfInstancePreloadDataBuilder());
- // mock optional
- Optional<VnfPreloadList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
- VnfInstancePreloadList vnfInstancePreloadList = mock(VnfInstancePreloadList.class);
- doReturn(vnfInstancePreloadList).when(optional).get();
- VnfInstancePreloadData vnfInstancePreloadData = mock(VnfInstancePreloadData.class);
- doReturn(vnfInstancePreloadData).when(vnfInstancePreloadList).getVnfInstancePreloadData();
- VnfInstanceTopologyInformation vnfInstanceTopologyInformation = mock(VnfInstanceTopologyInformation.class);
- doReturn(vnfInstanceTopologyInformation).when(vnfInstancePreloadData).getVnfInstanceTopologyInformation();
-
- Whitebox.invokeMethod(vnfapiProvider, "getVnfInstancePreloadData", "preloadName", "preloadType",
- vnfInstancePreloadDataBuilder, LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(vnfInstanceTopologyInformation,
- vnfInstancePreloadDataBuilder.getVnfInstanceTopologyInformation());
-
- // Three Parameters:
- // String preload_name, String preload_type, VnfInstancePreloadDataBuilder preloadDataBuilder
- Whitebox.invokeMethod(vnfapiProvider, "getVnfInstancePreloadData", "preloadName", "preloadType",
- vnfInstancePreloadDataBuilder);
-
- Assert.assertEquals(vnfInstanceTopologyInformation,
- vnfInstancePreloadDataBuilder.getVnfInstanceTopologyInformation());
- }
-
- @Test public void getVfModulePreloadData() throws Exception {
- // Four Parameters
- // String preload_name, String preload_type, VfModulePreloadDataBuilder preloadDataBuilder,
- // LogicalDatastoreType type
- VfModulePreloadDataBuilder vfModulePreloadDataBuilder = spy(new VfModulePreloadDataBuilder());
- // mock optional
- Optional<VfModulePreloadList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
- VfModulePreloadList vfModulePreloadList = mock(VfModulePreloadList.class);
- doReturn(vfModulePreloadList).when(optional).get();
- VfModulePreloadData vfModulePreloadData = mock(VfModulePreloadData.class);
- doReturn(vfModulePreloadData).when(vfModulePreloadList).getVfModulePreloadData();
- VfModuleTopologyInformation vfModuleTopologyInformation = mock(VfModuleTopologyInformation.class);
- doReturn(vfModuleTopologyInformation).when(vfModulePreloadData).getVfModuleTopologyInformation();
-
- Whitebox.invokeMethod(vnfapiProvider, "getVfModulePreloadData", "preloadName", "preloadType",
- vfModulePreloadDataBuilder, LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(vfModuleTopologyInformation, vfModulePreloadDataBuilder.getVfModuleTopologyInformation());
-
- // Three Parameters:
- // String vnf_name, String vnf_type, VfModulePreloadDataBuilder preloadDataBuilder
- Whitebox.invokeMethod(vnfapiProvider, "getVfModulePreloadData", "preloadName", "preloadType",
- vfModulePreloadDataBuilder);
-
- Assert.assertEquals(vfModuleTopologyInformation, vfModulePreloadDataBuilder.getVfModuleTopologyInformation());
- }
-
- /**
- * With ServiceStatusBuilder, RequestInformation
- */
- @Test public void setServiceStatusOne() throws Exception {
- // VNFActivateRequest
- RequestInformation requestInformation = mock(RequestInformation.class);
- ServiceStatusBuilder serviceStatusBuilder = spy(new ServiceStatusBuilder());
- doReturn(RequestInformation.RequestAction.VNFActivateRequest).when(requestInformation).getRequestAction();
- doReturn(RequestInformation.RequestSubAction.SUPP).when(requestInformation).getRequestSubAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.VNFActivateRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //ChangeVNFActivateRequest
- doReturn(RequestInformation.RequestAction.ChangeVNFActivateRequest).when(requestInformation).getRequestAction();
- doReturn(RequestInformation.RequestSubAction.CANCEL).when(requestInformation).getRequestSubAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert
- .assertEquals(ServiceStatus.VnfsdnAction.ChangeVNFActivateRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //DisconnectVNFRequest
- doReturn(RequestInformation.RequestAction.DisconnectVNFRequest).when(requestInformation).getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.DisconnectVNFRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //PreloadVNFRequest
- doReturn(RequestInformation.RequestAction.PreloadVNFRequest).when(requestInformation).getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.PreloadVNFRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //DeletePreloadVNFRequest
- doReturn(RequestInformation.RequestAction.DeletePreloadVNFRequest).when(requestInformation).getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.DeletePreloadVNFRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //VnfInstanceActivateRequest
- doReturn(RequestInformation.RequestAction.VnfInstanceActivateRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.VnfInstanceActivateRequest,
- serviceStatusBuilder.getVnfsdnAction());
-
- //ChangeVnfInstanceActivateRequest
- doReturn(RequestInformation.RequestAction.ChangeVnfInstanceActivateRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.ChangeVnfInstanceActivateRequest,
- serviceStatusBuilder.getVnfsdnAction());
-
- //DisconnectVnfInstanceRequest
- doReturn(RequestInformation.RequestAction.DisconnectVnfInstanceRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.DisconnectVnfInstanceRequest,
- serviceStatusBuilder.getVnfsdnAction());
-
- //PreloadVnfInstanceRequest
- doReturn(RequestInformation.RequestAction.PreloadVnfInstanceRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert
- .assertEquals(ServiceStatus.VnfsdnAction.PreloadVnfInstanceRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //VfModuleActivateRequest
- doReturn(RequestInformation.RequestAction.VfModuleActivateRequest).when(requestInformation).getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.VfModuleActivateRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //ChangeVfModuleActivateRequest
- doReturn(RequestInformation.RequestAction.ChangeVfModuleActivateRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.ChangeVfModuleActivateRequest,
- serviceStatusBuilder.getVnfsdnAction());
-
- //DisconnectVfModuleRequest
- doReturn(RequestInformation.RequestAction.DisconnectVfModuleRequest).when(requestInformation)
- .getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert
- .assertEquals(ServiceStatus.VnfsdnAction.DisconnectVfModuleRequest, serviceStatusBuilder.getVnfsdnAction());
-
- //PreloadVfModuleRequest
- doReturn(RequestInformation.RequestAction.PreloadVfModuleRequest).when(requestInformation).getRequestAction();
- Whitebox.invokeMethod(vnfapiProvider, "setServiceStatus", serviceStatusBuilder, requestInformation);
- Assert.assertEquals(ServiceStatus.VnfsdnAction.PreloadVfModuleRequest, serviceStatusBuilder.getVnfsdnAction());
- }
-
- @Test public void getServiceData() throws Exception {
- ServiceDataBuilder serviceDataBuilder = spy(new ServiceDataBuilder());
- // mock optional
- Optional<VnfList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
- VnfList vnfList = mock(VnfList.class);
- doReturn(vnfList).when(optional).get();
- ServiceData serviceData = mock(ServiceData.class);
- doReturn(serviceData).when(vnfList).getServiceData();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(serviceData).getSdncRequestHeader();
-
- Whitebox.invokeMethod(vnfapiProvider, "getServiceData", "siid", serviceDataBuilder,
- LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(sdncRequestHeader, serviceDataBuilder.getSdncRequestHeader());
- }
-
- @Test public void getVnfInstanceServiceData() throws Exception {
- VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder = spy(new VnfInstanceServiceDataBuilder());
- // mock optional
- Optional<VnfList> optional = mock(Optional.class);
- doReturn(optional).when(checkedFuture).get();
- doReturn(true).when(optional).isPresent();
- VnfInstanceList vnfInstanceList = mock(VnfInstanceList.class);
- doReturn(vnfInstanceList).when(optional).get();
- VnfInstanceServiceData vnfInstanceServiceData = mock(VnfInstanceServiceData.class);
- doReturn(vnfInstanceServiceData).when(vnfInstanceList).getVnfInstanceServiceData();
- SdncRequestHeader sdncRequestHeader = mock(SdncRequestHeader.class);
- doReturn(sdncRequestHeader).when(vnfInstanceServiceData).getSdncRequestHeader();
-
- Whitebox.invokeMethod(vnfapiProvider, "getVnfInstanceServiceData", "siid", vnfInstanceServiceDataBuilder,
- LogicalDatastoreType.CONFIGURATION);
-
- Assert.assertEquals(sdncRequestHeader, vnfInstanceServiceDataBuilder.getSdncRequestHeader());
- }
-
- @Test public void DeleteVnfList() throws Exception {
- LogicalDatastoreType configuration = LogicalDatastoreType.CONFIGURATION;
- VnfList vnfList = mock(VnfList.class);
- VnfListKey vnfListKey = mock(VnfListKey.class);
- doReturn(vnfListKey).when(vnfList).key();
- InstanceIdentifier<VnfList> vnfListInstanceIdentifier = mock(InstanceIdentifier.class);
- dataBroker.newWriteOnlyTransaction().put(configuration, vnfListInstanceIdentifier, vnfList);
-
- Whitebox.invokeMethod(vnfapiProvider, "DeleteVnfList", vnfList, configuration);
-
- verify(dataBroker, times(2)).newWriteOnlyTransaction();
- }
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/DataBrokerUtil.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/DataBrokerUtil.java
deleted file mode 100644
index 352e9404..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/DataBrokerUtil.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi.util;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.Vnfs;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfList;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-
-/**
- * This util class provides utility to read and write {@link VnfList} data objects from the {@link DataBroker}
- *
- */
-public class DataBrokerUtil {
-
-
- private final DataBroker dataBroker;
-
- public DataBrokerUtil(DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- }
-
- /** @return VnfList - the VnfList object read from the DataBroker or null if none was found */
- public VnfList read(String VnfListKey, LogicalDatastoreType logicalDatastoreType) throws Exception {
- InstanceIdentifier VnfListInstanceIdentifier = InstanceIdentifier.<Vnfs>builder(Vnfs.class)
- .child(VnfList.class, new VnfListKey(VnfListKey)).build();
- ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
- Optional<VnfList> data = (Optional<VnfList>) readTx.read(logicalDatastoreType, VnfListInstanceIdentifier).get();
- if(!data.isPresent()){
- return null;
- }
- return data.get();
- }
-
-
- /**
- * Write the {@link VnfList} object to the {@link DataBroker}
- * @param isReplace - false specifies the new data is to be merged into existing data, where as true cause the
- * existing data to be replaced.
- * @param VnfList - the {@link VnfList} data object to be presisted in the db.
- * @param logicalDatastoreType - The logicalDatastoreType
- */
- public void write(boolean isReplace,VnfList VnfList, LogicalDatastoreType logicalDatastoreType) throws Exception {
- // Each entry will be identifiable by a unique key, we have to create that
- // identifier
- InstanceIdentifier.InstanceIdentifierBuilder<VnfList> VnfListBuilder = InstanceIdentifier
- .<Vnfs>builder(Vnfs.class).child(VnfList.class, VnfList.key());
- InstanceIdentifier<VnfList> path = VnfListBuilder.build();
-
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- if (!isReplace) {
- tx.merge(logicalDatastoreType, path, VnfList);
- } else {
- tx.put(logicalDatastoreType, path, VnfList);
- }
- CheckedFuture<Void,TransactionCommitFailedException> cf = tx.submit();
- cf.checkedGet();
-
- }
-
-
-
-
-
-
-
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/MDSALUtil.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/MDSALUtil.java
deleted file mode 100644
index b28139c7..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/MDSALUtil.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi.util;
-
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-import java.util.concurrent.Future;
-import java.util.function.Consumer;
-import java.util.function.Function;
-
-
-/**
- * This uill class provides utility to build yang objects using a recursive syntax that resembles the tree structure
- * when defining the same yang object in json format.
- *
- * For Example
- * <pre>
- * {@code
- * import static org.onap.sdnc.northbound.util.MDSALUtil.*;
- * VnfTopologyOperationInput input = build(vnfTopologyOperationInput()
- * .setServiceInformation(
- * build(serviceInformation()
- * .setServiceId("serviceId: xyz")
- * .setServiceInstanceId("serviceInstanceId: xyz")
- * .setServiceType("serviceType: xyz")
- * .setSubscriberName("subscriberName: xyz")
- * )
- * )
- * .setVnfRequestInformation(
- * build(vnfRequestInformation()
- * .setVnfId("vnfId: xyz")
- * .setVnfName("vnfName: xyz")//defect if missing
- * .setVnfType("vnfType: xyz")//defect if missing
- * )
- * )
- * .setSdncRequestHeader(
- * build(sdncRequestHeader()
- * .setSvcAction(SvcAction.Delete)
- * )
- * )
- * );
- * );
- * }
- * </pre>
- */
-public class MDSALUtil {
-
- public static VnfTopologyOperationInputBuilder vnfTopologyOperationInput(){return new VnfTopologyOperationInputBuilder();}
- public static VnfTopologyOperationOutputBuilder vnfTopologyOperationOutput(){return new VnfTopologyOperationOutputBuilder();}
-
- public static ServiceInformationBuilder serviceInformation(){return new ServiceInformationBuilder();}
- public static VnfRequestInformationBuilder vnfRequestInformation(){return new VnfRequestInformationBuilder();}
- public static VnfListBuilder vnfList(){return new VnfListBuilder();}
- public static ServiceDataBuilder serviceData() { return new ServiceDataBuilder();}
- public static SdncRequestHeaderBuilder sdncRequestHeader(){return new SdncRequestHeaderBuilder();}
- public static VnfInformationBuilder vnfInformation(){return new VnfInformationBuilder();}
-
-
- public static <P> P build(Builder<P> b) {
- return b == null? null :b.build();
- }
-
- public static <P,B extends Builder<P>> P build(Function<P,B> builderConstructor,P sourceDataObject){
- if(sourceDataObject == null){
- return null;
- }
- B bp = builderConstructor.apply(sourceDataObject);
- return bp.build();
- }
-
- public static <P,B extends Builder<P>> P build(Function<P,B> builderConstructor,P sourceDataObject,Consumer<B> builder){
- if(sourceDataObject == null){
- return null;
- }
- B bp = builderConstructor.apply(sourceDataObject);
- builder.accept(bp);
- return bp.build();
- }
-
- public static <I,O> O exec(Function<I,Future<RpcResult<O>>> rpc,I rpcParameter,Function<RpcResult<O>,O> rpcResult) throws Exception {
- Future<RpcResult<O>> future = rpc.apply(rpcParameter);
- return rpcResult.apply(future.get());
- }
-
-}
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/PropBuilder.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/PropBuilder.java
deleted file mode 100644
index 6ecc94c8..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/PropBuilder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi.util;
-
-import org.opendaylight.yangtools.concepts.Builder;
-
-import java.util.Properties;
-
-/**
- * A Util class that adds method chaining to the {@link #set(String, String)} to reducing the syntax needed to populate
- * {@link Properties}
- */
-public class PropBuilder implements Builder<Properties> {
-
-
- final Properties prop;
-
- public PropBuilder(Properties prop) {
- this.prop = prop;
- }
-
- public PropBuilder() {
- this.prop = new Properties();
- }
-
- public Properties build(){
- return prop;
- }
-
- public PropBuilder set(String key, String value) {
- prop.setProperty(key, value);
- return this;
- }
-
- public String get(String key) {
- return prop.getProperty(key);
- }
-
-
- public static PropBuilder propBuilder(){
- return (new PropBuilder());
- }
-} \ No newline at end of file
diff --git a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/VNFSDNSvcLogicServiceClientMockUtil.java b/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/VNFSDNSvcLogicServiceClientMockUtil.java
deleted file mode 100644
index d4d94ca8..00000000
--- a/vnfapi/provider/src/test/java/org/onap/sdnc/vnfapi/util/VNFSDNSvcLogicServiceClientMockUtil.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.sdnc.vnfapi.util;
-
-import org.onap.sdnc.vnfapi.VNFSDNSvcLogicServiceClient;
-import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
-
-import java.util.Properties;
-
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.isA;
-import static org.mockito.Mockito.when;
-import static org.onap.sdnc.vnfapi.util.MDSALUtil.build;
-import static org.onap.sdnc.vnfapi.util.PropBuilder.propBuilder;
-
-
-/**
- * VNFSDNSvcLogicServiceClientMockUtil provides a set of util methods for quickly configuring method
- * behaviour on the Mock VNFSDNSvcLogicServiceClient
- */
-public class VNFSDNSvcLogicServiceClientMockUtil {
-
-
- private final String MODULE = "VNF-API";
- private final String MODE = "sync";
- 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 networkId = "networkId";
-
-
- private final VNFSDNSvcLogicServiceClient mockVNFSDNSvcLogicServiceClient;
-
-
-
- public VNFSDNSvcLogicServiceClientMockUtil(VNFSDNSvcLogicServiceClient mockVNFSDNSvcLogicServiceClient) {
- this.mockVNFSDNSvcLogicServiceClient = mockVNFSDNSvcLogicServiceClient;
- }
-
-
- /** @param scvOperation - The scvOperation parameter to use on the {@link VNFSDNSvcLogicServiceClient} methods */
- public void setScvOperation(String scvOperation) {
- this.scvOperation = scvOperation;
- }
-
- /**
- * Configure {@link VNFSDNSvcLogicServiceClient#hasGraph(String, String, String, String)}
- * to return the specified value when when invoked with the parameters
- * {@link #MODULE}, {@link #MODE}, {@link #VERSION} and {@link #scvOperation}
- */
- public void mockHasGraph(Boolean isHasGraph) throws Exception {
- when(
- mockVNFSDNSvcLogicServiceClient
- .hasGraph(
- eq(MODULE),
- eq(scvOperation),
- eq(VERSION),
- eq(MODE)
- )
- )
- .thenReturn(isHasGraph);
- }
-
-
- /**
- * @return
- * PropBuilder - A PropBuilder populated with the expected properties returned from
- * {@link VNFSDNSvcLogicServiceClient#execute(String, String, String, String, ServiceDataBuilder, Properties)}
- */
- public PropBuilder createExecuteOKResult(){
- return propBuilder()
- .set(errorCode,"200")
- .set(errorMessage,"OK")
- .set(ackFinal,"Y")
- .set(serviceObjectPath,"serviceObjectPath: XYZ")
- .set(networkObjectPath,"networkObjectPath: XYZ")
- .set(networkId,"networkId: XYZ");
-
- }
-
-
- /**
- * Configure
- * {@link VNFSDNSvcLogicServiceClient#execute(String, String, String, String, ServiceDataBuilder, Properties)}
- * to return the specified svcResultProp when when invoked with the parameters
- * {@link #MODULE}, {@link #MODE}, {@link #VERSION} and {@link #scvOperation}
- */
- public void mockExecute(PropBuilder svcResultProp) throws Exception{
- when(
- mockVNFSDNSvcLogicServiceClient
- .execute(
- eq(MODULE),
- eq(scvOperation),
- eq(VERSION),
- eq(MODE),
- isA(ServiceDataBuilder.class),
- isA(Properties.class)
- )
- )
- .thenReturn(build(
- svcResultProp
- ));
- }
-
-}
diff --git a/vnfapi/provider/src/test/resources/proplist.properties b/vnfapi/provider/src/test/resources/proplist.properties
deleted file mode 100644
index 556de910..00000000
--- a/vnfapi/provider/src/test/resources/proplist.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# openECOMP : SDN-C
-# ================================================================================
-# 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=========================================================
-###
-
-proplist.aptFile = target/properties.apt
diff --git a/vnfapi/provider/src/test/resources/simplelogger.properties b/vnfapi/provider/src/test/resources/simplelogger.properties
deleted file mode 100644
index 14ffcca0..00000000
--- a/vnfapi/provider/src/test/resources/simplelogger.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# openECOMP : SDN-C
-# ================================================================================
-# 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.slf4j.simpleLogger.defaultLogLevel=info
-org.slf4j.simplelogger.log.org.onap.sdnc.vnfapi.VnfApiProvider=debug