summaryrefslogtreecommitdiffstats
path: root/esr-mgr
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-09-12 17:24:52 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-09-12 17:24:52 +0800
commitbc65f229b176269aaf9fe0cee5cf5f9e42a5d455 (patch)
treed40d162a17b6905a718144bbc611436bcf4df5bc /esr-mgr
parentbb02e67db383ee68af8179c350e07a6c1ddffca9 (diff)
Realize the data transformation of VNFM.
Realize the data transformation of VNFM between AAI and ESR. Change-Id: I74575bf7a3b2202b97d753ce2a23b846acbd2c60 Issue-ID: AAI-286 Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr-mgr')
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java1
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java75
2 files changed, 75 insertions, 1 deletions
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 54720ce..6194b10 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
@@ -21,7 +21,6 @@ import org.onap.aai.esr.common.SystemStatus;
import org.onap.aai.esr.common.SystemType;
import org.onap.aai.esr.entity.aai.AuthInfo;
import org.onap.aai.esr.entity.aai.CloudRegion;
-import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
import org.onap.aai.esr.entity.rest.VimAuthInfo;
import org.onap.aai.esr.entity.rest.VimRegisterInfo;
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java
new file mode 100644
index 0000000..531e84e
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2017 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.aai.esr.util;
+
+import org.onap.aai.esr.common.SystemType;
+import org.onap.aai.esr.entity.aai.AuthInfo;
+import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
+import org.onap.aai.esr.entity.aai.EsrVnfm;
+import org.onap.aai.esr.entity.rest.VnfmRegisterInfo;
+
+public class VnfmManagerUtil {
+
+ public EsrVnfm vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) {
+ EsrVnfm esrVnfm = new EsrVnfm();
+ EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList();
+ AuthInfo authInfo = new AuthInfo();
+ esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl());
+ esrVnfm.setResouceVersion(vnfmRegisterInfo.getVersion());
+ esrVnfm.setVimId(vnfmRegisterInfo.getVimId());
+ esrVnfm.setVnfmId(ExtsysUtil.generateId());
+ authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo);
+ esrSystemInfo = ExtsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo);
+ esrVnfm.setEsrSystemInfoList(esrSystemInfo);
+ return esrVnfm;
+ }
+
+ /**
+ * @param vnfmRegisterInfo vnfm register informantion from portal
+ * @return
+ */
+ private AuthInfo getAuthInfoFromVnfmRegisterInfo(VnfmRegisterInfo vnfmRegisterInfo) {
+ AuthInfo authInfo = new AuthInfo();
+ authInfo.setEsrSystemInfoId(ExtsysUtil.generateId());
+ authInfo.setSystemName(vnfmRegisterInfo.getName());
+ authInfo.setType(vnfmRegisterInfo.getType());
+ authInfo.setVendor(vnfmRegisterInfo.getVendor());
+ authInfo.setVersion(vnfmRegisterInfo.getVersion());
+ authInfo.setServiceUrl(vnfmRegisterInfo.getUrl());
+ authInfo.setUserName(vnfmRegisterInfo.getUserName());
+ authInfo.setPassword(vnfmRegisterInfo.getPassword());
+ authInfo.setSystemType(SystemType.VNFM.toString());
+ return authInfo;
+ }
+
+ public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfm esrVnfm) {
+ VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
+ AuthInfo authInfo = new AuthInfo();
+ vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId());
+ vnfmRegisterInfo.setCertificateUrl(esrVnfm.getCertificateUrl());
+ vnfmRegisterInfo.setVimId(esrVnfm.getVimId());
+ authInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo().getEsrSystemInfo().get(0);
+ vnfmRegisterInfo.setName(authInfo.getSystemName());
+ vnfmRegisterInfo.setPassword(authInfo.getPassword());
+ vnfmRegisterInfo.setType(authInfo.getType());
+ vnfmRegisterInfo.setUrl(authInfo.getServiceUrl());
+ vnfmRegisterInfo.setUserName(authInfo.getUserName());
+ vnfmRegisterInfo.setVendor(authInfo.getVendor());
+ vnfmRegisterInfo.setVersion(authInfo.getVersion());
+ return vnfmRegisterInfo;
+ }
+
+}