2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
8 * ================================================================================
9 * Modifications Copyright (C) 2019 Ericsson
10 * =============================================================================
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * ============LICENSE_END=========================================================
26 package org.onap.appc.seqgen.provider;
28 import java.util.HashMap;
29 import java.util.HashSet;
30 import java.util.LinkedList;
31 import java.util.List;
34 import java.util.concurrent.ExecutorService;
35 import java.util.concurrent.Executors;
36 import org.apache.commons.lang.StringUtils;
37 import org.onap.appc.dg.objects.InventoryModel;
38 import org.onap.appc.dg.objects.Node;
39 import org.onap.appc.dg.objects.VnfcDependencyModel;
40 import org.onap.appc.domainmodel.Vnf;
41 import org.onap.appc.domainmodel.Vnfc;
42 import org.onap.appc.domainmodel.Vserver;
43 import org.onap.appc.domainmodel.lcm.VNFOperation;
44 import org.onap.appc.exceptions.APPCException;
45 import org.onap.appc.seqgen.SequenceGenerator;
46 import org.onap.appc.seqgen.impl.SequenceGeneratorFactory;
47 import org.onap.appc.seqgen.objects.CapabilityModel;
48 import org.onap.appc.seqgen.objects.Constants;
49 import org.onap.appc.seqgen.objects.Constants.Action;
50 import org.onap.appc.seqgen.objects.PreCheckOption;
51 import org.onap.appc.seqgen.objects.RequestInfo;
52 import org.onap.appc.seqgen.objects.RequestInfoBuilder;
53 import org.onap.appc.seqgen.objects.Response;
54 import org.onap.appc.seqgen.objects.SequenceGeneratorInput;
55 import org.onap.appc.seqgen.objects.SequenceGeneratorInputBuilder;
56 import org.onap.appc.seqgen.objects.Transaction;
57 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
58 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
59 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
60 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
61 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.GenerateSequenceInput;
62 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.GenerateSequenceOutput;
63 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.GenerateSequenceOutputBuilder;
64 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.SequenceGeneratorService;
65 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.dependency.info.dependency.info.Vnfcs;
66 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.inventory.info.inventory.info.vnf.info.Vm;
67 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.StatusBuilder;
68 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.Transactions;
69 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.TransactionsBuilder;
70 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.ActionIdentifier;
71 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.ActionIdentifierBuilder;
72 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.PrecheckOptions;
73 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.PrecheckOptionsBuilder;
74 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.Responses;
75 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.ResponsesBuilder;
76 import org.opendaylight.yang.gen.v1.org.onap.appc.sequencegenerator.rev170706.response.transactions.responses.ResponseActionBuilder;
77 import org.opendaylight.yangtools.yang.common.RpcResult;
78 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
79 import com.att.eelf.configuration.EELFLogger;
80 import com.att.eelf.configuration.EELFManager;
81 import com.google.common.util.concurrent.Futures;
82 import com.google.common.util.concurrent.ListenableFuture;
85 public class SequenceGeneratorProvider implements AutoCloseable,SequenceGeneratorService {
86 protected DataBroker dataBroker;
87 protected RpcProviderRegistry rpcRegistry;
88 protected NotificationPublishService notificationService;
89 protected BindingAwareBroker.RpcRegistration<SequenceGeneratorService> rpcRegistration;
90 private final EELFLogger log = EELFManager.getInstance().getLogger(SequenceGeneratorProvider.class);
91 private final ExecutorService executor;
92 private static final String APP_NAME = "SequenceGeneratorProvider";
94 public SequenceGeneratorProvider(DataBroker dataBroker2, NotificationPublishService notificationProviderService,
95 RpcProviderRegistry rpcRegistry2) {
96 log.info("Creating provider for " + APP_NAME);
97 executor = Executors.newFixedThreadPool(1);
98 this.dataBroker = dataBroker2;
99 this.notificationService = notificationProviderService;
101 this.rpcRegistry = rpcRegistry2;
103 if (this.rpcRegistry != null) {
104 rpcRegistration = rpcRegistry.addRpcImplementation(SequenceGeneratorService.class, this);
106 log.info("Initialization complete for " + APP_NAME);
110 public void close() throws Exception {
111 log.info("Closing provider for " + APP_NAME);
112 if(this.executor != null){
115 if(this.rpcRegistration != null) {
116 rpcRegistration.close();
118 log.info("Successfully closed provider for " + APP_NAME);
122 public ListenableFuture<RpcResult<GenerateSequenceOutput>> generateSequence(GenerateSequenceInput input) {
123 RpcResult<GenerateSequenceOutput> rpcResult=null;
124 log.debug("Received input = " + input );
126 if(input.getRequestInfo()==null){
127 throw new APPCException("Request info is missing in the input");
129 SequenceGenerator seqGenerator = SequenceGeneratorFactory.getInstance()
130 .createSequenceGenerator(VNFOperation.findByString(input.getRequestInfo().getAction().name()));
131 SequenceGeneratorInput seqGenInput = buildSeqGenInput(input);
132 List<Transaction> transactions = seqGenerator.generateSequence(seqGenInput);
133 if (transactions.isEmpty()) {
134 rpcResult = buildFailureResponse("Request is not supported", 450);
136 rpcResult = buildSuccessResponse(transactions);
138 } catch (Exception e) {
139 log.error("Error Generating Sequence",e);
140 rpcResult = buildFailureResponse(e.getMessage(), 0);
142 return Futures.immediateFuture(rpcResult);
145 private RpcResult<GenerateSequenceOutput> buildSuccessResponse(List<Transaction> transactions) {
146 log.info("Building response from the list of transactions");
147 List<Transactions> transactionList = new LinkedList<>();
148 for(Transaction transaction: transactions) {
149 ActionIdentifier actionIdentifier = buildActionIdentifierForResponse(transaction);
150 List<PrecheckOptions> precheckOptions = buildPrecheckOptionsForResponse(transaction);
151 List<Responses> responseList = getResponses(transaction);
152 Transactions transactionObj
153 = new TransactionsBuilder()
154 .setActionIdentifier(actionIdentifier)
155 .setAction(transaction.getAction())
156 .setActionLevel(transaction.getActionLevel())
157 .setPrecheckOperator(transaction.getPreCheckOperator())
158 .setPayload(transaction.getPayload())
159 .setTransactionId(transaction.getTransactionId())
160 .setPrecheckOptions(precheckOptions)
161 .setResponses(responseList)
163 transactionList.add(transactionObj);
166 GenerateSequenceOutputBuilder builder = new GenerateSequenceOutputBuilder()
167 .setTransactions(transactionList);
169 return RpcResultBuilder
170 .<GenerateSequenceOutput> status(true)
171 .withResult(builder.build()).build();
174 private ActionIdentifier buildActionIdentifierForResponse(Transaction transaction) {
175 log.info("Adding action identifiers to response.");
176 ActionIdentifier actionIdentifier = null;
177 if(transaction.getActionIdentifier() != null){
178 actionIdentifier = new ActionIdentifierBuilder()
179 .setVnfId(transaction.getActionIdentifier().getVnfId())
180 .setVnfcName(transaction.getActionIdentifier().getVnfcName())
181 .setVserverId(transaction.getActionIdentifier().getvServerId())
184 return actionIdentifier;
187 private List<PrecheckOptions> buildPrecheckOptionsForResponse(Transaction transaction) {
188 log.info("Adding Precheck options to response");
189 List<PrecheckOptions> precheckOptions = new LinkedList<>();
190 if(transaction.getPrecheckOptions() != null){
191 for(PreCheckOption option:transaction.getPrecheckOptions()){
192 PrecheckOptions precheckOption = new PrecheckOptionsBuilder()
193 .setParamName(option.getParamName())
194 .setParamValue(option.getParamValue())
195 .setPreTransactionId(option.getPreTransactionId())
196 .setRule(option.getRule())
198 precheckOptions.add(precheckOption);
201 return precheckOptions;
203 private List<Responses> getResponses(Transaction transaction) {
204 log.info("Building response from the Transaction");
205 List<Responses> responseList = new LinkedList<>();
206 for(Response resp : transaction.getResponses()){
207 Map<String,String> responseActions = resp.getResponseAction();
208 ResponseActionBuilder responseActionBuilder = new ResponseActionBuilder();
209 if(responseActions.get(Constants.ResponseAction.WAIT.getAction()) != null){
210 responseActionBuilder = responseActionBuilder.setWait(Integer.parseInt(responseActions.get(Constants.ResponseAction.WAIT.getAction())));
212 if(responseActions.get(Constants.ResponseAction.RETRY.getAction()) != null){
213 responseActionBuilder = responseActionBuilder.setRetry(Integer.parseInt(responseActions.get(Constants.ResponseAction.RETRY.getAction())));
215 if(responseActions.get(Constants.ResponseAction.CONTINUE.getAction().toLowerCase())!=null){
216 responseActionBuilder = responseActionBuilder
217 .setContinue(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.CONTINUE.getAction().toLowerCase())));
219 if(responseActions.get(Constants.ResponseAction.IGNORE.getAction()) != null){
220 responseActionBuilder = responseActionBuilder.setIgnore(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.IGNORE.getAction())));
222 if(responseActions.get(Constants.ResponseAction.STOP.getAction()) != null){
223 responseActionBuilder = responseActionBuilder.setStop(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.STOP.getAction())));
225 if(responseActions.get(Constants.ResponseAction.JUMP.getAction()) != null){
226 responseActionBuilder = responseActionBuilder.setJump(Integer.parseInt(responseActions.get(Constants.ResponseAction.JUMP.getAction())));
228 Responses response = new ResponsesBuilder()
229 .setResponseMessage(resp.getResponseMessage())
230 .setResponseAction(responseActionBuilder.build())
232 responseList.add(response);
237 private SequenceGeneratorInput buildSeqGenInput(GenerateSequenceInput input) throws APPCException {
239 log.info("Building SequenceGeneratorInput from Yang object GenerateSequenceInput.");
240 validateMandatory(input);
242 RequestInfo requestInfo = buildRequestInfoForSeqGenInput(input);
243 InventoryModel inventoryModel = readInventoryModel(input);
245 VnfcDependencyModel dependencyModel = readDependencyModel(input);
246 if(dependencyModel != null){
247 validateInventoryModelWithDependencyModel(dependencyModel, inventoryModel);
250 CapabilityModel capModel = buildCapabilitiesForSeqGenInput(input);
252 SequenceGeneratorInputBuilder builder = new SequenceGeneratorInputBuilder()
253 .requestInfo(requestInfo)
254 .inventoryModel(inventoryModel)
255 .dependendcyModel(dependencyModel)
256 .capabilityModel(capModel);
258 builder = buildTunableParamsForSeqGenInput(input, builder);
260 return builder.build();
263 private SequenceGeneratorInputBuilder buildTunableParamsForSeqGenInput(GenerateSequenceInput input, SequenceGeneratorInputBuilder builder) {
264 log.info("Initializing Tunable Parameters based on YANG object.");
265 if(input.getTunableParameters() != null){
266 builder = builder.tunableParameter(Constants.RETRY_COUNT,String.valueOf(input.getTunableParameters().getRetryCount()))
267 .tunableParameter(Constants.WAIT_TIME,String.valueOf(input.getTunableParameters().getWaitTime()));
268 if(input.getTunableParameters().getStrategy() != null){
269 builder = builder.tunableParameter(Constants.STRATEGY,input.getTunableParameters().getStrategy().name());
275 public CapabilityModel buildCapabilitiesForSeqGenInput(GenerateSequenceInput input) {
276 log.info("Initializing capabilities based on YANG object.");
278 List<String> vnfCapabilities = null;
279 List<String> vfModuleCapabilities = null;
280 Map<String, List<String>> vmCapabilities = null;
281 List<String> vnfcCapabilities = null;
283 if(input.getCapabilities()!=null){
284 if(input.getCapabilities().getVnf()!=null){
285 vnfCapabilities = input.getCapabilities().getVnf();
287 if(input.getCapabilities().getVnfc()!=null){
288 vfModuleCapabilities = input.getCapabilities().getVnfc();
290 if(input.getCapabilities().getVm()!=null){
291 vmCapabilities = new HashMap<String, List<String>>();
292 vmCapabilities.put(Action.ATTACH_VOLUME.getActionType(), input.getCapabilities().getVm().getAttachVolume());
293 vmCapabilities.put(Action.DETACH_VOLUME.getActionType(), input.getCapabilities().getVm().getDetachVolume());
294 vmCapabilities.put(Action.EVACUATE.getActionType(), input.getCapabilities().getVm().getEvacuate());
295 vmCapabilities.put(Action.MIGRATE.getActionType(), input.getCapabilities().getVm().getMigrate());
296 vmCapabilities.put(Action.REBOOT.getActionType(), input.getCapabilities().getVm().getReboot());
297 vmCapabilities.put(Action.REBUILD.getActionType(), input.getCapabilities().getVm().getRebuild());
298 vmCapabilities.put(Action.RESTART.getActionType(), input.getCapabilities().getVm().getRestart());
299 vmCapabilities.put(Action.SNAPSHOT.getActionType(), input.getCapabilities().getVm().getSnapshot());
300 vmCapabilities.put(Action.START.getActionType(), input.getCapabilities().getVm().getStart());
301 vmCapabilities.put(Action.STOP.getActionType(), input.getCapabilities().getVm().getStop());
303 if(input.getCapabilities().getVfModule()!=null){
304 vnfcCapabilities = input.getCapabilities().getVfModule();
307 return new CapabilityModel(vnfCapabilities, vfModuleCapabilities, vmCapabilities, vnfcCapabilities);
310 private void validateInventoryModelWithDependencyModel(VnfcDependencyModel dependencyModel, InventoryModel inventoryModel) throws APPCException {
311 Set<String> dependencyModelVnfcSet = new HashSet<>();
312 Set<String> dependencyModelMandatoryVnfcSet = new HashSet<>();
313 Set<String> inventoryModelVnfcsSet = new HashSet<>();
315 for (Node<Vnfc> node : dependencyModel.getDependencies()) {
316 dependencyModelVnfcSet.add(node.getChild().getVnfcType().toLowerCase());
317 if (node.getChild().isMandatory()) {
318 dependencyModelMandatoryVnfcSet.add(node.getChild().getVnfcType().toLowerCase());
322 for (Vnfc vnfc : inventoryModel.getVnf().getVnfcs()) {
323 inventoryModelVnfcsSet.add(vnfc.getVnfcType().toLowerCase());
326 // if dependency model and inventory model contains same set of VNFCs, validation succeed and hence return
327 if (dependencyModelVnfcSet.equals(inventoryModelVnfcsSet)) {
331 if (inventoryModelVnfcsSet.size() >= dependencyModelVnfcSet.size()) {
332 Set<String> difference = new HashSet<>(inventoryModelVnfcsSet);
333 difference.removeAll(dependencyModelVnfcSet);
334 log.error("Dependency model is missing following vnfc type(s): " + difference);
335 throw new APPCException("Dependency model is missing following vnfc type(s): " + difference);
337 Set<String> difference = new HashSet<>(dependencyModelMandatoryVnfcSet);
338 difference.removeAll(inventoryModelVnfcsSet);
339 if (difference.size() > 0) {
340 log.error("Inventory model is missing following mandatory vnfc type(s): " + difference);
341 throw new APPCException("VMs missing for the mandatory VNFC : " + difference);
346 private RequestInfo buildRequestInfoForSeqGenInput(GenerateSequenceInput input) {
347 log.info("Building RequestInfo from Yang object");
348 RequestInfoBuilder requestInfobuilder = buildRequestInformation(input);
350 if(input.getRequestInfo().getActionIdentifier() != null){
351 requestInfobuilder = buildActionIdentifiers(input, requestInfobuilder);
354 return requestInfobuilder.build();
357 private RequestInfoBuilder buildActionIdentifiers(GenerateSequenceInput input, RequestInfoBuilder requestInfobuilder) {
358 log.info("Initializing actionIdentifier for RequestInfo");
359 requestInfobuilder = requestInfobuilder
361 .vnfId(input.getRequestInfo().getActionIdentifier().getVnfId())
362 .vnfcName(input.getRequestInfo().getActionIdentifier().getVnfcName())
363 .vServerId(input.getRequestInfo().getActionIdentifier().getVserverId());
364 return requestInfobuilder;
367 private RequestInfoBuilder buildRequestInformation(GenerateSequenceInput input) {
368 log.info("Initializing action, actionLevel and payload for RequestInfo");
369 return new RequestInfoBuilder()
370 .action(input.getRequestInfo().getAction().name())
371 .actionLevel(input.getRequestInfo().getActionLevel().getName().toLowerCase())
372 .payload(input.getRequestInfo().getPayload());
375 private void validateMandatory(GenerateSequenceInput input) throws APPCException {
376 if(input.getRequestInfo() == null){
377 throw new APPCException("Request Info is not present in the request");
379 if(input.getRequestInfo().getAction() == null){
380 throw new APPCException("Action is not present in the request");
382 if(input.getInventoryInfo() == null){
383 throw new APPCException("inventoryInfo is not provided in the input");
385 if (input.getInventoryInfo().getVnfInfo() == null) {
386 log.error("vnfInfo is null in the input");
387 throw new APPCException("vnfInfo is missing in the input");
389 if(input.getInventoryInfo().getVnfInfo().getVm().isEmpty()){
390 log.error("Null vm information in input.");
391 throw new APPCException("VnfInfo is missing in the input");
393 log.info("Mandatory information present in the request.");
396 private VnfcDependencyModel readDependencyModel(GenerateSequenceInput input) throws APPCException{
397 log.info("Initializing DependencyModel from YANG model.");
398 if(input.getDependencyInfo() == null || input.getDependencyInfo().getVnfcs() == null || input.getDependencyInfo().getVnfcs().isEmpty()){
399 log.info("No dependency model information is present for the request.");
402 List<Vnfcs> vnfcs = input.getDependencyInfo().getVnfcs();
403 Set<Node<org.onap.appc.domainmodel.Vnfc>> dependencies = new HashSet<>();
404 Set<String> parentVnfcs = new HashSet<>();
405 Set<String> allVnfcTypes = new HashSet<>();
406 for(Vnfcs vnfcObj:vnfcs) {
407 org.onap.appc.domainmodel.Vnfc vnfc = new org.onap.appc.domainmodel.Vnfc();
408 vnfc.setVnfcType(vnfcObj.getVnfcType());
409 allVnfcTypes.add(vnfcObj.getVnfcType());
410 vnfc.setResilienceType(vnfcObj.getResilience());
411 Node<Vnfc> currentNode = buildVnfcNodeForDependenyInfo(dependencies, vnfcObj, vnfc);
412 for(String parentVnfcType:vnfcObj.getParents()) {
413 parentVnfcs.add(parentVnfcType);
414 Node<Vnfc> parentNode = readNode(parentVnfcType, dependencies);
415 if(parentNode == null){
416 Vnfc parentVnfc = new Vnfc();
417 parentVnfc.setVnfcType(parentVnfcType);
418 parentNode = new Node<>(parentVnfc);
419 currentNode.addParent(parentVnfc);
420 dependencies.add(parentNode);
423 currentNode.addParent(parentNode.getChild());
427 for(String parent:parentVnfcs){
428 if(!allVnfcTypes.contains(parent)){
429 throw new APPCException("Dependency model missing vnfc type " + parent);
432 return new VnfcDependencyModel(dependencies);
435 private Node<Vnfc> buildVnfcNodeForDependenyInfo(Set<Node<Vnfc>> dependencies, Vnfcs vnfcObj, Vnfc vnfc) {
436 Node<Vnfc> currentNode = readNode(vnfcObj.getVnfcType(), dependencies);
437 if(currentNode == null){
438 currentNode = new Node<>(vnfc);
439 dependencies.add(currentNode);
442 currentNode.getChild().setResilienceType(vnfcObj.getResilience());
443 currentNode.getChild().setMandatory(vnfcObj.isMandatory());
448 private Node<org.onap.appc.domainmodel.Vnfc> readNode(String vnfcType, Set<Node<org.onap.appc.domainmodel.Vnfc>> dependencies) {
449 for(Node<org.onap.appc.domainmodel.Vnfc> node : dependencies){
450 if(node.getChild().getVnfcType().equalsIgnoreCase(vnfcType)){
457 private InventoryModel readInventoryModel(GenerateSequenceInput input) throws APPCException {
459 log.info("Initializing InventoryModel from Yang input model");
460 Vnf vnf = createVnfForInventoryModel(input);
461 Map<org.onap.appc.domainmodel.Vnfc, List<Vserver>> map = new HashMap<>();
462 buildVserverDetailsForInventoryModel(input, vnf, map);
463 for(Map.Entry<org.onap.appc.domainmodel.Vnfc, List<Vserver>> entry:map.entrySet()){
464 org.onap.appc.domainmodel.Vnfc vnfc = entry.getKey();
465 List<Vserver> vmList = entry.getValue();
466 vnfc.addVservers(vmList);
468 return new InventoryModel(vnf);
471 private void buildVserverDetailsForInventoryModel(GenerateSequenceInput input, Vnf vnf, Map<Vnfc, List<Vserver>> map) throws APPCException {
472 if(input.getInventoryInfo().getVnfInfo().getVm().size() < 1) {
473 throw new APPCException("vnfInfo is missing in the input");
475 for(Vm vm:input.getInventoryInfo().getVnfInfo().getVm()) {
476 if(StringUtils.isBlank(vm.getVserverId())){
477 throw new APPCException("vserver-id not found ");
479 Vserver vserver=new Vserver();
480 vserver.setId(vm.getVserverId());
481 if(!StringUtils.isBlank(vm.getVnfc().getVnfcName()) &&
482 !StringUtils.isBlank(vm.getVnfc().getVnfcType())) {
483 Vnfc vfc = new Vnfc();
484 vfc.setVnfcName(vm.getVnfc().getVnfcName());
485 vfc.setVnfcType(vm.getVnfc().getVnfcType());
486 vfc.setVnfcFunctionCode(vm.getVnfc().getVnfcFunctionCode());
487 vserver.setVnfc(vfc);
488 List<Vserver> vms = map.get(vfc);
490 vms = new LinkedList<>();
495 vnf.addVserver(vserver);
499 private Vnf createVnfForInventoryModel(GenerateSequenceInput input) {
500 log.info("Setting VnfId and VnfType values for Vnf Inventory Model ");
502 vnf.setVnfId(input.getInventoryInfo().getVnfInfo().getVnfId());
503 vnf.setVnfType(input.getInventoryInfo().getVnfInfo().getVnfType());
504 vnf.setIdentityUrl(input.getInventoryInfo().getVnfInfo().getIdentityUrl());
508 private RpcResult<GenerateSequenceOutput> buildFailureResponse(String errorMessage, int errorCode){
509 GenerateSequenceOutputBuilder sequenceGeneratorOutputBuilder=new GenerateSequenceOutputBuilder();
510 StatusBuilder statusBuilder = new StatusBuilder();
511 statusBuilder.setCode((errorCode != 0)? errorCode : 401);
512 statusBuilder.setMessage(errorMessage);
513 sequenceGeneratorOutputBuilder.setStatus(statusBuilder.build());
514 return RpcResultBuilder
515 .<GenerateSequenceOutput> status(true)
516 .withResult(sequenceGeneratorOutputBuilder.build())