summaryrefslogtreecommitdiffstats
path: root/huawei
diff options
context:
space:
mode:
authorluxin <luxin7@huawei.com>2018-01-18 16:06:31 +0800
committerluxin <luxin7@huawei.com>2018-01-18 16:06:31 +0800
commit61c585122c85c6b1133bc4eac16e55f164233ef8 (patch)
treed435dbd34baf0e19f2ef45d9ed4a04af8b4700e3 /huawei
parent5074bb2cf9c8082957de19f55cb6a0f568678930 (diff)
Add query vms interface
Query vms from svnfm Change-Id: I81f49b0bd36df47835ff1f9c217ff93a84f5ac00 Issue-ID: VFC-668 Signed-off-by: luxin <luxin7@huawei.com>
Diffstat (limited to 'huawei')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
index 98c3fe94..f40f741d 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfRoa.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.MediaType;
import org.apache.commons.collections.map.UnmodifiableMap;
import org.apache.commons.lang3.StringUtils;
+import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.ResultRequestUtil;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.VnfmJsonUtil;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.VnfmUtil;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient.ServiceException;
@@ -353,4 +354,22 @@ public class VnfRoa {
LOG.warn("function=getJobBody, jobInfoJson: {}", jobInfoJson);
return jobInfoJson.toString();
}
+
+ @GET
+ @Path("/{vnfmId}/vms")
+ public String getVms(@PathParam("vnfmId") String vnfmId, @Context HttpServletResponse resp)
+ throws ServiceException {
+ LOG.info("function=getVms, msg=enter to get vms: vnfmId: {}", vnfmId);
+ JSONObject restJson = new JSONObject();
+ JSONObject vnfmObjcet = VnfmUtil.getVnfmById(vnfmId);
+ if(vnfmObjcet.isNullObject()) {
+ LOG.error("function=getVnf, msg=vnfm not exists, vnfmId: {}", vnfmId);
+ restJson.put("message", "vnfm not exists");
+ return restJson.toString();
+ }
+ String url = "/v2/vapps/instances/query/vms";
+ restJson = ResultRequestUtil.call(vnfmObjcet, url, Constant.GET, null, Constant.CERTIFICATE);
+ LOG.info("function=getVms, restJson: {}", restJson);
+ return restJson.getString("data");
+ }
}