Resolve healing VNF problem 59/11959/1
authorluxin <luxin7@huawei.com>
Tue, 12 Sep 2017 13:34:22 +0000 (21:34 +0800)
committerluxin <luxin7@huawei.com>
Tue, 12 Sep 2017 13:34:22 +0000 (21:34 +0800)
Change-Id: Ia656616853d27229b14e6b85f483d5a398a439b9
Issue-Id:VFC-327
Signed-off-by: luxin <luxin7@huawei.com>
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/common/ResultRequestUtil.java
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/vnf/VnfMgrVnfm.java

index 7350213..8890412 100644 (file)
@@ -245,11 +245,12 @@ public final class ResultRequestUtil {
 
             String result = null;
             String vnfPath = path.contains("%s") ? String.format(path, mgrVcmm.getRoaRand()) : path;
-            LOG.info("function=call, msg=url is {}, session is {}", vnfmObject.getString("url") + vnfPath,
-                    mgrVcmm.getAccessSession());
+            String oldUrl = vnfmObject.getString("url").trim();
+            String newUrl = oldUrl.replaceAll("30001", "30000");
+            LOG.info("function=call, msg=url is {}, session is {}", newUrl + vnfPath, mgrVcmm.getAccessSession());
             HttpRequests.Builder builder =
-                    new HttpRequests.Builder(authModel).addHeader(Constant.ACCESSSESSION, mgrVcmm.getAccessSession())
-                            .setUrl(vnfmObject.getString("url"), vnfPath).setParams(paramsJson);
+                    new HttpRequests.Builder(authModel).addHeader("X-Auth-Token", mgrVcmm.getAccessSession())
+                            .setUrl(newUrl, vnfPath).setParams(paramsJson);
             MethodType methodType = MethodType.methodType(HttpRequests.Builder.class, new Class[0]);
             MethodHandle mt =
                     MethodHandles.lookup().findVirtual(builder.getClass(), methodName, methodType).bindTo(builder);
@@ -263,8 +264,6 @@ public final class ResultRequestUtil {
 
             // logout delete tokens
             String token = mgrVcmm.getAccessSession();
-            String oldUrl = vnfmObject.getString("url").trim();
-            String newUrl = oldUrl.replaceAll("30001", "30000");
             String user = vnfmObject.getString("userName");
             removeV3Tokens(newUrl, token, user);
         } catch(IOException e) {
index e71ba27..4c2383a 100644 (file)
@@ -135,14 +135,17 @@ public class ConnectMgrVnfm {
         try {
             httpMethod = new HttpRequests.Builder(info.getAuthenticateMode())
                     .setUrl(info.getUrl(), ParamConstants.CSM_AUTH_CONNECT_SOUTH)
-                    .setParams(String.format(ParamConstants.GET_TOKENS_V3, info.getUserName(), info.getUserPwd()))
+                    .setParams(String.format(ParamConstants.GET_TOKENS_V3, info.getUserName(), info.getUserPwd(),
+                            info.getUserName()))
                     .post().execute();
             statusCode = httpMethod.getStatusCode();
 
             String result = httpMethod.getResponseBodyAsString();
-            LOG.info("connect result:" + result);
+            LOG.info("connect statusCode={}, result={}:", statusCode, result);
             if(statusCode == HttpStatus.SC_CREATED) {
-                Header header = httpMethod.getResponseHeader("accessSession");
+                LOG.info("function=connectSouth, header={}.", httpMethod.getResponseHeaders());
+                Header header = httpMethod.getResponseHeader("X-Subject-Token");
+                LOG.info("function=connectSouth, header={}.", header.getValue());
                 setAccessSession(header.getValue());
                 statusCode = HttpStatus.SC_OK;
             } else {
index f8aeded..9fa4260 100644 (file)
@@ -260,7 +260,7 @@ public class VnfMgrVnfm implements InterfaceVnfMgr {
 
             restJson.put(Constant.RETCODE, Constant.REST_SUCCESS);
         } else {
-            LOG.error("function=getJob, msg=send get vnf msg to csm get wrong status: {}", statusCode);
+            LOG.error("function=healVnf, msg=send heal vnf msg to csm get wrong status: {}", statusCode);
         }
 
         return restJson;