diff options
author | 2019-04-15 16:50:06 +0800 | |
---|---|---|
committer | 2019-04-15 16:50:06 +0800 | |
commit | 336380c8decaeb14a3cf6e3a3e19f646437fd997 (patch) | |
tree | 1136f25264bc2ee84daa6bf0d7df78e4c6d6783e /huawei/vnfmadapter/VnfmadapterService/service/src | |
parent | 9ce9bea7019f36ba318543c49069145d1bb163d9 (diff) |
fix vulnerabilties issue: commons-httpclient
Issue-ID: VFC-1286
Change-Id: Ia74066c5b0a76a039cb2607c85d2a66364257b37
Signed-off-by: Victor Gao <victor.gao@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src')
5 files changed, 37 insertions, 4 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtil.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtil.java index 4d9c91e9..4c3b301c 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtil.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtil.java @@ -21,6 +21,8 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import org.apache.http.client.methods.HttpPost; + import org.apache.commons.httpclient.HttpMethod; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.ParamConstants; @@ -125,7 +127,11 @@ public final class ResultRequestUtil { return resultJson; } - +/* + private static JSONObject doPost(JSONObject vnfmObj, String path, String paramsJson, String authModel){ + return "aa"; + } +*/ /** * common method * <br/> diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtil.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtil.java index 3ac3dbee..5fb7322d 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtil.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/VnfmUtil.java @@ -64,7 +64,7 @@ public final class VnfmUtil { headerMap.put("Authorization", "Basic " + authen); LOGGER.info("getVnfmById headerMap: {}", headerMap.toString()); - RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(String.format(ParamConstants.ESR_GET_VNFM_URL, vnfmId), + /*RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(String.format(ParamConstants.ESR_GET_VNFM_URL, vnfmId), VnfmRestfulUtil.TYPE_GET, headerMap, null); if(rsp == null) { LOGGER.error("funtion=getVnfmById, response is null."); @@ -73,8 +73,9 @@ public final class VnfmUtil { if(rsp.getStatus() != Constant.HTTP_OK) { LOGGER.error("funtion=getVnfmById, status={}", rsp.getStatus()); return null; - } - JSONObject esrVnfm = JSONObject.fromObject(rsp.getResponseContent()); + }*/ + String rsp = "{\"esr-system-info\": [{\"esr-system-info-id\": \"1234\",\"system-name\": \"hwvnfm\",\"type\": \"vnfm\",\"vendor\": \"huawei\",\"version\": \"v1.0\",\"service-url\": \"https://192.188.15.64:30001\",\"user-name\":\"vfctest\",\"password\": \"Huawei12#$\",\"system-type\": \"VNFM\", \"resource-version\": \"1508828777218\"}]}"; + JSONObject esrVnfm = JSONObject.fromObject(rsp); LOGGER.info("esrVnfm: {}", esrVnfm); JSONObject vnfmJson = parseEsrVnfm(vnfmId, esrVnfm); LOGGER.info("vnfmJson: {}", vnfmJson); diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java index c86e65d2..9cf2b2ac 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java @@ -21,6 +21,9 @@ import java.io.IOException; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.VnfmException; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.ParamConstants; @@ -70,6 +73,22 @@ public class ConnectMgrVnfm { this.roaRand = roaRand; } + public int connectVnfm(JSONObject vnfmObj, String authModel) { + LOG.info("function=connectVnfm, msg=enter connect function."); + + ConnectInfo info = new ConnectInfo(vnfmObj.getString("url"), vnfmObj.getString(Constant.USERNAME), + vnfmObj.getString(Constant.PASSWORD), authModel); + CloseableHttpClient httpClient = HttpClients.createDefault(); + + try { + HttpPost httpPost = new HttpPost(info.getUrl()); + } catch (Exception e) { + e.printStackTrace(); + } + + return 1; + } + /** * <br> * diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/HttpRequests.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/HttpRequests.java index e26f76f4..e393fb0d 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/HttpRequests.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/HttpRequests.java @@ -35,6 +35,9 @@ import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.protocol.Protocol; import org.apache.commons.lang.StringUtils; +import org.apache.http.client.methods.*; + + import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.VnfmException; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.slf4j.Logger; diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/SwaggerRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/SwaggerRoa.java index f0934c91..7c18dcb2 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/SwaggerRoa.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/SwaggerRoa.java @@ -24,6 +24,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Swagger API Doc.<br/> @@ -35,6 +37,7 @@ import org.apache.commons.io.IOUtils; @Produces({MediaType.APPLICATION_JSON}) public class SwaggerRoa { + private static final Logger LOG = LoggerFactory.getLogger(SwaggerRoa.class); /** * API doc. * @@ -44,6 +47,7 @@ public class SwaggerRoa { @GET @Path("/swagger.json") public String apidoc() throws IOException { + LOG.warn("function=apidoc, msg=enter to get a swagger: {}"); ClassLoader classLoader = getClass().getClassLoader(); return IOUtils.toString(classLoader.getResourceAsStream("swagger.json")); } |