Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library RequestsLibrary |
| 3 | Library Process |
| 4 | |
| 5 | *** Variables *** |
| 6 | |
| 7 | ${cli_exec} docker exec cli onap |
| 8 | ${cli_exec_cli_10_help} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap --help" |
| 9 | ${cli_exec_cli_10_version} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap --version" |
| 10 | ${cli_exec_cli_10_schema_refresh} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap schema-refresh" |
| 11 | ${cli_exec_cli_10_schema_validate} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap schema-validate -i -l schema-refresh.yaml" |
| 12 | ${cli_exec_cli_10_schema_validate_invalid} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap schema-validate -i -l invalid-yaml-path.yaml" |
| 13 | ${cli_exec_cli_10_schema_validate_empty} docker exec cli bash -c "export CLI_PRODUCT_VERSION=cli-1.0 && onap schema-validate" |
| 14 | |
| 15 | ${cli_exec_onap_11} docker exec cli bash -c "export CLI_PRODUCT_VERSION=onap-1.1 && onap" |
| 16 | ${cli_exec_onap_11_microservice_create} docker exec cli bash -c "export CLI_PRODUCT_VERSION=onap-1.1 && onap microservice-create --service-name test-service --service-version v1 --service-url /api/test/v1 --host-url http://${MSB_IAG_IP}:80 23.14.15.156 80" |
| 17 | ${cli_exec_onap_11_microservice_list} docker exec cli bash -c "export CLI_PRODUCT_VERSION=onap-1.1 && onap microservice-list --host-url http://${MSB_IAG_IP}:80 --long" |
| 18 | ${cli_exec_onap_11_microservice_show} docker exec cli bash -c "export CLI_PRODUCT_VERSION=onap-1.1 && onap microservice-show --service-name test-service --service-version v1 --host-url http://${MSB_IAG_IP}:80" |
| 19 | ${cli_exec_onap_11_microservice_delete} docker exec cli bash -c "export CLI_PRODUCT_VERSION=onap-1.1 && onap microservice-delete --service-name test-service --service-version v1 --host-url http://${MSB_IAG_IP}:80 --node-ip 23.14.15.156 --node-port 80" |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | Liveness Test |
| 23 | [Documentation] Check cli liveness check |
| 24 | Create Session cli http://${CLI_IP}:8080 |
| 25 | CheckUrl cli / |
| 26 | |
| 27 | Check Cli help |
| 28 | [Documentation] check cli help command |
| 29 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_help} shell=yes |
| 30 | Log ${cli_cmd_output.stdout} |
| 31 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 32 | Should Contain ${cli_cmd_output.stdout} CLI version |
| 33 | |
| 34 | Check Cli Version Default |
| 35 | [Documentation] check cli default version |
| 36 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_version} shell=yes |
| 37 | Log ${cli_cmd_output.stdout} |
| 38 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 39 | Should Contain ${cli_cmd_output.stdout} : cli-1.0 |
| 40 | |
| 41 | Check Cli Scheam Refresh |
| 42 | [Documentation] check cli schema-refresh command |
| 43 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_schema_refresh} shell=yes |
| 44 | Log ${cli_cmd_output.stdout} |
| 45 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 46 | Should Contain ${cli_cmd_output.stdout} sl-no |
| 47 | Should Contain ${cli_cmd_output.stdout} command |
| 48 | Should Contain ${cli_cmd_output.stdout} product-version |
| 49 | Should Contain ${cli_cmd_output.stdout} schema |
| 50 | Should Contain ${cli_cmd_output.stdout} version |
| 51 | |
| 52 | Check Cli Schema Validate With Valid Path |
| 53 | [Documentation] check cli schema-validate command with valid path |
| 54 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_schema_validate} shell=yes |
| 55 | Log ${cli_cmd_output.stdout} |
| 56 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 57 | Should Contain ${cli_cmd_output.stdout} sl-no |
| 58 | Should Contain ${cli_cmd_output.stdout} error |
| 59 | |
| 60 | Check Cli Scheam Validate With Invalid Path |
| 61 | [Documentation] check cli schema-validate command with invalid path |
| 62 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_schema_validate_invalid} shell=yes |
| 63 | Log ${cli_cmd_output.stdout} |
| 64 | Should Be Equal As Strings ${cli_cmd_output.rc} 1 |
| 65 | Should Contain ${cli_cmd_output.stdout} 0xb001 |
| 66 | |
| 67 | Check Cli Scheam Validate Empty Argument |
| 68 | [Documentation] check cli schema-validate with empty argument |
| 69 | ${cli_cmd_output}= Run Process ${cli_exec_cli_10_schema_validate_empty} shell=yes |
| 70 | Log ${cli_cmd_output.stdout} |
| 71 | Should Be Equal As Strings ${cli_cmd_output.rc} 1 |
| 72 | Should Contain ${cli_cmd_output.stdout} 0x7003 |
| 73 | |
| 74 | Check Cli create microservice |
| 75 | [Documentation] check create microservice |
| 76 | ${cli_cmd_output}= Run Process ${cli_exec_onap_11_microservice_create} shell=yes |
| 77 | Log ${cli_cmd_output.stdout} |
| 78 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 79 | |
| 80 | Check Cli list microservice |
| 81 | [Documentation] check list microservice |
| 82 | ${cli_cmd_output}= Run Process ${cli_exec_onap_11_microservice_list} shell=yes |
| 83 | Log ${cli_cmd_output.stdout} |
| 84 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 85 | |
| 86 | Check Cli show microservice |
| 87 | [Documentation] check show microservice |
| 88 | ${cli_cmd_output}= Run Process ${cli_exec_onap_11_microservice_show} shell=yes |
| 89 | Log ${cli_cmd_output.stdout} |
| 90 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 91 | |
| 92 | Check Cli delete microservice |
| 93 | [Documentation] check delete microservice |
| 94 | ${cli_cmd_output}= Run Process ${cli_exec_onap_11_microservice_delete} shell=yes |
| 95 | Log ${cli_cmd_output.stdout} |
| 96 | Should Be Equal As Strings ${cli_cmd_output.rc} 0 |
| 97 | |
| 98 | |
| 99 | |
| 100 | *** Keywords *** |
| 101 | CheckUrl |
| 102 | [Arguments] ${session} ${path} |
| 103 | ${resp}= Get Request ${session} ${path} |
| 104 | Should Be Equal As Integers ${resp.status_code} 200 |