summaryrefslogtreecommitdiffstats
path: root/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai
diff options
context:
space:
mode:
Diffstat (limited to 'esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai')
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java44
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java36
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/NfvoRegisterProvider.java54
3 files changed, 133 insertions, 1 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
index bd8c77d..e5b49d6 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java
@@ -20,12 +20,13 @@ import org.onap.aai.esr.common.MsbConfig;
import org.onap.aai.esr.entity.aai.EsrEmsDetail;
import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;
import org.onap.aai.esr.entity.aai.EsrVnfmDetail;
+import org.onap.aai.esr.entity.aai.EsrNfvoDetail;
import org.onap.aai.esr.exception.ExtsysException;
import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
public class ExternalSystemProxy {
- private static IExternalSystem externalSystem;
+ private static IExternalSystem externalSystem, externalSystemV16;
private static String transactionId = "9999";
private static String fromAppId = "esr-server";
private static String authorization = AaiCommon.getAuthenticationCredentials();
@@ -33,6 +34,8 @@ public class ExternalSystemProxy {
ClientConfig config = new ClientConfig();
externalSystem =
ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class);
+ externalSystemV16 =
+ ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddrV16(), config, IExternalSystem.class);
}
public void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException {
@@ -70,6 +73,45 @@ public class ExternalSystemProxy {
}
}
+ public void registerNfvo(String nfvoId, EsrNfvoDetail esrNfvoDetail) throws ExtsysException {
+ ClientConfig config = new ClientConfig(new NfvoRegisterProvider());
+ IExternalSystem registerNfvoServiceproxy =
+ ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddrV16(), config, IExternalSystem.class);
+ try {
+ registerNfvoServiceproxy.registerNFVO(transactionId, fromAppId, authorization, nfvoId, esrNfvoDetail);
+ } catch (Exception e) {
+ throw new ExtsysException("PUT NFVO to A&AI failed.", e);
+ }
+ }
+
+ public String queryNfvoDetail(String nfvoId) throws ExtsysException {
+ try {
+ return externalSystemV16.queryNFVODetail(transactionId, fromAppId, authorization, nfvoId);
+ } catch (Exception e) {
+ throw new ExtsysException("Query NFVO detail from A&AI failed.", e);
+ }
+ }
+
+ public String queryNfvoList() throws ExtsysException {
+ try {
+ return externalSystemV16.queryNFVOList(transactionId, fromAppId, authorization);
+ } catch (Exception e) {
+ throw new ExtsysException("Query NFVO list from A&AI failed.", e);
+ }
+ }
+
+ public void deleteNfvo(String nfvoId, String resourceVersion) throws ExtsysException {
+ try {
+ externalSystemV16.deleteNFVO(transactionId, fromAppId, authorization, nfvoId, resourceVersion);
+ } catch (Exception e) {
+ throw new ExtsysException("Delete NFVO from A&AI failed.", e);
+ }
+ }
+
+
+
+
+
public void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) throws ExtsysException {
ClientConfig config = new ClientConfig(new ThirdpartySdncRegisterProvider());
IExternalSystem registerSdncServiceproxy =
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java
index c066654..7e1a425 100644
--- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.MediaType;
import org.onap.aai.esr.entity.aai.EsrEmsDetail;
import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail;
import org.onap.aai.esr.entity.aai.EsrVnfmDetail;
+import org.onap.aai.esr.entity.aai.EsrNfvoDetail;
import org.onap.aai.esr.exception.ExtsysException;
@Path("/")
@@ -67,6 +68,41 @@ public interface IExternalSystem {
throws ExtsysException;
@PUT
+ @Path("/esr-nfvo-list/esr-nfvo/{nfvo_id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public void registerNFVO(@HeaderParam("X-TransactionId") String transactionId,
+ @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization,
+ @PathParam("nfvo_id") String nfvoId, EsrNfvoDetail esrNfvoDetail) throws ExtsysException;
+
+ @GET
+ @Path("/esr-nfvo-list/esr-nfvo/{nfvo_id}?depth=all")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public String queryNFVODetail(@HeaderParam("X-TransactionId") String transactionId,
+ @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization,
+ @PathParam("nfvo_id") String nfvoId) throws ExtsysException;
+
+ @GET
+ @Path("/esr-nfvo-list")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public String queryNFVOList(@HeaderParam("X-TransactionId") String transactionId,
+ @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization)
+ throws ExtsysException;
+
+ @DELETE
+ @Path("/esr-nfvo-list/esr-nfvo/{nfvo_id}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public void deleteNFVO(@HeaderParam("X-TransactionId") String transactionId,
+ @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization,
+ @PathParam("nfvo_id") String nfvoId, @QueryParam("resource-version") String resourceVersion)
+ throws ExtsysException;
+
+
+
+ @PUT
@Path("/esr-ems-list/esr-ems/{ems_id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/NfvoRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/NfvoRegisterProvider.java
new file mode 100644
index 0000000..119c8f4
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/NfvoRegisterProvider.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2019 Verizon. All Rights Reserved.
+ *
+ * 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.externalservice.aai;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import org.onap.aai.esr.entity.aai.EsrNfvoDetail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.google.gson.Gson;
+
+public class NfvoRegisterProvider implements MessageBodyWriter<EsrNfvoDetail> {
+
+ private static final Logger logger = LoggerFactory.getLogger(NfvoRegisterProvider.class);
+
+ @Override
+ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
+ return EsrNfvoDetail.class.isAssignableFrom(type);
+ }
+
+ @Override
+ public long getSize(EsrNfvoDetail t, Class<?> type, Type genericType, Annotation[] annotations,
+ MediaType mediaType) {
+ return -1;
+ }
+
+ @Override
+ public void writeTo(EsrNfvoDetail t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
+ MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
+ throws IOException, WebApplicationException {
+ String json = new Gson().toJson(t, EsrNfvoDetail.class);
+ logger.info("the param to register NFVO input is:" + json);
+ entityStream.write(json.getBytes("UTF-8"));
+ }
+}