import java.util.ArrayList;
-import org.onap.aai.esr.common.SystemStatus;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.aai.CloudRegionDetail;
import org.onap.aai.esr.entity.rest.VimAuthInfo;
import org.onap.aai.esr.entity.rest.VimRegisterInfo;
-
public class VimManagerUtil {
+ private static ExtsysUtil extsysUtil = new ExtsysUtil();
- public static CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
+ public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
CloudRegionDetail cloudRegion = new CloudRegionDetail();
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo());
esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos());
- esrSystemInfoList = ExtsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
+ esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus());
+ esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
cloudRegion.setEsrSystemInfoList(esrSystemInfoList);
return cloudRegion;
}
- private static EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(ArrayList<VimAuthInfo> vimAuthInfos) {
+ private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(ArrayList<VimAuthInfo> vimAuthInfos) {
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
VimAuthInfo vimAuthInfo = new VimAuthInfo();
vimAuthInfo = vimAuthInfos.get(0);
esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl());
esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert());
esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure());
- esrSystemInfoObj.setEsrSystemInfoId(ExtsysUtil.generateId());
+ esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId());
esrSystemInfoObj.setSystemType(SystemType.VIM.toString());
- esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString());
+// esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString());
return esrSystemInfoObj;
}
- private static VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo authInfo) {
+ private VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo authInfo) {
VimAuthInfo vimAuthInfo = new VimAuthInfo();
vimAuthInfo.setAuthUrl(authInfo.getServiceUrl());
vimAuthInfo.setCloudDomain(authInfo.getCloudDomain());
return vimAuthInfo;
}
- public static VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) {
+ public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) {
VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
VimAuthInfo vimAuthInfo = new VimAuthInfo();
ArrayList<VimAuthInfo> vimAuthInfos = new ArrayList<VimAuthInfo>();
- vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0));
+ if(cloudRegion.getEsrSystemInfoList()!=null){
+ vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0));
+ vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus());
+ }
vimAuthInfos.add(vimAuthInfo);
vimRegisterInfo.setVimAuthInfos(vimAuthInfos);
vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo());