2 * Copyright 2018 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.aai.esr.wrapper;
18 import javax.ws.rs.core.Response;
19 import org.onap.aai.esr.entity.aai.Pnf;
20 import org.onap.aai.esr.entity.rest.PnfRegisterInfo;
21 import org.onap.aai.esr.exception.ExceptionUtil;
22 import org.onap.aai.esr.exception.ExtsysException;
23 import org.onap.aai.esr.externalservice.aai.NetworkProxy;
24 import org.onap.aai.esr.util.PnfManagerUtil;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class PnfManagerWrapper {
29 private static PnfManagerWrapper pnfManagerWrapper;
30 private static final Logger LOG = LoggerFactory.getLogger(PnfManagerWrapper.class);
32 // private static PnfManagerUtil pnfManagerUtil = new PnfManagerUtil();
33 private static NetworkProxy networkProxy = new NetworkProxy();
36 * get PnfManagerWrapper instance.
38 * @return pnf manager wrapper instance
40 public static PnfManagerWrapper getInstance() {
41 if (pnfManagerWrapper == null) {
42 pnfManagerWrapper = new PnfManagerWrapper(networkProxy);
44 return pnfManagerWrapper;
47 public PnfManagerWrapper(NetworkProxy networkProxy){
48 PnfManagerWrapper.networkProxy = networkProxy;
54 public Response queryPnfList() {
55 // TODO Auto-generated method stub
63 public Response queryPnfById(String pnfId) {
64 // TODO Auto-generated method stub
72 public Response delPnf(String pnfId) {
73 // TODO Auto-generated method stub
82 public Response updatePnf(PnfRegisterInfo pnf, String pnfId) {
83 // TODO Auto-generated method stub
91 public Response registerPnf(PnfRegisterInfo pnfRegisterInfo) {
92 Pnf pnf = PnfManagerUtil.pnfRegisterInfo2pnf(pnfRegisterInfo);
93 String pnfName = pnf.getPnfName();
95 networkProxy.registerPnf(pnfName, pnf);
96 return Response.ok().build();
97 } catch (ExtsysException e) {
98 LOG.error("Register PNF failed !", e);
99 throw ExceptionUtil.buildExceptionResponse(e.getMessage());