summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml13
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java4
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java91
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java17
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java2
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/constant/CommonConstants.java4
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java4
-rw-r--r--nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java9
8 files changed, 57 insertions, 87 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
index b12c681e..4f08fa0c 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml
@@ -120,6 +120,19 @@
<artifactId>dropwizard-core</artifactId>
<version>0.8.0</version>
</dependency>
+
+ <dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.54</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
+ <version>3.6</version>
+ </dependency>
+
</dependencies>
<build>
<!--
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java
index e405f868..57276747 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java
@@ -40,8 +40,8 @@ public class AaiVnfmInfo {
@JsonProperty("resource-version")
private String resourceVersion;
- @SerializedName("esr-system-info-list")
- @JsonProperty("esr-system-info-list")
+ @SerializedName("esr-system-info")
+ @JsonProperty("esr-system-info")
private List<EsrSystemInfo> esrSystemInfoList;
public String getVnfmId() {
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java
index 9e750ea1..f5a0b8cb 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java
@@ -16,54 +16,50 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.bo.entity;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
public class EsrSystemInfo {
+ @JsonProperty("esr-system-info-id")
@SerializedName("esr-system-info-id")
private String esrSystemId;
+ @JsonProperty("system-name")
@SerializedName("system-name")
private String esrSystemName;
+ @JsonProperty("type")
@SerializedName("type")
private String type;
+ @JsonProperty("vendor")
@SerializedName("vendor")
private String vendor;
+ @JsonProperty("version")
@SerializedName("version")
private String version;
+ @JsonProperty("service-url")
@SerializedName("service-url")
private String serviceUrl;
+ @JsonProperty("user-name")
@SerializedName("user-name")
private String userName;
+ @JsonProperty("password")
@SerializedName("password")
private String password;
- @SerializedName("protocal")
- private String protocal;
+ @JsonProperty("system-type")
+ @SerializedName("system-type")
+ private String systemType;
- @SerializedName("ssl-cacert")
- private String sslCacert;
+ @JsonProperty("resource-version")
+ @SerializedName("resource-version")
+ private String resourceVersion;
- @SerializedName("ssl-insecure")
- private String sslInsecure;
-
- @SerializedName("ip-address")
- private String ip;
-
- @SerializedName("port")
- private String port;
-
- @SerializedName("cloud-domain")
- private String cloudDomain;
-
- @SerializedName("default-tenant")
- private String defaultTenant;
-
public String getEsrSystemId() {
return esrSystemId;
}
@@ -128,60 +124,19 @@ public class EsrSystemInfo {
this.password = password;
}
- public String getProtocal() {
- return protocal;
- }
-
- public void setProtocal(String protocal) {
- this.protocal = protocal;
- }
-
- public String getSslCacert() {
- return sslCacert;
- }
-
- public void setSslCacert(String sslCacert) {
- this.sslCacert = sslCacert;
- }
-
- public String getSslInsecure() {
- return sslInsecure;
+ public String getSystemType() {
+ return systemType;
}
- public void setSslInsecure(String sslInsecure) {
- this.sslInsecure = sslInsecure;
+ public void setSystemType(String systemType) {
+ this.systemType = systemType;
}
- public String getIp() {
- return ip;
+ public String getResourceVersion() {
+ return resourceVersion;
}
- public void setIp(String ip) {
- this.ip = ip;
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
}
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-
- public String getCloudDomain() {
- return cloudDomain;
- }
-
- public void setCloudDomain(String cloudDomain) {
- this.cloudDomain = cloudDomain;
- }
-
- public String getDefaultTenant() {
- return defaultTenant;
- }
-
- public void setDefaultTenant(String defaultTenant) {
- this.defaultTenant = defaultTenant;
- }
-
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java
index a8286f86..ddc78ebe 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java
@@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.impl;
import java.io.IOException;
import java.util.HashMap;
+import org.apache.commons.codec.binary.Base64;
import org.apache.http.client.ClientProtocolException;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.bo.AaiVnfmInfo;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.inf.AaiMgmrInf;
@@ -28,7 +29,6 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf;
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;
@@ -62,10 +62,19 @@ public class AaiMgmrInfImpl implements AaiMgmrInf{
private String operateHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException {
String url=adaptorEnv.getAaiApiUriFront() + httpPath;
- HashMap<String, String> map = new HashMap<>();
- map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
+ HashMap<String, String> headerMap = new HashMap<>();
+ headerMap.put("Content-Type", "application/json");
+ headerMap.put("Accept", "application/json");
+ headerMap.put("X-TransactionId", "9999");
+ headerMap.put("X-FromAppId", "esr-server");
+
+ Base64 token = new Base64();
+ String authen = new String(token.encode(("AAI:AAI").getBytes()));
+ headerMap.put("Authorization", "Basic " + authen);
+ logger.info("getVimById headerMap: {}", headerMap.toString());
+
- String responseStr = httpClientProcessor.process(url, method, map, gson.toJson(httpBodyObj)).getContent();
+ String responseStr = httpClientProcessor.process(url, method, headerMap, gson.toJson(httpBodyObj)).getContent();
return responseStr;
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
index 29d2fc2d..3e7457cb 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java
@@ -229,7 +229,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{
EsrSystemInfo systemInfo = vnfmInfo.getEsrSystemInfoList().get(0);
- String urlHead = systemInfo.getProtocal() + "://" + systemInfo.getIp() + ":" + systemInfo.getPort();
+ String urlHead = systemInfo.getServiceUrl();
adaptorEnv.setCbamApiUriFront(urlHead);
return urlHead;
}
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 052f6ee5..8115e767 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
@@ -31,7 +31,7 @@ public class CommonConstants {
//AAI path get vnfm
// /external-system/esr-vnfm-list/esr-vnfm/{vnfm-id}
- public static final String RetrieveVnfmListPath = "/external-system/esr-vnfm-list/esr-vnfm/%s";
+ public static final String RetrieveVnfmListPath = "/external-system/esr-vnfm-list/esr-vnfm/%s/esr-system-info-list";
//Nslcm path
public static final String NslcmGrantPath = "/ns/grantvnf";
@@ -43,7 +43,7 @@ public class CommonConstants {
//CBAM -- Nokia VNFM path
public static final String CBAM_TOKEN_KEY = "access_token";
public static final String RetrieveCbamTokenPath="/auth/realms/cbam/protocol/openid-connect/token";
- public static final String RetrieveCbamTokenPostStr="grant_type=%s&client_id=%s&client_secret=%s";
+ public static final String RetrieveCbamTokenPostStr="grant_type=%s&client_id=%s&client_secret=%s&usernmae=%s&password=%s";
public static final String CbamCreateVnfPath="/vnfs";
public static final String CbamInstantiateVnfPath="/vnfs/%s/instantiate";
public static final String CbamQueryVnfPath="/vnfs/%s";
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
index 3a2ca761..01c256bd 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java
@@ -56,7 +56,7 @@ public class AaiMgmrInfImplTest {
+ "\"vim-id\":\"vim-id_001\","
+ "\"certificate-url\":\"certificate-url_001\","
+ "\"resource-version\":\"resource-version_001\","
- + "\"esr-system-info-list\":[{\"ip-address\" : \"1.3.5.6\"}]"
+ + "\"esr-system-info\":[{\"type\" : \"vnfm\"}]"
+ "}"
+ "";
HttpResult httpResult = new HttpResult();
@@ -69,6 +69,6 @@ public class AaiMgmrInfImplTest {
public void testQueryVnfPackage() throws ClientProtocolException, IOException
{
AaiVnfmInfo vnfmInfo = aaiMgmr.queryVnfm(vnfmId);
- Assert.assertEquals("1.3.5.6", vnfmInfo.getEsrSystemInfoList().get(0).getIp());
+ Assert.assertEquals("vnfm", vnfmInfo.getEsrSystemInfoList().get(0).getType());
}
}
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
index 3948638c..d7834465 100644
--- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
+++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java
@@ -105,16 +105,9 @@ public class VnfmDriverMgmrImplTest {
cbamHttpHead = protocol + "://" + ip + ":" + port;
EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
- esrSystemInfo.setProtocal(protocol);
- esrSystemInfo.setIp(ip);
- esrSystemInfo.setPort(port);
- esrSystemInfo.setCloudDomain("cloudDomain");
- esrSystemInfo.setDefaultTenant("defaultTenant");
esrSystemInfo.setEsrSystemId("esrSystemId");
esrSystemInfo.setPassword("password");
- esrSystemInfo.setServiceUrl("serviceUrl");
- esrSystemInfo.setSslCacert("sslCacert");
- esrSystemInfo.setSslInsecure("sslInsecure");
+ esrSystemInfo.setServiceUrl(cbamHttpHead);
esrSystemInfo.setType("type");
esrSystemInfo.setUserName("userName");
esrSystemInfo.setVendor("vendor");