summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-29 18:15:10 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-08-30 11:02:07 +0530
commita4cd2403a5a171d6ab6aa6b1b0b1aae83345121b (patch)
tree21646bed2f1dd2974ed24756c1f04855362219eb
parent56ecabe9f1e7fca51d919df2836811b378c0e7df (diff)
Add versioning for command
By allowing to add version to the YAML, helps to create same command for multiple versions of product say onap 1.0, 1.1 CLI-37 Change-Id: Ic3982ea912045ff4f422fcf093cbd98ecd99716d Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--deployment/docker/src/main/docker/Dockerfile1
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommand.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java110
-rw-r--r--framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java7
-rw-r--r--framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java10
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/Constants.java5
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java37
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java5
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java30
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/ExternalSchema.java31
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java23
-rw-r--r--framework/src/main/resources/onap-cli-schema/schema-refresh.yaml (renamed from framework/src/main/resources/schema-refresh.yaml)1
-rw-r--r--framework/src/main/resources/onap-cli-schema/schema-validate.yaml (renamed from framework/src/main/resources/schema-validate.yaml)1
-rw-r--r--framework/src/main/resources/onap.properties6
-rw-r--r--framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java2
-rw-r--r--framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java20
-rw-r--r--framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java6
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java4
-rw-r--r--framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml1
-rw-r--r--framework/src/test/resources/onap-test-schema.yaml1
-rw-r--r--framework/src/test/resources/onap.properties56
-rw-r--r--framework/src/test/resources/sample-test-invalid-schema-duplicate-longoption.yaml1
-rw-r--r--framework/src/test/resources/sample-test-invalid-schema-duplicate-name.yaml1
-rw-r--r--framework/src/test/resources/sample-test-invalid-schema-duplicate-shortoption.yaml1
-rw-r--r--framework/src/test/resources/sample-test-invalid-schema.yaml3
-rw-r--r--framework/src/test/resources/sample-test-schema-auth-required.yaml1
-rw-r--r--framework/src/test/resources/sample-test-schema-http.yaml1
-rw-r--r--framework/src/test/resources/sample-test-schema-swagger.yaml1
-rw-r--r--framework/src/test/resources/sample-test-schema.yaml1
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java4
-rw-r--r--main/src/main/resources/onap-readme.txt5
-rw-r--r--main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java2
-rw-r--r--main/src/test/resources/onap-cli-schema/sample-create-schema.yaml1
-rw-r--r--main/src/test/resources/sample-test-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema-1.1.yaml52
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema-1.1.yaml33
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema-1.1.yaml30
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema-1.1.yaml31
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema-1.1.yaml50
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema-1.1.yaml33
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema-1.1.yaml34
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema-1.1.yaml37
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema-1.1.yaml63
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema.yaml1
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema-1.1.yaml40
-rw-r--r--plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema.yaml1
-rw-r--r--plugins/aai/src/test/resources/onap-cli-sample/cloud-region/cloud-list-sample.yaml2
-rw-r--r--plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceCreateCommand.java2
-rw-r--r--plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceDeleteCommand.java2
-rw-r--r--plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceListCommand.java2
-rw-r--r--plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceShowCommand.java2
-rw-r--r--plugins/msb/src/main/resources/onap-cli-schema/microservice-create-schema.yaml (renamed from plugins/msb/src/main/resources/microservice-create-schema.yaml)1
-rw-r--r--plugins/msb/src/main/resources/onap-cli-schema/microservice-delete-schema.yaml (renamed from plugins/msb/src/main/resources/microservice-delete-schema.yaml)1
-rw-r--r--plugins/msb/src/main/resources/onap-cli-schema/microservice-list-schema.yaml (renamed from plugins/msb/src/main/resources/microservice-list-schema.yaml)1
-rw-r--r--plugins/msb/src/main/resources/onap-cli-schema/microservice-show-schema.yaml (renamed from plugins/msb/src/main/resources/microservice-show-schema.yaml)1
-rw-r--r--plugins/msb/src/test/resources/service-list-schema.yaml1
-rw-r--r--plugins/msb/src/test/resources/user-create-schema.yaml1
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-checkin-schema.yaml2
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-create-schema.yaml2
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-list-schema.yaml2
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-show-schema.yaml2
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-submit-schema.yaml2
-rw-r--r--plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-upload-schema.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml2
-rw-r--r--plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml2
-rw-r--r--validation/pom.xml41
81 files changed, 795 insertions, 99 deletions
diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile
index 1b453def..83ebb615 100644
--- a/deployment/docker/src/main/docker/Dockerfile
+++ b/deployment/docker/src/main/docker/Dockerfile
@@ -26,6 +26,7 @@ ENV ONAP_PASSWORD guest
ENV ONAP_CLI_DEBUG false
ENV ONAP_CLI_DEBUG_PORT 5005
ENV MODE console
+ENV CLI_PRODUCT_VERSION cli-1.0
ENTRYPOINT cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ && \
service lighttpd start && \
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommand.java b/framework/src/main/java/org/onap/cli/fw/OnapCommand.java
index 08cbc3bc..c65ca9a8 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommand.java
@@ -58,6 +58,8 @@ public abstract class OnapCommand {
private String cmdSchemaName;
+ private String cmdVersion;
+
private OnapService onapService = new OnapService();
private List<OnapCommandParameter> cmdParameters = new ArrayList<>();
@@ -324,4 +326,12 @@ public abstract class OnapCommand {
return OnapCommandUtils.help(this);
}
// (mrkanag) Add toString for all command, parameter, result, etc objects in JSON format
+
+ public void setVersion(String version) {
+ this.cmdVersion = version;
+ }
+
+ public String getVersion() {
+ return this.cmdVersion;
+ }
}
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
index 567e0381..ca875b35 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java
@@ -16,6 +16,14 @@
package org.onap.cli.fw;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.onap.cli.fw.cmd.OnapHttpCommand;
import org.onap.cli.fw.conf.Constants;
import org.onap.cli.fw.conf.OnapCommandConfg;
@@ -24,6 +32,7 @@ import org.onap.cli.fw.error.OnapCommandHelpFailed;
import org.onap.cli.fw.error.OnapCommandInvalidRegistration;
import org.onap.cli.fw.error.OnapCommandNotFound;
import org.onap.cli.fw.error.OnapCommandRegistrationFailed;
+import org.onap.cli.fw.error.OnapCommandRegistrationVersionMissing;
import org.onap.cli.fw.output.OnapCommandResult;
import org.onap.cli.fw.output.OnapCommandResultAttribute;
import org.onap.cli.fw.output.OnapCommandResultAttributeScope;
@@ -32,24 +41,17 @@ import org.onap.cli.fw.output.ResultType;
import org.onap.cli.fw.utils.ExternalSchema;
import org.onap.cli.fw.utils.OnapCommandUtils;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* Onap Command registrar provides a common place, where every command would get registered automatically when its
* loaded into JVM.
*
*/
public class OnapCommandRegistrar {
- /*
- * static { //Start the AOP for logging new OnapCommandLogger(); }
- */
+
private Map<String, Class<? extends OnapCommand>> registry = new HashMap<>();
+ private Set<String> availableProductVersions = new HashSet<>();
+
private static OnapCommandRegistrar registrar = null;
/**
@@ -61,9 +63,15 @@ public class OnapCommandRegistrar {
* Command Class
* @throws OnapCommandInvalidRegistration
* Invalid registration exception
+ * @throws OnapCommandRegistrationVersionMissing
*/
- public void register(String name, Class<? extends OnapCommand> cmd) throws OnapCommandInvalidRegistration {
- this.registry.put(name, cmd);
+ public void register(String name, String version, Class<? extends OnapCommand> cmd) throws OnapCommandInvalidRegistration, OnapCommandRegistrationVersionMissing {
+ if (version == null || version.isEmpty()) {
+ throw new OnapCommandRegistrationVersionMissing(name);
+ }
+
+ this.registry.put(name + ":" + version, cmd);
+ this.availableProductVersions.add(version);
}
/**
@@ -92,6 +100,27 @@ public class OnapCommandRegistrar {
}
/**
+ * Get the list of discovered commands for a given product version in registrar.
+ *
+ * @return set
+ */
+ public Set<String> listCommandsForEnabledProductVersion() {
+ String version = OnapCommandConfg.getEnabledProductVersion();
+
+ Set<String> cmds = new HashSet<>();
+ if (!this.availableProductVersions.contains(version)) {
+ return cmds;
+ }
+
+ for (String cmd: this.registry.keySet()) {
+ if (cmd.split(":")[1].equalsIgnoreCase(version)) {
+ cmds.add(cmd.split(":")[0]);
+ }
+ }
+ return cmds;
+ }
+
+ /**
* Returns map of command to schema.
*
* @return map
@@ -103,7 +132,7 @@ public class OnapCommandRegistrar {
List<ExternalSchema> schemas = OnapCommandUtils.findAllExternalSchemas();
if (schemas != null) {
for (ExternalSchema schema : schemas) {
- map.put(schema.getCmdName(), schema.getSchemaName());
+ map.put(schema.getCmdName() + ":" + schema.getCmdVersion(), schema.getSchemaName());
}
}
if (this.registry != null) {
@@ -127,19 +156,23 @@ public class OnapCommandRegistrar {
* Exception
*/
public OnapCommand get(String cmdName) throws OnapCommandException {
- OnapCommand cmd;
- Class<? extends OnapCommand> cls = registry.get(cmdName);
+ return this.get(cmdName, OnapCommandConfg.getEnabledProductVersion());
+ }
+
+ private OnapCommand get(String cmdName, String version) throws OnapCommandException {
+ Class<? extends OnapCommand> cls = registry.get(cmdName + ":" + version);
if (cls == null) {
- throw new OnapCommandNotFound(cmdName);
+ throw new OnapCommandNotFound(cmdName, version);
}
+ OnapCommand cmd;
try {
Constructor<?> constr = cls.getConstructor();
cmd = (OnapCommand) constr.newInstance();
String schemaName;
if (cmd.getClass().equals(OnapHttpCommand.class)) { // NOSONAR
- schemaName = OnapCommandUtils.loadExternalSchemaFromJson(cmdName).getSchemaName();
+ schemaName = OnapCommandUtils.loadExternalSchemaFromJson(cmdName, version).getSchemaName();
} else {
schemaName = this.getSchemaFileName(cls);
}
@@ -152,13 +185,13 @@ public class OnapCommandRegistrar {
return cmd;
}
- private void autoDiscover() throws OnapCommandInvalidRegistration {
+ private void autoDiscover() throws OnapCommandInvalidRegistration, OnapCommandRegistrationVersionMissing {
List<Class<OnapCommand>> cmds = OnapCommandUtils.findOnapCommands();
for (Class<OnapCommand> cmd : cmds) {
if (cmd.isAnnotationPresent(OnapCommandSchema.class)) {
OnapCommandSchema ano = cmd.getAnnotation(OnapCommandSchema.class);
- this.register(ano.name(), cmd);
+ this.register(ano.name(), ano.version(), cmd);
}
}
}
@@ -166,15 +199,14 @@ public class OnapCommandRegistrar {
private void autoDiscoverHttpSchemas() throws OnapCommandException {
List<ExternalSchema> schemas = OnapCommandUtils.loadExternalSchemasFromJson();
for (ExternalSchema schema : schemas) {
- this.register(schema.getCmdName(), OnapHttpCommand.class);
+ if (schema.isHttp()) {
+ this.register(schema.getCmdName(), schema.getCmdVersion(), OnapHttpCommand.class);
+ }
}
}
private String getSchemaFileName(Class<? extends OnapCommand> cmd) {
OnapCommandSchema ano = (OnapCommandSchema) cmd.getAnnotation(OnapCommandSchema.class);
- if (ano.schema().isEmpty()) {
- return "onap-" + ano.name() + "-schema.yaml";
- }
return ano.schema();
}
@@ -188,7 +220,18 @@ public class OnapCommandRegistrar {
if (version == null) {
version = OnapCommandConfg.getVersion();
}
- return version;
+
+ String configuredProductVersion = OnapCommandConfg.getEnabledProductVersion();
+
+ String errorNote = "";
+ if (!this.availableProductVersions.contains(configuredProductVersion)) {
+ errorNote = "** CUATION: Please configure the enabled product version to use one of " + this.availableProductVersions.toString() +
+ ".\nTo enable a product version, set env variable CLI_PRODUCT_VERSION or cli.product.version in onap.properties";
+ }
+ return "CLI version : " + version + "\n"
+ + "Available product versions: " + this.availableProductVersions.toString() + "\n"
+ + "Enabled product version : " + configuredProductVersion + "\n" +
+ errorNote;
}
/**
@@ -209,6 +252,12 @@ public class OnapCommandRegistrar {
attr.setScope(OnapCommandResultAttributeScope.SHORT);
help.getRecords().add(attr);
+ OnapCommandResultAttribute attrVer = new OnapCommandResultAttribute();
+ attrVer.setName(Constants.PRODUCT_VERSION.toUpperCase());
+ attrVer.setDescription(Constants.DESCRIPTION);
+ attrVer.setScope(OnapCommandResultAttributeScope.SHORT);
+ help.getRecords().add(attrVer);
+
OnapCommandResultAttribute attrSrv = new OnapCommandResultAttribute();
attrSrv.setName(Constants.SERVICE.toUpperCase());
attrSrv.setDescription(Constants.SERVICE);
@@ -224,18 +273,19 @@ public class OnapCommandRegistrar {
for (String cmdName : OnapCommandUtils.sort(this.listCommands())) {
OnapCommand cmd;
try {
- cmd = this.get(cmdName);
+ String []cmdVer = cmdName.split(":");
+ cmd = this.get(cmdVer[0], cmdVer[1]);
+ attr.getValues().add(cmdVer[0]);
+ attrVer.getValues().add(cmdVer[1]);
+ attrSrv.getValues().add(cmd.printVersion());
+ attrDesc.getValues().add(cmd.getDescription());
} catch (OnapCommandException e) {
throw new OnapCommandHelpFailed(e);
}
-
- attr.getValues().add(cmd.getName());
- attrSrv.getValues().add(cmd.printVersion());
- attrDesc.getValues().add(cmd.getDescription());
}
try {
- return "\n\nOnap sub-commands:\n" + help.print();
+ return "\n\nOnap sub-commands:\n" + help.print() + "\n" + this.getVersion();
} catch (OnapCommandException e) {
throw new OnapCommandHelpFailed(e);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
index 853d3583..471ab057 100644
--- a/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
+++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandSchema.java
@@ -40,6 +40,13 @@ public @interface OnapCommandSchema {
String name();
/**
+ * Command version
+ *
+ * @return
+ */
+ String version();
+
+ /**
* Schema file name placed under class path
*
* @return
diff --git a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
index e9d495c6..458a7587 100644
--- a/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
+++ b/framework/src/main/java/org/onap/cli/fw/ad/OnapAuthClient.java
@@ -54,8 +54,6 @@ public class OnapAuthClient {
private OnapService service = new OnapService();
- private String authType = OnapCommandConfg.getAuthType();
-
private Map<String, String> paramMap = new HashMap<>();
public OnapAuthClient(OnapCredentials creds, boolean debug, OnapService service, List<OnapCommandParameter> params) throws OnapCommandHttpFailure, OnapCommandInvalidParameterValue {
@@ -64,7 +62,6 @@ public class OnapAuthClient {
for (OnapCommandParameter param : params) {
paramMap.put(param.getName(), param.getValue().toString());
}
- this.authType = service.getAuthType();
this.http = new OnapHttpConnection(creds.getHostUrl().startsWith("https"), debug);
}
@@ -88,15 +85,14 @@ public class OnapAuthClient {
return;
}
- if (this.authType.equalsIgnoreCase(Constants.AUTH_BASIC)) {
+ if (this.service.getAuthType().equalsIgnoreCase(Constants.AUTH_BASIC)) {
String authToken = BasicScheme.authenticate(new UsernamePasswordCredentials(
creds.getUsername(), creds.getPassword()), "UTF-8", false).getValue();
Map<String, String> mapHeaders = OnapCommandConfg.getBasicCommonHeaders(this.paramMap);
- if(this.service.getName() != null){
- mapHeaders.putAll(OnapCommandConfg.getServiceHeaders(this.service.getName(), this.paramMap));
- }
+ mapHeaders.putAll(OnapCommandConfg.getServiceHeaders(this.service.getName(), this.paramMap));
mapHeaders.put(OnapCommandConfg.getXAuthTokenName(), authToken);
+
this.http.setCommonHeaders(mapHeaders);
return;
}
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
index 57432751..81cdfca2 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java
@@ -30,7 +30,7 @@ import java.util.List;
* Refresh external schema.
*
*/
-@OnapCommandSchema(name = "schema-refresh", schema = "schema-refresh.yaml")
+@OnapCommandSchema(name = "schema-refresh", version="0.0", schema = "schema-refresh.yaml")
public class OnapSchemaRefreshCommand extends OnapCommand {
@Override
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java
index b1811483..140ac818 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java
@@ -29,7 +29,7 @@ import java.util.Map;
/**
* Validate schema command.
*/
-@OnapCommandSchema(name = "schema-validate", schema = "schema-validate.yaml")
+@OnapCommandSchema(name = "schema-validate", version="0.0", schema = "schema-validate.yaml")
public class OnapSchemaValidateCommand extends OnapCommand {
@Override
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
index e9b158e7..980b94d3 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/Constants.java
@@ -129,6 +129,8 @@ public class Constants {
public static final String CONF = "onap.properties";
public static final String ONAP_IGNORE_AUTH = "cli.ignore_auth";
public static final String ONAP_CLI_VERSION = "cli.version";
+ public static final String ONAP_CLI_PRODUCT_VERSION = "cli.product.version";
+ public static final String ONAP_CLI_PRODUCT_VERSION_ENV_NAME = "CLI_PRODUCT_VERSION";
public static final String HTTP_API_KEY_USE_COOKIES = "cli.http.api_key_use_cookies";
public static final String EXCLUDE_PARAMS_INTERNAL_CMD = "cli.exclude_params_internal_cmd";
public static final String NO_AUTH_DISABLE_INCLUDE_PARAMS_EXTERNAL_CMD = "cli.no_auth_disable_include_params_external_cmd";
@@ -146,7 +148,7 @@ public class Constants {
public static final String EXTERNAL_JSON_PATTERN = "/**/*.json";
public static final String EXTERNAL_SCHEMA_PATH_PATERN = EXTERNAL_SCHEMA_DIRECTORY + EXTERNAL_YAML_PATTERN;
public static final String EXTERNAL_DISCOVERY_DIRECTORY = "data";
- public static final String EXTERNAL_DISCOVERY_FILE = "external-schema.json";
+ public static final String EXTERNAL_DISCOVERY_FILE = "cli-schema.json";
public static final String EXTERNAL_DISCOVERY_DIRECTORY_PATTERN = EXTERNAL_DISCOVERY_DIRECTORY
+ EXTERNAL_JSON_PATTERN;
@@ -177,6 +179,7 @@ public class Constants {
public static final String DEFAULT_SCHEMA_FILE_NAME = "default_input_parameters.yaml";
+ public static final String PRODUCT_VERSION = "product version";
// Error message
public static final String SCHEMA_INVALID_DEFAULT_PARAMS_SECTION = "Invalid default_parameter section";
public static final String SCHEMA_FILE_EMPTY = "The schema file cann't be null or empty";
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
index 479431f2..5ca0589f 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConfg.java
@@ -68,6 +68,14 @@ public final class OnapCommandConfg {
return prps.getProperty(Constants.ONAP_CLI_VERSION);
}
+ public static String getEnabledProductVersion() {
+ String version = System.getenv(Constants.ONAP_CLI_PRODUCT_VERSION_ENV_NAME);
+ if (version == null) {
+ version = prps.getProperty(Constants.ONAP_CLI_PRODUCT_VERSION);
+ }
+ return version;
+ }
+
/**
* checks if cookies based auth.
*
@@ -103,22 +111,25 @@ public final class OnapCommandConfg {
private static Map<String, String> getHeaderValues(String headerKey, Map<String, String> paramMap) {
Map<String, String> mapHeaders = new HashMap<String, String> ();
- Arrays.stream(prps.getProperty(headerKey) // NOSONAR
- .split(",")).map(String::trim).forEach(header -> {
- String headerName = prps.getProperty(headerKey+ "." + header);
- String headerValue = prps.getProperty(headerKey + "." + header + ".value", null);
- if (headerValue != null) {
- headerValue = headerValue.replaceAll("uuid", UUID.randomUUID().toString());
- if (headerValue.contains("${")) {
- String param = headerValue.substring(headerValue.indexOf("${")+2 ,headerValue.indexOf("}"));
- String pattern = "${"+param+"}";
- headerValue = headerValue.replace(pattern, paramMap.getOrDefault(param, param));
+ if (prps.containsKey(headerKey)) {
+ Arrays.stream(prps.getProperty(headerKey) // NOSONAR
+ .split(",")).map(String::trim).forEach(header -> {
+ String headerName = prps.getProperty(headerKey+ "." + header);
+ String headerValue = prps.getProperty(headerKey + "." + header + ".value", null);
+ if (headerValue != null) {
+ headerValue = headerValue.replaceAll("uuid", UUID.randomUUID().toString());
+ if (headerValue.contains("${")) {
+ String param = headerValue.substring(headerValue.indexOf("${")+2 ,headerValue.indexOf("}"));
+ String pattern = "${"+param+"}";
+ headerValue = headerValue.replace(pattern, paramMap.getOrDefault(param, param));
+ }
}
- }
- mapHeaders.put(headerName, headerValue);
- });
+ mapHeaders.put(headerName, headerValue);
+ });
+ }
return mapHeaders;
}
+
public static Map<String, String> getBasicCommonHeaders(Map<String, String> paramMap) {
return getHeaderValues(Constants.SERVICE_AUTH_BASIC_HTTP_HEADERS, paramMap);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
index 172d60bb..4a070fb3 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandNotFound.java
@@ -24,7 +24,8 @@ public class OnapCommandNotFound extends OnapCommandException {
private static final long serialVersionUID = 6676137916079057963L;
- public OnapCommandNotFound(String cmdName) {
- super("0x0011", "Command " + cmdName + " is not registered");
+ public OnapCommandNotFound(String cmdName, String version) {
+ super("0x0011", "Command " + cmdName + " is not available for product version " + version +
+ ". so please check command name or product version set in env variable CLI_PRODUCT_VERSION or cli.product.version in onap.properties");
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java
new file mode 100644
index 00000000..2bad5a4c
--- /dev/null
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandRegistrationVersionMissing.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.cli.fw.error;
+
+/**
+ * Command Not registered in Onap Command Registrar as version missing.
+ *
+ */
+public class OnapCommandRegistrationVersionMissing extends OnapCommandException {
+
+ private static final long serialVersionUID = 5513297861129088463L;
+
+ public OnapCommandRegistrationVersionMissing(String cmdName) {
+ super("0x0031", "Command " + cmdName + " version is missing");
+ }
+}
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/ExternalSchema.java b/framework/src/main/java/org/onap/cli/fw/utils/ExternalSchema.java
index e9f19673..12f217ce 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/ExternalSchema.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/ExternalSchema.java
@@ -19,8 +19,11 @@ package org.onap.cli.fw.utils;
public class ExternalSchema {
private String schemaName;
+ private String schemaURI;
private String cmdName;
+ private String cmdVersion;
private String version;
+ private String http = "false";
public String getSchemaName() {
return schemaName;
@@ -46,4 +49,32 @@ public class ExternalSchema {
this.version = version;
}
+ public String getCmdVersion() {
+ return cmdVersion;
+ }
+
+ public void setCmdVersion(String cmdVersion) {
+ this.cmdVersion = cmdVersion;
+ }
+
+ public String getSchemaURI() {
+ return schemaURI;
+ }
+
+ public void setSchemaURI(String schemaURI) {
+ this.schemaURI = schemaURI;
+ }
+
+ public String getHttp() {
+ return http;
+ }
+
+ public void setHttp(String internal) {
+ this.http = internal;
+ }
+
+ public boolean isHttp() {
+ return this.getHttp().equals("true");
+ }
+
}
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index 625c644b..b31b75cf 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -25,6 +25,7 @@ import org.onap.cli.fw.ad.OnapCredentials;
import org.onap.cli.fw.ad.OnapService;
import org.onap.cli.fw.cmd.OnapHttpCommand;
import org.onap.cli.fw.cmd.OnapSwaggerCommand;
+import org.onap.cli.fw.conf.Constants;
import org.onap.cli.fw.conf.OnapCommandConfg;
import org.onap.cli.fw.error.OnapCommandDiscoveryFailed;
import org.onap.cli.fw.error.OnapCommandException;
@@ -372,6 +373,13 @@ public class OnapCommandUtils {
}
break;
+ case VERSION:
+ Object version = values.get(key);
+ if (version != null) {
+ cmd.setVersion(version.toString());
+ }
+ break;
+
case DESCRIPTION:
Object description = values.get(key);
if (description != null) {
@@ -1482,7 +1490,11 @@ public class OnapCommandUtils {
for (Entry<String, String> entry : resultMap.entrySet()) {
String key = entry.getKey();
- resultsProcessed.put(key, replaceLineFromOutputResults(resultMap.get(key), resultHttp));
+ try {
+ resultsProcessed.put(key, replaceLineFromOutputResults(resultMap.get(key), resultHttp));
+ } catch(OnapCommandResultEmpty e) {
+ // pass // NOSONAR
+ }
}
return resultsProcessed;
@@ -1508,9 +1520,14 @@ public class OnapCommandUtils {
if (resourceMap != null && resourceMap.size() > 0) {
ExternalSchema schema = new ExternalSchema();
schema.setSchemaName(resource.getFilename());
+ schema.setSchemaURI(resource.getURI().toString());
schema.setCmdName((String) resourceMap.get(NAME));
Object obj = resourceMap.get(ONAP_CMD_SCHEMA_VERSION);
schema.setVersion(obj.toString());
+ schema.setCmdVersion(resourceMap.get(Constants.VERSION).toString());
+ if (resourceMap.get(Constants.HTTP) != null) {
+ schema.setHttp("true");
+ }
extSchemas.add(schema);
}
}
@@ -1672,12 +1689,12 @@ public class OnapCommandUtils {
* @throws OnapCommandDiscoveryFailed
* exception
*/
- public static ExternalSchema loadExternalSchemaFromJson(String cmd) throws OnapCommandException {
+ public static ExternalSchema loadExternalSchemaFromJson(String cmd, String version) throws OnapCommandException {
List<ExternalSchema> list = loadExternalSchemasFromJson();
ExternalSchema schemaStr = null;
if (list != null) {
for (ExternalSchema schema : list) {
- if (cmd.equals(schema.getCmdName())) {
+ if (cmd.equals(schema.getCmdName()) && version.equals(schema.getCmdVersion())) {
schemaStr = schema;
break;
}
diff --git a/framework/src/main/resources/schema-refresh.yaml b/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml
index 59f2496c..56492502 100644
--- a/framework/src/main/resources/schema-refresh.yaml
+++ b/framework/src/main/resources/onap-cli-schema/schema-refresh.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: schema-refresh
description: Onap command to refresh schemas stored in onap_cli_schema folders.
+version: 0.0
service:
auth: none
name: onap-cli
diff --git a/framework/src/main/resources/schema-validate.yaml b/framework/src/main/resources/onap-cli-schema/schema-validate.yaml
index 76945793..a4c1fd29 100644
--- a/framework/src/main/resources/schema-validate.yaml
+++ b/framework/src/main/resources/onap-cli-schema/schema-validate.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: schema-validate
description: Onap command to validate schema
+version: 0.0
service:
auth: none
name: onap-cli
diff --git a/framework/src/main/resources/onap.properties b/framework/src/main/resources/onap.properties
index 9d59f1e2..9e6b34bd 100644
--- a/framework/src/main/resources/onap.properties
+++ b/framework/src/main/resources/onap.properties
@@ -12,7 +12,6 @@ cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,host
cli.no_auth_enable_exclude_params_external_cmd=onap-username,onap-password,no-auth
cli.no_auth_enable_include_params_external_cmd=host-url
-cli.service.auth=aaf
cli.http.basic.common_headers=x-auth-token,x-transaction-id,x-app-id
cli.http.basic.common_headers.x-auth-token=Authorization
cli.http.basic.common_headers.x-transaction-id=X-TransactionId
@@ -29,7 +28,7 @@ cli.http.basic.common_headers.sdc.user-id.value=${onap-username}
#cli.service.auth=aaf
#schema validation
-cli.schema.top_level_params_list=onap_cmd_schema_version,name,description,service,parameters,results,http
+cli.schema.top_level_params_list=onap_cmd_schema_version,name,version,description,service,parameters,results,http
cli.schema.top_level_mandatory_list=onap_cmd_schema_version
cli.schema.service_params_list=name,version,auth,mode
@@ -52,3 +51,6 @@ cli.schema.http_methods=post,get,delete,put,head
cli.schema.boolean_values=true,false
cli.schema.auth_values=none,basic
cli.schema.mode_values=direct,catalog
+
+#product version
+cli.product.version=cli-1.0
diff --git a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
index 69714ad7..16c92185 100644
--- a/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
+++ b/framework/src/test/java/org/onap/cli/cmd/sample/OnapCommandSample.java
@@ -25,7 +25,7 @@ import org.onap.cli.fw.error.OnapCommandExecutionFailed;
* This command helps to test the Command functionalities.
*
*/
-@OnapCommandSchema(name = "sample-test", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(name = "sample-test", version="cli-1.0", schema = "sample-test-schema.yaml")
public class OnapCommandSample extends OnapCommand {
public OnapCommandSample() {
diff --git a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
index a076eee6..840a75d7 100644
--- a/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/OnapCommandRegistrarTest.java
@@ -50,7 +50,7 @@ public class OnapCommandRegistrarTest {
if (!file.exists()) {
file.mkdir();
} else {
- File f1 = new File(path + "/external-schema.json");
+ File f1 = new File(path + "/cli-schema.json");
f1.delete();
}
}
@@ -60,7 +60,7 @@ public class OnapCommandRegistrarTest {
public void registerTest() throws OnapCommandException {
OnapCommand test = new OnapCommandTest();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
- registerar.register("Test", cmd);
+ registerar.register("Test", "cli-1.0", cmd);
OnapCommand cc = registerar.get("Test");
assertTrue(cmd == cc.getClass());
@@ -71,7 +71,7 @@ public class OnapCommandRegistrarTest {
public void cmdTestSchema() throws OnapCommandException {
OnapCommand test = new OnapCommandTest();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
- registerar.register("Test", cmd);
+ registerar.register("Test", "cli-1.0", cmd);
OnapCommand cc = registerar.get("Test");
}
@@ -82,14 +82,16 @@ public class OnapCommandRegistrarTest {
registerar.get("Test1");
fail("This should have thrown an exception");
} catch (OnapCommandNotFound e) {
- assertEquals(e.getMessage(), "0x0011::Command Test1 is not registered");
+ //pass // NOSONAR
+ } catch (Exception e) {
+ fail("This should have thrown an OnapCommandNotFound exception");
}
}
@Test
public void onapCommandRegistrationFailedTest() throws OnapCommandException {
- @OnapCommandSchema(name = "Test2", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(name = "Test2", version= "cli-1.0", schema = "sample-test-schema.yaml")
class Test extends OnapCommand {
@Override
@@ -102,7 +104,7 @@ public class OnapCommandRegistrarTest {
OnapCommand com = new Test();
Class<OnapCommand> cmd = (Class<OnapCommand>) com.getClass();
try {
- registerar.register("Test2", cmd);
+ registerar.register("Test2", "cli-1.0", cmd);
registerar.get("Test2");
fail("This should have thrown an exception");
} catch (OnapCommandRegistrationFailed e) {
@@ -116,7 +118,7 @@ public class OnapCommandRegistrarTest {
OnapCommand test = new OnapCommandTest1();
Class<OnapCommand> cmd = (Class<OnapCommand>) test.getClass();
registerar = new OnapCommandRegistrar();
- registerar.register("test1", cmd);
+ registerar.register("test1", "cli-1.0", cmd);
String help = registerar.getHelp();
assertNotNull(help);
}
@@ -139,7 +141,7 @@ public class OnapCommandRegistrarTest {
}
}
-@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, schema = "sample-test-schema.yaml")
+@OnapCommandSchema(name = OnapCommandTest.CMD_NAME, version = "cli-1.0", schema = "sample-test-schema.yaml")
class OnapCommandTest extends OnapCommand {
public OnapCommandTest() {
@@ -154,7 +156,7 @@ class OnapCommandTest extends OnapCommand {
}
-@OnapCommandSchema(name = OnapCommandTest1.CMD_NAME, schema = "test-schema.yaml")
+@OnapCommandSchema(name = OnapCommandTest1.CMD_NAME, version = "cli-1.0", schema = "test-schema.yaml")
class OnapCommandTest1 extends OnapCommand {
public OnapCommandTest1() {
diff --git a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
index 1d0c1a6b..0a388e5f 100644
--- a/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/error/OnapCommandErrorTest.java
@@ -190,9 +190,11 @@ public class OnapCommandErrorTest {
@Test
public void onapCommandNotFoundTest() {
- OnapCommandNotFound failed = new OnapCommandNotFound("Test");
+ OnapCommandNotFound failed = new OnapCommandNotFound("Test", "1.0");
- assertEquals("0x0011::Command Test is not registered", failed.getMessage());
+ assertEquals("0x0011::Command Test is not available for product version 1.0."
+ + " so please check command name or product version set in env variable CLI_PRODUCT_VERSION or"
+ + " cli.product.version in onap.properties", failed.getMessage());
}
@Test
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index 064576d8..5a992c6f 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -434,14 +434,14 @@ public class OnapCommandUtilsTest {
}
- @OnapCommandSchema(name = "sample-test", schema = "sample-test-schema.yaml")
+ @OnapCommandSchema(name = "sample-test", version = "cli-1.0", schema = "sample-test-schema.yaml")
class OnapCommandSample extends OnapCommand {
@Override
protected void run() throws OnapCommandException {
}
}
- @OnapCommandSchema(name = "sample-swagger-test", schema = "sample-test-schema-swagger.yaml")
+ @OnapCommandSchema(name = "sample-swagger-test", version = "cli-1.0", schema = "sample-test-schema-swagger.yaml")
class OnapSwaggerBasedCommandSample extends OnapSwaggerCommand {
@Override
@@ -449,7 +449,7 @@ public class OnapCommandUtilsTest {
}
}
- @OnapCommandSchema(name = "sample-http-test", schema = "sample-test-schema-http.yaml")
+ @OnapCommandSchema(name = "sample-http-test", version = "cli-1.0", schema = "sample-test-schema-http.yaml")
class OnapHttpCommandSample extends OnapHttpCommand {
@Override
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
index fa73ea6e..f7ba2355 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OpenCommandRegistrarTest.java
@@ -34,9 +34,9 @@ public class OpenCommandRegistrarTest {
public void test() throws OnapCommandException {
OnapCommandRegistrar registrar = OnapCommandRegistrar.getRegistrar();
OnapCommand cmd = registrar.get("sample-test");
- registrar.listCommands();
- registrar.getAllCommandToSchemaMap();
cmd.printVersion();
+ registrar.listCommands();
+
}
}
diff --git a/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml b/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml
index 18a7bb16..0da1d22e 100644
--- a/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml
+++ b/framework/src/test/resources/onap-cli-schema/sample-test1-schema-http.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test1
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/onap-test-schema.yaml b/framework/src/test/resources/onap-test-schema.yaml
index aa656064..0a2f5c47 100644
--- a/framework/src/test/resources/onap-test-schema.yaml
+++ b/framework/src/test/resources/onap-test-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+verion: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/onap.properties b/framework/src/test/resources/onap.properties
new file mode 100644
index 00000000..9e6b34bd
--- /dev/null
+++ b/framework/src/test/resources/onap.properties
@@ -0,0 +1,56 @@
+cli.ignore_auth=false
+cli.version=1.0
+cli.http.api_key_use_cookies=true
+
+cli.service_name=onap-cli
+cli.api_gateway=msb
+cli.auth_service=auth
+
+# service section
+cli.exclude_params_internal_cmd=onap-username,onap-password,host-url,no-auth
+cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,host-url,no-auth
+cli.no_auth_enable_exclude_params_external_cmd=onap-username,onap-password,no-auth
+cli.no_auth_enable_include_params_external_cmd=host-url
+
+cli.http.basic.common_headers=x-auth-token,x-transaction-id,x-app-id
+cli.http.basic.common_headers.x-auth-token=Authorization
+cli.http.basic.common_headers.x-transaction-id=X-TransactionId
+cli.http.basic.common_headers.x-transaction-id.value=req-uuid
+cli.http.basic.common_headers.x-app-id=X-FromAppId
+cli.http.basic.common_headers.x-app-id.value=onap-cli
+
+# Service specific headers
+cli.http.basic.common_headers.sdc=user-id
+cli.http.basic.common_headers.sdc.user-id=USER_ID
+cli.http.basic.common_headers.sdc.user-id.value=${onap-username}
+
+#TODO mrkanag add support for aaf like defined above for basic
+#cli.service.auth=aaf
+
+#schema validation
+cli.schema.top_level_params_list=onap_cmd_schema_version,name,version,description,service,parameters,results,http
+cli.schema.top_level_mandatory_list=onap_cmd_schema_version
+
+cli.schema.service_params_list=name,version,auth,mode
+cli.schema.service_params_mandatory_list=name,version
+
+cli.schema.input_params_list=name,description,type,short_option,long_option, is_optional,default_value,is_secured
+cli.schema.input_params_mandatory_list=name,description,type
+
+cli.schema.result_params_list=name,description,scope,type,is_secured
+cli.schema.result_params_mandatory_list=name, description, type
+
+cli.schema.http_sections=request,success_codes,result_map,sample_response
+cli.schema.http_mandatory_sections=equest, success_codes
+
+cli.schema.http_request_params=uri,method,body,headers,queries,multipart_entity_name
+cli.schema.http_request_mandatory_params=uri,method
+
+cli.schema.http_methods=post,get,delete,put,head
+
+cli.schema.boolean_values=true,false
+cli.schema.auth_values=none,basic
+cli.schema.mode_values=direct,catalog
+
+#product version
+cli.product.version=cli-1.0
diff --git a/framework/src/test/resources/sample-test-invalid-schema-duplicate-longoption.yaml b/framework/src/test/resources/sample-test-invalid-schema-duplicate-longoption.yaml
index 8761bb30..a18aacc0 100644
--- a/framework/src/test/resources/sample-test-invalid-schema-duplicate-longoption.yaml
+++ b/framework/src/test/resources/sample-test-invalid-schema-duplicate-longoption.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/sample-test-invalid-schema-duplicate-name.yaml b/framework/src/test/resources/sample-test-invalid-schema-duplicate-name.yaml
index df4ed316..375f4548 100644
--- a/framework/src/test/resources/sample-test-invalid-schema-duplicate-name.yaml
+++ b/framework/src/test/resources/sample-test-invalid-schema-duplicate-name.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/sample-test-invalid-schema-duplicate-shortoption.yaml b/framework/src/test/resources/sample-test-invalid-schema-duplicate-shortoption.yaml
index 519f6e3b..9c501452 100644
--- a/framework/src/test/resources/sample-test-invalid-schema-duplicate-shortoption.yaml
+++ b/framework/src/test/resources/sample-test-invalid-schema-duplicate-shortoption.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/sample-test-invalid-schema.yaml b/framework/src/test/resources/sample-test-invalid-schema.yaml
index ed21772c..fc301bbd 100644
--- a/framework/src/test/resources/sample-test-invalid-schema.yaml
+++ b/framework/src/test/resources/sample-test-invalid-schema.yaml
@@ -1,11 +1,12 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
parameters:
- -- name: bool-param
+ - name: bool-param
type: bool
description: Onap boolean param, by default its always false.
short_option: b
diff --git a/framework/src/test/resources/sample-test-schema-auth-required.yaml b/framework/src/test/resources/sample-test-schema-auth-required.yaml
index 4df6445a..408c74c7 100644
--- a/framework/src/test/resources/sample-test-schema-auth-required.yaml
+++ b/framework/src/test/resources/sample-test-schema-auth-required.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/sample-test-schema-http.yaml b/framework/src/test/resources/sample-test-schema-http.yaml
index 7bbf6775..56a0a536 100644
--- a/framework/src/test/resources/sample-test-schema-http.yaml
+++ b/framework/src/test/resources/sample-test-schema-http.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-create-http
description: Register microservice into Onap
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/framework/src/test/resources/sample-test-schema-swagger.yaml b/framework/src/test/resources/sample-test-schema-swagger.yaml
index c88ddb7a..b9944363 100644
--- a/framework/src/test/resources/sample-test-schema-swagger.yaml
+++ b/framework/src/test/resources/sample-test-schema-swagger.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test-swagger
description: Sample swagger command test.
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/framework/src/test/resources/sample-test-schema.yaml b/framework/src/test/resources/sample-test-schema.yaml
index dbb5cbed..2f021779 100644
--- a/framework/src/test/resources/sample-test-schema.yaml
+++ b/framework/src/test/resources/sample-test-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: onap-1.0
service:
name: sample
version: v1
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index 05daf116..2695c3f7 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -86,7 +86,7 @@ public class OnapCli {
if ((args.isEmpty())
|| ((args.size() == 1) && (this.getLongOption(OnapCliConstants.PARAM_HELP_LOGN).equals(args.get(0))
|| this.getShortOption(OnapCliConstants.PARAM_HELP_SHORT).equals(args.get(0))))) {
- this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("onap-readme.txt")));
+ this.print(IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream("README.md")));
String help = OnapCommandRegistrar.getRegistrar().getHelp();
this.print(help);
this.exitSuccessfully();
@@ -173,7 +173,7 @@ public class OnapCli {
private ConsoleReader createConsoleReader() throws IOException {
ConsoleReader console = new ConsoleReader();
try {
- StringCompleter strCompleter = new StringCompleter(OnapCommandRegistrar.getRegistrar().listCommands());
+ StringCompleter strCompleter = new StringCompleter(OnapCommandRegistrar.getRegistrar().listCommandsForEnabledProductVersion());
strCompleter.add(OnapCliConstants.PARAM_INTERACTIVE_EXIT,
OnapCliConstants.PARAM_INTERACTIVE_CLEAR);
console.addCompleter(strCompleter);
diff --git a/main/src/main/resources/onap-readme.txt b/main/src/main/resources/onap-readme.txt
index 737cd04d..1008737b 100644
--- a/main/src/main/resources/onap-readme.txt
+++ b/main/src/main/resources/onap-readme.txt
@@ -12,4 +12,7 @@ To know the CLI version, type onap [-v|--version]
To know the CLI usage, type onap [-h|--help]
To know the usage of sub commands, type onap <command> [-h|--help]
-To know more, please refer the Onap wiki https://wiki.onap.org \ No newline at end of file
+To know more, please refer the Onap wiki https://wiki.onap.org
+
+NOTE: This file has been deprecated in amesterdam release and is
+replaced by README.md file \ No newline at end of file
diff --git a/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java b/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
index 517d6c4f..b06824b6 100644
--- a/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
+++ b/main/src/test/java/org/onap/cli/main/OnapCommandSampleTest.java
@@ -24,7 +24,7 @@ import org.onap.cli.fw.error.OnapCommandException;
* This command helps to test the Command functionalities.
*
*/
-@OnapCommandSchema(name = "sample-test", schema = "sample-test-schema.yaml")
+@OnapCommandSchema(name = "sample-test", version = "cli-1.0", schema = "sample-test-schema.yaml")
public class OnapCommandSampleTest extends OnapCommand {
@Override
diff --git a/main/src/test/resources/onap-cli-schema/sample-create-schema.yaml b/main/src/test/resources/onap-cli-schema/sample-create-schema.yaml
index 6fb12beb..478f58f6 100644
--- a/main/src/test/resources/onap-cli-schema/sample-create-schema.yaml
+++ b/main/src/test/resources/onap-cli-schema/sample-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-create
description: Sample create into Onap
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/main/src/test/resources/sample-test-schema.yaml b/main/src/test/resources/sample-test-schema.yaml
index 419f416c..b1988240 100644
--- a/main/src/test/resources/sample-test-schema.yaml
+++ b/main/src/test/resources/sample-test-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: sample-test
description: Onap sample command to test the command features
+version: cli-1.0
service:
name: sample
version: v1
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema-1.1.yaml
new file mode 100644
index 00000000..511e090a
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema-1.1.yaml
@@ -0,0 +1,52 @@
+onap_cmd_schema_version: 1.0
+name: cloud-list
+description: List the configured clouds and Onap service subscriptions
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+results:
+ direction: landscape
+ attributes:
+ - name: cloud
+ description: Onap cloud
+ scope: short
+ type: string
+ - name: region
+ description: Onap cloud region
+ scope: short
+ type: string
+ - name: tenant
+ description: Onap cloud tenat
+ scope: long
+ type: string
+ - name: tenant-id
+ description: Onap cloud tenat id
+ scope: long
+ type: string
+ - name: customer
+ description: Onap cloud customer
+ scope: long
+ type: string
+ - name: service
+ description: Onap cloud service
+ scope: long
+ type: string
+http:
+ request:
+ uri: /aai/v11/cloud-infrastructure/cloud-regions
+ method: GET
+ success_codes:
+ - 200
+ result_map:
+ cloud: $b{cloud-region.[*].cloud-owner}
+ region: $b{cloud-region.[*].cloud-region-id}
+ tenant: $b{cloud-region.[*].tenants.tenant.[*].tenant-name}
+ tenant-id: $b{cloud-region.[*].tenants.tenant.[*].tenant-id}
+ customer: $b{cloud-region.[*].tenants.tenant.[*].relationship-list.relationship.[*].relationship-data.[?(@.relationship-key == 'customer.global-customer-id')].relationship-value}
+ service: $b{cloud-region.[*].tenants.tenant.[*].relationship-list.relationship.[*].relationship-data.[?(@.relationship-key == 'service-subscription.service-type')].relationship-value}
+ sample_response:
+ body: '{"cloud-region":[{"cloud-owner":"Rackspace","cloud-region-id":"RegionOne","cloud-type":"SharedNode","owner-defined-type":"OwnerType","cloud-region-version":"v1","cloud-zone":"CloudZone","resource-version":"1500729864","tenants":{"tenant":[{"tenant-id":"e69e6d64b44347509c3fc512391f34a6","tenant-name":"onap","resource-version":"1500729865","relationship-list":{"relationship":[{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"Demonstration"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/Demonstration123/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"Demonstration123"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/u1/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"u1"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/u2/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"u2"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/DemoCust_7151e36a-1a57-4993-b513-54134f2b8f19/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"DemoCust_7151e36a-1a57-4993-b513-54134f2b8f19"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"Demonstration"},{"relationship-key":"service-subscription.service-type","relationship-value":"vLB"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/Linan/service-subscriptions/service-subscription/vFW/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"Linan"},{"relationship-key":"service-subscription.service-type","relationship-value":"vFW"}]},{"related-to":"service-subscription","related-link":"https://192.168.17.12:8443/aai/v8/business/customers/customer/Linan/service-subscriptions/service-subscription/vLB/","relationship-data":[{"relationship-key":"customer.global-customer-id","relationship-value":"Linan"},{"relationship-key":"service-subscription.service-type","relationship-value":"vLB"}]}]}}]}}]}'
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema.yaml
index cb04aac7..1f231256 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/cloud-region/cloud-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: cloud-list
description: List the configured clouds and Onap service subscriptions
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema-1.1.yaml
new file mode 100644
index 00000000..a3d61b41
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema-1.1.yaml
@@ -0,0 +1,33 @@
+onap_cmd_schema_version: 1.0
+name: customer-create
+description: Create a customer in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: customer-name
+ description: Onap customer name
+ type: string
+ short_option: x
+ long_option: customer-name
+ is_optional: false
+ - name: subscriber-name
+ description: Onap subscriber name
+ type: string
+ short_option: y
+ long_option: subscriber-name
+ is_optional: false
+
+http:
+ request:
+ uri: /aai/v11/business/customers/customer/${customer-name}
+ method: PUT
+ body: '{"global-customer-id": "${customer-name}", "subscriber-name": "${subscriber-name}", "subscriber-type": "INFRA"}'
+ success_codes:
+ - 201
+ sample_response:
+ body: ''
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema.yaml
index 58c1a094..533cd71e 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: customer-create
description: Create a customer in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema-1.1.yaml
new file mode 100644
index 00000000..2e6c1ebc
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema-1.1.yaml
@@ -0,0 +1,30 @@
+onap_cmd_schema_version: 1.0
+name: customer-delete
+description: Delete a customer from Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: customer-name
+ description: Onap customer name
+ type: string
+ short_option: x
+ long_option: customer-name
+ is_optional: false
+ - name: resource-version
+ description: Onap customer resource version
+ type: uuid
+ short_option: y
+ long_option: resource-version
+ is_optional: true
+http:
+ request:
+ uri: /aai/v11/business/customers/customer/${customer-name}?resource-version=${resource-version}
+ method: DELETE
+ success_codes:
+ - 204
+ - 404
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema.yaml
index 4c3fe055..3baca5eb 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-delete-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: customer-delete
description: Delete a customer from Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema-1.1.yaml
new file mode 100644
index 00000000..c49d3cbb
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema-1.1.yaml
@@ -0,0 +1,31 @@
+onap_cmd_schema_version: 1.0
+name: customer-list
+description: Lists the registetred customers in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+results:
+ direction: landscape
+ attributes:
+ - name: name
+ description: Onap customer name
+ scope: short
+ type: string
+ - name: resource-version
+ description: Onap customer resource version
+ scope: short
+ type: string
+http:
+ request:
+ uri: /aai/v11/business/customers
+ method: GET
+ success_codes:
+ - 200
+ result_map:
+ name: $b{customer.[*].global-customer-id}
+ resource-version: $b{customer.[*].resource-version}
+ sample_response:
+ body: '{"customer":[{"global-customer-id":"Demonstration","subscriber-name":"Demonstration","subscriber-type":"INFRA","resource-version":"1500729865","service-subscriptions":{"service-subscription":[{"service-type":"vFW","resource-version":"1500729865","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}},{"service-type":"vLB","resource-version":"1500729865","service-instances":{"service-instance":[{"service-instance-id":"d6167ea1-ff83-4236-9b32-37494dfb7537","service-instance-name":"demoVLB-1","persona-model-id":"af01a849-721b-407d-a880-be836e26ee81","persona-model-version":"1.0","resource-version":"1501154574","relationship-list":{"relationship":[{"related-to":"generic-vnf","related-link":"https://192.168.17.12:8443/aai/v8/network/generic-vnfs/generic-vnf/16c6d95d-44e3-4527-aa63-a495bf8e776e/","relationship-data":[{"relationship-key":"generic-vnf.vnf-id","relationship-value":"16c6d95d-44e3-4527-aa63-a495bf8e776e"}],"related-to-property":[{"property-key":"generic-vnf.vnf-name","property-value":"demoVLB-1-VNF-1"}]}]}}]},"relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}}]}},{"global-customer-id":"Linan","subscriber-name":"Linan","subscriber-type":"INFRA","resource-version":"1501768482","service-subscriptions":{"service-subscription":[{"service-type":"vFW","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}},{"service-type":"vLB","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}}]}},{"global-customer-id":"DemoCust_7151e36a-1a57-4993-b513-54134f2b8f19","subscriber-name":"DemoCust_7151e36a-1a57-4993-b513-54134f2b8f19","subscriber-type":"INFRA","resource-version":"1501766760","service-subscriptions":{"service-subscription":[{"service-type":"vFW","resource-version":"1501766760","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}}]}}]}' \ No newline at end of file
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema.yaml
index a4f701b9..79c4e20a 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: customer-list
description: Lists the registetred customers in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema-1.1.yaml
new file mode 100644
index 00000000..c7a39bcb
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema-1.1.yaml
@@ -0,0 +1,50 @@
+onap_cmd_schema_version: 1.0
+name: customer-show
+description: Lists the registetred customers in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: customer-name
+ description: Onap customer name
+ type: string
+ short_option: x
+ long_option: customer-name
+ is_optional: false
+
+results:
+ direction: landscape
+ attributes:
+ - name: name
+ description: Onap customer name
+ scope: short
+ type: string
+ - name: subscriber-name
+ description: Onap subscriber name
+ scope: short
+ type: string
+ - name: resource-version
+ description: Onap subscriber resource version
+ scope: long
+ type: string
+ - name: subscriber-type
+ description: Onap subscriber type
+ scope: long
+ type: string
+http:
+ request:
+ uri: /aai/v11/business/customers/customer/${customer-name}
+ method: GET
+ success_codes:
+ - 200
+ result_map:
+ name: $b{$.global-customer-id}
+ subscriber-name: $b{$.subscriber-name}
+ subscriber-type: $b{$.subscriber-type}
+ resource-version: $b{$.resource-version}
+ sample_response:
+ body: '{"global-customer-id":"Linan","subscriber-name":"Linan","subscriber-type":"INFRA","resource-version":"1501768482","service-subscriptions":{"service-subscription":[{"service-type":"vFW","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}},{"service-type":"vLB","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}}]}}'
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema.yaml
index 7923779a..ff5a5c71 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/customer/customer-show-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: customer-show
description: Lists the registetred customers in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema-1.1.yaml
new file mode 100644
index 00000000..a91f005b
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema-1.1.yaml
@@ -0,0 +1,33 @@
+onap_cmd_schema_version: 1.0
+name: service-type-create
+description: Add a service type in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: service-type
+ description: Onap service type
+ type: string
+ short_option: x
+ long_option: service-type
+ is_optional: false
+ - name: service-type-id
+ description: Onap service type uuid
+ type: uuid
+ short_option: y
+ long_option: service-type-id
+ is_optional: true
+
+http:
+ request:
+ uri: /aai/v11/service-design-and-creation/services/service/${service-type-id}
+ method: PUT
+ body: '{"service-description": "${service-type}", "service-id": "${service-type-id}"}'
+ success_codes:
+ - 201
+ sample_response:
+ body: ''
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema.yaml
index ad11c35d..0f5eea1f 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: service-type-create
description: Add a service type in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema-1.1.yaml
new file mode 100644
index 00000000..30296a94
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema-1.1.yaml
@@ -0,0 +1,34 @@
+onap_cmd_schema_version: 1.0
+name: service-type-delete
+description: Delete a service type from Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: service-type-id
+ description: Onap service type uuid
+ type: uuid
+ short_option: x
+ long_option: service-type-id
+ is_optional: true
+ - name: resource-version
+ description: Onap service resource version
+ type: uuid
+ short_option: y
+ long_option: resource-version
+ is_optional: true
+http:
+ request:
+ uri: /aai/v11/service-design-and-creation/services/service/${service-type-id}?resource-version=${resource-version}
+ queries:
+ resource-version: ${resource-version}
+ method: DELETE
+ success_codes:
+ - 204
+ - 404
+ sample_response:
+ body: ''
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema.yaml
index a2eecd93..d007a05c 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-delete-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: service-type-delete
description: Delete a service type from Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema-1.1.yaml
new file mode 100644
index 00000000..ac57b05b
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema-1.1.yaml
@@ -0,0 +1,37 @@
+onap_cmd_schema_version: 1.0
+name: service-type-list
+description: List the service types configured in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+results:
+ direction: landscape
+ attributes:
+ - name: service-type-id
+ description: Onap cloud service
+ scope: short
+ type: string
+ - name: service-type
+ description: Onap cloud service
+ scope: short
+ type: string
+ - name: resource-version
+ description: Onap cloud service resource version
+ scope: short
+ type: string
+http:
+ request:
+ uri: /aai/v11/service-design-and-creation/services
+ method: GET
+ success_codes:
+ - 200
+ result_map:
+ service-type: $b{service.[*].service-description}
+ service-type-id: $b{service.[*].service-id}
+ resource-version: $b{service.[*].resource-version}
+ sample_response:
+ body: '{"service":[{"service-id":"db3403eb-5c94-4295-bb00-a9dba8964ab3","service-description":"vFW","resource-version":"1500729865"},{"service-id":"33737156-ff09-4b3d-884a-fe9a372afa4e","service-description":"vLB","resource-version":"1500729866"}]}'
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema.yaml
index 7be38f1c..a81b6d95 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/service-type/service-type-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: service-type-list
description: List the service types configured in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema-1.1.yaml
new file mode 100644
index 00000000..9b86330e
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema-1.1.yaml
@@ -0,0 +1,63 @@
+onap_cmd_schema_version: 1.0
+name: subscription-create
+description: Create a subscription for a customer in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: customer-name
+ description: Onap customer name
+ type: string
+ short_option: x
+ long_option: customer-name
+ is_optional: false
+ - name: subscriber-name
+ description: Onap subscriber name
+ type: string
+ short_option: y
+ long_option: subscriber-name
+ is_optional: false
+ - name: cloud-type
+ description: Onap cloud type (openstack, rackspace)
+ type: string
+ short_option: z
+ long_option: cloud-type
+ is_optional: false
+ - name: cloud-region
+ description: Onap cloud region
+ type: string
+ short_option: r
+ long_option: cloud-region
+ is_optional: false
+ - name: cloud-tenant-id
+ description: Onap cloud tenant id
+ type: string
+ short_option: c
+ long_option: cloud-tenant-id
+ is_optional: false
+ - name: service-type
+ description: Onap service type
+ type: string
+ short_option: e
+ long_option: service-type
+ is_optional: false
+ - name: resource-version
+ description: Onap subscription resource version. It is mandatory for existing customer to create a new subscription
+ type: string
+ short_option: g
+ long_option: resource-version
+ is_optional: true
+http:
+ request:
+ uri: /aai/v11/business/customers/customer/${customer-name}
+ method: PUT
+ body: '{"global-customer-id": "${customer-name}", "subscriber-name": "${subscriber-name}", "subscriber-type": "INFRA", "resource-version":"${resource-version}", "service-subscriptions":{"service-subscription":[{"relationship-list":{"relationship":[{"related-to":"tenant","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"${cloud-type}"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"${cloud-region}"},{"relationship-key":"tenant.tenant-id","relationship-value":"${cloud-tenant-id}"}]}]},"service-type":"${service-type}"}]}}}'
+ success_codes:
+ - 200
+ - 201
+ sample_response:
+ body: ''
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema.yaml
index 58b5fc53..9bd67350 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: subscription-create
description: Create a subscription for a customer in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema-1.1.yaml b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema-1.1.yaml
new file mode 100644
index 00000000..b4d1093c
--- /dev/null
+++ b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema-1.1.yaml
@@ -0,0 +1,40 @@
+onap_cmd_schema_version: 1.0
+name: subscription-list
+description: Lists the subscription for a given customer in Onap
+version: onap-1.1
+service:
+ name: aai
+ version: v8
+ auth: basic
+ mode: direct
+
+parameters:
+ - name: customer-name
+ description: Onap customer name
+ type: string
+ short_option: x
+ long_option: customer-name
+ is_optional: false
+
+results:
+ direction: landscape
+ attributes:
+ - name: service-type
+ description: Onap service type
+ scope: short
+ type: string
+
+http:
+ request:
+ uri: /aai/v11/business/customers/customer/${customer-name}
+ method: GET
+ success_codes:
+ - 200
+ result_map:
+ service-type: $b{$.service-subscriptions.service-subscription.[*].service-type}
+ sample_response:
+ body: '{"global-customer-id":"Linan","subscriber-name":"Linan","subscriber-type":"INFRA","resource-version":"1501768482","service-subscriptions":{"service-subscription":[{"service-type":"vFW","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}},{"service-type":"vLB","resource-version":"1501768482","relationship-list":{"relationship":[{"related-to":"tenant","related-link":"https://192.168.17.12:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/Rackspace/RegionOne/tenants/tenant/e69e6d64b44347509c3fc512391f34a6/","relationship-data":[{"relationship-key":"cloud-region.cloud-owner","relationship-value":"Rackspace"},{"relationship-key":"cloud-region.cloud-region-id","relationship-value":"RegionOne"},{"relationship-key":"tenant.tenant-id","relationship-value":"e69e6d64b44347509c3fc512391f34a6"}],"related-to-property":[{"property-key":"tenant.tenant-name","property-value":"onap"}]}]}}]}}'
+
+
+
+
diff --git a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema.yaml b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema.yaml
index e3131eb0..f3bb9f7f 100644
--- a/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema.yaml
+++ b/plugins/aai/src/main/resources/onap-cli-schema/subscription/subscription-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: subscription-list
description: Lists the subscription for a given customer in Onap
+version: onap-1.0
service:
name: aai
version: v8
diff --git a/plugins/aai/src/test/resources/onap-cli-sample/cloud-region/cloud-list-sample.yaml b/plugins/aai/src/test/resources/onap-cli-sample/cloud-region/cloud-list-sample.yaml
index 55e65a99..95ea4112 100644
--- a/plugins/aai/src/test/resources/onap-cli-sample/cloud-region/cloud-list-sample.yaml
+++ b/plugins/aai/src/test/resources/onap-cli-sample/cloud-region/cloud-list-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: cloud-list
-
+version: onap-1.0
samples:
sample1:
name: List the configured clouds in onap
diff --git a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceCreateCommand.java b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceCreateCommand.java
index 8b46e6b8..4246d654 100644
--- a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceCreateCommand.java
+++ b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceCreateCommand.java
@@ -19,6 +19,6 @@ package org.onap.cli.cmd.cs.msb;
import org.onap.cli.fw.OnapCommandSchema;
import org.onap.cli.fw.cmd.OnapHttpCommand;
-@OnapCommandSchema(name = "microservice-create", schema = "microservice-create-schema.yaml")
+@OnapCommandSchema(name = "microservice-create", version = "onap-1.0", schema = "microservice-create-schema.yaml")
public class OnapServiceCreateCommand extends OnapHttpCommand {
}
diff --git a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceDeleteCommand.java b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceDeleteCommand.java
index 595934d9..5522723b 100644
--- a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceDeleteCommand.java
+++ b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceDeleteCommand.java
@@ -19,6 +19,6 @@ package org.onap.cli.cmd.cs.msb;
import org.onap.cli.fw.OnapCommandSchema;
import org.onap.cli.fw.cmd.OnapHttpCommand;
-@OnapCommandSchema(name = "microservice-delete", schema = "microservice-delete-schema.yaml")
+@OnapCommandSchema(name = "microservice-delete", version = "onap-1.0", schema = "microservice-delete-schema.yaml")
public class OnapServiceDeleteCommand extends OnapHttpCommand {
}
diff --git a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceListCommand.java b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceListCommand.java
index 436d187b..fadbf020 100644
--- a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceListCommand.java
+++ b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceListCommand.java
@@ -19,6 +19,6 @@ package org.onap.cli.cmd.cs.msb;
import org.onap.cli.fw.OnapCommandSchema;
import org.onap.cli.fw.cmd.OnapHttpCommand;
-@OnapCommandSchema(name = "microservice-list", schema = "microservice-list-schema.yaml")
+@OnapCommandSchema(name = "microservice-list", version = "onap-1.0", schema = "microservice-list-schema.yaml")
public class OnapServiceListCommand extends OnapHttpCommand {
}
diff --git a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceShowCommand.java b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceShowCommand.java
index 2256cc61..bef3af9b 100644
--- a/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceShowCommand.java
+++ b/plugins/msb/src/main/java/org/onap/cli/cmd/cs/msb/OnapServiceShowCommand.java
@@ -19,6 +19,6 @@ package org.onap.cli.cmd.cs.msb;
import org.onap.cli.fw.OnapCommandSchema;
import org.onap.cli.fw.cmd.OnapHttpCommand;
-@OnapCommandSchema(name = "microservice-show", schema = "microservice-show-schema.yaml")
+@OnapCommandSchema(name = "microservice-show", version = "onap-1.0", schema = "microservice-show-schema.yaml")
public class OnapServiceShowCommand extends OnapHttpCommand {
}
diff --git a/plugins/msb/src/main/resources/microservice-create-schema.yaml b/plugins/msb/src/main/resources/onap-cli-schema/microservice-create-schema.yaml
index 13bd53b1..71f068c1 100644
--- a/plugins/msb/src/main/resources/microservice-create-schema.yaml
+++ b/plugins/msb/src/main/resources/onap-cli-schema/microservice-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: microservice-create
description: Register microservice into Onap
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/plugins/msb/src/main/resources/microservice-delete-schema.yaml b/plugins/msb/src/main/resources/onap-cli-schema/microservice-delete-schema.yaml
index 695efe1e..af92172f 100644
--- a/plugins/msb/src/main/resources/microservice-delete-schema.yaml
+++ b/plugins/msb/src/main/resources/onap-cli-schema/microservice-delete-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: microservice-delete
description: Deletes the micro service from Onap
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/plugins/msb/src/main/resources/microservice-list-schema.yaml b/plugins/msb/src/main/resources/onap-cli-schema/microservice-list-schema.yaml
index 42fa0ec4..1688ef24 100644
--- a/plugins/msb/src/main/resources/microservice-list-schema.yaml
+++ b/plugins/msb/src/main/resources/onap-cli-schema/microservice-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: microservice-list
description: Lists the registetred micro services in Onap
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/plugins/msb/src/main/resources/microservice-show-schema.yaml b/plugins/msb/src/main/resources/onap-cli-schema/microservice-show-schema.yaml
index 26cccfd3..3173b779 100644
--- a/plugins/msb/src/main/resources/microservice-show-schema.yaml
+++ b/plugins/msb/src/main/resources/onap-cli-schema/microservice-show-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: microservice-show
description: Details the registered microservice in Onap
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/plugins/msb/src/test/resources/service-list-schema.yaml b/plugins/msb/src/test/resources/service-list-schema.yaml
index 72e774b8..f7a45a3c 100644
--- a/plugins/msb/src/test/resources/service-list-schema.yaml
+++ b/plugins/msb/src/test/resources/service-list-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: service-list
description: Onap Service list
+version: onap-1.0
service:
name: msb
version: v1
diff --git a/plugins/msb/src/test/resources/user-create-schema.yaml b/plugins/msb/src/test/resources/user-create-schema.yaml
index 3f1e8866..08bbd5b6 100644
--- a/plugins/msb/src/test/resources/user-create-schema.yaml
+++ b/plugins/msb/src/test/resources/user-create-schema.yaml
@@ -1,6 +1,7 @@
onap_cmd_schema_version: 1.0
name: user-create
description: Onap user create command.
+version: onap-1.0
service:
name: auth
version: v1
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-checkin-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-checkin-schema.yaml
index a845deb5..4bd8b1f4 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-checkin-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-checkin-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-checkin
description: Checkin Vendor Software Product
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-create-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-create-schema.yaml
index 6f460884..f090b035 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-create-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-create-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-create
description: Create Vendor Software Product
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-list-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-list-schema.yaml
index 9fe2564e..1055f297 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-list-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-list-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-list
description: List of the Vendor Software Products
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-show-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-show-schema.yaml
index 0f400b74..83e11139 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-show-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-show-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-show
description: Details of the Vendor Software Product
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-submit-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-submit-schema.yaml
index 95572939..631e204d 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-submit-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-submit-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-submit
description: Submit Vendor Software Product
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-upload-schema.yaml b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-upload-schema.yaml
index bc0bc4c7..5786531c 100644
--- a/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-upload-schema.yaml
+++ b/plugins/sdc/src/main/resources/onap-cli-schema/vsp/vsp-upload-schema.yaml
@@ -1,7 +1,7 @@
onap_cmd_schema_version: 1.0
name: vsp-upload
description: Upload the CSAR file to VSP
-
+version: onap-1.0
service:
name: sdc
version: v1.0
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml
index 6e3263e3..c5d64917 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-checkin
-
+version: onap-1.0
samples:
sample1:
name: Checkin the Vendor Software Product
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml
index c261899d..c96a76fd 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-create
-
+version: onap-1.0
samples:
sample1:
name: Create the Vendor Software Product
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml
index 82013df6..4cfa64af 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-list
-
+version: onap-1.0
samples:
sample1:
name: List Vendor Software Products
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml
index f599b747..4938c0cb 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-show
-
+version: onap-1.0
samples:
sample1:
name: Show the details of Vendor Software Products
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml
index 19f3d7d0..568fdf72 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-submit
-
+version: onap-1.0
samples:
sample1:
name: Submit the Vendor Software Product
diff --git a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml
index 7fecc8a0..1fd10340 100644
--- a/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml
+++ b/plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml
@@ -1,7 +1,7 @@
onap_cli_sample_version: 1.0
name: vsp-upload
-
+version: onap-1.0
samples:
sample1:
name: upload the zip file to Vendor Software Product
diff --git a/validation/pom.xml b/validation/pom.xml
new file mode 100644
index 00000000..adeb49b8
--- /dev/null
+++ b/validation/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2017 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.cli</groupId>
+ <artifactId>cli</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>cli-validation</artifactId>
+ <name>cli/validation</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>