summaryrefslogtreecommitdiffstats
path: root/nokia/vnfmdriver
diff options
context:
space:
mode:
Diffstat (limited to 'nokia/vnfmdriver')
-rwxr-xr-xnokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh4
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql2
-rwxr-xr-xnokia/vnfmdriver/vfcadaptorservice/docker/Dockerfile2
-rwxr-xr-xnokia/vnfmdriver/vfcadaptorservice/docker/init-mysql.sh2
-rwxr-xr-xnokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh10
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml11
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java7
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java10
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java1
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java28
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/bo/MsbServiceInfo.java66
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java137
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/inf/IMsbMgmr.java6
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmGrantVnfResponse.java10
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/NslcmVimInfo.java (renamed from nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimInfo.java)21
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimAssets.java12
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java3
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java26
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java25
21 files changed, 289 insertions, 136 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh
index 8b77e28d..a200e513 100755
--- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh
+++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh
@@ -44,10 +44,12 @@ fi
echo
echo "DB-INIT [vnfm_db] : START"
-mysql -u$1 -p$2 -h$3 -P$4 <$(cd `dirname $0`; pwd)/db/mysql/db-schema.sql
+echo "start to create database and tables ... "
+mysql -u$1 -p$2 -h$3 -P$4 <$(cd `dirname $0`; pwd)/db/mysql/db-schema.sql > myout_init_db.file 2>&1
if [ $? != 0 ] ; then
echo "DB-INIT [vnfm_db] : FAILED !"
+ cat myout_init_db.file
exit 1
fi
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
index 1b2b6027..2f2c8913 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
+++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql
@@ -17,7 +17,7 @@
/******************drop old database and user***************************/
use mysql;
-drop database IF EXISTS vnfm_db;
+drop database IF EXISTS vnfm_db;
delete from user where User='vnfm';
FLUSH PRIVILEGES;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/Dockerfile b/nokia/vnfmdriver/vfcadaptorservice/docker/Dockerfile
index 6bcd1dbb..05d261a9 100755
--- a/nokia/vnfmdriver/vfcadaptorservice/docker/Dockerfile
+++ b/nokia/vnfmdriver/vfcadaptorservice/docker/Dockerfile
@@ -25,6 +25,8 @@ RUN wget -q http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm && rp
RUN yum -y update
RUN yum -y install -y mysql-server
RUN mysql_install_db --user=mysql --datadir=/var/lib/mysql
+EXPOSE 3306
+RUN sed -i "s|bind-address.*|# bind-address = 127.0.0.1|" /etc/my.cnf
COPY init-mysql.sh .
# 30-tomcat.txt - AUTOGENERATED, DO NOT MODIFY MANUALLY
diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/init-mysql.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/init-mysql.sh
index a11592cf..50fc17f5 100755
--- a/nokia/vnfmdriver/vfcadaptorservice/docker/init-mysql.sh
+++ b/nokia/vnfmdriver/vfcadaptorservice/docker/init-mysql.sh
@@ -17,6 +17,6 @@
# Wait for mysql to initialize; Set mysql root password
echo Initializing mysql
for i in {1..10}; do
- /usr/bin/mysqladmin -u vnfm password 'vnfmpass' &> /dev/null && break
+ /usr/bin/mysqladmin -u root password 'rootpass' &> /dev/null && break
sleep $i
done
diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh
index 39e85026..69e2b25d 100755
--- a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh
+++ b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh
@@ -16,6 +16,14 @@
#
# Config mysql credentials
+function start_mysql {
+ echo "start mysql ... "
+ service mysql start
+ sleep 1
+}
+
+start_mysql
+
# Initialize MySQL schema
cd bin
-./init_db.sh vnfm vnfmpass 127.0.0.1 3306
+./init_db.sh root rootpass 127.0.0.1 3306
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
index 3bdebb80..89b06760 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
@@ -111,17 +111,6 @@
<artifactId>json</artifactId>
</dependency>
<dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.39</version>
- </dependency>
-
- <dependency>
- <groupId>org.onap.msb.java-sdk</groupId>
- <artifactId>msb-java-sdk</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.8.0</version>
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
index 42c91058..28400ed0 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java
@@ -32,7 +32,10 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VimInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VnfExtCpData;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AccessInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.GrantInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimComputeResourceFlavour;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest;
@@ -59,15 +62,21 @@ public class Driver2CbamRequestConverter {
VimInfo vim = new VimInfo();
EndpointInfo inter = new EndpointInfo();
OpenstackV3Info openstackV3 = new OpenstackV3Info();
-
- vim.setId(nslc.getVim().getVimId());
- openstackV3.setId(nslc.getVim().getVimId());
- inter.setEndpoint(nslc.getVim().getInterfaceEndpoint());
+ List<NslcmVimInfo> nslcmVim=nslc.getVim();
+ for(int i=0;i<=nslcmVim.size();i++) {
+ vim.setId(nslcmVim.get(i).getVimInfoId());
+ openstackV3.setId(nslcmVim.get(i).getVimId());
+ inter.setEndpoint(nslcmVim.get(i).getInterfaceEndpoint());
openstackV3.setInterfaceInfo(inter);
OpenStackAccessInfoV3 v3 = new OpenStackAccessInfoV3();
- v3.setUsername(nslc.getVim().getAccessInfo().getUsername());
- v3.setPassword(nslc.getVim().getAccessInfo().getPassword());
+ List<AccessInfo> accessInfo=nslcmVim.get(i).getAccessInfo();
+ for(int j=0;j<=accessInfo.size();j++) {
+ v3.setUsername(accessInfo.get(j).getUsername());
+ v3.setPassword(accessInfo.get(j).getPassword());
+ }
openstackV3.setAccessInfo(v3);
+ }
+
vims.add(vim);
List<ExtVirtualLinkData> list = new ArrayList<ExtVirtualLinkData>();
ExtVirtualLinkData ext = new ExtVirtualLinkData();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
index e8bb6be4..a3fb8e57 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java
@@ -20,18 +20,15 @@ import java.io.IOException;
import java.util.HashMap;
import org.apache.http.client.ClientProtocolException;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.CatalogQueryVnfResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf.CatalogMgmrInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VnfPackageInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMethod;
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
index 4a9570b5..e9a706c5 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/common/bo/AdaptorEnv.java
@@ -56,6 +56,8 @@ public class AdaptorEnv {
//cbamApiFront is from aai query
private String cbamApiUriFront;
+
+ private String msbApiUriFront;
// for retrieving token from CBAM, configured in application.properties
@Value("${grantType}")
@@ -211,5 +213,13 @@ public class AdaptorEnv {
this.lcmApiUriFront = lcmApiUriFront;
}
+ public String getMsbApiUriFront() {
+ return msbApiUriFront;
+ }
+
+ public void setMsbApiUriFront(String msbApiUriFront) {
+ this.msbApiUriFront = msbApiUriFront;
+ }
+
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
index aefd996a..052f6ee5 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java
@@ -68,4 +68,5 @@ public class CommonConstants {
public static final String MSB_REGISTER_SERVICE_PATH = "/api/microservices/v1/services";
// public static final String MSB_REGISTER_SERVICE_PATH = "/api/microservices/v1/services/{serviceName}/version/{version}/nodes/{ip}/{port}";
public static final String MSB_UNREGISTER_SERVICE_PATH = "/api/microservices/v1/services/%s/version/%s/nodes/%s/%s";
+ public static final String MSB_QUERY_SERVICE_PATH = "/api/microservices/v1/services/%s/version/%s";
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
index 30da37e3..eddc51a5 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/init/EnvVariablesInitialization.java
@@ -18,9 +18,9 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.init;
import java.io.IOException;
+import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;
import org.json.JSONObject;
-import org.onap.msb.sdk.discovery.common.RouteException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.util.CommonUtil;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
@@ -53,42 +53,47 @@ public class EnvVariablesInitialization implements ApplicationRunner {
try {
handleAaiMsbServiceInfo();
- } catch (RouteException e) {
+ } catch (Exception e) {
logger.error("handleAaiMsbServiceInfo error", e);
}
try {
handLcmMsbServiceInfo();
- } catch (RouteException e) {
+ } catch (Exception e) {
logger.error("handLcmMsbServiceInfo error", e);
}
try {
handCatalogMsbServiceInfo();
- } catch (RouteException e) {
+ } catch (Exception e) {
logger.error("handCatalogMsbServiceInfo error", e);
}
}
- private void handleAaiMsbServiceInfo() throws RouteException {
- String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndPort(adaptorEnv.getAaiServiceNameInMsb(), adaptorEnv.getAaiVersionInMsb());
+ private void handleAaiMsbServiceInfo() throws ClientProtocolException, IOException {
+ String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion(adaptorEnv.getAaiServiceNameInMsb(), adaptorEnv.getAaiVersionInMsb());
adaptorEnv.setAaiUrlInMsb(urlInMsb);
adaptorEnv.setAaiApiUriFront(generateApiUriFront(urlInMsb));
}
private String generateApiUriFront(String urlInMsb) {
- return CommonConstants.SCHEMA_HTTP + "://" + adaptorEnv.getMsbIp() + ":" + adaptorEnv.getMsbPort() + urlInMsb;
+ return generateMsbApiUriFront() + urlInMsb;
+ }
+
+ private String generateMsbApiUriFront()
+ {
+ return CommonConstants.SCHEMA_HTTP + "://" + adaptorEnv.getMsbIp() + ":" + adaptorEnv.getMsbPort();
}
- private void handLcmMsbServiceInfo() throws RouteException {
- String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndPort(adaptorEnv.getLcmServiceNameInMsb(), adaptorEnv.getLcmVersionInMsb());
+ private void handLcmMsbServiceInfo() throws ClientProtocolException, IOException {
+ String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion(adaptorEnv.getLcmServiceNameInMsb(), adaptorEnv.getLcmVersionInMsb());
adaptorEnv.setLcmUrlInMsb(urlInMsb);
adaptorEnv.setLcmApiUriFront(generateApiUriFront(urlInMsb));
}
- private void handCatalogMsbServiceInfo() throws RouteException {
- String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndPort(adaptorEnv.getCatalogServiceNameInMsb(), adaptorEnv.getCatalogVersionInMsb());
+ private void handCatalogMsbServiceInfo() throws ClientProtocolException, IOException {
+ String urlInMsb = msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion(adaptorEnv.getCatalogServiceNameInMsb(), adaptorEnv.getCatalogVersionInMsb());
adaptorEnv.setCatalogUrlInMsb(urlInMsb);
adaptorEnv.setCatalogApiUriFront(generateApiUriFront(urlInMsb));
}
@@ -102,6 +107,7 @@ public class EnvVariablesInitialization implements ApplicationRunner {
adaptorEnv.setMsbIp(msb_ip);
adaptorEnv.setMsbPort(msb_port);
+ adaptorEnv.setMsbApiUriFront(generateMsbApiUriFront());
}
private String readMsbInfoFromJsonFile() throws IOException {
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/bo/MsbServiceInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/bo/MsbServiceInfo.java
new file mode 100644
index 00000000..0ca55017
--- /dev/null
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/bo/MsbServiceInfo.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2016-2017, Nokia Corporation
+ *
+ * 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.
+ */
+
+package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.bo;
+
+public class MsbServiceInfo {
+ private String serviceName;
+ private String version;
+ private String protocol;
+ private String visualRange;
+ private String url;
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getVisualRange() {
+ return visualRange;
+ }
+
+ public void setVisualRange(String visualRange) {
+ this.visualRange = visualRange;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
index 7738b2f2..78dcf413 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java
@@ -17,98 +17,129 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.impl;
import java.io.IOException;
+import java.util.HashMap;
-import org.onap.msb.sdk.discovery.common.RouteException;
-import org.onap.msb.sdk.discovery.entity.MicroServiceFullInfo;
-import org.onap.msb.sdk.discovery.entity.MicroServiceInfo;
-import org.onap.msb.sdk.discovery.entity.RouteResult;
-import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
+import org.apache.http.client.ClientProtocolException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.util.CommonUtil;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.bo.MsbServiceInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.inf.IMsbMgmr;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestMethod;
-import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
@Component
public class MsbMgmrImpl implements IMsbMgmr {
private static final Logger logger = LoggerFactory.getLogger(MsbMgmrImpl.class);
-
+
@Autowired
AdaptorEnv adaptorEnv;
-
+
+ @Autowired
+ HttpClientProcessorInf httpClientProcessor;
+
private Gson gson = new Gson();
-
+
@Override
public void register() {
+
try {
- String vfcAdaptorInfoJsonStr = readVfcAdaptorInfoFromJsonFile();
-
- JSON json = com.alibaba.fastjson.JSON.parseObject(vfcAdaptorInfoJsonStr);
- MicroServiceInfo msinfo = com.alibaba.fastjson.JSON.toJavaObject(json , MicroServiceInfo.class);
-
- MSBServiceClient msbClient = new MSBServiceClient(adaptorEnv.getMsbIp(), adaptorEnv.getMsbPort());
- MicroServiceFullInfo microServiceInfo = msbClient.registerMicroServiceInfo(msinfo);
- logger.info("Registered service response info is " + microServiceInfo.toString());
+ String url = adaptorEnv.getMsbApiUriFront() + CommonConstants.MSB_REGISTER_SERVICE_PATH;
+ HashMap<String, String> map = new HashMap<>();
+ map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
+
+ String bodyPostStr = readVfcAdaptorInfoFromJsonFile();
+
+ HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.POST, map, bodyPostStr);
+ String responseStr = httpResult.getContent();
+
+ logger.info("MsbMgmrImpl -> register, responseStr is " + responseStr);
- } catch (RouteException e) {
- logger.error("RouteException Failed to register nokia vnfm driver! ", e);
+ if(httpResult.getStatusCode() == 201)
+ {
+ logger.info("MsbMgmrImpl -> register, Successfully ");
+ }
+ else
+ {
+ logger.error("MsbMgmrImpl -> register Error, statusCode = " + httpResult.getStatusCode());
+ }
+
} catch (IOException e) {
logger.error("IOException Failed to register nokia vnfm driver! ", e);
}
-
+
}
-
+
private String readVfcAdaptorInfoFromJsonFile() throws IOException {
- String filePath = "/etc/adapterInfo/vnfmadapterinfo.json";
+ String filePath = "/etc/adapterInfo/vnfmadapterinfo.json";
String fileContent = CommonUtil.getJsonStrFromFile(filePath);
- return fileContent;
- }
+ return fileContent;
+ }
@Override
public void unregister() {
try {
- String jsonStr = readVfcAdaptorInfoFromJsonFile();
- MicroServiceInfo msinfo = gson.fromJson(jsonStr, MicroServiceInfo.class);
-
- MSBServiceClient msbClient = new MSBServiceClient(adaptorEnv.getMsbIp(), adaptorEnv.getMsbPort());
- RouteResult routeResult = msbClient.cancelMicroServiceInfo(msinfo.getServiceName(), msinfo.getVersion());
- logger.info("unregistered service response info is " + routeResult.toString());
+ String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_UNREGISTER_SERVICE_PATH);
+
+ HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.DELETE, null, null);
+ String responseStr = httpResult.getContent();
+
+ logger.info("MsbMgmrImpl -> unregister, responseStr is " + responseStr);
+ if(httpResult.getStatusCode() == 204)
+ {
+ logger.info("MsbMgmrImpl -> register, Successfully ");
+ }
+ else
+ {
+ logger.error("MsbMgmrImpl -> register Error, statusCode = " + httpResult.getStatusCode());
+ }
+
+ } catch (Exception e) {
+ logger.error("IOException Failed to unregister nokia vnfm driver! ", e);
+ }
+
+ }
+
+ public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws ClientProtocolException, IOException {
+ String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version);
+
+ HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null);
+
+ String responseStr = httpResult.getContent();
+ logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr);
+ String serviceUrl = "";
+ if(httpResult.getStatusCode() == 200)
+ {
+ MsbServiceInfo serviceInfo = gson.fromJson(responseStr, MsbServiceInfo.class);
+ if (null == serviceInfo) {
+ logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version);
+ }
- } catch (IOException e) {
- logger.error("Failed to read vfcadaptor info! ", e);
- } catch (RouteException e) {
- logger.error("Failed to register nokia vnfm driver! ", e);
+ serviceUrl = serviceInfo.getUrl();
+ logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl);
+ }
+ else
+ {
+ logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error, statusCode = " + httpResult.getStatusCode());
}
+
+
+ return serviceUrl;
}
-
- public String getServiceUrlInMsbBySeriveNameAndPort(String serviceName, String version) throws RouteException
- {
- String serviceUrl = null;
- MSBServiceClient msbClient = new MSBServiceClient(adaptorEnv.getMsbIp(), adaptorEnv.getMsbPort());
- MicroServiceFullInfo microServiceInfo = msbClient.queryMicroServiceInfo(serviceName, version);
- if(null == microServiceInfo)
- {
- logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version);
- }
- else
- {
- serviceUrl = microServiceInfo.getUrl();
- logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl);
- }
- return serviceUrl;
-
- }
public void setAdaptorEnv(AdaptorEnv env) {
this.adaptorEnv = env;
}
-
+
public static final void main(String[] args) {
MsbMgmrImpl impl = new MsbMgmrImpl();
impl.register();
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/inf/IMsbMgmr.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/inf/IMsbMgmr.java
index f63b5a56..be9043e6 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/inf/IMsbMgmr.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/inf/IMsbMgmr.java
@@ -16,10 +16,12 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.inf;
-import org.onap.msb.sdk.discovery.common.RouteException;
+import java.io.IOException;
+
+import org.apache.http.client.ClientProtocolException;
public interface IMsbMgmr {
public void register();
public void unregister();
- public String getServiceUrlInMsbBySeriveNameAndPort(String serviceName, String version) throws RouteException;
+ public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws ClientProtocolException, IOException;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmGrantVnfResponse.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmGrantVnfResponse.java
index b5f0fec1..8a0dd538 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmGrantVnfResponse.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmGrantVnfResponse.java
@@ -19,25 +19,27 @@ import java.util.List;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
public class NslcmGrantVnfResponse {
@JsonProperty("vim")
- private VimInfo vim;
+ private List<NslcmVimInfo> vim;
@JsonProperty("vimAssets")
private VimAssets vimAssets;
@JsonProperty("additionalParam")
private List<ResourceDefinition> additionalParam;
- public VimInfo getVim() {
+
+
+ public List<NslcmVimInfo> getVim() {
return vim;
}
- public void setVim(VimInfo vim) {
+ public void setVim(List<NslcmVimInfo> vim) {
this.vim = vim;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
index bdfdf848..ccfe8f25 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/NslcmNotifyLCMEventsRequest.java
@@ -15,6 +15,8 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo;
+import java.util.List;
+
import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVirtualLink;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVirtualStorage;
@@ -34,11 +36,11 @@ public class NslcmNotifyLCMEventsRequest {
@JsonProperty("jobId")
private String jobId;
@JsonProperty("affectedVnfc")
- private AffectedVnfc affectedVnfc;
+ private List<AffectedVnfc> affectedVnfc;
@JsonProperty("affectedVl")
- private AffectedVirtualLink affectedVl;
+ private List<AffectedVirtualLink> affectedVl;
@JsonProperty("affectedVirtualStorage")
- private AffectedVirtualStorage affectedVirtualStorage;
+ private List<AffectedVirtualStorage> affectedVirtualStorage;
public CommonEnum.status getStatus() {
return status;
}
@@ -63,27 +65,26 @@ public class NslcmNotifyLCMEventsRequest {
public void setJobId(String jobId) {
this.jobId = jobId;
}
- public AffectedVnfc getAffectedVnfc() {
+ public List<AffectedVnfc> getAffectedVnfc() {
return affectedVnfc;
}
- public void setAffectedVnfc(AffectedVnfc affectedVnfc) {
+ public void setAffectedVnfc(List<AffectedVnfc> affectedVnfc) {
this.affectedVnfc = affectedVnfc;
}
- public AffectedVirtualLink getAffectedVl() {
+ public List<AffectedVirtualLink> getAffectedVl() {
return affectedVl;
}
- public void setAffectedVl(AffectedVirtualLink affectedVl) {
+ public void setAffectedVl(List<AffectedVirtualLink> affectedVl) {
this.affectedVl = affectedVl;
}
- public AffectedVirtualStorage getAffectedVirtualStorage() {
+ public List<AffectedVirtualStorage> getAffectedVirtualStorage() {
return affectedVirtualStorage;
}
- public void setAffectedVirtualStorage(AffectedVirtualStorage affectedVirtualStorage) {
+ public void setAffectedVirtualStorage(List<AffectedVirtualStorage> affectedVirtualStorage) {
this.affectedVirtualStorage = affectedVirtualStorage;
}
-
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/NslcmVimInfo.java
index 8bb63490..268840f7 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/NslcmVimInfo.java
@@ -15,9 +15,11 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity;
+import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonProperty;
-public class VimInfo {
+public class NslcmVimInfo {
@JsonProperty("vimInfoId")
private String vimInfoId;
@@ -25,9 +27,9 @@ public class VimInfo {
@JsonProperty("vimId")
private String vimId;
@JsonProperty("interfaceInfo")
- private InterfaceInfo interfaceInfo;
+ private List<InterfaceInfo> interfaceInfo;
@JsonProperty("accessInfo")
- private AccessInfo accessInfo;
+ private List<AccessInfo> accessInfo;
@JsonProperty("interfaceEndpoint")
private String interfaceEndpoint;
@@ -47,20 +49,23 @@ public class VimInfo {
public void setVimId(String vimId) {
this.vimId = vimId;
}
-
- public InterfaceInfo getInterfaceInfo() {
+
+
+
+
+ public List<InterfaceInfo> getInterfaceInfo() {
return interfaceInfo;
}
- public void setInterfaceInfo(InterfaceInfo interfaceInfo) {
+ public void setInterfaceInfo(List<InterfaceInfo> interfaceInfo) {
this.interfaceInfo = interfaceInfo;
}
- public AccessInfo getAccessInfo() {
+ public List<AccessInfo> getAccessInfo() {
return accessInfo;
}
- public void setAccessInfo(AccessInfo accessInfo) {
+ public void setAccessInfo(List<AccessInfo> accessInfo) {
this.accessInfo = accessInfo;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimAssets.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimAssets.java
index 041e6413..a2199436 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimAssets.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/bo/entity/VimAssets.java
@@ -15,20 +15,24 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity;
+import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class VimAssets {
@JsonProperty("softwareImage")
- private VimSoftwareImage softwareImage;
+ private List<VimSoftwareImage> softwareImage;
- public VimSoftwareImage getSoftwareImage() {
+ public List<VimSoftwareImage> getSoftwareImage() {
return softwareImage;
}
- public void setSoftwareImage(VimSoftwareImage softwareImage) {
+ public void setSoftwareImage(List<VimSoftwareImage> softwareImage) {
this.softwareImage = softwareImage;
- }
+ }
+
+
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
index d5130893..e61323da 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/impl/VnfContinueProcessorImpl.java
@@ -18,7 +18,6 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.impl;
import java.util.concurrent.Executors;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor.Cbam2DriverResponseConverter;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor.Driver2CbamRequestConverter;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor.InstantiateVnfContinueRunnable;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor.TerminateVnfContinueRunnable;
@@ -29,7 +28,9 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.inf.NslcmMgmrInf;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.inf.VnfContinueProcessorInf;
+import org.springframework.stereotype.Component;
+@Component
public class VnfContinueProcessorImpl implements VnfContinueProcessorInf{
@Override
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java
index 8e175e63..aa1a0217 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImplTest.java
@@ -16,14 +16,22 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.impl;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.http.client.ClientProtocolException;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.msb.sdk.discovery.common.RouteException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpResult;
+import org.springframework.web.bind.annotation.RequestMethod;
public class MsbMgmrImplTest {
@InjectMocks
@@ -40,23 +48,29 @@ public class MsbMgmrImplTest {
env.setMsbPort(80);
msbMgmr.setAdaptorEnv(env);
MockitoAnnotations.initMocks(this);
+
+ String json = "{\"serviceName\":\"catalog\", \"url\":\"/api/catalog/v1\"}";
+ HttpResult httpResult = new HttpResult();
+ httpResult.setContent(json);
+
+ when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult);
}
- @Test(expected = RuntimeException.class)
+ @Test
public void testRegister()
{
msbMgmr.register();
}
- @Test(expected = RuntimeException.class)
+ @Test
public void testunRegister()
{
msbMgmr.unregister();
}
- @Test(expected = RouteException.class)
- public void testGetServiceUrlInMsbBySeriveNameAndPort() throws RouteException
+ @Test
+ public void testGetServiceUrlInMsbBySeriveNameAndPort() throws ClientProtocolException, IOException
{
- msbMgmr.getServiceUrlInMsbBySeriveNameAndPort("serviceName", "88");
+ msbMgmr.getServiceUrlInMsbBySeriveNameAndVersion("serviceName", "88");
}
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
index ddff4ca2..47c33bf1 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImplTest.java
@@ -45,7 +45,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.AffectedVnfc;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.InterfaceInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimAssets;
-import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimInfo;
+import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.NslcmVimInfo;
import org.springframework.web.bind.annotation.RequestMethod;
import com.google.gson.Gson;
@@ -87,18 +87,21 @@ public class NslcmMgmrImplTest {
additionalParam2.add(resource);
gresponse.setAdditionalParam(additionalParam2);
- VimInfo vim = new VimInfo();
- vim.setInterfaceEndpoint("interfaceEndpoint");
- vim.setVimId("vimId");
- AccessInfo accessInfo = null;
- vim.setAccessInfo(accessInfo );
- InterfaceInfo interfaceInfo = null;
- vim.setInterfaceInfo(interfaceInfo);
+ List<NslcmVimInfo> vim = new ArrayList<NslcmVimInfo>();
+ NslcmVimInfo vims=new NslcmVimInfo();
+ vims.setInterfaceEndpoint("interfaceEndpoint");
+ vims.setVimId("vimId");
+ List<AccessInfo> accessInfo = null;
+ vims.setAccessInfo(accessInfo);
+ List<InterfaceInfo> interfaceInfo = null;
+ vims.setInterfaceInfo(interfaceInfo);
+
+ vim.add(vims);
VimAssets vimAssets = null;
gresponse.setVimAssets(vimAssets);
- gresponse.setVim(vim );
+ gresponse.setVim(vim);
String json = gson.toJson(gresponse);
HttpResult httpResult = new HttpResult();
httpResult.setContent(json);
@@ -139,9 +142,9 @@ public class NslcmMgmrImplTest {
cbamRequest.setJobId("jobId");
cbamRequest.setOperation("operation");
cbamRequest.setVnfInstanceId(vnfInstanceId);
- AffectedVirtualStorage affectedVirtualStorage = new AffectedVirtualStorage();
+ List<AffectedVirtualStorage> affectedVirtualStorage = new ArrayList<AffectedVirtualStorage>();
cbamRequest.setAffectedVirtualStorage(affectedVirtualStorage );
- AffectedVnfc affectedVnfc = new AffectedVnfc();
+ List<AffectedVnfc> affectedVnfc = new ArrayList<AffectedVnfc>();
cbamRequest.setAffectedVnfc(affectedVnfc );
nslcmMgmr.notifyVnf(cbamRequest, vnfInstanceId);
}