}
Map<String, ArrayList<String>> results = OnapCommandUtils.populateOutputs(this.getResultMap(), output);
+ results = OnapCommandUtils.populateOutputsFromInputParameters(results, this.getParametersMap());
for (OnapCommandResultAttribute attr : this.getResult().getRecords()) {
attr.setValues(results.get(attr.getName()));
return resultsProcessed;
}
+ /**
+ * Populate result from input parameters.
+ *
+ * @param resultMap
+ * map
+ * @param params
+ * Map<String, OnapCommandParameter>
+ * @return map
+ * @throws OnapCommandHttpHeaderNotFound
+ * header not found exception
+ * @throws OnapCommandHttpInvalidResponseBody
+ * invalid response body exception
+ * @throws OnapCommandResultMapProcessingFailed
+ * map processing failed exception
+ */
+ public static Map<String, ArrayList<String>> populateOutputsFromInputParameters(
+ Map<String, ArrayList<String>> resultMap,
+ Map<String, OnapCommandParameter> params)
+ throws OnapCommandException {
+ Map<String, ArrayList<String>> resultsProcessed = new HashMap<>();
+
+ for (Entry<String, ArrayList<String>> entry : resultMap.entrySet()) {
+ String key = entry.getKey();
+ resultsProcessed.put(key, new ArrayList<>());
+ for (String value: entry.getValue()) {
+ try {
+ value = replaceLineFromInputParameters(value, params);
+ } catch(OnapCommandResultEmpty e) {
+ // pass // NOSONAR
+ }
+ resultsProcessed.get(key).add(value);
+ }
+ }
+
+ return resultsProcessed;
+ }
+
/**
* Find external schema files.
*
--- /dev/null
+onap_cli_sample_version: 1.0
+
+name: microservice-create
+version: onap-1.1
+samples:
+ sample1:
+ name: Create a service
+ input: --service-name test-service --service-version v1 --service-url /api/test/v1 --host-url http://192.168.17.23:80 23.14.15.156 80
+ output: |
+ +----------+------------------------------------+
+ |property |value |
+ +----------+------------------------------------+
+ |name |test-service |
+ +----------+------------------------------------+
+ |version |v1 |
+ +----------+------------------------------------+
+ |url |/api/test/v1 |
+ +----------+------------------------------------+
+ |status |1 |
+ +----------+------------------------------------+
\ No newline at end of file