2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright 2018 Nokia
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.infrastructure.pnf.delegate;
25 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
26 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
27 import org.camunda.bpm.engine.delegate.DelegateExecution;
28 import org.camunda.bpm.engine.delegate.JavaDelegate;
29 import org.onap.aai.domain.yang.Pnf;
30 import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.stereotype.Component;
37 * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
39 * Inputs: - pnfCorrelationId - String - pnfUuid - String
42 public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
44 private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class);
45 private PnfManagement pnfManagement;
48 public void setPnfManagement(PnfManagement pnfManagement) {
49 this.pnfManagement = pnfManagement;
53 public void execute(DelegateExecution execution) throws Exception {
54 String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
55 String pnfUuid = (String) execution.getVariable(PNF_UUID);
57 pnf.setPnfId(pnfUuid);
58 pnf.setPnfName(pnfCorrelationId);
59 pnfManagement.createEntry(pnfCorrelationId, pnf);
60 logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid);