2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * =============================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
20 * ============LICENSE_END=========================================================
22 package org.onap.appc.flow.controller.node;
24 import java.io.FileInputStream;
25 import java.io.IOException;
26 import java.io.InputStream;
27 import java.nio.charset.Charset;
28 import java.util.ArrayList;
29 import java.util.Arrays;
30 import java.util.HashMap;
31 import java.util.List;
33 import java.util.Properties;
34 import org.json.JSONObject;
36 import org.apache.commons.io.IOUtils;
37 import org.apache.commons.lang3.StringUtils;
38 import org.onap.appc.flow.controller.ResponseHandlerImpl.DefaultResponseHandler;
39 import org.onap.appc.flow.controller.data.PrecheckOption;
40 import org.onap.appc.flow.controller.data.ResponseAction;
41 import org.onap.appc.flow.controller.data.Transaction;
42 import org.onap.appc.flow.controller.data.Transactions;
43 import org.onap.appc.flow.controller.dbervices.FlowControlDBService;
44 import org.onap.appc.flow.controller.executorImpl.GraphExecutor;
45 import org.onap.appc.flow.controller.executorImpl.NodeExecutor;
46 import org.onap.appc.flow.controller.executorImpl.RestExecutor;
47 import org.onap.appc.flow.controller.interfaceData.ActionIdentifier;
48 import org.onap.appc.flow.controller.interfaceData.Capabilities;
49 import org.onap.appc.flow.controller.interfaceData.DependencyInfo;
50 import org.onap.appc.flow.controller.interfaceData.Input;
51 import org.onap.appc.flow.controller.interfaceData.InventoryInfo;
52 import org.onap.appc.flow.controller.interfaceData.RequestInfo;
53 import org.onap.appc.flow.controller.interfaceData.Vm;
54 import org.onap.appc.flow.controller.interfaceData.VnfInfo;
55 import org.onap.appc.flow.controller.interfaceData.Vnfcs;
56 import org.onap.appc.flow.controller.interfaceData.Vnfcslist;
57 import org.onap.appc.flow.controller.interfaces.FlowExecutorInterface;
58 import org.onap.appc.flow.controller.utils.EncryptionTool;
59 import org.onap.appc.flow.controller.utils.FlowControllerConstants;
60 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
61 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
62 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
64 import com.att.eelf.configuration.EELFLogger;
65 import com.att.eelf.configuration.EELFManager;
66 import com.fasterxml.jackson.annotation.JsonInclude.Include;
67 import com.fasterxml.jackson.core.JsonParseException;
68 import com.fasterxml.jackson.databind.DeserializationFeature;
69 import com.fasterxml.jackson.databind.JsonMappingException;
70 import com.fasterxml.jackson.databind.JsonNode;
71 import com.fasterxml.jackson.databind.ObjectMapper;
72 import com.fasterxml.jackson.databind.SerializationFeature;
74 public class FlowControlNode implements SvcLogicJavaPlugin{
77 private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlNode.class);
78 private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR";
80 public void processFlow(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
81 log.debug("Received processParamKeys call with params : " + inParams);
82 String responsePrefix = inParams.get(FlowControllerConstants.INPUT_PARAM_RESPONSE_PRIFIX);
85 responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
86 FlowControlDBService dbservice = FlowControlDBService.initialise();
87 SvcLogicContext localContext = new SvcLogicContext();
88 localContext.setAttribute(FlowControllerConstants.REQUEST_ID, ctx.getAttribute(FlowControllerConstants.REQUEST_ID));
89 localContext.setAttribute(FlowControllerConstants.VNF_TYPE, ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
90 localContext.setAttribute(FlowControllerConstants.REQUEST_ACTION, ctx.getAttribute(FlowControllerConstants.REQUEST_ACTION));
91 localContext.setAttribute(FlowControllerConstants.ACTION_LEVEL, ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL));
92 localContext.setAttribute(FlowControllerConstants.RESPONSE_PREFIX, responsePrefix);
93 ctx.setAttribute(FlowControllerConstants.RESPONSE_PREFIX, responsePrefix);
94 dbservice.getFlowReferenceData(ctx, inParams, localContext);
96 for (Object key : localContext.getAttributeKeySet()) {
97 String parmName = (String) key;
98 String parmValue = ctx.getAttribute(parmName);
99 log.debug("processFlow " + parmName + "=" + parmValue);
102 processFlowSequence(inParams, ctx, localContext);
103 if(!ctx.getAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS).equals(FlowControllerConstants.OUTPUT_STATUS_SUCCESS))
104 throw new SvcLogicException(ctx.getAttribute(responsePrefix + FlowControllerConstants.OUTPUT_STATUS_MESSAGE));
106 } catch (Exception e) {
107 ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_STATUS, FlowControllerConstants.OUTPUT_STATUS_FAILURE);
108 ctx.setAttribute(responsePrefix + FlowControllerConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
110 throw new SvcLogicException(e.getMessage());
114 private void processFlowSequence( Map<String, String> inParams, SvcLogicContext ctx, SvcLogicContext localContext) throws Exception
116 String fn = "FlowExecutorNode.processflowSequence";
117 log.debug(fn + "Received model for flow : " + localContext.toString());
118 FlowControlDBService dbservice = FlowControlDBService.initialise();
119 String flowSequnce =null;
120 for (Object key : localContext.getAttributeKeySet()) {
121 String parmName = (String) key;
122 String parmValue = ctx.getAttribute(parmName);
123 log.debug(parmName + "=" + parmValue);
126 if(localContext != null && localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) !=null){
128 if(localContext.getAttribute(FlowControllerConstants.GENERATION_NODE) != null){
129 GraphExecutor transactionExecutor = new GraphExecutor();
130 Boolean generatorExists = transactionExecutor.hasGraph("APPC_COMMOM", localContext.getAttribute(FlowControllerConstants.GENERATION_NODE), null, "sync");
132 flowSequnce = transactionExecutor.executeGraph("APPC_COMMOM", localContext.getAttribute(FlowControllerConstants.GENERATION_NODE),
133 null, "sync", null).getProperty(FlowControllerConstants.FLOW_SEQUENCE);
136 throw new Exception("Can not find Custom defined Flow Generator for " + localContext.getAttribute(FlowControllerConstants.GENERATION_NODE));
138 else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.DESINGTIME)){
139 localContext.setAttribute(FlowControllerConstants.VNFC_TYPE, ctx.getAttribute(FlowControllerConstants.VNFC_TYPE));
140 flowSequnce = dbservice.getDesignTimeFlowModel(localContext);
141 if(flowSequnce == null)
142 throw new Exception("Flow Sequence is not found User Desinged VNF " + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
144 else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.RUNTIME)){
146 Transaction transaction = new Transaction();
147 String input = collectInputParams(ctx,transaction);
148 log.info("CollectInputParamsData-Input: " + input );
150 RestExecutor restExe = new RestExecutor();
151 HashMap<String,String>flowSeq= restExe.execute(transaction, localContext);
153 JSONObject sequence=new JSONObject(flowSeq.get("restResponse"));
154 if(sequence.has("output"))
155 flowSequnce = sequence.getJSONObject("output").toString();
156 log.info("MultistepSequenceGenerator-Output: "+flowSequnce);
158 if(flowSequnce == null)
159 throw new Exception("Failed to get the Flow Sequece runtime for VNF type" + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
162 else if(((String) localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE)).equalsIgnoreCase(FlowControllerConstants.EXTERNAL)){
163 //String input = collectInputParams(localContext);
164 // flowSequnce = ""; //get it from the External interface calling the Rest End point - TBD
165 if(flowSequnce == null)
166 throw new Exception("Flow Sequence not found for " + ctx.getAttribute(FlowControllerConstants.VNF_TYPE));
170 //No other type of model supported...in Future can get flowModel from other generators which will be included here
171 throw new Exception("No information found for sequence Owner Design-Time Vs Run-Time" );
175 FlowGenerator flowGenerator = new FlowGenerator();
176 Transactions trans = flowGenerator.createSingleStepModel(inParams,ctx);
177 ObjectMapper mapper = new ObjectMapper();
178 flowSequnce = mapper.writeValueAsString(trans);
179 log.debug("Single step Flow Sequence : " + flowSequnce);
182 log.debug("Received Flow Sequence : " + flowSequnce);
184 HashMap<Integer, Transaction> transactionMap = createTransactionMap(flowSequnce, localContext);
185 exeuteAllTransaction(transactionMap, ctx);
186 log.info("Executed all the transacstion successfully");
190 private void exeuteAllTransaction(HashMap<Integer, Transaction> transactionMap, SvcLogicContext ctx) throws Exception {
192 String fn = "FlowExecutorNode.exeuteAllTransaction ";
194 FlowExecutorInterface flowExecutor = null;
195 for (int key = 1; key <= transactionMap.size() ; key++ )
197 log.debug(fn + "Starting transactions ID " + key + " :)=" + retry);
198 Transaction transaction = transactionMap.get(key);
199 if(!preProcessor(transactionMap, transaction)){
200 log.info("Skipping Transaction ID " + transaction.getTransactionId());
203 if(transaction.getExecutionType() != null){
204 switch (transaction.getExecutionType()){
205 case FlowControllerConstants.GRAPH :
206 flowExecutor = new GraphExecutor();
208 case FlowControllerConstants.NODE :
209 flowExecutor = new NodeExecutor();
211 case FlowControllerConstants.REST :
212 flowExecutor = new RestExecutor();
215 throw new Exception("No Executor found for transaction ID" + transaction.getTransactionId());
217 flowExecutor.execute(transaction, ctx);
218 ResponseAction responseAction= handleResponse(transaction);
220 if(responseAction.getWait() != null && Integer.parseInt(responseAction.getWait()) > 0){
221 log.debug(fn + "Going to Sleep .... " + responseAction.getWait());
222 Thread.sleep(Integer.parseInt(responseAction.getWait())*1000);
225 if(responseAction.isIntermediateMessage()){
226 log.debug(fn + "Sending Intermediate Message back .... ");
227 sendIntermediateMessage();
229 if(responseAction.getRetry() != null && Integer.parseInt(responseAction.getRetry()) > retry ){
230 log.debug(fn + "Ooppss!!! We will retry again ....... ");
233 log.debug(fn + "key =" + key + "retry =" + retry);
236 if(responseAction.isIgnore()){
237 log.debug(fn + "Ignoring this Error and moving ahead ....... ");
240 if(responseAction.isStop()){
241 log.debug(fn + "Need to Stop ....... ");
244 if(responseAction.getJump() != null && Integer.parseInt(responseAction.getJump()) > 0 ){
245 key = Integer.parseInt(responseAction.getJump());
248 log.debug(fn + "key =" + key + "retry =" + retry);
252 throw new Exception("Don't know how to execute transaction ID " + transaction.getTransactionId());
257 private void sendIntermediateMessage() {
258 // TODO Auto-generated method stub
262 private ResponseAction handleResponse(Transaction transaction) {
263 log.info("Handling Response for transaction Id " + transaction.getTransactionId());
264 DefaultResponseHandler defaultHandler = new DefaultResponseHandler();
265 return defaultHandler.handlerResponse(transaction);
268 private boolean preProcessor(HashMap<Integer, Transaction> transactionMap, Transaction transaction) throws IOException {
270 log.debug("Starting Preprocessing Logic ");
271 boolean runthisStep = false;
273 if(transaction.getPrecheck() != null && transaction.getPrecheck().getPrecheckOptions() != null
274 && !transaction.getPrecheck().getPrecheckOptions().isEmpty()){
275 List<PrecheckOption> precheckOptions = transaction.getPrecheck().getPrecheckOptions();
276 for(PrecheckOption precheck : precheckOptions){
277 Transaction trans = transactionMap.get(precheck.getpTransactionID());
278 ObjectMapper mapper = new ObjectMapper();
279 log.info("Mapper= " + mapper.writeValueAsString(trans));
280 HashMap<Object, Object> trmap = mapper.readValue(mapper.writeValueAsString(trans), HashMap.class);
281 if(trmap.get(precheck.getParamName()) != null &&
282 ((String) trmap.get(precheck.getParamName())).equalsIgnoreCase(precheck.getParamValue()))
287 if(transaction.getPrecheck().getPrecheckOperator() != null &&
288 transaction.getPrecheck().getPrecheckOperator().equalsIgnoreCase("any") && runthisStep)
294 log.debug("No Pre check defined for transaction ID " + transaction.getTransactionId());
304 log.debug("Returing process current Transaction = " + runthisStep);
309 private HashMap<Integer, Transaction> createTransactionMap(String flowSequnce, SvcLogicContext localContext) throws Exception {
310 ObjectMapper mapper = new ObjectMapper();
311 Transactions transactions = mapper.readValue(flowSequnce,Transactions.class);
312 HashMap<Integer, Transaction> transMap = new HashMap<Integer, Transaction>();
313 for(Transaction transaction : transactions.getTransactions()){
314 compileFlowDependencies(transaction, localContext);
315 //loadTransactionIntoStatus(transactions, ctx); //parse the Transactions Object and create records in process_flow_status table
316 transMap.put(transaction.getTransactionId(), transaction);
321 private void compileFlowDependencies(Transaction transaction, SvcLogicContext localContext) throws Exception {
323 String fn = "FlowExecutorNode.compileFlowDependencies";
324 FlowControlDBService dbservice = FlowControlDBService.initialise();
325 dbservice.populateModuleAndRPC(transaction, localContext.getAttribute(FlowControllerConstants.VNF_TYPE));
326 ObjectMapper mapper = new ObjectMapper();
327 log.debug("Indivisual Transaction Details :" + transaction.toString());
328 if((localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) == null) ||
329 ( localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE) != null &&
330 ! localContext.getAttribute(FlowControllerConstants.SEQUENCE_TYPE).equalsIgnoreCase(FlowControllerConstants.DESINGTIME))){
331 localContext.setAttribute("artifact-content", mapper.writeValueAsString(transaction));
332 dbservice.loadSequenceIntoDB(localContext);
334 //get a field in transction class as transactionhandle interface and register the Handler here for each trnactions
337 private String collectInputParams(SvcLogicContext ctx,Transaction transaction) throws Exception {
339 String fn = "FlowExecuteNode.collectInputParams";
340 Properties prop = loadProperties();
341 log.info("Loaded Properties " + prop.toString());
343 String vnfId = ctx.getAttribute(FlowControllerConstants.VNF_ID);
344 String inputData = null;
345 log.debug(fn + "vnfId :" + vnfId);
347 if (StringUtils.isBlank(vnfId)) {
348 throw new Exception("VnfId is missing");
353 ActionIdentifier actionIdentifier = new ActionIdentifier();
354 log.debug("Enter ActionIdentifier");
355 if (StringUtils.isNotBlank(vnfId)) {
356 actionIdentifier.setVnfId(vnfId);
358 if (StringUtils.isNotBlank(ctx.getAttribute(FlowControllerConstants.VSERVER_ID))) {
359 actionIdentifier.setVserverId(ctx.getAttribute(FlowControllerConstants.VSERVER_ID));
361 if (StringUtils.isNotBlank(ctx.getAttribute(FlowControllerConstants.VNFC_NAME))) {
362 actionIdentifier.setVnfcName(ctx.getAttribute(FlowControllerConstants.VNFC_NAME));
364 log.info("ActionIdentifierData" + actionIdentifier.toString());
366 RequestInfo requestInfo = new RequestInfo();
367 log.info("Enter RequestInfo");
368 requestInfo.setAction(ctx.getAttribute(FlowControllerConstants.REQUEST_ACTION));
369 requestInfo.setActionLevel(ctx.getAttribute(FlowControllerConstants.ACTION_LEVEL));
370 requestInfo.setPayload(ctx.getAttribute(FlowControllerConstants.PAYLOAD));
371 requestInfo.setActionIdentifier(actionIdentifier);
372 log.debug("RequestInfo: " + requestInfo.toString());
374 InventoryInfo inventoryInfo = getInventoryInfo(ctx, vnfId);
375 DependencyInfo dependencyInfo = getDependencyInfo(ctx);
376 Capabilities capabilites = getCapabilitesData(ctx);
378 Input input = new Input();
379 log.info("Enter InputData");
380 input.setRequestInfo(requestInfo);
381 input.setInventoryInfo(inventoryInfo);
382 input.setDependencyInfo(dependencyInfo);
383 input.setCapabilities(capabilites);
384 log.info(fn + "Input parameters:" + input.toString());
386 ObjectMapper mapper = new ObjectMapper();
387 mapper.setSerializationInclusion(Include.NON_NULL);
388 mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
389 inputData = mapper.writeValueAsString(input);
390 log.info("InputDataJson:" + inputData);
392 } catch (Exception e) {
396 String resourceUri = prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_URL);
397 log.info(fn + "resourceUri= " + resourceUri);
399 EncryptionTool et = EncryptionTool.getInstance();
400 String pass = et.decrypt(prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_PWD));
402 transaction.setPayload(inputData);
403 transaction.setExecutionRPC("POST");
404 transaction.setuId(prop.getProperty(FlowControllerConstants.SEQ_GENERATOR_UID));
405 transaction.setPswd(pass);
406 transaction.setExecutionEndPoint(resourceUri);
412 private DependencyInfo getDependencyInfo(SvcLogicContext ctx) throws Exception {
414 String fn = "FlowExecutorNode.getDependencyInfo";
415 DependencyInfo dependencyInfo = new DependencyInfo();
416 FlowControlDBService dbservice = FlowControlDBService.initialise();
417 String dependencyData = dbservice.getDependencyInfo(ctx);
418 log.info(fn + "dependencyDataInput:" + dependencyData);
420 if (dependencyData != null) {
421 ObjectMapper mapper = new ObjectMapper();
422 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
423 mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
424 //JsonNode dependencyInfoData = mapper.readTree(dependencyData).get("dependencyInfo");
425 JsonNode vnfcData = mapper.readTree(dependencyData.toString()).get("vnfcs");
426 List<Vnfcs> vnfclist = Arrays.asList(mapper.readValue(vnfcData.toString(), Vnfcs[].class));
427 dependencyInfo.getVnfcs().addAll(vnfclist);
429 log.info("Dependency Output:"+ dependencyInfo.toString());
432 return dependencyInfo;
436 private Capabilities getCapabilitesData(SvcLogicContext ctx)throws Exception {
438 String fn = "FlowExecutorNode.getCapabilitesData";
439 Capabilities capabilities = new Capabilities();
440 FlowControlDBService dbservice = FlowControlDBService.initialise();
441 String capabilitiesData = dbservice.getCapabilitiesData(ctx);
442 log.info(fn + "capabilitiesDataInput:" + capabilitiesData);
444 if (capabilitiesData != null) {
445 ObjectMapper mapper = new ObjectMapper();
446 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
447 mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
448 JsonNode capabilitiesNode = mapper.readValue(capabilitiesData,JsonNode.class);
449 log.info("capabilitiesNode:" + capabilitiesNode.toString());
451 JsonNode vnfs = capabilitiesNode.findValue(FlowControllerConstants.VNF);
452 List<String> vnfsList = new ArrayList<String>();
454 for (int i = 0; i < vnfs.size(); i++) {
456 String vnf = vnfs.get(i).asText();
461 JsonNode vfModules = capabilitiesNode.findValue(FlowControllerConstants.VF_MODULE);
462 List<String> vfModulesList = new ArrayList<String>();
463 if (vfModules != null) {
464 for (int i = 0; i < vfModules.size(); i++) {
466 String vfModule = vfModules.get(i).asText();
467 vfModulesList.add(vfModule);
471 JsonNode vnfcs = capabilitiesNode.findValue(FlowControllerConstants.VNFC);
472 List<String> vnfcsList = new ArrayList<String>();
474 for (int i = 0; i < vnfcs.size(); i++) {
476 String vnfc1 = vnfcs.get(i).asText();
477 vnfcsList.add(vnfc1);
481 JsonNode vms = capabilitiesNode.findValue(FlowControllerConstants.VM);
483 List<String> vmList = new ArrayList<String>();
485 for (int i = 0; i < vms.size(); i++) {
487 String vm1 = vms.get(i).asText();
492 capabilities.getVnfc().addAll(vnfcsList);
493 capabilities.getVnf().addAll(vnfsList);
494 capabilities.getVfModule().addAll(vfModulesList);
495 capabilities.getVm().addAll(vmList);
497 log.info("Capabilities Output:"+ capabilities.toString());
505 private InventoryInfo getInventoryInfo(SvcLogicContext ctx, String vnfId) throws Exception{
507 String fn = "FlowExecutorNode.getInventoryInfo";
509 VnfInfo vnfInfo = new VnfInfo();
510 vnfInfo.setVnfId(vnfId);
511 vnfInfo.setVnfName(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name"));
512 vnfInfo.setVnfType(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type"));
514 String vmcount = ctx.getAttribute("tmp.vnfInfo.vm-count");
515 if(StringUtils.isNotBlank(vmcount)){
516 int vmCount = Integer.parseInt(vmcount);
517 log.info(fn +"vmcount:"+ vmCount);
520 Vnfcslist vnfc = new Vnfcslist();
524 for (int i = 0; i < vmCount; i++) {
526 vm.setVserverId(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vserver-id"));
527 String vnfccount = ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-count");
528 int vnfcCount = Integer.parseInt(vnfccount);
531 vnfc.setVnfcName(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-name"));
532 vnfc.setVnfcType(ctx.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-type"));
535 vnfInfo.getVm().add(vm);
539 InventoryInfo inventoryInfo = new InventoryInfo();
540 inventoryInfo.setVnfInfo(vnfInfo);
541 log.info(fn + "Inventory Output:" +inventoryInfo.toString());
543 return inventoryInfo;
547 private String getFlowSequence() throws IOException {
549 String sequenceModel = IOUtils.toString(FlowControlNode.class.getClassLoader().getResourceAsStream("sequence.json"), Charset.defaultCharset());
555 private static Properties loadProperties() throws Exception {
556 Properties props = new Properties();
557 String propDir = System.getenv(SDNC_CONFIG_DIR_VAR);
559 throw new Exception("Cannot find Property file -" + SDNC_CONFIG_DIR_VAR);
560 String propFile = propDir + FlowControllerConstants.APPC_FLOW_CONTROLLER;
561 InputStream propStream = new FileInputStream(propFile);
564 props.load(propStream);
568 throw new Exception("Could not load properties file " + propFile, e);
578 log.warn("Could not close FileInputStream", e);