summaryrefslogtreecommitdiffstats
path: root/grpc/grpc-server
diff options
context:
space:
mode:
authorItohan Ukponmwan <itohan.ukponmwan@intel.com>2019-08-05 16:30:20 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-05 16:30:20 +0000
commit55f55f93890a2c4745ee89505cc889f54ba3c3dd (patch)
tree5eb804de9b3907b38621a3f5d8169ae3f6a64c21 /grpc/grpc-server
parentd53b78f51ed1a37f13163fe0ffd77ebd1c7f6f6f (diff)
parentb9d85a33892c99949aff8e3471eb0fdc039d44aa (diff)
Merge changes I816a1dbb,Ice38da57,I1217d391,I07d22e81,I0ddcdc1c, ...
* changes: Add integration support Update framework Add vf model add artifact command Add service model artifact add command Add VF model checkout command Add VF checkin command Add sdc service resource property set Add sdc consumer-show command Add sdc consumer create command Add ID output in service-model commands Update open-cli.properties Update the sample command OCS YAML Add product into service and schema list Update the version format Update the README Set SNAPSHOT versioning clean-up stale onap profiles Ignore python build artifacts from git
Diffstat (limited to 'grpc/grpc-server')
-rw-r--r--grpc/grpc-server/pom.xml4
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java40
2 files changed, 31 insertions, 13 deletions
diff --git a/grpc/grpc-server/pom.xml b/grpc/grpc-server/pom.xml
index be038ad5..c894e67b 100644
--- a/grpc/grpc-server/pom.xml
+++ b/grpc/grpc-server/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.onap.cli</groupId>
<artifactId>oclip-grpc</artifactId>
- <version>3.0.0</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>oclip-grpc-server</artifactId>
<name>oclip/grpc/server</name>
@@ -32,7 +32,7 @@
<dependency>
<groupId>org.onap.cli</groupId>
<artifactId>cli-main</artifactId>
- <version>3.0.0</version>
+ <version>4.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
index 79d761d6..f34df89f 100644
--- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
+++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
@@ -29,11 +29,13 @@ import org.onap.cli.fw.conf.OnapCommandConfig;
import org.onap.cli.fw.conf.OnapCommandConstants;
import org.onap.cli.fw.error.OnapCommandException;
import org.onap.cli.fw.input.OnapCommandParameter;
+import org.onap.cli.fw.input.OnapCommandParameterType;
import org.onap.cli.fw.output.OnapCommandResultType;
import org.onap.cli.fw.registrar.OnapCommandRegistrar;
import org.onap.cli.fw.store.OnapCommandExecutionStore;
import org.onap.cli.fw.store.OnapCommandExecutionStore.ExecutionStoreContext;
import org.onap.cli.main.OnapCli;
+import org.onap.cli.main.utils.OnapCliArgsParser;
import org.open.infc.grpc.Args;
import org.open.infc.grpc.Input;
import org.open.infc.grpc.OpenInterfaceGrpc;
@@ -181,6 +183,24 @@ public class OpenInterfaceGrpcServer {
if (params.contains(arg.getKey()))
cmd.getParametersMap().get(arg.getKey()).setValue(arg.getValue());
}
+
+ //fill values from the file, if needed
+ for (OnapCommandParameter param: cmd.getParameters()) {
+ if (param.getParameterType().equals(OnapCommandParameterType.JSON)) {
+ param.setValue(OnapCliArgsParser.readJsonStringFromUrl(param.getValue().toString(), param.getName()));
+
+ } else if (param.getParameterType().equals(OnapCommandParameterType.TEXT)) {
+ param.setValue(OnapCliArgsParser.readTextStringFromUrl(param.getValue().toString(), param.getName()));
+
+ } else if (param.getParameterType().equals(OnapCommandParameterType.BYTE)) {
+ param.setValue(OnapCliArgsParser.readBytesFromUrl(param.getValue().toString(), param.getName()));
+
+ } else if (param.getParameterType().equals(OnapCommandParameterType.YAML)) {
+ param.setValue(OnapCliArgsParser.readYamlStringFromUrl(param.getValue().toString(), param.getName()));
+
+ }
+ }
+
} else {
cmd.getParametersMap().get(OnapCommandConstants.INFO_PRODUCT).setValue(product);
@@ -194,7 +214,9 @@ public class OpenInterfaceGrpcServer {
if (!cmd.isRpc()) {
//Start the execution
- if (req.getRequestId() != null) {
+ if (req.getRequestId() != null && !req.getRequestId().isEmpty()) {
+ if (!(cmd.getInfo().getProduct().equalsIgnoreCase("open-cli") &&
+ cmd.getName().equalsIgnoreCase("execution-list"))) {
String input = cmd.getArgsJson(true);
executionStoreContext = OnapCommandExecutionStore.getStore().storeExectutionStart(
req.getRequestId(),
@@ -203,12 +225,16 @@ public class OpenInterfaceGrpcServer {
cmd.getName(),
profile,
input);
+ }
}
}
-
+ cmd.setExecutionContext(executionStoreContext);
cmd.execute();
if (!cmd.isRpc()) {
+ //Track and/or persist the execution context
+ new OnapCli().handleTracking(cmd);
+
String printOut = cmd.getResult().print();
Builder reply = Output.newBuilder();
reply.putAttrs(OnapCommandConstants.ERROR, "{}");
@@ -226,15 +252,6 @@ public class OpenInterfaceGrpcServer {
}
output = reply.build();
-
- if (req.getRequestId() != null) {
- //complete the execution recording
- OnapCommandExecutionStore.getStore().storeExectutionEnd(
- executionStoreContext,
- printOut,
- null,
- cmd.getResult().isPassed());
- }
logger.info(output.toString());
} else {
//Rpc command will set the output.
@@ -254,6 +271,7 @@ public class OpenInterfaceGrpcServer {
executionStoreContext,
null,
e.getMessage(),
+ cmd.getResult().getDebugInfo(),
false);
reply.putAddons("execution-id", executionStoreContext.getExecutionId());
}