diff --git a/.github/workflows/cloud-controller-build.yaml b/.github/workflows/cloud-controller-build.yaml index bc300a61e..e8dc2c2b1 100644 --- a/.github/workflows/cloud-controller-build.yaml +++ b/.github/workflows/cloud-controller-build.yaml @@ -17,17 +17,13 @@ env: # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script testbeds: '[ - { - "number": "ext-03", - "version": "1.1.0" - }, { "number": "01", - "version": "1.1.0" + "version": "1.2.0-RC1" }, { "number": "02", - "version": "1.1.0" + "version": "1.2.0-RC1" } ]' diff --git a/.github/workflows/interop.yml b/.github/workflows/interop.yml index f0cae17b1..0e9c72596 100644 --- a/.github/workflows/interop.yml +++ b/.github/workflows/interop.yml @@ -129,7 +129,7 @@ jobs: - -c - | cd tests - pytest -m "${{ steps.marker.outputs.expression }}" -s -vvv --testbed=interop -o 'jobName=Github-Interop-${{ matrix.test_type }}' -o 'jobNumber=${{ github.run_number }}' --skip-testrail --alluredir=/tmp/allure-results + pytest -m "${{ steps.marker.outputs.expression }}" -s -vvv --testbed=interop -o 'jobName=Github-Interop-${{ matrix.test_type }}' -o 'jobNumber=${{ github.run_number }}' --skip-testrail --alluredir=/tmp/allure-results --1.x ret=\$? # sleep some time to be able to download the Allure results sleep 60 diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 83c747043..1bac7dac1 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -58,7 +58,7 @@ jobs: run: docker push ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }} test: - runs-on: ubuntu-latest + runs-on: [ self-hosted, small ] needs: [ build ] strategy: max-parallel: 1 @@ -73,6 +73,17 @@ jobs: testbed: ${{ steps.testbed.outputs.name }} steps: + - name: install aws CLI tool + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + sudo ./aws/install + + - name: install kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + - name: get EKS access credentials run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} @@ -80,6 +91,7 @@ jobs: run: | wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz + - name: set job name id: job run: echo "::set-output name=name::perf-${{ github.run_id }}" @@ -95,12 +107,14 @@ jobs: kubectl create ns $NAMESPACE kubectl config set-context --current --namespace=$NAMESPACE echo "::set-output name=name::${NAMESPACE}" + - name: create configuration.py secret run: | cat << EOF > configuration.py ${{ secrets.LAB_CONFIGURATION }} EOF kubectl create secret generic configuration --from-file=configuration=./configuration.py + - name: run perf tests run: | cat </dev/null 2>&1 exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}") + - name: print logs if: always() run: | podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///") kubectl logs $podname + - name: upload Allure results as artifact if: always() uses: actions/upload-artifact@v2 @@ -218,6 +234,7 @@ jobs: - name: add report metadata run: | cat << EOF >> allure-results-dataplane_throughput_test/environment.properties + Testbed=${{ needs.test.outputs.testbed }} Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD) CiRun.Id=${{ github.run_id }} diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index d24d9faf3..e7ad5248f 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -187,7 +187,7 @@ jobs: - -c - | cd tests - pytest -m "${{ github.event.inputs.marker_expression || 'sanity and not interop' }}" -s -vvv --testbed="${{ matrix.testbed }}" --skip-testrail --alluredir=/tmp/allure-results -o build=${{ github.event.inputs.ap_firmware_url || 'null'}} + pytest -m "${{ github.event.inputs.marker_expression || 'sanity and not interop' }}" -s -vvv --testbed="${{ matrix.testbed }}" --skip-testrail --alluredir=/tmp/allure-results -o build=${{ github.event.inputs.ap_firmware_url || 'null'}} --1.x ret=\$? # sleep some time to be able to download the Allure results sleep 60 diff --git a/.github/workflows/test-ucentral-deployment.yaml b/.github/workflows/test-ucentral-deployment.yaml new file mode 100644 index 000000000..594a51d8f --- /dev/null +++ b/.github/workflows/test-ucentral-deployment.yaml @@ -0,0 +1,110 @@ +name: Test uCentral chart deployment + +defaults: + run: + shell: bash + +env: + AWS_EKS_NAME: tip-wlan-main + AWS_DEFAULT_OUTPUT: json + AWS_DEFAULT_REGION: us-east-2 + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} + + # DigiCert certs + DIGICERT_CERT: ${{ secrets.DIGICERT_CERT }} + DIGICERT_KEY: ${{ secrets.DIGICERT_KEY }} + +on: + workflow_dispatch: + inputs: + deploy_method: + default: 'git' + description: 'Deploy method to use (git or bundle is supported, git is default)' + required: true + chart_version: + default: 'main' + description: 'Chart version to deploy (git tag or helm package version may be used, main is default)' + required: true + ucentralgw_version: + default: 'master' + description: 'uCentralGW version to be deployed (git tag or helm package version may be used, msater is default)' + required: true + ucentralgwui_version: + default: 'main' + description: 'uCentralGW UI version to be deployed (git tag or helm package version may be used, main is default)' + required: true + ucentralsec_version: + default: 'main' + description: 'uCentralSec version to be deployed (git tag or helm package version may be used, main is default)' + required: true + ucentralfms_version: + default: 'main' + description: 'uCentralFMS version to be deployed (git tag or helm package version may be used, main is default)' + required: true + +jobs: + deploy: + name: Deploy test uCentral instance + runs-on: ubuntu-latest + steps: + + - name: Checkout repo with Helm values + uses: actions/checkout@v2 + with: + path: wlan-testing + + - name: Prepare certificates from secrets + working-directory: wlan-testing/helm/ucentral + run: | + echo "${{ env.DIGICERT_CERT }}" | base64 -d > cert.pem + echo "${{ env.DIGICERT_KEY }}" | base64 -d > key.pem + + - name: Fetch kubeconfig + run: | + aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} + + - name: Deploy uCentralGW + working-directory: wlan-testing/helm/ucentral + env: + TOFILL: YES + run: | + export NAMESPACE="ucentral-$GITHUB_RUN_ID" + export DEPLOY_METHOD="${{ github.event.inputs.deploy_method }}" + export CHART_VERSION="${{ github.event.inputs.chart_version }}" + export UCENTRALGW_VERSION="${{ github.event.inputs.ucentralgw_version }}" + export UCENTRALGWUI_VERSION="${{ github.event.inputs.ucentralgwui_version }}" + export UCENTRALSEC_VERSION="${{ github.event.inputs.ucentralsec_version }}" + export UCENTRALFMS_VERSION="${{ github.event.inputs.ucentralfms_version }}" + export VALUES_FILE_LOCATION=values.ucentral-qa.yaml + export RTTY_TOKEN="${{ secrets.RTTY_TOKEN }}" + export UCENTRALGW_AUTH_USERNAME="${{ secrets.UCENTRALGW_AUTH_USERNAME }}" + export UCENTRALGW_AUTH_PASSWORD="${{ secrets.UCENTRALGW_AUTH_PASSWORD }}" + export UCENTRALFMS_S3_SECRET="${{ secrets.UCENTRALFMS_S3_SECRET }}" + export UCENTRALFMS_S3_KEY="${{ secrets.UCENTRALFMS_S3_KEY }}" + ./deploy.sh + + - name: Show resource state on deployment failure + if: failure() + run: | + kubectl get pods --namespace ucentral-$GITHUB_RUN_ID + kubectl get services --namespace ucentral-$GITHUB_RUN_ID + kubectl get persistentvolumeclaims --namespace ucentral-$GITHUB_RUN_ID + - name: Describe pods on deployment failure + if: failure() + run: | + kubectl describe pods --namespace ucentral-$GITHUB_RUN_ID + - name: Describe services on deployment failure + if: failure() + run: | + kubectl describe services --namespace ucentral-$GITHUB_RUN_ID + - name: Describe persistentvolumeclaims on deployment failure + if: failure() + run: | + kubectl describe persistentvolumeclaims --namespace ucentral-$GITHUB_RUN_ID + + - name: Delete Cloud SDK + if: always() + run: | + kubectl delete namespace ucentral-$GITHUB_RUN_ID diff --git a/.github/workflows/ucentralgw-deployment.yaml b/.github/workflows/ucentralgw-deployment.yaml deleted file mode 100644 index 4f8a8ef4d..000000000 --- a/.github/workflows/ucentralgw-deployment.yaml +++ /dev/null @@ -1,161 +0,0 @@ -name: Update uCentral - -defaults: - run: - shell: bash - -env: - AWS_EKS_NAME: tip-wlan-main - AWS_DEFAULT_OUTPUT: json - AWS_DEFAULT_REGION: us-east-2 - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} - - # DigiCert certs - DIGICERT_CERT: ${{ secrets.DIGICERT_CERT }} - DIGICERT_KEY: ${{ secrets.DIGICERT_KEY }} - - # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script - testbeds: '[ - { - "namespace": "qa01", - "ucentralgw_version": "master", - "ucentralsec_version": "main", - "ucentralfms_version": "main", - "ucentralgwui_version": "main" - }, - { - "namespace": "dev01", - "ucentralgw_version": "master", - "ucentralsec_version": "main", - "ucentralfms_version": "main", - "ucentralgwui_version": "main" - } - ]' - -on: - workflow_dispatch: {} - -jobs: - generate-matrix: - name: Generate matrix for build - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: generate-matrix - id: set-matrix - run: | - echo '::set-output name=matrix::{"include":${{ env.testbeds }}}' - - deploy: - name: Update uCentral instances - runs-on: ubuntu-latest - needs: [ generate-matrix ] - strategy: - matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} - fail-fast: false - steps: - - - name: Checkout uCentral assembly chart repo - uses: actions/checkout@v2 - with: - path: wlan-cloud-ucentral-deploy - repository: Telecominfraproject/wlan-cloud-ucentral-deploy - - name: Checkout repo with Helm values - uses: actions/checkout@v2 - with: - path: wlan-testing - - - name: Prepare certificates from secrets - run: | - echo "${{ env.DIGICERT_CERT }}" | base64 -d > cert.pem - echo "${{ env.DIGICERT_KEY }}" | base64 -d > key.pem - - - name: Fetch kubeconfig - run: | - aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} - - - name: Deploy uCentralGW - working-directory: wlan-cloud-ucentral-deploy/chart - run: | - helm plugin install https://github.com/aslafy-z/helm-git --version 0.10.0 - sed -i '/wlan-cloud-ucentralgw@/s/ref=.*/ref='${{ matrix.ucentralgw_version }}'\"/g' Chart.yaml - sed -i '/wlan-cloud-ucentralgw-ui@/s/ref=.*/ref='${{ matrix.ucentralgwui_version }}'\"/g' Chart.yaml - sed -i '/wlan-cloud-ucentralsec@/s/ref=.*/ref='${{ matrix.ucentralsec_version }}'\"/g' Chart.yaml - sed -i '/wlan-cloud-ucentralfms@/s/ref=.*/ref='${{ matrix.ucentralfms_version }}'\"/g' Chart.yaml - export UCENTRALGW_VERSION_TAG=$(echo ${{ matrix.ucentralgw_version }} | tr '/' '-') - export UCENTRALGWUI_VERSION_TAG=$(echo ${{ matrix.ucentralgwui_version }} | tr '/' '-') - export UCENTRALSEC_VERSION_TAG=$(echo ${{ matrix.ucentralsec_version }} | tr '/' '-') - export UCENTRALFMS_VERSION_TAG=$(echo ${{ matrix.ucentralfms_version }} | tr '/' '-') - helm repo add bitnami https://charts.bitnami.com/bitnami - helm repo update - helm dependency update - helm upgrade --install --create-namespace \ - --namespace ucentral-${{ matrix.namespace }} --wait --timeout 20m \ - -f ../../wlan-testing/helm/ucentral/values.ucentral-qa.yaml \ - --set ucentralgw.configProperties."rtty\.token"=${{ secrets.RTTY_TOKEN }} \ - --set ucentralsec.configProperties."authentication\.default\.username"=${{ secrets.UCENTRALGW_AUTH_USERNAME }} \ - --set ucentralsec.configProperties."authentication\.default\.password"=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} \ - --set rttys.config.token=${{ secrets.RTTY_TOKEN }} \ - --set ucentralfms.configProperties."s3\.secret"=${{ secrets.UCENTRALFMS_S3_SECRET }} \ - --set ucentralfms.configProperties."s3\.key"=${{ secrets.UCENTRALFMS_S3_KEY }} \ - --set ucentralgw.services.ucentralgw.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=gw-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralgw.configProperties."ucentral\.fileuploader\.host\.0\.name"=gw-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralgw.configProperties."rtty\.server"=rtty-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralgw.configProperties."ucentral\.system\.uri\.public"=https://gw-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:16002 \ - --set ucentralgw.configProperties."ucentral\.system\.uri\.private"=https://gw-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:17002 \ - --set ucentralgw.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralsec.services.ucentralsec.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=sec-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralsec.configProperties."ucentral\.system\.uri\.public"=https://sec-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:16001 \ - --set ucentralsec.configProperties."ucentral\.system\.uri\.private"=https://sec-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:17001 \ - --set ucentralsec.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set rttys.services.rttys.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=rtty-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralgwui.ingresses.default.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=webui-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralgwui.ingresses.default.hosts={webui-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build} \ - --set ucentralgwui.public_env_variables.DEFAULT_UCENTRALSEC_URL=https://sec-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:16001 \ - --set ucentralfms.services.ucentralfms.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=fms-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set ucentralfms.configProperties."ucentral\.system\.uri\.public"=https://fms-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:16004 \ - --set ucentralfms.configProperties."ucentral\.system\.uri\.private"=https://fms-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build:17004 \ - --set ucentralfms.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${{ matrix.namespace }}.cicd.lab.wlan.tip.build \ - --set-file ucentralgw.certs."restapi-cert\.pem"=../../cert.pem \ - --set-file ucentralgw.certs."restapi-key\.pem"=../../key.pem \ - --set-file ucentralgw.certs."websocket-cert\.pem"=../../cert.pem \ - --set-file ucentralgw.certs."websocket-key\.pem"=../../key.pem \ - --set-file rttys.certs."restapi-cert\.pem"=../../cert.pem \ - --set-file rttys.certs."restapi-key\.pem"=../../key.pem \ - --set-file ucentralsec.certs."restapi-cert\.pem"=../../cert.pem \ - --set-file ucentralsec.certs."restapi-key\.pem"=../../key.pem \ - --set-file ucentralfms.certs."restapi-cert\.pem"=../../cert.pem \ - --set-file ucentralfms.certs."restapi-key\.pem"=../../key.pem \ - --set ucentralgw.images.ucentralgw.tag=$UCENTRALGW_VERSION_TAG \ - --set ucentralgwui.images.ucentralgwui.tag=$UCENTRALGWUI_VERSION_TAG \ - --set ucentralsec.images.ucentralsec.tag=$UCENTRALSEC_VERSION_TAG \ - --set ucentralfms.images.ucentralfms.tag=$UCENTRALFMS_VERSION_TAG \ - tip-ucentral . - - - name: Show resource state on deployment failure - if: failure() - run: | - kubectl get pods --namespace ucentral-${{ matrix.namespace }} - kubectl get services --namespace ucentral-${{ matrix.namespace }} - kubectl get persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} - - name: Describe pods on deployment failure - if: failure() - run: | - kubectl describe pods --namespace ucentral-${{ matrix.namespace }} - - name: Describe services on deployment failure - if: failure() - run: | - kubectl describe services --namespace ucentral-${{ matrix.namespace }} - - name: Describe persistentvolumeclaims on deployment failure - if: failure() - run: | - kubectl describe persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} - - - name: Rollback Cloud SDK - if: failure() - run: | - helm rollback tip-ucentral --namespace ucentral-${{ matrix.namespace }} --wait --timeout 20m - diff --git a/.github/workflows/ucentralgw-dev-deployment.yaml b/.github/workflows/ucentralgw-dev-deployment.yaml new file mode 100644 index 000000000..a9ce1a0e5 --- /dev/null +++ b/.github/workflows/ucentralgw-dev-deployment.yaml @@ -0,0 +1,120 @@ +name: Update DEV uCentral clusters + +defaults: + run: + shell: bash + +env: + AWS_EKS_NAME: tip-wlan-main + AWS_DEFAULT_OUTPUT: json + AWS_DEFAULT_REGION: us-east-2 + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} + + # DigiCert certs + DIGICERT_CERT: ${{ secrets.DIGICERT_CERT }} + DIGICERT_KEY: ${{ secrets.DIGICERT_KEY }} + + # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script + # Required object fiels per environment: + # - namespace - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'ucentral-test') + # - deploy_method - deployment method for the chart deployment (supported methods - 'git' (will use helm-git from assembly chart) and 'bundle' (will use chart stored in the Artifactory0 + # - chart_version - version of chart to be deployed from assembly chart (for 'git' method git ref may be passed, for 'bundle' method version of chart may be passed) + # - ucentralgw_version - uCentralGW version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - ucentralsec_version - uCentralSec version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - ucentralfms_version - uCentralFMS version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + # - ucentralgwui_version - uCentralGW UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) + testbeds: '[ + { + "namespace": "dev01", + "deploy_method": "git", + "chart_version": "main", + "ucentralgw_version": "master", + "ucentralsec_version": "main", + "ucentralfms_version": "main", + "ucentralgwui_version": "main" + } + ]' + +on: + workflow_dispatch: {} + +jobs: + generate-matrix: + name: Generate matrix for build + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: generate-matrix + id: set-matrix + run: | + echo '::set-output name=matrix::{"include":${{ env.testbeds }}}' + + deploy: + name: Update uCentral instances + runs-on: ubuntu-latest + needs: [ generate-matrix ] + strategy: + matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} + fail-fast: false + steps: + + - name: Checkout repo with Helm values + uses: actions/checkout@v2 + with: + path: wlan-testing + + - name: Prepare certificates from secrets + working-directory: wlan-testing/helm/ucentral + run: | + echo "${{ env.DIGICERT_CERT }}" | base64 -d > cert.pem + echo "${{ env.DIGICERT_KEY }}" | base64 -d > key.pem + + - name: Fetch kubeconfig + run: | + aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} + + - name: Deploy uCentralGW + working-directory: wlan-testing/helm/ucentral + run: | + export NAMESPACE="${{ matrix.namespace }}" + export DEPLOY_METHOD="${{ matrix.deploy_method }}" + export CHART_VERSION="${{ matrix.chart_version }}" + export UCENTRALGW_VERSION="${{ matrix.ucentralgw_version }}" + export UCENTRALGWUI_VERSION="${{ matrix.ucentralgwui_version }}" + export UCENTRALSEC_VERSION="{{ matrix.ucentralsec_version }}" + export UCENTRALFMS_VERSION="${{ matrix.ucentralfms_version }}" + export VALUES_FILE_LOCATION=values.ucentral-qa.yaml + export RTTY_TOKEN="${{ secrets.RTTY_TOKEN }}" + export UCENTRALGW_AUTH_USERNAME="${{ secrets.UCENTRALGW_AUTH_USERNAME }}" + export UCENTRALGW_AUTH_PASSWORD="${{ secrets.UCENTRALGW_AUTH_PASSWORD }}" + export UCENTRALFMS_S3_SECRET="${{ secrets.UCENTRALFMS_S3_SECRET }}" + export UCENTRALFMS_S3_KEY="${{ secrets.UCENTRALFMS_S3_KEY }}" + ./deploy.sh + + - name: Show resource state on deployment failure + if: failure() + run: | + kubectl get pods --namespace ucentral-${{ matrix.namespace }} + kubectl get services --namespace ucentral-${{ matrix.namespace }} + kubectl get persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} + - name: Describe pods on deployment failure + if: failure() + run: | + kubectl describe pods --namespace ucentral-${{ matrix.namespace }} + - name: Describe services on deployment failure + if: failure() + run: | + kubectl describe services --namespace ucentral-${{ matrix.namespace }} + - name: Describe persistentvolumeclaims on deployment failure + if: failure() + run: | + kubectl describe persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} + + - name: Rollback Cloud SDK + if: failure() + run: | + helm rollback tip-ucentral --namespace ucentral-${{ matrix.namespace }} --wait --timeout 20m + diff --git a/.github/workflows/ucentralgw-qa-deployment.yaml b/.github/workflows/ucentralgw-qa-deployment.yaml new file mode 100644 index 000000000..99506f656 --- /dev/null +++ b/.github/workflows/ucentralgw-qa-deployment.yaml @@ -0,0 +1,111 @@ +name: Update QA uCentral clusters + +defaults: + run: + shell: bash + +env: + AWS_EKS_NAME: tip-wlan-main + AWS_DEFAULT_OUTPUT: json + AWS_DEFAULT_REGION: us-east-2 + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} + + # DigiCert certs + DIGICERT_CERT: ${{ secrets.DIGICERT_CERT }} + DIGICERT_KEY: ${{ secrets.DIGICERT_KEY }} + + # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script + testbeds: '[ + { + "namespace": "qa01", + "deploy_method": "git", + "chart_version": "main", + "ucentralgw_version": "master", + "ucentralsec_version": "main", + "ucentralfms_version": "main", + "ucentralgwui_version": "main" + } + ]' + +on: + workflow_dispatch: {} + +jobs: + generate-matrix: + name: Generate matrix for build + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: generate-matrix + id: set-matrix + run: | + echo '::set-output name=matrix::{"include":${{ env.testbeds }}}' + + deploy: + name: Update uCentral instances + runs-on: ubuntu-latest + needs: [ generate-matrix ] + strategy: + matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} + fail-fast: false + steps: + + - name: Checkout repo with Helm values + uses: actions/checkout@v2 + with: + path: wlan-testing + + - name: Prepare certificates from secrets + working-directory: wlan-testing/helm/ucentral + run: | + echo "${{ env.DIGICERT_CERT }}" | base64 -d > cert.pem + echo "${{ env.DIGICERT_KEY }}" | base64 -d > key.pem + + - name: Fetch kubeconfig + run: | + aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} + + - name: Deploy uCentralGW + working-directory: wlan-testing/helm/ucentral + run: | + export NAMESPACE="${{ matrix.namespace }}" + export DEPLOY_METHOD="${{ matrix.deploy_method }}" + export CHART_VERSION="${{ matrix.chart_version }}" + export UCENTRALGW_VERSION="${{ matrix.ucentralgw_version }}" + export UCENTRALGWUI_VERSION="${{ matrix.ucentralgwui_version }}" + export UCENTRALSEC_VERSION="{{ matrix.ucentralsec_version }}" + export UCENTRALFMS_VERSION="${{ matrix.ucentralfms_version }}" + export RTTY_TOKEN="${{ secrets.RTTY_TOKEN }}" + export UCENTRALGW_AUTH_USERNAME="${{ secrets.UCENTRALGW_AUTH_USERNAME }}" + export UCENTRALGW_AUTH_PASSWORD="${{ secrets.UCENTRALGW_AUTH_PASSWORD }}" + export UCENTRALFMS_S3_SECRET="${{ secrets.UCENTRALFMS_S3_SECRET }}" + export UCENTRALFMS_S3_KEY="${{ secrets.UCENTRALFMS_S3_KEY }}" + ./deploy.sh + + - name: Show resource state on deployment failure + if: failure() + run: | + kubectl get pods --namespace ucentral-${{ matrix.namespace }} + kubectl get services --namespace ucentral-${{ matrix.namespace }} + kubectl get persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} + - name: Describe pods on deployment failure + if: failure() + run: | + kubectl describe pods --namespace ucentral-${{ matrix.namespace }} + - name: Describe services on deployment failure + if: failure() + run: | + kubectl describe services --namespace ucentral-${{ matrix.namespace }} + - name: Describe persistentvolumeclaims on deployment failure + if: failure() + run: | + kubectl describe persistentvolumeclaims --namespace ucentral-${{ matrix.namespace }} + + - name: Rollback Cloud SDK + if: failure() + run: | + helm rollback tip-ucentral --namespace ucentral-${{ matrix.namespace }} --wait --timeout 20m + diff --git a/helm/ucentral/deploy.sh b/helm/ucentral/deploy.sh new file mode 100755 index 000000000..b8730f941 --- /dev/null +++ b/helm/ucentral/deploy.sh @@ -0,0 +1,126 @@ +#!/bin/bash +set -e + +# Usage function +usage () { + echo; + echo "This script is indended for uCentral Cloud SDK deployment to TIP QA/Dev environments using assembly Helm chart (https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy/tree/main/chart) with configuration through environment variables"; + echo; + echo "Required environment variables:" + echo; + echo "- NAMESPACE - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'ucentral-test')"; + echo "- UCENTRALGW_VERSION - uCentralGW version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo "- UCENTRALGWUI_VERSION - uCentralGW UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo "- UCENTRALSEC_VERSION - uCentralSec version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo "- UCENTRALFMS_VERSION - uCentralFMS version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)"; + echo; + echo "- DEPLOY_METHOD - deployment method for the chart deployment (supported methods - 'git' (will use helm-git from assembly chart) and 'bundle' (will use chart stored in the Artifactory0"; + echo "- CHART_VERSION - version of chart to be deployed from assembly chart (for 'git' method git ref may be passed, for 'bundle' method version of chart may be passed)"; + echo; + echo "- VALUES_FILE_LOCATION - path to file with override values that may be used for deployment"; + echo "- RTTY_TOKEN - token to be used for rttys and uCentralGW for remote tty sessions"; + echo "- UCENTRALGW_AUTH_USERNAME - username to be used for requests to uCentralSec"; + echo "- UCENTRALGW_AUTH_PASSWORD - hashed password for uCentralSec (details on this may be found in https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/#authenticationdefaultpassword)"; + echo "- UCENTRALFMS_S3_SECRET - secret key that is used for uCentralFMS access to firmwares S3 bucket"; + echo "- UCENTRALFMS_S3_KEY - access key that is used for uCentralFMS access to firmwares S3 bucket"; + echo "- CERT_LOCATION - path to certificate in PEM format that will be used for securing all endpoint in all services"; + echo "- KEY_LOCATION - path to private key in PEM format that will be used for securing all endpoint in all services"; +} + +# Check if required environment variables were passed +## Environment specifics +[ -z ${NAMESPACE+x} ] && echo "NAMESPACE is unset" && usage && exit 1 +[ -z ${UCENTRALGW_VERSION+x} ] && echo "UCENTRALGW_VERSION is unset" && usage && exit 1 +[ -z ${UCENTRALGWUI_VERSION+x} ] && echo "UCENTRALGWUI_VERSION is unset" && usage && exit 1 +[ -z ${UCENTRALSEC_VERSION+x} ] && echo "UCENTRALSEC_VERSION is unset" && usage && exit 1 +[ -z ${UCENTRALFMS_VERSION+x} ] && echo "UCENTRALFMS_VERSION is unset" && usage && exit 1 +## Deployment specifics +[ -z ${DEPLOY_METHOD+x} ] && echo "DEPLOY_METHOD is unset" && usage && exit 1 +[ -z ${CHART_VERSION+x} ] && echo "CHART_VERSION is unset" && usage && exit 1 +## Variables specifics +[ -z ${VALUES_FILE_LOCATION+x} ] && echo "VALUES_FILE_LOCATION is unset" && usage && exit 1 +[ -z ${RTTY_TOKEN+x} ] && echo "RTTY_TOKEN is unset" && usage && exit 1 +[ -z ${UCENTRALGW_AUTH_USERNAME+x} ] && echo "UCENTRALGW_AUTH_USERNAME is unset" && usage && exit 1 +[ -z ${UCENTRALGW_AUTH_PASSWORD+x} ] && echo "UCENTRALGW_AUTH_PASSWORD is unset" && usage && exit 1 +[ -z ${UCENTRALFMS_S3_SECRET+x} ] && echo "UCENTRALFMS_S3_SECRET is unset" && usage && exit 1 +[ -z ${UCENTRALFMS_S3_KEY+x} ] && echo "UCENTRALFMS_S3_KEY is unset" && usage && exit 1 +[ -z ${CERT_LOCATION+x} ] && echo "CERT_LOCATION is unset" && usage && exit 1 +[ -z ${KEY_LOCATION+x} ] && echo "KEY_LOCATION is unset" && usage && exit 1 + +# Transform some environment variables +export UCENTRALGW_VERSION_TAG=$(echo ${UCENTRALGW_VERSION} | tr '/' '-') +export UCENTRALGWUI_VERSION_TAG=$(echo ${UCENTRALGWUI_VERSION} | tr '/' '-') +export UCENTRALSEC_VERSION_TAG=$(echo ${UCENTRALSEC_VERSION} | tr '/' '-') +export UCENTRALFMS_VERSION_TAG=$(echo ${UCENTRALFMS_VERSION} | tr '/' '-') + +# Check deployment method that's required for this environment +helm plugin install https://github.com/databus23/helm-diff || true +if [[ "$DEPLOY_METHOD" == "git" ]]; then + helm plugin install https://github.com/aslafy-z/helm-git --version 0.10.0 || true + rm -rf wlan-cloud-ucentral-deploy || true + git clone https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy.git + cd wlan-cloud-ucentral-deploy + git checkout $CHART_VERSION + cd chart + sed -i '/wlan-cloud-ucentralgw@/s/ref=.*/ref='${UCENTRALGW_VERSION}'\"/g' Chart.yaml + sed -i '/wlan-cloud-ucentralgw-ui@/s/ref=.*/ref='${UCENTRALGWUI_VERSION}'\"/g' Chart.yaml + sed -i '/wlan-cloud-ucentralsec@/s/ref=.*/ref='${UCENTRALSEC_VERSION}'\"/g' Chart.yaml + sed -i '/wlan-cloud-ucentralfms@/s/ref=.*/ref='${UCENTRALFMS_VERSION}'\"/g' Chart.yaml + helm repo add bitnami https://charts.bitnami.com/bitnami + helm repo update + helm dependency update + cd ../.. + export DEPLOY_SOURCE="wlan-cloud-ucentral-deploy/chart" +else + if [[ "$DEPLOY_METHOD" == "bundle" ]]; then + helm repo add tip-wlan-cloud-ucentral-helm https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/ || true + export DEPLOY_SOURCE="tip-wlan-cloud-ucentral-helm/wlan-cloud-ucentral --version $CHART_VERSION" + else + echo "Deploy method is not correct: $DEPLOY_METHOD. Valid value - git or bundle" + exit 1 + fi +fi + +# Run the deployment +helm upgrade --install --create-namespace --wait --timeout 20m \ + --namespace ucentral-${NAMESPACE} \ + -f $VALUES_FILE_LOCATION \ + --set ucentralgw.configProperties."rtty\.token"=${RTTY_TOKEN} \ + --set ucentralsec.configProperties."authentication\.default\.username"=${UCENTRALGW_AUTH_USERNAME} \ + --set ucentralsec.configProperties."authentication\.default\.password"=${UCENTRALGW_AUTH_PASSWORD} \ + --set rttys.config.token=${RTTY_TOKEN} \ + --set ucentralfms.configProperties."s3\.secret"=${UCENTRALFMS_S3_SECRET} \ + --set ucentralfms.configProperties."s3\.key"=${UCENTRALFMS_S3_KEY} \ + --set ucentralgw.services.ucentralgw.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=gw-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralgw.configProperties."ucentral\.fileuploader\.host\.0\.name"=gw-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralgw.configProperties."rtty\.server"=rtty-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralgw.configProperties."ucentral\.system\.uri\.public"=https://gw-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:16002 \ + --set ucentralgw.configProperties."ucentral\.system\.uri\.private"=https://gw-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:17002 \ + --set ucentralgw.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralsec.services.ucentralsec.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=sec-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralsec.configProperties."ucentral\.system\.uri\.public"=https://sec-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ + --set ucentralsec.configProperties."ucentral\.system\.uri\.private"=https://sec-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:17001 \ + --set ucentralsec.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set rttys.services.rttys.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=rtty-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralgwui.ingresses.default.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=webui-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralgwui.ingresses.default.hosts={webui-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build} \ + --set ucentralgwui.public_env_variables.DEFAULT_UCENTRALSEC_URL=https://sec-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:16001 \ + --set ucentralfms.services.ucentralfms.annotations."external-dns\.alpha\.kubernetes\.io/hostname"=fms-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set ucentralfms.configProperties."ucentral\.system\.uri\.public"=https://fms-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:16004 \ + --set ucentralfms.configProperties."ucentral\.system\.uri\.private"=https://fms-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build:17004 \ + --set ucentralfms.configProperties."ucentral\.system\.uri\.ui"=https://webui-ucentral-${NAMESPACE}.cicd.lab.wlan.tip.build \ + --set-file ucentralgw.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file ucentralgw.certs."restapi-key\.pem"=$KEY_LOCATION \ + --set-file ucentralgw.certs."websocket-cert\.pem"=$CERT_LOCATION \ + --set-file ucentralgw.certs."websocket-key\.pem"=$KEY_LOCATION \ + --set-file rttys.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file rttys.certs."restapi-key\.pem"=$KEY_LOCATION \ + --set-file ucentralsec.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file ucentralsec.certs."restapi-key\.pem"=$KEY_LOCATION \ + --set-file ucentralfms.certs."restapi-cert\.pem"=$CERT_LOCATION \ + --set-file ucentralfms.certs."restapi-key\.pem"=$KEY_LOCATION \ + --set ucentralgw.images.ucentralgw.tag=$UCENTRALGW_VERSION_TAG \ + --set ucentralgwui.images.ucentralgwui.tag=$UCENTRALGWUI_VERSION_TAG \ + --set ucentralsec.images.ucentralsec.tag=$UCENTRALSEC_VERSION_TAG \ + --set ucentralfms.images.ucentralfms.tag=$UCENTRALFMS_VERSION_TAG \ + tip-ucentral $DEPLOY_SOURCE diff --git a/libs/lanforge/lf_tests.py b/libs/lanforge/lf_tests.py index 30ca277f8..a3e8a111c 100644 --- a/libs/lanforge/lf_tests.py +++ b/libs/lanforge/lf_tests.py @@ -392,6 +392,51 @@ class RunTest: # influx.post_to_influx() return self.dualbandptest_obj + def apstabilitytest(self, ssid_5G="[BLANK]", ssid_2G="[BLANK]", mode="BRIDGE", vlan_id=100, dut_name="TIP", + instance_name="test_demo", dut_5g="", dut_2g=""): + instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S)) + + if mode == "BRIDGE": + self.upstream_port = self.upstream_port + elif mode == "NAT": + self.upstream_port = self.upstream_port + else: + self.upstream_port = self.upstream_port + "." + str(vlan_id) + + self.apstab_obj = ApAutoTest(lf_host=self.lanforge_ip, + lf_port=self.lanforge_port, + lf_user="lanforge", + lf_password="lanforge", + instance_name=instance_name, + config_name="dbp_config", + upstream="1.1." + self.upstream_port, + pull_report=True, + dut5_0=dut_5g, + dut2_0=dut_2g, + load_old_cfg=False, + local_lf_report_dir=self.local_report_path, + max_stations_2=5, + max_stations_5=5, + max_stations_dual=10, + radio2=[self.twog_radios], + radio5=[self.fiveg_radios], + sets=[['Basic Client Connectivity', '0'], ['Multi Band Performance', '0'], + ['Throughput vs Pkt Size', '0'], ['Capacity', '0'], + ['Stability', '1'], + ['Band-Steering', '0'], ['Multi-Station Throughput vs Pkt Size', '0'], + ['Long-Term', '0']], + raw_lines=[['reset_dur:300'],['reset_batch_size:2']] + ) + self.apstab_obj.setup() + self.apstab_obj.run() + report_name = self.apstab_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + # influx = CSVtoInflux(influxdb=self.influxdb, + # _influx_tag=self.influx_params["influx_tag"], + # target_csv=self.local_report_path + report_name + "/kpi.csv") + # influx.post_to_influx() + return self.apstab_obj + + def ratevsrange(self, station_name=None, mode="BRIDGE", vlan_id=100, download_rate="85%", dut_name="TIP", upload_rate="0", duration="1m", instance_name="test_demo", raw_lines=None): if mode == "BRIDGE": diff --git a/tests/configuration.py b/tests/configuration.py index 0e82d846e..896e216b1 100644 --- a/tests/configuration.py +++ b/tests/configuration.py @@ -53,7 +53,7 @@ CONFIGURATION = { 'password': "pumpkin77", 'port': 22, 'jumphost_tty': '/dev/ttyAP1', - 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ecw5410/dev/ecw5410-2021-06-25-pending-b6743c3.tar.gz" + 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ecw5410/trunk/ecw5410-1.2.0-rc1.tar.gz" } ], "traffic_generator": { @@ -93,7 +93,7 @@ CONFIGURATION = { 'password': "pumpkin77", 'port': 22, 'jumphost_tty': '/dev/ttyAP2', - 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/eap101/dev/eap101-2021-06-25-pending-b6743c3.tar.gz" + 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/eap101/trunk/eap101-1.2.0-rc1.tar.gz" } ], "traffic_generator": { @@ -102,9 +102,9 @@ CONFIGURATION = { "ip": "10.28.3.8", "port": 8080, "ssh_port": 22, - "2.4G-Radio": ["wiphy4"], - "5G-Radio": ["wiphy5"], - "AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"], + "2.4G-Radio": ["1.1.wiphy4"], + "5G-Radio": ["1.1.wiphy5"], + "AX-Radio": ["1.1.wiphy0", "1.1.wiphy1", "1.1.wiphy2", "1.1.wiphy3"], "upstream": "1.1.eth2", "upstream_subnet": "10.28.2.1/24", "uplink": "1.1.eth3", diff --git a/tests/conftest.py b/tests/conftest.py index 17336c8e3..dcfc0b974 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -249,12 +249,15 @@ def get_equipment_id(request, setup_controller, testbed, get_configuration): @pytest.fixture(scope="session") def instantiate_access_point(testbed, get_apnos, get_configuration): """setup the access point connectivity""" - for access_point_info in get_configuration['access_point']: - if access_point_info["jumphost"]: - get_apnos(access_point_info, pwd="../libs/apnos/") - else: - pass - # Write a code to verify Access Point Connectivity + if request.config.getoption("1.x"): + for access_point_info in get_configuration['access_point']: + if access_point_info["jumphost"]: + get_apnos(access_point_info, pwd="../libs/apnos/", sdk="1.x") + else: + pass + else: + get_apnos(access_point_info, pwd="../libs/apnos/") + # Write a code to verify Access Point Connectivity yield True @@ -338,7 +341,7 @@ def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_f active_fw_list = [] try: for access_point in get_configuration['access_point']: - ap_ssh = get_apnos(access_point) + ap_ssh = get_apnos(access_point, sdk="1.x") active_fw = ap_ssh.get_active_firmware() active_fw_list.append(active_fw) except Exception as e: @@ -412,7 +415,7 @@ def setup_test_run(setup_controller, request, upgrade_firmware, get_configuratio active_fw_list = [] try: for access_point in get_configuration['access_point']: - ap_ssh = get_apnos(access_point) + ap_ssh = get_apnos(access_point, sdk="1.x") active_fw = ap_ssh.get_active_firmware() active_fw_list.append(active_fw) except Exception as e: @@ -497,7 +500,7 @@ def test_access_point(request, testbed, get_apnos, get_configuration): mgr_status = [] if request.config.getoption("1.x"): for access_point_info in get_configuration['access_point']: - ap_ssh = get_apnos(access_point_info) + ap_ssh = get_apnos(access_point_info, sdk="1.x") status = ap_ssh.get_manager_state() if "ACTIVE" not in status: time.sleep(30) diff --git a/tests/controller_tests/test_api_login.py b/tests/controller_tests/test_api_login.py index 6c2b4be3b..a5d370923 100644 --- a/tests/controller_tests/test_api_login.py +++ b/tests/controller_tests/test_api_login.py @@ -13,18 +13,10 @@ def test_cloud_sdk_version(setup_controller, testbed, test_cases, update_report) try: response = setup_controller.portal_ping() if CONFIGURATION[testbed]['controller']['version'] == response._project_version: - update_report.update_testrail(case_id=test_cases["cloud_ver"], - status_id=1, msg='Read CloudSDK version from API successfully') PASS = True else: - update_report.update_testrail(case_id=test_cases["cloud_ver"], - status_id=0, msg='Could not read CloudSDK version from API - ' - 'version missmatch') PASS = False except Exception as e: print(e) - update_report.update_testrail(case_id=test_cases["cloud_ver"], - status_id=0, msg='Could not read CloudSDK version from API - Exception ' - 'occured') PASS = False assert PASS diff --git a/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py b/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py index 209798709..1fc761638 100644 --- a/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py +++ b/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py @@ -45,13 +45,13 @@ class TestSetupBridgeEnterpriseSuiteA(object): @pytest.mark.twog def test_setup_wpa_enterprise_2g_ssid_profile(self, setup_profiles, update_report, test_cases): """ WPA Enterprise SSID 2.4G """ - assert setup_profiles['wpa2_enterprise_2g'] + assert setup_profiles['wpa_enterprise_2g'] @pytest.mark.wpa_enterprise @pytest.mark.fiveg def test_setup_wpa_enterprise_5g_ssid_profile(self, setup_profiles, update_report, test_cases): """ WPA Enterprise SSID 5G """ - assert setup_profiles['wpa2_enterprise_5g'] + assert setup_profiles['wpa_enterprise_5g'] @pytest.mark.sanity_light @pytest.mark.wpa2_enterprise diff --git a/tests/e2e/basic/configuration_tests/vlan_mode/test_enterprise_security_modes_configuration.py b/tests/e2e/basic/configuration_tests/vlan_mode/test_enterprise_security_modes_configuration.py index 545133adc..9f30e043b 100644 --- a/tests/e2e/basic/configuration_tests/vlan_mode/test_enterprise_security_modes_configuration.py +++ b/tests/e2e/basic/configuration_tests/vlan_mode/test_enterprise_security_modes_configuration.py @@ -15,14 +15,14 @@ setup_params_enterprise = { "mode": "VLAN", "ssid_modes": { "wpa_enterprise": [ - {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}], + {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"], "vlan": 100}], "wpa2_enterprise": [ - {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"]}], + {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}], "wpa3_enterprise": [ - {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]}, + {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"], "vlan": 100}]}, "rf": {}, "radius": True @@ -108,11 +108,11 @@ setup_params_enterprise_two = { "mode": "VLAN", "ssid_modes": { "wpa_wpa2_enterprise_mixed": [ - {"ssid_name": "ssid_wpa_wpa2_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa_wpa2_eap_5g", "appliedRadios": ["5G"]}], + {"ssid_name": "ssid_wpa_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}], "wpa3_enterprise_mixed": [ - {"ssid_name": "ssid_wpa3_mixed_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa3_mixed_eap_5g", "appliedRadios": ["5G"]}] + {"ssid_name": "ssid_wpa3_mixed_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa3_mixed_eap_5g", "appliedRadios": ["5G"], "vlan": 100}] }, "rf": {}, "radius": True diff --git a/tests/e2e/basic/conftest.py b/tests/e2e/basic/conftest.py index b1348c876..d64d7081d 100644 --- a/tests/e2e/basic/conftest.py +++ b/tests/e2e/basic/conftest.py @@ -47,7 +47,6 @@ def create_lanforge_chamberview_dut(lf_tools): return dut_name - @pytest.fixture(scope="class") def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, @@ -78,10 +77,10 @@ def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixture # call this, if 1.x return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, - instantiate_profile, - get_markers, create_lanforge_chamberview_dut, lf_tools, - get_security_flags, get_configuration, radius_info, get_apnos, - radius_accounting_info) + instantiate_profile, + get_markers, create_lanforge_chamberview_dut, lf_tools, + get_security_flags, get_configuration, radius_info, get_apnos, + radius_accounting_info) yield return_var @@ -116,7 +115,7 @@ def num_stations(request): @pytest.fixture(scope="class") def get_vif_state(get_apnos, get_configuration, request, lf_tools): if request.config.getoption("1.x"): - ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") + ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") vif_state = list(ap_ssh.get_vif_state_ssids()) vif_state.sort() yield vif_state diff --git a/tests/e2e/basic/endurance_test/__init__.py b/tests/e2e/basic/endurance_test/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/e2e/basic/endurance_test/bridge_mode/__init__.py b/tests/e2e/basic/endurance_test/bridge_mode/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/e2e/basic/endurance_test/bridge_mode/test_ap_stability.py b/tests/e2e/basic/endurance_test/bridge_mode/test_ap_stability.py new file mode 100644 index 000000000..e91568f3f --- /dev/null +++ b/tests/e2e/basic/endurance_test/bridge_mode/test_ap_stability.py @@ -0,0 +1,74 @@ +""" + + Stability Test: Bridge Mode + pytest -m "regression and bridge" + +""" + + +import os +import allure +import pytest + +pytestmark = [pytest.mark.regression,pytest.mark.bridge, pytest.mark.usefixtures("setup_test_run")] + +setup_params_general = { + "mode": "BRIDGE", + "ssid_modes": { + "wpa2_personal": [ + {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"}]}, + "rf": {}, + "radius": False +} + + +@pytest.mark.regression +@pytest.mark.wifi5 +@pytest.mark.wifi6 +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestAPStabilityBridge(object): + """ + pytest -m "regression and bridge and wpa2_personal and twog and fiveg" + """ + + @pytest.mark.wpa2_personal + @pytest.mark.twog + @pytest.mark.fiveg + @allure.testcase(name="test_ap_stability_wpa2_personal", + url="https://telecominfraproject.atlassian.net/browse/WIFI-3035") + def test_ap_stability_wpa2_personal(self, get_vif_state, lf_tools, + create_lanforge_chamberview_dut, lf_test, get_configuration): + profile_data = setup_params_general["ssid_modes"]["wpa2_personal"] + ssid_2G = profile_data[0]["ssid_name"] + ssid_5G = profile_data[0]["ssid_name"] + dut_name = create_lanforge_chamberview_dut + mode = "BRIDGE" + vlan = 1 + print(lf_tools.dut_idx_mapping) + dut_5g = "" + dut_2g = "" + for i in lf_tools.dut_idx_mapping: + if lf_tools.dut_idx_mapping[i][3] == "5G": + dut_5g = dut_name + ' ' + lf_tools.dut_idx_mapping[i][0] + ' ' + lf_tools.dut_idx_mapping[i][4] + print(dut_5g) + if lf_tools.dut_idx_mapping[i][3] == "2G": + dut_2g = dut_name + ' ' + lf_tools.dut_idx_mapping[i][0] + ' ' + lf_tools.dut_idx_mapping[i][4] + print(dut_2g) + if ssid_2G and ssid_5G not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID's NOT AVAILABLE IN VIF STATE") + + apstab_obj = lf_test.apstabilitytest(mode=mode, ssid_2G=ssid_2G, ssid_5G=ssid_5G, + instance_name="stability_instance_wpa2p_bridge", + vlan_id=vlan, dut_5g=dut_5g, dut_2g=dut_2g) + + report_name = apstab_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + lf_tools.attach_report_graphs(report_name=report_name, pdf_name="AP Stability Test") + assert True diff --git a/tests/e2e/basic/endurance_test/nat_mode/__init__.py b/tests/e2e/basic/endurance_test/nat_mode/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/e2e/basic/test_firmware.py b/tests/e2e/basic/test_firmware.py index ca9330626..8b86d39e1 100644 --- a/tests/e2e/basic/test_firmware.py +++ b/tests/e2e/basic/test_firmware.py @@ -6,7 +6,8 @@ import allure import pytest -pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light, pytest.mark.usefixtures("setup_test_run")] +pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light, + pytest.mark.usefixtures("setup_test_run")] @allure.testcase("firmware upgrade from Cloud") @@ -16,14 +17,8 @@ class TestFirmware(object): @pytest.mark.firmware_create def test_firmware_create(self, upload_firmware, update_report, test_cases): if upload_firmware != 0: - update_report.update_testrail(case_id=test_cases["create_fw"], - status_id=1, - msg='Create new FW version by API successful') PASS = True else: - update_report.update_testrail(case_id=test_cases["create_fw"], - status_id=5, - msg='Error creating new FW version by API') PASS = False assert PASS @@ -31,14 +26,8 @@ class TestFirmware(object): def test_firmware_upgrade_request(self, upgrade_firmware, update_report, test_cases): print(upgrade_firmware) if not upgrade_firmware: - update_report.update_testrail(case_id=test_cases["upgrade_api"], - status_id=0, - msg='Error requesting upgrade via API') PASS = False else: - update_report.update_testrail(case_id=test_cases["upgrade_api"], - status_id=1, - msg='Upgrade request using API successful') PASS = True assert PASS @@ -48,39 +37,21 @@ class TestFirmware(object): ap_fw_list = [] for i in get_equipment_id: ap_fw_list.append(setup_controller.get_ap_firmware_old_method(equipment_id=i)) - if get_latest_firmware != ap_fw_list: - update_report.update_testrail(case_id=test_cases["cloud_fw"], - status_id=5, - msg='CLOUDSDK reporting incorrect firmware version.') - else: - update_report.update_testrail(case_id=test_cases["cloud_fw"], - status_id=1, - msg='CLOUDSDK reporting correct firmware version.') assert get_latest_firmware == ap_fw_list @pytest.mark.firmware_ap - def test_ap_firmware(get_configuration, get_apnos, get_latest_firmware, update_report, test_cases): """yields the active version of firmware on ap""" active_fw_list = [] try: for access_point in get_configuration['access_point']: - ap_ssh = get_apnos(access_point) + ap_ssh = get_apnos(access_point, sdk="1.x") active_fw = ap_ssh.get_active_firmware() active_fw_list.append(active_fw) except Exception as e: print(e) active_fw_list = [] - if active_fw_list == get_latest_firmware: - update_report.update_testrail(case_id=test_cases["ap_upgrade"], - status_id=1, - msg='Upgrade to ' + str(get_latest_firmware) + ' successful') - else: - update_report.update_testrail(case_id=test_cases["ap_upgrade"], - status_id=4, - msg='Cannot reach AP after upgrade to check CLI - re-test required') - assert active_fw_list == get_latest_firmware diff --git a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_ttls.py b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_ttls.py index f36fe012b..f25af116b 100644 --- a/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_ttls.py +++ b/tests/e2e/basic/validation_of_operating_modes/bridge_mode/client_connectivity/test_enterprise_ttls.py @@ -72,7 +72,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object): @pytest.mark.fiveg def test_wpa_enterprise_5g(self, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, test_cases, radius_info, exit_on_fail): - """ wpa enterprise 2g + """ wpa enterprise 5g pytest -m "client_connectivity and bridge and enterprise and ttls and wpa_enterprise and fiveg" """ profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1] @@ -80,7 +80,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object): security = "wpa" extra_secu = ["wpa2"] mode = "BRIDGE" - band = "twog" + band = "fiveg" vlan = 1 ttls_passwd = radius_info["password"] eap = "TTLS" @@ -274,7 +274,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object): security = "wpa" extra_secu = ["wpa2"] mode = "BRIDGE" - band = "twog" + band = "fiveg" vlan = 1 ttls_passwd = radius_info["password"] eap = "TTLS" diff --git a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py index cb802face..48103a603 100644 --- a/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py +++ b/tests/e2e/basic/validation_of_operating_modes/nat_mode/client_connectivity/test_enterprise_ttls.py @@ -64,7 +64,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object): security = "wpa" extra_secu = ["wpa2"] mode = "NAT" - band = "twog" + band = "fiveg" vlan = 1 ttls_passwd = radius_info["password"] eap = "TTLS" @@ -236,7 +236,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object): security = "wpa" extra_secu = ["wpa2"] mode = "NAT" - band = "twog" + band = "fiveg" vlan = 1 ttls_passwd = radius_info["password"] eap = "TTLS" diff --git a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py index b8e429773..44dec989b 100644 --- a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py +++ b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py @@ -66,7 +66,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): security = "wpa" extra_secu = ["wpa2"] mode = "VLAN" - band = "twog" + band = "fiveg" vlan = 100 ttls_passwd = radius_info["password"] eap = "TTLS" @@ -188,11 +188,11 @@ setup_params_enterprise_two = { "mode": "VLAN", "ssid_modes": { "wpa_wpa2_enterprise_mixed": [ - {"ssid_name": "ssid_wpa_wpa2_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa_wpa2_eap_5g", "appliedRadios": ["5G"]}], + {"ssid_name": "ssid_wpa_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}], "wpa3_enterprise_mixed": [ - {"ssid_name": "ssid_wpa3_mixed_eap_2g", "appliedRadios": ["2G"]}, - {"ssid_name": "ssid_wpa3_mixed_eap_5g", "appliedRadios": ["5G"]}] + {"ssid_name": "ssid_wpa3_mixed_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa3_mixed_eap_5g", "appliedRadios": ["5G"], "vlan": 100}] }, "rf": {}, "radius": True @@ -244,7 +244,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object): security = "wpa" extra_secu = ["wpa2"] mode = "VLAN" - band = "twog" + band = "fiveg" vlan = 100 ttls_passwd = radius_info["password"] eap = "TTLS" diff --git a/tests/fixtures_1x.py b/tests/fixtures_1x.py index 0437162e6..d61b8aa14 100644 --- a/tests/fixtures_1x.py +++ b/tests/fixtures_1x.py @@ -168,12 +168,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) - test_cases["open_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["open_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["open_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["open_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["open_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["open_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -192,12 +198,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_ssid_profile(profile_data=j) - test_cases["wpa_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -217,12 +229,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=j) - test_cases["wpa2_personal_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_personal_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_personal_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa2_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_personal_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_personal_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -243,12 +261,18 @@ class Fixtures_1x: creates_profile = instantiate_profile.create_wpa_wpa2_personal_mixed_ssid_profile( profile_data=j) - test_cases["wpa_wpa2_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_personal_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_wpa2_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_personal_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -268,12 +292,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_personal_ssid_profile(profile_data=j) - test_cases["wpa3_personal_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_personal_mixed": @@ -292,12 +322,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_personal_mixed_ssid_profile( profile_data=j) - test_cases["wpa3_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -316,13 +352,19 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_enterprise_ssid_profile(profile_data=j) - test_cases["wpa_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa2_enterprise": @@ -340,12 +382,19 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=j) - test_cases["wpa2_enterprise_2g"] = True + + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa2_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_enterprise": @@ -363,12 +412,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_enterprise_ssid_profile(profile_data=j) - test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -388,12 +443,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_wpa2_enterprise_mixed_ssid_profile( profile_data=j) - test_cases["wpa_wpa2_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_enterprise_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_wpa2_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_enterprise_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_enterprise_mixed": @@ -412,12 +473,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_enterprise_mixed_ssid_profile( profile_data=j) - test_cases["wpa3_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -436,12 +503,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wep_ssid_profile(profile_data=j) - test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wep_2g"] = True + if j["appliedRadios"].__contains__("is5GHzU"): + test_cases["wep_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wep_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wep_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") # Equipment AP Profile Creation @@ -464,7 +537,7 @@ class Fixtures_1x: print(e) print("failed to create AP Profile") - ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") + ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") # ssid_names = [] # for i in instantiate_profile.profile_creation_ids["ssid"]: # ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i)) @@ -488,7 +561,7 @@ class Fixtures_1x: allure.attach( body=str("VIF Config: " + str(vif_config) + "\n" + "SSID Pushed from Controller: " + str(ssid_names)), name="SSID Profiles in VIF Config and Controller: ") - ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") + ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") # This loop will check the VIF Config with VIF State test_cases['vifs'] = False @@ -508,58 +581,58 @@ class Fixtures_1x: ap_logs = ap_ssh.logread() allure.attach(body=ap_logs, name="AP LOgs: ") - ssid_info = ap_ssh.get_ssid_info() - ssid_data = [] - print(ssid_info) - band_mapping = ap_ssh.get_bssid_band_mapping() - print(band_mapping) - idx_mapping = {} - for i in range(0, len(ssid_info)): - if ssid_info[i][1] == "OPEN": - ssid_info[i].append("") - if ssid_info[i][1] == "OPEN": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=OPEN" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - - if ssid_info[i][1] == "WPA": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - if ssid_info[i][1] == "WPA2": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA2" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - if ssid_info[i][1] == "WPA3_PERSONAL": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA3" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - - if ssid_info[i][1] == "WPA | WPA2": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA|WPA2" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - - if ssid_info[i][1] == "EAP-TTLS": - ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=EAP-TTLS" + - " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] - idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], - ssid_info[i][0]] - ssid_data.append(ssid) - lf_tools.dut_idx_mapping = idx_mapping - # Add bssid password and security from iwinfo data - # Format SSID Data in the below format - # ssid_data = [ - # ['ssid_idx=0 ssid=Default-SSID-2g security=WPA|WEP| password=12345678 bssid=90:3c:b3:94:48:58'], - # ['ssid_idx=1 ssid=Default-SSID-5gl password=12345678 bssid=90:3c:b3:94:48:59'] - # ] - allure.attach(name="SSID DATA IN LF DUT", body=str(ssid_data)) - lf_tools.update_ssid(ssid_data=ssid_data) + # ssid_info = ap_ssh.get_ssid_info() + # ssid_data = [] + # print(ssid_info) + # band_mapping = ap_ssh.get_bssid_band_mapping() + # print(band_mapping) + # idx_mapping = {} + # for i in range(0, len(ssid_info)): + # if ssid_info[i][1] == "OPEN": + # ssid_info[i].append("") + # if ssid_info[i][1] == "OPEN": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=OPEN" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # + # if ssid_info[i][1] == "WPA": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # if ssid_info[i][1] == "WPA2": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA2" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # if ssid_info[i][1] == "WPA3_PERSONAL": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA3" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # + # if ssid_info[i][1] == "WPA | WPA2": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=WPA|WPA2" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # + # if ssid_info[i][1] == "EAP-TTLS": + # ssid = ["ssid_idx=" + str(i) + " ssid=" + ssid_info[i][3] + " security=EAP-TTLS" + + # " password=" + ssid_info[i][2] + " bssid=" + ssid_info[i][0]] + # idx_mapping[str(i)] = [ssid_info[i][3], ssid_info[i][2], ssid_info[i][1], band_mapping[ssid_info[i][0]], + # ssid_info[i][0]] + # ssid_data.append(ssid) + # lf_tools.dut_idx_mapping = idx_mapping + # # Add bssid password and security from iwinfo data + # # Format SSID Data in the below format + # # ssid_data = [ + # # ['ssid_idx=0 ssid=Default-SSID-2g security=WPA|WEP| password=12345678 bssid=90:3c:b3:94:48:58'], + # # ['ssid_idx=1 ssid=Default-SSID-5gl password=12345678 bssid=90:3c:b3:94:48:59'] + # # ] + # allure.attach(name="SSID DATA IN LF DUT", body=str(ssid_data)) + # lf_tools.update_ssid(ssid_data=ssid_data) def teardown_session(): print("\nRemoving Profiles") diff --git a/tests/test_connectivity.py b/tests/test_connectivity.py index 0923e09bd..ad703c0e7 100644 --- a/tests/test_connectivity.py +++ b/tests/test_connectivity.py @@ -19,12 +19,8 @@ class TestResources(object): """Test case to verify cloud Controller Connectivity""" if setup_controller.bearer: allure.attach(name="Controller Connectivity Success", body="") - update_report.update_testrail(case_id=test_cases["cloud_ver"], - status_id=1, msg='Read CloudSDK version from API successfully') else: allure.attach(name="Controller Connectivity Failed", body="") - update_report.update_testrail(case_id=test_cases["cloud_ver"], - status_id=0, msg='Could not read CloudSDK version from API') pytest.exit("Controller Not Available") assert setup_controller.bearer @@ -38,16 +34,9 @@ class TestResources(object): flag = False if flag is False: allure.attach(name="Access Point Connectivity Success", body=str(test_access_point)) - update_report.update_testrail(case_id=test_cases["cloud_connection"], - status_id=5, - msg='CloudSDK connectivity failed') - pytest.exit("Access Point Manager state is not Active") else: allure.attach(name="Access Point Connectivity Failed", body=str(test_access_point)) - update_report.update_testrail(case_id=test_cases["cloud_connection"], - status_id=1, - msg='Manager status is Active') assert flag @@ -59,7 +48,6 @@ class TestResources(object): allure.attach(name="LANforge-", body=str(traffic_generator_connectivity)) else: - allure.attach(name="LANforgeGUI-5.4.3 is not available", body=str(traffic_generator_connectivity)) pytest.exit("LANforgeGUI-5.4.3 is not available") assert traffic_generator_connectivity diff --git a/tools/pdu_automation.py b/tools/pdu_automation.py new file mode 100644 index 000000000..e1e4da4bc --- /dev/null +++ b/tools/pdu_automation.py @@ -0,0 +1,97 @@ +import os +import pprint +import time +import argparse +from typing import Sequence +from typing import Optional + +try: + import dlipower +except: + print('Please wait we are installing DLI Power') + os.system('pip install dlipower') + + +class setup: + def __init__(self, hostname, user, password): + self.hostname = hostname + self.user = user + self.password = password + self.power_switch = dlipower.PowerSwitch(hostname=self.hostname, userid=self.user, password=self.password) + + +class switch_on(setup): + def __init__(self, hostname, user, password, port=None): + super().__init__(hostname, user, password) + self.port = port + if self.port != 'all': + self.i = 0 + for i in self.power_switch: + # print(i.description) + if i.description == self.port: + self.power_switch[self.i].state = "ON" + self.i += 1 + else: + for outlet in self.power_switch: + outlet.state = 'ON' + + +class switch_off(setup): + def __init__(self, hostname, user, password, port=None): + super().__init__(hostname, user, password) + self.port = port + if self.port != 'all': + self.i = 0 + for i in self.power_switch: + # print(i.description) + if i.description == self.port: + self.power_switch[self.i].state = "OFF" + self.i += 1 + # self.power_switch[int(self.port)-1].state = "OFF" + else: + for outlet in self.power_switch: + outlet.state = 'OFF' + + +class print_status(setup): + def __init__(self, hostname, user, password): + super().__init__(hostname, user, password) + print(self.power_switch) + + +def main(argv: Optional[Sequence[str]] = None): + parser = argparse.ArgumentParser() + parser.add_argument('--host', help='Please provide host name eg: 192.168.200.65') + parser.add_argument('--username', help='Please provide username eg: admin') + parser.add_argument('--password', help='Please provide password eg: 1234') + parser.add_argument('--action', help='Switches all Outlets in ON Mode eg: --on_all\n' + 'Switches all Outlets in OFF Mode eg: --off_all\n' + 'Cycle all Outlets in OFF Mode and then ON Mode eg: --cycle_all\n' + 'Switches the target Outlets in ON Mode eg: --on\n' + 'Switches the target Outlets in OFF Mode --off\n') + parser.add_argument('--port', help='Please provide port name eg: --port lanforge') + args = parser.parse_args(argv) + dic = vars(args) + # print(dic) + if dic['action'] == 'on': + set = setup(dic['host'], dic['username'], dic['password']) + on = switch_on(dic['host'], dic['username'], dic['password'], dic['port']) + elif dic['action'] == 'off': + set = setup(dic['host'], dic['username'], dic['password']) + off = switch_off(dic['host'], dic['username'], dic['password'], dic['port']) + # off = switch_on(dic['action']) + elif dic['action'] == 'cycle': + set = setup(dic['host'], dic['username'], dic['password']) + on = switch_off(dic['host'], dic['username'], dic['password'], dic['port']) + off = switch_on(dic['host'], dic['username'], dic['password'], dic['port']) + else: + print('Command not found') + + +if __name__ == '__main__': + main() + +# Command line to be used as +# python pdu_automation.py --host 192.168.200.90 --user admin --password 1234 --action on --port all +# python pdu_automation.py --host 192.168.200.90 --user admin --password 1234 --action off --port 'Outlet 1' +# python pdu_automation.py --host 192.168.200.90 --user admin --password 1234 --action cycle --port all