X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fesr-server.git;a=blobdiff_plain;f=esr-mgr%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fesr%2Futil%2FVimManagerUtil.java;h=0a69f40f0048d6761997ea3ff45ec2f90726c905;hp=1fc68a98303a698c3cb3c12c170a437c3ac5830e;hb=769718b3e8b4e659299602701b575cf1b4b182c5;hpb=6011cbc9b4031f3ce25a82ccb1c0fedf4a2bf57a diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java index 1fc68a9..0a69f40 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java @@ -17,6 +17,7 @@ package org.onap.aai.esr.util; import java.util.ArrayList; +import java.util.List; import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; @@ -30,8 +31,6 @@ public class VimManagerUtil { public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) { CloudRegionDetail cloudRegion = new CloudRegionDetail(); - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner()); cloudRegion.setCloudRegionId(vimRegisterInfo.getCloudRegionId()); @@ -42,23 +41,23 @@ public class VimManagerUtil { cloudRegion.setOwnerDefinedType(vimRegisterInfo.getOwnerDefinedType()); cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo()); - esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); + EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus()); - esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); + EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); cloudRegion.setEsrSystemInfoList(esrSystemInfoList); return cloudRegion; } - private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(ArrayList vimAuthInfos) { + private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List vimAuthInfos) { EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo = vimAuthInfos.get(0); + VimAuthInfo vimAuthInfo = vimAuthInfos.get(0); esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain()); esrSystemInfoObj.setUserName(vimAuthInfo.getUserName()); esrSystemInfoObj.setPassword(vimAuthInfo.getPassword()); esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl()); esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert()); esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure()); + esrSystemInfoObj.setDefaultTenant(vimAuthInfo.getDefaultTenant()); esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId()); esrSystemInfoObj.setSystemType(SystemType.VIM.toString()); // esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString()); @@ -73,15 +72,18 @@ public class VimManagerUtil { vimAuthInfo.setSslCacert(authInfo.getSslCassert()); vimAuthInfo.setSslInsecure(authInfo.getSslInsecure()); vimAuthInfo.setUserName(authInfo.getUserName()); + vimAuthInfo.setDefaultTenant(authInfo.getDefaultTenant()); return vimAuthInfo; } public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) { VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - ArrayList vimAuthInfos = new ArrayList(); - vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); - vimAuthInfos.add(vimAuthInfo); + List vimAuthInfos = new ArrayList<>(); + if(cloudRegion.getEsrSystemInfoList()!=null){ + VimAuthInfo vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); + vimAuthInfos.add(vimAuthInfo); + vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); + } vimRegisterInfo.setVimAuthInfos(vimAuthInfos); vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo()); vimRegisterInfo.setCloudOwner(cloudRegion.getCloudOwner()); @@ -91,7 +93,6 @@ public class VimManagerUtil { vimRegisterInfo.setComplexName(cloudRegion.getComplexName()); vimRegisterInfo.setCloudRegionVersion(cloudRegion.getCloudRegionVersion()); vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType()); - vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); return vimRegisterInfo; } }