summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGao Weitao <victor.gao@huawei.com>2017-09-26 02:47:59 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-26 02:47:59 +0000
commit6954a62508d173e40cd18ffe2d4c3e8bd1c5b886 (patch)
treee5126e33b4e2cf4908a5dc73b8102c07e90db7a4
parent08a947280e9fbf94bc1e119869384ec874cf802e (diff)
parent24ca0c1ac3a84de0bfe0a35d0db9883439bb5777 (diff)
Merge "Add constant instead of duplicating literal"
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java2
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java36
2 files changed, 24 insertions, 14 deletions
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 77c0fcc3..936be09c 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
@@ -63,6 +63,8 @@ public class Constant {
public static final String HEADER_AUTH_TOKEN = "accessSession";
+ public static final String X_AUTH_TOKEN = "X-Auth-Token";
+
public static final String DOWNLOADCSAR_SUCCESS = "Success";
public static final int UNZIP_SUCCESS = 0;
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 c2c6d5c0..c86e65d2 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
@@ -42,6 +42,14 @@ public class ConnectMgrVnfm {
private static final Logger LOG = LoggerFactory.getLogger(ConnectMgrVnfm.class);
+ private static final String CONNECT_FAIL = "connect fail, code:";
+
+ private static final String CONNECT_JSONEXCEPTION = "function=connect, msg=connect JSONException e={}.";
+
+ private static final String CONNECT_VNFMEXCEPTION = "function=connect, msg=connect VnfmException e={}.";
+
+ private static final String CONNECT_IOEXCEPTION = "function=connect, msg=connect IOException e={}.";
+
private String accessSession;
private String roaRand;
@@ -63,10 +71,10 @@ public class ConnectMgrVnfm {
}
/**
- * Make connection
* <br>
- *
+ *
* @param vnfmObj
+ * @param authModel
* @return
* @since VFC 1.0
*/
@@ -95,15 +103,15 @@ public class ConnectMgrVnfm {
setRoaRand(tokenObj.getString("roa_rand"));
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {
@@ -149,15 +157,15 @@ public class ConnectMgrVnfm {
setAccessSession(header.getValue());
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {
@@ -201,15 +209,15 @@ public class ConnectMgrVnfm {
setRoaRand(tokenObj.getString("roa_rand"));
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {