diff options
author | vrvarma <vv8305@att.com> | 2018-09-28 10:30:00 -0400 |
---|---|---|
committer | vrvarma <vv8305@att.com> | 2018-10-03 22:56:37 -0400 |
commit | 3fe70c777050581f090f1bcc9ebf9e44857d0b56 (patch) | |
tree | 599724de7400629cdd3ddee32391816310035662 | |
parent | bd341518ff41ddaa96afd22df6301075e7a8b4f5 (diff) |
Initial implementation of optf-osdf csit
Fixing osdf, simulator startup scripts
Split the setup & functional test cases
Add robot keywords for test suites
Refactoring test suites based on comments
Change-Id: Ic96343968ec919ac3c5272bc953bbaeb974f2393
Signed-off-by: vrvarma <vv8305@att.com>
Issue-ID: OPTFRA-286
-rwxr-xr-x | plans/optf-osdf/osdf/setup.sh | 52 | ||||
-rwxr-xr-x | plans/optf-osdf/osdf/teardown.sh | 34 | ||||
-rw-r--r-- | plans/optf-osdf/osdf/testplan.txt | 22 | ||||
-rwxr-xr-x | scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml | 64 | ||||
-rwxr-xr-x | scripts/optf-osdf/osdf/osdf_proxy_settings.sh | 35 | ||||
-rwxr-xr-x | scripts/optf-osdf/osdf/osdf_script.sh | 57 | ||||
-rwxr-xr-x | scripts/optf-osdf/osdf/simulator_script.sh | 74 | ||||
-rwxr-xr-x | scripts/optf-osdf/osdf/wait_for_port.sh | 36 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/__init__.robot | 4 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/data/pci-opt-request.json | 20 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/data/placement_request.json | 102 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/optf_osdf_setup.robot | 12 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/optf_osdf_test.robot | 48 | ||||
-rw-r--r-- | tests/optf-osdf/osdf/resources/common-keywords.robot | 50 |
14 files changed, 610 insertions, 0 deletions
diff --git a/plans/optf-osdf/osdf/setup.sh b/plans/optf-osdf/osdf/setup.sh new file mode 100755 index 00000000..771423ca --- /dev/null +++ b/plans/optf-osdf/osdf/setup.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +# +echo "# simulator scripts calling"; +source ${WORKSPACE}/scripts/optf-osdf/osdf/simulator_script.sh + +# add here eventual scripts needed for optf/osdf +# +echo "# optf/osdf scripts calling"; +source ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_script.sh + +# +# add here below the start of all docker containers needed for optf/osdf CSIT testing +# +echo "# optf/osdf scripts docker containers spinoff"; + +# +# add here all the configuration steps eventually needed to be carried out for optf/osdf CSIT testing +# +echo "# optf/osdf configuration step"; + + +# +# add here all ROBOT_VARIABLES settings +# +echo "# optf/osdf robot variables settings"; +echo "osdf ip = ${OSDF_IP}" + +ROBOT_VARIABLES="-v OSDF_HOSTNAME:http://${OSDF_IP} -v OSDF_PORT:8699" + +echo ${ROBOT_VARIABLES} + + + diff --git a/plans/optf-osdf/osdf/teardown.sh b/plans/optf-osdf/osdf/teardown.sh new file mode 100755 index 00000000..144ce266 --- /dev/null +++ b/plans/optf-osdf/osdf/teardown.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + + +# +# add here below the killing of all docker containers used for optf/osdf CSIT testing +# + +# +# optf/osdf scripts docker containers killing"; +# + +kill-instance.sh optf-osdf +kill-instance.sh osdf_sim + + + diff --git a/plans/optf-osdf/osdf/testplan.txt b/plans/optf-osdf/osdf/testplan.txt new file mode 100644 index 00000000..87a2d545 --- /dev/null +++ b/plans/optf-osdf/osdf/testplan.txt @@ -0,0 +1,22 @@ +# +# ------------------------------------------------------------------------- +# Copyright (c) 2015-2017 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +# Test suites are relative paths under [integration.git]/test/csit/tests/. +# Place the suites in run order. +optf-osdf/osdf diff --git a/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml b/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml new file mode 100755 index 00000000..78399660 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf-properties/osdf_config.yaml @@ -0,0 +1,64 @@ +osdfUserNameForSO: "" # The OSDF Manager username for MSO. +odfPasswordForSO: "" # The OSDF Manager password for MSO. + +# msoUrl: "" # The SO url for call back. This will be part of the request, so no need +soUsername: "" # SO username for call back. +soPassword: "" # SO password for call back. + +conductorUrl: "http://127.0.0.1:5000/simulated/oof/has-api/flow1-success-simple/main.json" +conductorUsername: "CONDUCTOR-USER" +conductorPassword: "CONDUCTOR-PASSWD" +conductorPingWaitTime: 2 # seconds to wait before calling the conductor retry URL +conductorMaxRetries: 5 # if we don't get something in 30 minutes, give up + +# Policy Platform -- requires ClientAuth, Authorization, and Environment +policyPlatformUrl: http://127.0.0.1:5000/simulated/policy/pdp-has-vcpe-good/getConfig # Policy Dev platform URL +policyPlatformEnv: TEST # Environment for policy platform +policyPlatformUsername: POLICY-USER # Policy platform username. +policyPlatformPassword: POLICY-PASSWD # Policy platform password. +policyClientUsername: POLICY-CLIENT-USER # For use with ClientAuth +policyClientPassword: POLICY-CLIENT-PASSWD # For use with ClientAuth + +messageReaderHosts: https://DMAAP-HOST1:3905,https://DMAAP-HOST2:3905,https://DMAAP-HOST3:3905 +messageReaderTopic: org.onap.oof.osdf.multicloud +messageReaderAafUserId: DMAAP-OSDF-MC-USER +messageReaderAafPassword: DMAAP-OSDF-MC-PASSWD + +sdcUrl: https://SDC-HOST:8443/sdc/v1/catalog +sdcUsername: SDC-OSDF-USER +sdcPassword: SDC-OSDF-PASSWD +sdcONAPInstanceID: ONAP-OSDF + +osdfPlacementUrl: "http://127.0.0.1:24699/osdf/api/v2/placement" + +# Credentials for the OOF placement service - Generic +osdfPlacementUsername: test +osdfPlacementPassword: testpwd + +# Credentials for the OOF placement service - SO +osdfPlacementSOUsername: so_test +osdfPlacementSOPassword: so_testpwd + +# Credentials for the OOF placement service - VFC +osdfPlacementVFCUsername: vfc_test +osdfPlacementVFCPassword: vfc_testpwd + +# Credentials for the OOF CM scheduling service - Generic +osdfCMSchedulerUsername: test1 +osdfCMSchedulerPassword: testpwd1 + +# config db api +configDbUrl: http://127.0.0.1:5000/simulated/configdb +configDbUserName: osdf +configDbPassword: passwd +configDbGetCellListUrl: 'getCellList' +configDbGetNbrListUrl: 'getNbrList' + +# Credentials for PCIHandler +pciHMSUsername: "" # pcihandler username for call back. +pciHMSPassword: "" # pcihandler password for call back. + +#Credentials for the OOF PCI Opt Service +osdfPCIOptUsername: pci_test +osdfPCIOptPassword: pci_testpwd + diff --git a/scripts/optf-osdf/osdf/osdf_proxy_settings.sh b/scripts/optf-osdf/osdf/osdf_proxy_settings.sh new file mode 100755 index 00000000..b68fca97 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf_proxy_settings.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +# put into this file local proxy settings in case they are needed on your local environment +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_proxy_settings.sh" + +echo "optf/osdf proxy settings" +if [ "$#" -eq "1" ]; then + echo "$1" + cd $1 + pwd +else + exit 1 +fi + +# don't remove following lines: commands can be attached here + + diff --git a/scripts/optf-osdf/osdf/osdf_script.sh b/scripts/optf-osdf/osdf/osdf_script.sh new file mode 100755 index 00000000..71d19fe4 --- /dev/null +++ b/scripts/optf-osdf/osdf/osdf_script.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_script.sh" +# +# add here whatever commands is needed to prepare the optf/osdf CSIT testing +# + +# assume the base is /tmp dir +DIR=/tmp + +# the directory of the script +echo ${DIR} +cd ${DIR} + +# create directory for volume and copy configuration file +# run docker containers +OSDF_CONF=/tmp/osdf/properties/osdf_config.yaml +IMAGE_NAME=nexus3.onap.org:10001/onap/optf-osdf +IMAGE_VER=1.2.1-SNAPSHOT-latest + +mkdir -p /tmp/osdf/properties + +cp ${WORKSPACE}/scripts/optf-osdf/osdf/osdf-properties/*.yaml /tmp/osdf/properties/. + +#change conductor/configdb simulator urls +OSDF_SIM_IP=`get-instance-ip.sh osdf_sim` +echo "OSDF_SIM_IP=${OSDF_SIM_IP}" + +sed -i -e "s%127.0.0.1:5000%${OSDF_SIM_IP}:5000%g" $OSDF_CONF + +docker run -d --name optf-osdf -v ${OSDF_CONF}:/opt/osdf/config/osdf_config.yaml -p "8698:8699" ${IMAGE_NAME}:${IMAGE_VER} + +sleep 20 + +OSDF_IP=`get-instance-ip.sh optf-osdf` +${WORKSPACE}/scripts/optf-osdf/osdf/wait_for_port.sh ${OSDF_IP} 8699 + +echo "inspect docker things for tracing purpose" +docker inspect optf-osdf diff --git a/scripts/optf-osdf/osdf/simulator_script.sh b/scripts/optf-osdf/osdf/simulator_script.sh new file mode 100755 index 00000000..8f3f7d36 --- /dev/null +++ b/scripts/optf-osdf/osdf/simulator_script.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +echo "### This is ${WORKSPACE}/scripts/optf-osdf/osdf/simulator_script.sh" +# +# add here whatever commands is needed to prepare the optf/osdf CSIT testing +# +# assume the base is /tmp dir + +DIR=/tmp + +# the directory of the script +echo ${DIR} +cd ${DIR} + +# the temp directory used, within $DIR +# omit the -p parameter to create a temporal directory in the default location +WORK_DIR=`mktemp -d -p "$DIR"` +echo ${WORK_DIR} +cd ${WORK_DIR} + +# clone optf-osdf project +git clone https://gerrit.onap.org/r/optf/osdf + +#echo "i am ${USER} : only non jenkins users may need proxy settings" +if [ ${USER} != 'jenkins' ]; then + + # add proxy settings into this script when you work behind a proxy + ${WORKSPACE}/scripts/optf-osdf/osdf/osdf_proxy_settings.sh ${WORK_DIR} + +fi + +# prepare osdf_sim +cd ${WORK_DIR}/osdf/test/functest/simulators + +# check Dockerfile content +cat ./Dockerfile + +# build osdf_sim +chmod +x ./build_sim_image.sh +./build_sim_image.sh + +# run osdf_sim +docker run -d --name osdf_sim -p "5000:5000" osdf_sim:latest; + +OSDF_SIM_IP=`get-instance-ip.sh osdf_sim` +echo "OSDF_SIM_IP=${OSDF_SIM_IP}" + +${WORKSPACE}/scripts/optf-osdf/osdf/wait_for_port.sh ${OSDF_SIM_IP} 5000 + + +# wait a while before continuing +sleep 2 + +echo "inspect docker things for tracing purpose" +docker inspect osdf_sim + diff --git a/scripts/optf-osdf/osdf/wait_for_port.sh b/scripts/optf-osdf/osdf/wait_for_port.sh new file mode 100755 index 00000000..360fc210 --- /dev/null +++ b/scripts/optf-osdf/osdf/wait_for_port.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# ------------------------------------------------------------------------- +# Copyright (c) 2018 AT&T Intellectual Property +# +# 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. +# +# ------------------------------------------------------------------------- +# + +if [[ $# -ne 2 ]]; then + echo "Usage: wait-for-port hostname port" >&2 + exit 1 +fi + +host=$1 +port=$2 + +echo "Waiting for $host port $port open" +until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do + sleep 1 +done + +echo "$host port $port is open" + +exit 0 diff --git a/tests/optf-osdf/osdf/__init__.robot b/tests/optf-osdf/osdf/__init__.robot new file mode 100644 index 00000000..fb654d7b --- /dev/null +++ b/tests/optf-osdf/osdf/__init__.robot @@ -0,0 +1,4 @@ +*** Settings *** +Documentation Integration - Suite 1 + + diff --git a/tests/optf-osdf/osdf/data/pci-opt-request.json b/tests/optf-osdf/osdf/data/pci-opt-request.json new file mode 100644 index 00000000..7ec9ab5f --- /dev/null +++ b/tests/optf-osdf/osdf/data/pci-opt-request.json @@ -0,0 +1,20 @@ +{ + "requestInfo": { + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/", + "sourceId": "SO", + "requestType": "create", + "numSolutions": 1, + "optimizers": [ + "placement" + ], + "timeout": 600 + }, + "cellInfo": { + "networkId": "1000", + "cellIdList": [ + "cell0" + ] + } +}
\ No newline at end of file diff --git a/tests/optf-osdf/osdf/data/placement_request.json b/tests/optf-osdf/osdf/data/placement_request.json new file mode 100644 index 00000000..d9b16ca5 --- /dev/null +++ b/tests/optf-osdf/osdf/data/placement_request.json @@ -0,0 +1,102 @@ +{ + "requestInfo": { + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "callbackUrl": "https://wiki.onap.org:5000/callbackUrl/", + "sourceId": "SO", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 + }, + "placementInfo": { + "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, + "subscriberInfo": {"globalSubscriberId": "xxx-xx-xxx", "subscriberName": "subscriber_x"}, + "placementDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "tenantId": "vGMuxInfra-tenant", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vGMuxInfra-customeModelName" + } + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", + "tenantId": "vG-tenant", + "resourceModelInfo": { + "modelInvariantId": "vG-modelInvariantId", + "modelVersionId": "vG-versionId", + "modelName": "vG-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vG-customeModelName" + }, + "existingCandidates": [ + { + "identifierType": "serviceInstanceId", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + } + ], + "excludedCandidates": [ + { + "identifierType": "serviceInstanceId", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + }, + { + "identifierType": "vimId", + "cloudOwner": "vmware", + "identifiers": ["NYMDT67"] + } + ], + "requiredCandidates": [ + { + "identifierType": "vimId", + "cloudOwner": "amazon", + "identifiers": ["TXAUS219"] + } + ] + } + ] + }, + "serviceInfo": { + "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", + "serviceName": "vCPE", + "modelInfo": { + "modelInvariantId": "vCPE-invariantId", + "modelVersionId": "vCPE-versionId", + "modelName": "vCPE-model", + "modelType": "service", + "modelVersion": "1.0", + "modelCustomizationName": "vCPE-customeModelName" + } + }, + "licenseInfo": { + "licenseDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vGMuxInfra-customeModelName" + }, + "existingLicenses": { + "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], + "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/optf-osdf/osdf/optf_osdf_setup.robot b/tests/optf-osdf/osdf/optf_osdf_setup.robot new file mode 100644 index 00000000..fdf7f3e3 --- /dev/null +++ b/tests/optf-osdf/osdf/optf_osdf_setup.robot @@ -0,0 +1,12 @@ +*** Settings *** +Documentation Suite description +Resource ./resources/common-keywords.robot + +*** Test Cases *** +Check OSDF_SIM Docker Container + [Documentation] It checks osdf_simulator docker container is running + Verify Docker RC Status osdf_sim + +Check OSDF Docker Container + [Documentation] It checks optf-osdf docker container is running + Verify Docker RC Status optf-osdf
\ No newline at end of file diff --git a/tests/optf-osdf/osdf/optf_osdf_test.robot b/tests/optf-osdf/osdf/optf_osdf_test.robot new file mode 100644 index 00000000..c3921d5c --- /dev/null +++ b/tests/optf-osdf/osdf/optf_osdf_test.robot @@ -0,0 +1,48 @@ +*** Settings *** +Library json +Library OperatingSystem +Resource ./resources/common-keywords.robot + +Suite Teardown Delete All Sessions + +*** Variables *** +${osdf_host} ${OSDF_HOSTNAME}:${OSDF_PORT} +&{placement_auth} = username=test password=testpwd +&{wrong_authorization} = username=test password=test +&{pci_auth}= username=pci_test password=pci_testpwd + +*** Test Cases *** +Healthcheck + [Documentation] It sends a REST GET request to healthcheck url + ${resp}= Http Get ${osdf_host} /api/oof/v1/healthcheck + Should Be Equal As Integers ${resp.status_code} 200 + +SendPlacementWithInvalidAuth + [Documentation] It sends a POST request to osdf fail authentication + ${data}= Get Binary File ${CURDIR}${/}data${/}placement_request.json + ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/placement data=${data} auth=${wrong_authorization} + ${response_json} json.loads ${resp.content} + Should Be Equal Unauthorized, check username and password ${response_json['serviceException']['text']} + Should Be Equal As Integers ${resp.status_code} 401 + +SendPlacementWithValidAuth + [Documentation] It sends a POST request to osdf with correct authentication + ${data}= Get Binary File ${CURDIR}${/}data${/}placement_request.json + ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/placement data=${data} auth=${placement_auth} + ${response_json} json.loads ${resp.content} + Should Be Equal As Integers ${resp.status_code} 202 + Should Be Equal accepted ${response_json['requestStatus']} + +#SendPCIOptimizationWithAuth +# [Documentation] It sends a POST request PCI Optimization service +# +# ${data}= Get Binary File ${CURDIR}${/}data${/}pci-opt-request.json +# ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/pci data=${data} auth=${pci_auth} +# ${response_json} json.loads ${resp.content} +# Should Be Equal As Integers ${resp.status_code} 202 +# Should Be Equal accepted ${response_json['requestStatus']} + + + + + diff --git a/tests/optf-osdf/osdf/resources/common-keywords.robot b/tests/optf-osdf/osdf/resources/common-keywords.robot new file mode 100644 index 00000000..ea45f09d --- /dev/null +++ b/tests/optf-osdf/osdf/resources/common-keywords.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Suite description +Library OperatingSystem +Library RequestsLibrary +Library json +Library RequestsLibrary +*** Variables *** +&{headers}= Content-Type=application/json Accept=application/json +*** Keywords *** +Verify Docker RC Status + [Documentation] Method to verify whether docker instance is up and running + [Arguments] ${process_name} + ${rc} ${output}= Run and Return RC and Output docker ps + Log To Console ********************* + Log To Console retrurn_code = ${rc} + Log To Console output = ${output} + Should Be Equal As Integers ${rc} 0 + Should Contain ${output} ${process_name} + +Http Get + [Documentation] Wrapper for Http GET + [Arguments] ${host} ${restUrl} + Create Session optf-osdf ${host} + ${resp}= Get Request optf-osdf ${restUrl} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + [Return] ${resp} + +Http Post + [Documentation] Wrapper for Http POST + [Arguments] ${host} ${restUrl} ${auth} ${data} + ${pci_auth}= Create List ${auth['username']} ${auth['password']} + Create Session optf-osdf ${host} headers=${headers} auth=${pci_auth} + ${resp}= Post Request optf-osdf ${restUrl} data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + [Return] ${resp} + +Http Put + [Documentation] Wrapper for Http PUT + [Arguments] ${host} ${restUrl} ${auth} ${data} + ${pci_auth}= Create List ${auth['username']} ${auth['password']} + Create Session optf-osdf ${host} headers=${headers} auth=${pci_auth} + ${resp}= Put Request optf-osdf ${restUrl} data=${data} headers=${headers} + Log To Console ********************* + Log To Console response = ${resp} + Log To Console body = ${resp.text} + [Return] ${resp}
\ No newline at end of file |