From 9341cde619d14842368b5b26cce1e41021a74683 Mon Sep 17 00:00:00 2001 From: luxin Date: Wed, 27 Sep 2017 16:28:28 +0800 Subject: Define constant instead of localhost Change-Id: Idcf4f03cf564a1a454502f9b4382cb603239fc51 Issue-Id:VFC-391 Signed-off-by: luxin --- .../nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java | 1 + .../vnfm/svnfm/vnfmadapter/common/restclient/HttpBaseRest.java | 7 +++---- .../vnfmadapter/service/adapter/impl/AdapterResourceManager.java | 2 +- .../vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java | 2 ++ 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'huawei/vnfmadapter/VnfmadapterService') diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java index 110d170b..24d6ed11 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/DownloadCsarManager.java @@ -212,6 +212,7 @@ public class DownloadCsarManager { zipFile.close(); } catch(IOException e) { LOG.error("IOException: " + e); + ; } } } diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/HttpBaseRest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/HttpBaseRest.java index 45e1c753..cc80b5ed 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/HttpBaseRest.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/restclient/HttpBaseRest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Huawei Technologies Co., Ltd. + * Copyright 2016-2017 Huawei Technologies Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import org.eclipse.jetty.client.Address; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpExchange; import org.eclipse.jetty.http.HttpMethods; +import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,11 +50,9 @@ public abstract class HttpBaseRest implements Restful { protected HttpClient client = null; - private static final String LOCAL_HOST = "127.0.0.1"; - static final String HTTP_PATCH = "PATCH"; - String defaultIP = LOCAL_HOST; + String defaultIP = Constant.LOCAL_HOST; int defaultPort = -10000; diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java index 64e852e4..420d8eb0 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java @@ -395,7 +395,7 @@ public class AdapterResourceManager implements IResourceManager { JSONArray resArray = new JSONArray(); if(url == null || url.equals("")) { - url = "http://127.0.0.1:31943"; + url = "http://" + Constant.LOCAL_HOST + ":31943"; } // get vim_id diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java index 936be09c..3b1036e2 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java @@ -156,6 +156,8 @@ public class Constant { public static final String USERNAME = "userName"; + public static final String LOCAL_HOST = "127.0.0.1"; + private Constant() { // private constructor } -- cgit 1.2.3-korg