aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java1
-rw-r--r--framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java9
-rw-r--r--framework/src/main/java/org/onap/cli/fw/info/OnapCommandState.java53
-rw-r--r--framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java14
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java13
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java8
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java5
-rw-r--r--framework/src/main/resources/open-cli.properties2
-rw-r--r--framework/src/test/resources/open-cli-schema/sample-test-schema.yaml1
-rw-r--r--products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java30
-rw-r--r--products/onap-beijing/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-beijing.yaml46
-rw-r--r--products/onap-beijing/features/policy/pom.xml41
-rw-r--r--products/onap-beijing/features/pom.xml1
13 files changed, 220 insertions, 4 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java
index 6f1741e5..7ea4ddaa 100644
--- a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java
+++ b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java
@@ -58,6 +58,7 @@ public class OnapCommandConstants {
public static final String INFO_TYPE = "type";
public static final String INFO_AUTHOR = "author";
public static final String INFO_IGNORE = "ignore";
+ public static final String INFO_STATE = "state";
//parameters
public static final String PARAMETERS = "parameters";
diff --git a/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java
index 1496bcbb..55009a49 100644
--- a/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java
+++ b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java
@@ -31,6 +31,8 @@ public class OnapCommandInfo {
private OnapCommandType type = OnapCommandType.CMD;
+ private OnapCommandState state = OnapCommandState.STABLE;
+
private boolean ignore = false;
public String getProduct() {
@@ -73,5 +75,12 @@ public class OnapCommandInfo {
this.ignore = ignore;
}
+ public OnapCommandState getState() {
+ return state;
+ }
+
+ public void setState(OnapCommandState state) {
+ this.state = state;
+ }
} \ No newline at end of file
diff --git a/framework/src/main/java/org/onap/cli/fw/info/OnapCommandState.java b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandState.java
new file mode 100644
index 00000000..782a630d
--- /dev/null
+++ b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandState.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 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.info;
+
+import org.onap.cli.fw.error.OnapCommandInvalidCommandType;
+import org.onap.cli.fw.error.OnapCommandInvalidParameterType;
+
+/**
+ * Command life cycle state.
+ *
+ */
+public enum OnapCommandState {
+
+ EXPERIMENTAL,
+ STABLE,
+ DEPRECATED;
+
+ /**
+ * Get command state.
+ *
+ * @param name
+ * type name
+ * @return type
+ * @throws OnapCommandInvalidParameterType
+ * exception
+ */
+ public static OnapCommandState get(String name) throws OnapCommandInvalidCommandType {
+ if (EXPERIMENTAL.name().equalsIgnoreCase(name)) {
+ return EXPERIMENTAL;
+ } else if (STABLE.name().equalsIgnoreCase(name)) {
+ return STABLE;
+ } else if (DEPRECATED.name().equalsIgnoreCase(name)) {
+ return DEPRECATED;
+ } else {
+ throw new OnapCommandInvalidCommandType(name);
+ }
+ }
+}
diff --git a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
index 15a086c7..34dc6b6d 100644
--- a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
+++ b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
@@ -366,13 +366,22 @@ public class OnapCommandRegistrar {
attrSrv.setScope(OnapCommandResultAttributeScope.SHORT);
help.getRecords().add(attrSrv);
+ OnapCommandResultAttribute attrState = new OnapCommandResultAttribute();
+ attrState.setName(OnapCommandConstants.INFO_STATE.toUpperCase());
+ attrState.setDescription(OnapCommandConstants.INFO_STATE);
+ attrState.setScope(OnapCommandResultAttributeScope.SHORT);
+ help.getRecords().add(attrState);
+
+
OnapCommandResultAttribute attrDesc = new OnapCommandResultAttribute();
attrDesc.setName(OnapCommandConstants.DESCRIPTION.toUpperCase());
attrDesc.setDescription(OnapCommandConstants.DESCRIPTION);
attrDesc.setScope(OnapCommandResultAttributeScope.SHORT);
help.getRecords().add(attrDesc);
- for (String cmdName : isEnabledProductVersionOnly ? OnapCommandUtils.sort(this.listCommandsForEnabledProductVersion()) : OnapCommandUtils.sort(this.listCommands())) {
+ for (String cmdName : isEnabledProductVersionOnly ?
+ OnapCommandUtils.sort(this.listCommandsForEnabledProductVersion()) :
+ OnapCommandUtils.sort(this.listCommands())) {
OnapCommand cmd;
try {
if (!isEnabledProductVersionOnly) {
@@ -385,8 +394,9 @@ public class OnapCommandRegistrar {
attr.getValues().add(cmdName);
}
- attrSrv.getValues().add(cmd.printVersion());
+ attrSrv.getValues().add(cmd.getInfo().getService());
attrDesc.getValues().add(cmd.getDescription());
+ attrState.getValues().add(cmd.getInfo().getState().name());
} catch (OnapCommandException e) {
throw new OnapCommandHelpFailed(e);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java
index af444b8f..df30a240 100644
--- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java
+++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java
@@ -18,6 +18,7 @@ package org.onap.cli.fw.schema;
import org.onap.cli.fw.cmd.OnapCommandType;
import org.onap.cli.fw.conf.OnapCommandConstants;
+import org.onap.cli.fw.info.OnapCommandState;
import java.util.ArrayList;
import java.util.List;
@@ -55,6 +56,8 @@ public class OnapCommandSchemaInfo {
private String ignore = OnapCommandConstants.BOOLEAN_FALSE;
+ private String state = OnapCommandState.STABLE.name();
+
public String getSchemaName() {
return schemaName;
}
@@ -126,4 +129,14 @@ public class OnapCommandSchemaInfo {
public List<String> getSampleFiles() {
return sampleFiles;
}
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+
}
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
index 628ddf3a..06d688b4 100644
--- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
+++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java
@@ -30,6 +30,7 @@ import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_LIST;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_MANDATORY_LIST;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PRODUCT;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_SERVICE;
+import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_STATE;
import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_TYPE;
import static org.onap.cli.fw.conf.OnapCommandConstants.INPUT_PARAMS_LIST;
import static org.onap.cli.fw.conf.OnapCommandConstants.INPUT_PARAMS_MANDATORY_LIST;
@@ -67,7 +68,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.io.FileUtils;
import org.onap.cli.fw.cmd.OnapCommand;
import org.onap.cli.fw.cmd.OnapCommandType;
import org.onap.cli.fw.conf.OnapCommandConfig;
@@ -79,6 +79,7 @@ import org.onap.cli.fw.error.OnapCommandParameterNameConflict;
import org.onap.cli.fw.error.OnapCommandParameterOptionConflict;
import org.onap.cli.fw.error.OnapCommandSchemaNotFound;
import org.onap.cli.fw.info.OnapCommandInfo;
+import org.onap.cli.fw.info.OnapCommandState;
import org.onap.cli.fw.input.OnapCommandParameter;
import org.onap.cli.fw.input.OnapCommandParameterType;
import org.onap.cli.fw.output.OnapCommandPrintDirection;
@@ -248,6 +249,11 @@ public class OnapCommandSchemaLoader {
info.setCommandType(OnapCommandType.get(obj.toString()));
break;
+ case INFO_STATE:
+ Object state = infoMap.get(key1);
+ info.setState(OnapCommandState.get(state.toString()));
+ break;
+
case INFO_AUTHOR:
Object mode = infoMap.get(key1);
info.setAuthor(mode.toString());
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
index d0789d74..9bdd8a51 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
@@ -278,6 +278,11 @@ public class OnapCommandDiscoveryUtils {
if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_IGNORE) != null) {
schema.setIgnore(infoMap.get(OnapCommandConstants.INFO_IGNORE).toString());
}
+
+ if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_STATE) != null) {
+ schema.setState(infoMap.get(OnapCommandConstants.INFO_STATE).toString());
+ }
+
schema.setSchemaProfile(identitySchemaProfileType(resourceMap));
extSchemas.add(schema);
diff --git a/framework/src/main/resources/open-cli.properties b/framework/src/main/resources/open-cli.properties
index 79800fbc..cdb6dd12 100644
--- a/framework/src/main/resources/open-cli.properties
+++ b/framework/src/main/resources/open-cli.properties
@@ -6,7 +6,7 @@ cli.discover_always=false
cli.schema.base.sections=open_cli_schema_version,name,description,parameters,results,info
cli.schema.base.sections.mandatory=open_cli_schema_version
-cli.schema.base.info.sections=product,service,type,author,ignore
+cli.schema.base.info.sections=product,service,type,author,ignore,state
cli.schema.base.info.sections.mandatory=product,service
cli.schema.base.parameters.sections=name,description,type,short_option,long_option, is_optional,default_value,is_secured,is_include,is_default_param
diff --git a/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml b/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml
index f4894b3f..2ab2127a 100644
--- a/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml
+++ b/framework/src/test/resources/open-cli-schema/sample-test-schema.yaml
@@ -6,6 +6,7 @@ info:
service: test
type: cmd
author: Kanagaraj Manickam kanagaraj.manickam@huawei.com
+ state: experimental
parameters:
- name: bool-param
type: bool
diff --git a/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java b/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java
new file mode 100644
index 00000000..faa4a1f2
--- /dev/null
+++ b/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2018 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.cmd.auth;
+
+import org.onap.cli.fw.error.OnapCommandException;
+import org.onap.cli.fw.http.cmd.BasicAuthLoginCommand;
+import org.onap.cli.fw.schema.OnapCommandSchema;
+
+@OnapCommandSchema(schema = "basic-login-onap-sdc-beijing.yaml")
+public class OnapPolicyBasicAuthLoginCommandBeijing extends BasicAuthLoginCommand {
+
+ @Override
+ protected void run() throws OnapCommandException {
+ //don't do anything...
+ }
+}
diff --git a/products/onap-beijing/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-beijing.yaml b/products/onap-beijing/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-beijing.yaml
new file mode 100644
index 00000000..5596ec65
--- /dev/null
+++ b/products/onap-beijing/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-beijing.yaml
@@ -0,0 +1,46 @@
+# Copyright 2018 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.
+
+open_cli_schema_version: 1.0
+
+name: policy-basic-login
+
+description: ONAP basic login auth command
+
+
+info:
+ product: onap-beijing
+ service: policy-basic-auth
+ type: auth
+ author: ONAP CLI Team onap-discuss@lists.onap.org
+
+
+results:
+ direction: portrait
+ attributes:
+ - name: Authorization
+ description: Authorization
+ scope: short
+ type: string
+ default_value: Basic dGVzdHBkcDphbHBoYTEyMw==
+ - name: Environment
+ description: Environment
+ scope: short
+ type: string
+ default_value: ONAP-CLI
+ - name: ClientAuth
+ description: Client Auth
+ scope: short
+ type: string
+ default_value: cHl0aG9uOnRlc3Q= \ No newline at end of file
diff --git a/products/onap-beijing/features/policy/pom.xml b/products/onap-beijing/features/policy/pom.xml
new file mode 100644
index 00000000..1bc21aca
--- /dev/null
+++ b/products/onap-beijing/features/policy/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-products-onap-beijing-features</artifactId>
+ <version>2.0.0</version>
+ </parent>
+
+ <artifactId>cli-products-onap-beijing-features-policy</artifactId>
+ <name>cli/products/onap-beijing/features/policy</name>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/products/onap-beijing/features/pom.xml b/products/onap-beijing/features/pom.xml
index d49f8b1d..313b7429 100644
--- a/products/onap-beijing/features/pom.xml
+++ b/products/onap-beijing/features/pom.xml
@@ -36,6 +36,7 @@
<module>msb</module>
<module>so</module>
<module>sdc</module>
+ <module>policy</module>
</modules>
<build>