Merge branch 'master' into WIFI-5691

This commit is contained in:
Shivam Thakur
2021-12-13 11:55:29 +05:30
committed by GitHub
47 changed files with 3801 additions and 798 deletions

View File

@@ -0,0 +1,45 @@
name: build and push Docker image
description: build and push the wlan-testing Docker image
inputs:
registry:
description: the registry to push to
required: true
registry_user:
description: the user to authenticate against the registry
required: true
registry_password:
description: the password to authenticate against the registry
required: true
runs:
using: "composite"
steps:
- name: Checkout Testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Checkout LANforge scripts
uses: actions/checkout@v2
with:
path: wlan-lanforge-scripts
repository: Telecominfraproject/wlan-lanforge-scripts
- name: import LANforge scripts
shell: bash
working-directory: wlan-testing
run: ./sync_repos.bash
- name: docker login
shell: bash
run: docker login ${{ inputs.registry }} -u ${{ inputs.registry_user }} -p ${{ inputs.registry_password }}
- name: build docker image
working-directory: wlan-testing
shell: bash
run: docker build -t ${{ inputs.registry }}/cloud-sdk-nightly:${{ github.run_id }} -f docker/Dockerfile .
- name: push docker image
shell: bash
run: docker push ${{ inputs.registry }}/cloud-sdk-nightly:${{ github.run_id }}

View File

@@ -0,0 +1,17 @@
name: build and push Docker image
description: build and push the wlan-testing Docker image
inputs:
registry_user:
description: the user to authenticate against the registry
required: true
registry_password:
description: the password to authenticate against the registry
required: true
runs:
using: "composite"
steps:
- name: cleanup Docker image
shell: bash
run: curl -u ${{ inputs.registry_user }}:${{ inputs.registry_password }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/cloud-sdk-nightly/${{ github.run_id }}"

285
.github/workflows/advanced.yml vendored Normal file
View File

@@ -0,0 +1,285 @@
name: advanced testing
env:
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
schedule:
- cron: '30 20 * * *'
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: build and push Docker image
uses: ./.github/actions/build-and-push-docker
with:
registry: tip-tip-wlan-cloud-docker-repo.jfrog.io
registry_user: wlan-testing-cicd
registry_password: ${{ secrets.DOCKER_USER_PASSWORD }}
test:
runs-on: [ self-hosted, small ]
needs: [ build ]
timeout-minutes: 1440
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 }}
strategy:
fail-fast: false
matrix:
testbed:
- advanced-01
- advanced-02
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 }}
- name: install Allure CLI tool
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::advanced-ci-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_number }}-${{ matrix.testbed }}"
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 tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -x
- -c
- |
cd tests
pytest -m "advance" -s -vvv --testbed=${{ matrix.testbed }} --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: upload Allure results as artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: cleanup
if: ${{ always() }}
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
report:
needs: [ test ]
if: always()
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
testbed:
- advanced-01
- advanced-02
steps:
- name: install Allure CLI tool
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
- uses: actions/download-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: checkout testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: get reports branch
uses: actions/checkout@v2
continue-on-error: true
with:
ref: gh-pages
path: reports
- name: copy history into results
run: |
if [ -e "reports/advanced/${{ matrix.testbed }}/latest" ] ; then
cp -r reports/advanced/${{ matrix.testbed }}/latest/history/ allure-results/history
fi
- name: add report metadata
run: |
cat << EOF >> allure-results/environment.properties
Testbed=${{ matrix.testbed }}
Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD)
CiRun.Id=${{ github.run_id }}
CiRun.Number=${{ github.run_number }}
CiRun.Url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
EOF
- name: generate Allure report
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate allure-results
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report-${{ matrix.testbed }}
path: allure-report
# doing this to be able to aggregate multiple reports together later on
- name: copy results into report
run: |
mkdir -p allure-report/results
cp -r allure-results/* allure-report/results
- name: copy new report
run: |
mkdir -p reports/advanced/${{ matrix.testbed }}
cp -Tr allure-report reports/advanced/${{ matrix.testbed }}/${{ github.run_number }}
- name: update latest symlink
working-directory: reports/advanced/${{ matrix.testbed }}
run: ln -fns ${{ github.run_number }} latest
- name: generate new index.html
run: python wlan-testing/.github/tools/generate_directory_index.py -r reports
- name: commit reports update
working-directory: reports
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Automated deployment: $(date -u)"
- name: push
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
directory: reports
- name: upload to S3
if: github.ref == 'refs/heads/master'
uses: ./wlan-testing/.github/actions/allure-report-to-s3
with:
test_type: advanced
testbed: ${{ matrix.testbed }}
report_path: allure-report
s3_access_key_id: ${{ secrets.ALLURE_S3_ACCESS_KEY_ID }}
s3_access_key_secret: ${{ secrets.ALLURE_S3_ACCESS_KEY_SECRET }}
cleanup:
needs: [ test ]
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@v2
- name: cleanup Docker image
uses: ./.github/actions/cleanup-docker
with:
registry_user: wlan-testing-cicd
registry_password: ${{ secrets.DOCKER_USER_PASSWORD }}

View File

@@ -184,12 +184,6 @@ jobs:
kubectl logs -f $podname >/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

View File

@@ -14,6 +14,8 @@ env:
ALLURE_CLI_VERSION: 2.14.0
on:
repository_dispatch:
types: [openwifi-sdk-pr]
workflow_dispatch:
inputs:
testbeds:
@@ -27,27 +29,27 @@ on:
owgw_version:
default: 'master'
description: 'OpenWIFI Gateway version to be deployed.'
required: true
required: false
owgwui_version:
default: 'main'
description: 'OpenWIFI Web UI version to be deployed.'
required: true
required: false
owsec_version:
default: 'main'
description: 'OpenWIFI Security version to be deployed.'
required: true
required: false
owfms_version:
default: 'main'
description: 'OpenWIFI Firmware version to be deployed.'
required: true
required: false
owprov_version:
default: 'main'
description: 'OpenWIFI Provisioning version to be deployed.'
required: true
required: false
owprovui_version:
default: 'main'
description: 'OpenWIFI Provisioning Web UI version to be deployed.'
required: true
required: false
defaults:
run:
@@ -262,17 +264,17 @@ jobs:
- name: DOCKER_CERT_PATH
value: "/certs/client"
- name: OWGW_TAG
value: "${{ github.event.inputs.owgw_version }}"
value: "${{ github.event.inputs.owgw_version || github.event.client_payload.owgw_tag }}"
- name: OWGWUI_TAG
value: "${{ github.event.inputs.owgwui_version }}"
value: "${{ github.event.inputs.owgwui_version || github.event.client_payload.owgwui_tag }}"
- name: OWSEC_TAG
value: "${{ github.event.inputs.owsec_version }}"
value: "${{ github.event.inputs.owsec_version || github.event.client_payload.owsec_tag }}"
- name: OWFMS_TAG
value: "${{ github.event.inputs.owfms_version }}"
value: "${{ github.event.inputs.owfms_version || github.event.client_payload.owfms_tag }}"
- name: OWPROV_TAG
value: "${{ github.event.inputs.owprov_version }}"
value: "${{ github.event.inputs.owprov_version || github.event.client_payload.owprov_tag }}"
- name: OWPROVUI_TAG
value: "${{ github.event.inputs.owprovui_version }}"
value: "${{ github.event.inputs.owprovui_version || github.event.client_payload.owprovui_tag }}"
- name: INTERNAL_OWGW_HOSTNAME
value: "owgw.wlan.local"
- name: INTERNAL_OWSEC_HOSTNAME
@@ -361,92 +363,9 @@ jobs:
-e OWSEC_NEW_PASSWORD \
tip-tip-wlan-cloud-ucentral.jfrog.io/clustersysteminfo:main
generate-matrix:
name: generate testbed matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: generate-matrix
id: set-matrix
run: |
TESTBEDS="${{ github.event.inputs.testbeds || 'basic-05' }}"
TESTBEDS=$(echo $TESTBEDS | sed "s/,/\",\"/g" | sed 's/^/[\"/g' | sed 's/$/\"]/g')
TESTBEDS=$(echo "$TESTBEDS" | jq -c 'map({"testbed":.})')
echo "::set-output name=matrix::{\"include\":${TESTBEDS}}"
set-redirector-url:
needs: [ deploy-controller, generate-matrix ]
if: github.event.inputs.marker_expression == 'uc_sanity'
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
runs-on: self-hosted
steps:
- name: checkout testing repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-testing
path: wlan-testing
- name: checkout pki cert scripts repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-pki-cert-scripts
path: wlan-pki-cert-scripts
- name: install dependencies
run: |
sudo apt-get install -y python3-pip
pip install paramiko scp allure-pytest
- name: create configuration.py file
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
- name: set redirector URL
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
run: |
for id in $(echo -e 'from configuration import CONFIGURATION\nfor ap in CONFIGURATION["${{ matrix.testbed }}"]["access_point"]: print(ap["serial"])' | python3)
do
./wlan-pki-cert-scripts/digicert-change-ap-redirector.sh $id "${{ needs.deploy-controller.outputs.gateway_url }}"
current_redirector=$(./wlan-pki-cert-scripts/digicert-get-ap-redirector.sh $id)
if [[ "$current_redirector" != "${{ needs.deploy-controller.outputs.gateway_url }}" ]]; then
echo "Current redirector in DigiCert ($current_redirector) is different from the required one (${{ needs.deploy-controller.outputs.gateway_url }})"
exit 1
fi
done
- name: factory reset APs
run: |
set -x
AP_LEN=$(echo -e "from configuration import CONFIGURATION\nprint(len(CONFIGURATION['${{ matrix.testbed }}']['access_point']) - 1)" | python3)
for index in $(seq 0 $AP_LEN)
do
HOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['ip'])" | python3)
JUMPHOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost'])" | python3)
TTY=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost_tty'])" | python3)
PORT=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['port'])" | python3)
USERNAME=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['username'])" | python3)
PASSWORD=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['password'])" | python3)
cd wlan-testing/tools
python3 ap_tools.py --host $HOST --jumphost $JUMPHOST --tty $TTY --port $PORT --username $USERNAME --password $PASSWORD --cmd "jffs2reset -y -r"
cd ../..
done
- name: wait for APs to come up again
run: sleep 300
test:
runs-on: ubuntu-latest
needs: [ build, generate-matrix, deploy-controller, set-redirector-url ]
if: always()
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
needs: [ build, deploy-controller ]
steps:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
@@ -507,7 +426,7 @@ jobs:
- -c
- |
cd tests
pytest -m "${{ github.event.inputs.marker_expression || 'sdk_restapi' }}" -s -vvv --testbed="${{ matrix.testbed }}" --alluredir=/tmp/allure-results
pytest -m "${{ github.event.inputs.marker_expression || 'sdk_restapi' }}" -s -vvv --testbed="${{ github.event.inputs.testbeds || 'basic-05' }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
@@ -560,7 +479,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
name: allure-results-${{ github.event.inputs.testbeds || 'basic-05' }}
path: allure-results
- name: cleanup
@@ -570,12 +489,8 @@ jobs:
report:
runs-on: ubuntu-latest
needs: [ test, generate-matrix ]
needs: [ test ]
if: always()
strategy:
max-parallel: 1
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
steps:
- name: install Allure CLI tool
run: |
@@ -584,7 +499,7 @@ jobs:
- uses: actions/download-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}
name: allure-results-${{ github.event.inputs.testbeds || 'basic-05' }}
path: allure-results
- name: checkout testing repo
@@ -601,14 +516,14 @@ jobs:
- name: copy history into results
run: |
if [ -e "reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ matrix.testbed }}/latest" ] ; then
cp -r reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ matrix.testbed }}/latest/history/ allure-results/history
if [ -e "reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ github.event.inputs.testbeds || 'basic-05' }} /latest" ] ; then
cp -r reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ github.event.inputs.testbeds || 'basic-05' }}/latest/history/ allure-results/history
fi
- name: add report metadata
run: |
cat << EOF >> allure-results/environment.properties
Testbed=${{ matrix.testbed }}
Testbed=${{ github.event.inputs.testbeds || 'basic-05' }}
Tests.CommitId=$(cd wlan-testing && git rev-parse --short HEAD)
CiRun.Id=${{ github.run_id }}
CiRun.Number=${{ github.run_number }}
@@ -621,7 +536,7 @@ jobs:
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report-${{ matrix.testbed }}
name: allure-report-${{ github.event.inputs.testbeds || 'basic-05' }}
path: allure-report
# doing this to be able to aggregate multiple reports together later on
@@ -630,11 +545,11 @@ jobs:
- name: copy new report
run: |
mkdir -p reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ matrix.testbed }}
cp -Tr allure-report reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ matrix.testbed }}/${{ github.run_number }}
mkdir -p reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ github.event.inputs.testbeds || 'basic-05' }}
cp -Tr allure-report reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ github.event.inputs.testbeds || 'basic-05' }}/${{ github.run_number }}
- name: update latest symlink
working-directory: reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ matrix.testbed }}
working-directory: reports/docker-compose/${{ github.event.inputs.marker_expression || 'sdk_restapi' }}/${{ github.event.inputs.testbeds || 'basic-05' }}
run: ln -fns ${{ github.run_number }} latest
- name: generate new index.html
@@ -683,66 +598,3 @@ jobs:
- name: Delete namespace
run: kubectl delete ns --ignore-not-found=true "ow-docker-compose-${{ github.run_id }}"
reset-redirector-url:
needs: [ test, generate-matrix ]
if: github.event.inputs.marker_expression == 'uc_sanity' && always()
strategy:
fail-fast: false
matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }}
runs-on: self-hosted
steps:
- name: checkout testing repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-testing
path: wlan-testing
- name: checkout pki cert scripts repo
uses: actions/checkout@v2
with:
repository: Telecominfraproject/wlan-pki-cert-scripts
path: wlan-pki-cert-scripts
- name: install dependencies
run: |
pip install paramiko scp allure-pytest
- name: create configuration.py file
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
- name: reset redirector URL
env:
DIGICERT_API_KEY: ${{ secrets.DIGICERT_API_KEY }}
run: |
for id in $(echo -e 'from configuration import CONFIGURATION\nfor ap in CONFIGURATION["${{ matrix.testbed }}"]["access_point"]: print(ap["serial"])' | python3)
do
./wlan-pki-cert-scripts/digicert-change-ap-redirector.sh $id gw-qa01.cicd.lab.wlan.tip.build
current_redirector=$(./wlan-pki-cert-scripts/digicert-get-ap-redirector.sh $id)
if [[ "$current_redirector" != "gw-qa01.cicd.lab.wlan.tip.build" ]]; then
echo "Current redirector in DigiCert ($current_redirector) is different from the required one (gw-qa01.cicd.lab.wlan.tip.build)"
exit 1
fi
done
- name: factory reset APs
run: |
AP_LEN=$(echo -e "from configuration import CONFIGURATION\nprint(len(CONFIGURATION['${{ matrix.testbed }}']['access_point']) - 1)" | python3)
for index in $(seq 0 $AP_LEN)
do
HOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['ip'])" | python3)
JUMPHOST=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost'])" | python3)
TTY=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['jumphost_tty'])" | python3)
PORT=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['port'])" | python3)
USERNAME=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['username'])" | python3)
PASSWORD=$(echo -e "from configuration import CONFIGURATION\nprint(CONFIGURATION['${{ matrix.testbed }}']['access_point'][$index]['password'])" | python3)
cd wlan-testing/tools
python3 ap_tools.py --host $HOST --jumphost $JUMPHOST --tty $TTY --port $PORT --username $USERNAME --password $PASSWORD --cmd "jffs2reset -y -r"
cd ../..
done
- name: wait for APs to come up again
run: sleep 300

563
.github/workflows/quali-basic-manual.yml vendored Normal file
View File

@@ -0,0 +1,563 @@
name: manual pytest execution against basic lab
env:
# thirdparties
DOCKER_SERVER: tip-tip-wlan-cloud-docker-repo.jfrog.io
DOCKER_USER_NAME: wlan-testing-cicd
DOCKER_USER_PASSWORD: ${{ secrets.DOCKER_USER_PASSWORD }}
# AWS credentials
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 }}
# Cloud SDK certs
CACERT: ${{ secrets.CACERT }}
CAKEY: ${{ secrets.CAKEY }}
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
inputs:
openwifi_revision:
required: true
default: 'main'
description: 'revision of the Open Wifi Helm chart'
openwifi_gw_revision:
required: true
default: 'master'
description: 'revision of the Open Wifi gateway service'
openwifi_sec_revision:
required: true
default: 'main'
description: 'revision of the Open Wifi security service'
openwifi_fms_revision:
required: true
default: 'main'
description: 'revision of the Open Wifi fms service'
openwifi_ui_revision:
required: true
default: 'main'
description: 'revision of the Open Wifi UI'
ap_model:
description: 'AP model to test, one of edgecore_ecw5410,edgecore_eap101,tp-link_ec420-g1,edgecore_ecw5211,cig_wf188n,edgecore_eap102,cig_wf194c,hfcl_ion4'
required: true
firmware:
default: 'next-latest'
description: 'Target firmware version to be specified <branch>-<commit | latest>'
required: false
marker_expression:
description: "marker expression that will be passed to pytest's -m"
required: true
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout needed repositories
- name: Checkout Testing repo
uses: actions/checkout@v2
with:
path: wlan-testing
- name: Checkout LANforge scripts
uses: actions/checkout@v2
with:
path: wlan-lanforge-scripts
repository: Telecominfraproject/wlan-lanforge-scripts
- name: import LANforge scripts
working-directory: wlan-testing
run: ./sync_repos.bash
# build and push docker image
- name: docker login
run: docker login ${{ env.DOCKER_SERVER }} -u ${{ env.DOCKER_USER_NAME }} -p ${{ env.DOCKER_USER_PASSWORD }}
- name: build docker image
working-directory: wlan-testing
run: docker build -t ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }} -f docker/Dockerfile .
- name: push docker image
run: docker push ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
test:
runs-on: [ self-hosted, small ]
needs: [ build ]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: install dependencies
run: pip install -r .quali/requirements.txt
- name: start reservation
id: start
env:
CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build
CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }}
CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }}
run: |
RES_ID=$(python .quali/start_reservation.py --openwifi-version "${{ github.event.inputs.openwifi_revision }}" --openwifi-gw-version "${{ github.event.inputs.openwifi_gw_revision }}" --openwifi-sec-version "${{ github.event.inputs.openwifi_sec_revision }}" --openwifi-fms-version "${{ github.event.inputs.openwifi_fms_revision }}" --openwifi-ui-version "${{ github.event.inputs.openwifi_ui_revision }}" --ap-model "${{ github.event.inputs.ap_model }}")
echo ::set-output name=res_id::"$RES_ID"
- name: set reservation identifier
id: reservation
run: echo ::set-output name=identifier::$(echo ${{ steps.start.outputs.res_id }} | cut -d "-" -f 1)
- name: install JRE
run: |
sudo apt-get update
sudo apt-get install -y default-jre
- 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: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- 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: install Allure CLI tool
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::manual-${{ github.run_id }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: prepare configuration
env:
CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build
CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }}
CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }}
run: |
cat << EOF > configuration.py
Customer = ""
server = ""
CONFIGURATION = {
"basic": $(python .quali/get_configuration.py ${{ steps.start.outputs.res_id }})
}
open_flow = {}
RADIUS_SERVER_DATA = {
"ip": "10.10.1.221",
"port": 1812,
"secret": "testing123",
"user": "user",
"password": "password",
"pk_password": "whatever"
}
RADIUS_ACCOUNTING_DATA = {
"ip": "10.10.1.221",
"port": 1813,
"secret": "testing123",
"user": "user",
"password": "password",
"pk_password": "whatever"
}
PASSPOINT_RADIUS_SERVER_DATA = {
"ip": "52.234.179.191",
"port": 11812,
"secret": "yeababy20!",
"user": "nolaradius",
"password": "nolastart",
"pk_password": "whatever"
}
PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA = {
"ip": "52.234.179.191",
"port": 11813,
"secret": "yeababy20!"
}
PASSPOINT_PROVIDER_INFO = {
"mcc": None,
"mnc": None,
"network": None,
"nai_realms": {
"domain": "oss.ameriband.com",
"encoding": 0,
"eap_map": {"EAP-TTLS with username/password": ["Credential Type:username/password",
"Non-EAP Inner Authentication Type:MSCHAPV2"]}
},
"osu_nai_standalone": "anonymous@ameriband.com",
"osu_nai_shared": "anonymous@ameriband.com",
"roaming_oi": []
}
PASSPOINT_OPERATOR_INFO = {
"osen": "Disabled",
"domain_name_list": ["telecominfraproject.atlassian.net"],
"operator_names": [
{"locale": "eng", "name": "Default friendly passpoint_operator name"},
{"locale": "fra", "name": "Nom de l'opérateur convivial par défaut"}
]
}
PASSPOINT_VENUE_INFO = {
"venue_type": {"group": "Business", "type": "Police Station"},
"venue_names": [
{"locale": "eng", "name": "Example passpoint_venue", "url": "http://www.example.com/info-eng"},
{"locale": "fra", "name": "Exemple de lieu", "url": "http://www.example.com/info-fra"}
]
}
PASSPOINT_PROFILE_INFO = {
"profile_download_url_ios": "https://onboard.almondlabs.net/ttls/AmeriBand-Profile.mobileconfig",
"profile_download_url_android": "https://onboard.almondlabs.net/ttls/androidconfig.cfg",
"profile_name_on_device": "AmeriBand",
"radius_configuration": {
"user_defined_nas_id": "FB001AP001",
"operator_id": "AmeribandTIP",
"radius_acounting_service_interval": 60
},
"interworking_hs2dot0": "Enabled",
"hessid": None,
"access_network": {
"Access Network Type": "Free Public Network",
"Authentication Type": "Acceptance of Terms & Conditions",
"Emergency Services Reachable": "Enabled",
"Unauthenticated Emergency Service": "Disabled",
},
"ip_connectivity": {
"Internet Connectivity": "Enabled",
"IP Address Type": "Public IPv4 Address Available",
"Connection Capability": [{"status": "open", "protocol": "TCP", "port": 8888}],
"ANQP Domain ID": 1234,
"GAS Address 3 Behaviour": "P2P Spec Workaround From Request",
"Disable DGAF": False
}
}
TEST_CASES = {
"ap_upgrade": 2233,
"5g_wpa2_bridge": 2236,
"2g_wpa2_bridge": 2237,
"5g_wpa_bridge": 2419,
"2g_wpa_bridge": 2420,
"2g_wpa_nat": 4323,
"5g_wpa_nat": 4324,
"2g_wpa2_nat": 4325,
"5g_wpa2_nat": 4326,
"2g_wpa2_eap_ttls_bridge": 5214,
"5g_wpa2_eap_ttls_bridge": 5215,
"2g_wpa2_eap_ttls_nat": 5216,
"5g_wpa2_eap_ttls_nat": 5217,
"cloud_connection": 5222,
"cloud_fw": 5247,
"5g_wpa2_vlan": 5248,
"5g_wpa_vlan": 5249,
"5g_wpa2_eap_ttls_vlan": 5250,
"2g_wpa2_vlan": 5251,
"2g_wpa_vlan": 5252,
"2g_wpa2_eap_ttls_vlan": 5253,
"cloud_ver": 5540,
"bridge_vifc": 5541,
"nat_vifc": 5542,
"vlan_vifc": 5543,
"bridge_vifs": 5544,
"nat_vifs": 5545,
"vlan_vifs": 5546,
"upgrade_api": 5547,
"create_fw": 5548,
"ap_profile_bridge": 5641,
"ap_profile_nat": 5642,
"ap_profile_vlan": 5643,
"ssid_2g_wpa2_eap_bridge": 5644,
"ssid_2g_wpa2_bridge": 5645,
"ssid_2g_wpa_bridge": 5646,
"ssid_5g_wpa2_eap_bridge": 5647,
"ssid_5g_wpa2_bridge": 5648,
"ssid_5g_wpa_bridge": 5649,
"ssid_2g_wpa2_eap_nat": 5650,
"ssid_2g_wpa2_nat": 5651,
"ssid_2g_wpa_nat": 5652,
"ssid_5g_wpa2_eap_nat": 5653,
"ssid_5g_wpa2_nat": 5654,
"ssid_5g_wpa_nat": 5655,
"ssid_2g_wpa2_eap_vlan": 5656,
"ssid_2g_wpa2_vlan": 5657,
"ssid_2g_wpa_vlan": 5658,
"ssid_5g_wpa2_eap_vlan": 5659,
"ssid_5g_wpa2_vlan": 5660,
"ssid_5g_wpa_vlan": 5661,
"radius_profile": 5808,
"bridge_ssid_update": 8742,
"nat_ssid_update": 8743,
"vlan_ssid_update": 8744,
"2g_wpa3_bridge": 9740,
"5g_wpa3_bridge": 9741,
"ssid_2g_wpa3_bridge": 9742,
"ssid_5g_wpa3_bridge": 9743,
"ssid_2g_wpa3_nat": 9744,
"ssid_5g_wpa3_nat": 9745,
"ssid_2g_wpa3_vlan": 9746,
"ssid_5g_wpa3_vlan": 9747,
"2g_wpa3_nat": 9748,
"5g_wpa3_nat": 9749,
"2g_wpa3_vlan": 9750,
"5g_wpa3_vlan": 9751,
"ssid_2g_wpa3_eap_bridge": 9752,
"ssid_5g_wpa3_eap_bridge": 9753,
"2g_wpa3_eap_ttls_bridge": 9754,
"5g_wpa3_eap_ttls_bridge": 9755,
"ssid_2g_wpa3_eap_nat": 9756,
"ssid_5g_wpa3_eap_nat": 9757,
"ssid_2g_wpa3_eap_vlan": 9758,
"ssid_5g_wpa3_eap_vlan": 9759,
"2g_wpa3_eap_ttls_nat": 9760,
"5g_wpa3_eap_ttls_nat": 9761,
"2g_wpa3_eap_ttls_vlan": 9762,
"5g_wpa3_eap_ttls_vlan": 9763,
"ssid_2g_wpa3_mixed_bridge": 9764,
"ssid_5g_wpa3_mixed_bridge": 9765,
"2g_wpa3_mixed_eap_ttls_wpa3_bridge": 9766,
"2g_wpa3_mixed_wpa3_bridge": 9767,
"5g_wpa3_mixed_eap_ttls_wpa3_bridge": 9768,
"5g_wpa3_mixed_wpa3_bridge": 9769,
"ssid_2g_wpa3_mixed_nat": 9770,
"ssid_5g_wpa3_mixed_nat": 9771,
"ssid_2g_wpa3_mixed_vlan": 9772,
"ssid_5g_wpa3_mixed_vlan": 9773,
# "2g_wpa3_mixed_wpa2_nat": 9774,
"2g_wpa3_mixed_wpa3_nat": 9775,
# "5g_wpa3_mixed_wpa2_nat": 9776,
"5g_wpa3_mixed_wpa3_nat": 9777,
# "2g_wpa3_mixed_wpa2_vlan": 9778,
"2g_wpa3_mixed_wpa3_vlan": 9779,
# "5g_wpa3_mixed_wpa2_vlan": 9780,
"5g_wpa3_mixed_wpa3_vlan": 9781,
"ssid_2g_wpa3_enterprise_mixed_bridge": 9782,
"ssid_5g_wpa3_enterprise_mixed_bridge": 9783,
"2g_wpa2_mixed_eap_wpa2_bridge": 9784,
"2g_wpa3_mixed_eap_wpa3_bridge": 9785,
"5g_wpa3_mixed_eap_wpa2_bridge": 9786,
"5g_wpa3_mixed_eap_wpa3_bridge": 9787,
"ssid_2g_wpa3_enterprise_mixed_nat": 9788,
"ssid_5g_wpa3_enterprise_mixed_nat": 9789,
"2g_wpa3_mixed_eap_wpa2_nat": 9790,
"2g_wpa3_mixed_eap_ttls_wpa3_nat": 9791,
"5g_wpa3_mixed_eap_wpa2_nat": 9792,
"5g_wpa3_mixed_eap_ttls_wpa3_nat": 9793,
"ssid_2g_wpa3_enterprise_mixed_vlan": 9794,
"ssid_5g_wpa3_enterprise_mixed_vlan": 9795,
"2g_wpa3_mixed_eap_wpa2_vlan": 9796,
"2g_wpa3_mixed_eap_ttls_wpa3_vlan": 9797,
"5g_wpa3_mixed_eap_wpa2_vlan": 9798,
"5g_wpa3_mixed_eap_ttls_wpa3_vlan": 9799,
"ssid_2g_open_bridge": 9805,
"ssid_5g_open_bridge": 9806,
"ssid_2g_open_nat": 9807,
"ssid_5g_open_nat": 9808,
"ssid_2g_open_vlan": 9809,
"ssid_5g_open_vlan": 9810,
"ssid_2g_wpa2_mixed_bridge": 9811,
"ssid_5g_wpa2_mixed_bridge": 9812,
"ssid_2g_wpa2_mixed_nat": 9813,
"ssid_5g_wpa2_mixed_nat": 9814,
"ssid_2g_wpa2_mixed_vlan": 9815,
"ssid_5g_wpa2_mixed_vlan": 9817,
"ssid_2g_wpa_wpa2_enterprise_mixed_bridge": 9818,
"ssid_5g_wpa_wpa2_enterprise_mixed_bridge": 9819,
"ssid_2g_wpa_wpa2_enterprise_mixed_nat": 9820,
"ssid_5g_wpa_wpa2_enterprise_mixed_nat": 9821,
"ssid_2g_wpa_wpa2_enterprise_mixed_vlan": 9822,
"ssid_5g_wpa_wpa2_enterprise_mixed_vlan": 9823,
"ssid_2g_wpa_eap_bridge": 9824,
"ssid_5g_wpa_eap_bridge": 9825,
# "ssid_2g_wpa2_eap_bridge": 9824,
# "ssid_5g_wpa2_eap_bridge": 9825,
"ssid_2g_wpa_eap_nat": 9826,
"ssid_5g_wpa_eap_nat": 9827,
"ssid_2g_wpa_eap_vlan": 9828,
"ssid_5g_wpa_eap_vlan": 9829,
# "ap_update_bridge": 9856,
# "ap_update_nat": 9857,
# "ap_update_vlan": 9858,
# "bridge_vifc_update": 9859,
# "nat_vifc_update": 9860,
# "vlan_vifc_update": 9861,
# "bridge_vifs_update": 9862,
# "nat_vifs_update": 9863,
# "vlan_vifs_update": 9864,
"2g_wpa_eap_ttls_bridge": 9867,
"5g_wpa_eap_ttls_bridge": 9768,
"2g_wpa_eap_ttls_nat": 9869,
"5g_wpa_eap_ttls_nat": 9770,
"2g_wpa_eap_ttls_vlan": 9871,
"5g_wpa_eap_ttls_vlan": 9872,
# "2g_wpa2_mixed_eap_wpa_bridge": 9873,
"2g_wpa2_mixed_eap_ttls_wpa2_bridge": 9874,
# "5g_wpa2_mixed_eap_wpa_bridge": 9875,
"5g_wpa2_mixed_eap_ttls_wpa2_bridge": 9876,
# "2g_wpa2_mixed_eap_wpa_nat": 9877,
"2g_wpa2_mixed_eap_ttls_wpa2_nat": 9878,
# "5g_wpa2_mixed_eap_wpa_nat": 9879,
"5g_wpa2_mixed_eap_ttls_wpa2_nat": 9880,
# "2g_wpa2_mixed_eap_wpa_vlan": 9881,
"2g_wpa2_mixed_eap_ttls_wpa2_vlan": 9882,
# "5g_wpa2_mixed_eap_wpa_vlan": 9883,
"5g_wpa2_mixed_eap_ttls_wpa2_vlan": 9884,
# "2g_wpa2_mixed_wpa_bridge": 9885,
"2g_wpa2_mixed_wpa2_bridge": 9886,
# "5g_wpa2_mixed_wpa_bridge": 9887,
"5g_wpa2_mixed_wpa2_bridge": 9888,
# "2g_wpa2_mixed_wpa_nat": 9889,
"2g_wpa2_mixed_wpa2_nat": 9890,
# "5g_wpa2_mixed_wpa_nat": 9891,
"5g_wpa2_mixed_wpa2_nat": 9892,
# "2g_wpa2_mixed_wpa_vlan": 9893,
"2g_wpa2_mixed_wpa2_vlan": 9894,
# "5g_wpa2_mixed_wpa_vlan": 9895,
"5g_wpa2_mixed_wpa2_vlan": 9896,
"2g_open_bridge": 2234,
"5g_open_bridge": 2235,
"2g_open_nat": 4321,
"5g_open_nat": 4322,
"2g_open_vlan": 9897,
"5g_open_vlan": 9898
}
EOF
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -x
- -c
- |
HOSTS="sec-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build"
for HOST in \$HOSTS; do
HOST_ENTRY=""
until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done;
echo "\$HOST_ENTRY" >> /etc/hosts
echo "DNS record for \$HOST resolved successfully!"
done
cd tests
pytest -m "${{ github.event.inputs.marker_expression }}" -s -vvv --testbed="basic" -o firmware="${{ github.event.inputs.firmware }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
with:
name: allure-results
path: allure-results
- name: generate Allure report
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate allure-results
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report
path: allure-report
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
- name: stop reservation
if: always()
run: python .quali/stop_reservation.py ${{ steps.start.outputs.res_id }}
env:
CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build
CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }}
CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }}
cleanup:
needs: [ test ]
runs-on: ubuntu-latest
if: always()
steps:
- name: cleanup Docker image
run: curl -u${{ env.DOCKER_USER_NAME }}:${{ env.DOCKER_USER_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/cloud-sdk-nightly/${{ github.run_id }}"

View File

@@ -41,7 +41,7 @@ on:
description: 'revision of the Open Wifi UI'
ap_models:
required: true
default: 'ECW5410,EAP101,EC420,ECW5211,WF188N,EAP102,CIG194C'
default: 'edgecore_ecw5410,edgecore_eap101,tp-link_ec420-g1,edgecore_ecw5211,cig_wf188n,edgecore_eap102,cig_wf194c,hfcl_ion4'
description: 'the AP models to test'
ap_version:
required: true
@@ -71,12 +71,12 @@ jobs:
- name: set variables
id: vars
run: |
echo ::set-output name=openwifi::$(echo "${{ github.event.inputs.openwifi_revision || 'main' }}")
echo ::set-output name=gw::$(echo "${{ github.event.inputs.openwifi_gw_revision || 'master' }}")
echo ::set-output name=sec::$(echo "${{ github.event.inputs.openwifi_sec_revision || 'main' }}")
echo ::set-output name=fms::$(echo "${{ github.event.inputs.openwifi_fms_revision || 'main' }}")
echo ::set-output name=ui::$(echo "${{ github.event.inputs.openwifi_ui_revision || 'main' }}")
echo ::set-output name=ap_models::$(echo "${{ github.event.inputs.ap_models || 'ECW5410,EAP101,EC420,ECW5211,WF188N,EAP102,CIG194C' }}")
echo ::set-output name=openwifi::$(echo "${{ github.event.inputs.openwifi_revision || 'v2.4.0-RC3' }}")
echo ::set-output name=gw::$(echo "${{ github.event.inputs.openwifi_gw_revision || 'v2.4.0-RC3' }}")
echo ::set-output name=sec::$(echo "${{ github.event.inputs.openwifi_sec_revision || 'v2.4.0-RC2' }}")
echo ::set-output name=fms::$(echo "${{ github.event.inputs.openwifi_fms_revision || 'v2.4.0-RC2' }}")
echo ::set-output name=ui::$(echo "${{ github.event.inputs.openwifi_ui_revision || 'v2.4.0-RC2' }}")
echo ::set-output name=ap_models::$(echo "${{ github.event.inputs.ap_models || 'edgecore_ecw5410,edgecore_eap101,tp-link_ec420-g1,edgecore_ecw5211,cig_wf188n,edgecore_eap102,cig_wf194c,hfcl_ion4' }}")
echo ::set-output name=ap_version::$(echo "${{ github.event.inputs.ap_version || 'next-latest' }}")
echo ::set-output name=marker_expression::$(echo "${{ github.event.inputs.marker_expression || 'uc_sanity' }}")
@@ -169,7 +169,7 @@ jobs:
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}-$(echo ${{ matrix.ap_model }} | tr '[:upper:]' '[:lower:]')"
NAMESPACE="testing-${{ github.run_id }}-$(echo ${{ matrix.ap_model }} | tr '[:upper:]' '[:lower:]' | tr '_' '-')"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
@@ -183,6 +183,8 @@ jobs:
"basic": $(python .quali/get_configuration.py ${{ steps.start.outputs.res_id }})
}
open_flow = {}
RADIUS_SERVER_DATA = {
"ip": "10.10.1.221",
"port": 1812,
@@ -465,6 +467,8 @@ jobs:
}
EOF
cat configuration.py
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
@@ -495,12 +499,11 @@ jobs:
- -x
- -c
- |
apt-get update
apt-get install -y dnsutils
HOSTS="sec-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.identifier }}.cicd.lab.wlan.tip.build"
for HOST in \$HOSTS; do
until sleep 1; getent hosts \$HOST; do :; done
getent hosts \$HOST >> /etc/hosts
HOST_ENTRY=""
until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done;
echo "\$HOST_ENTRY" >> /etc/hosts
echo "DNS record for \$HOST resolved successfully!"
done
@@ -551,6 +554,22 @@ jobs:
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: show gw logs
if: failure()
run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owgw
- name: show fms logs
if: failure()
run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owfms
- name: show prov logs
if: failure()
run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owprov
- name: show sec logs
if: failure()
run: kubectl -n openwifi-${{ steps.reservation.outputs.identifier }} logs deployment/owsec
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
@@ -569,7 +588,7 @@ jobs:
report:
runs-on: ubuntu-latest
needs: [ test, generate-matrix ]
needs: [ test, vars, generate-matrix ]
if: always()
strategy:
max-parallel: 1
@@ -625,13 +644,11 @@ jobs:
run: cp -r allure-results allure-report/results
- name: copy new report
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
run: |
mkdir -p reports/sanity/${{ matrix.ap_model }}
cp -Tr allure-report reports/sanity/${{ matrix.ap_model }}/${{ github.run_number }}
- name: update latest symlink
if: ${{ (github.event.inputs.marker_expression || 'uc_sanity') == 'uc_sanity' }}
working-directory: reports/sanity/${{ matrix.ap_model }}
run: ln -fns ${{ github.run_number }} latest
@@ -647,7 +664,7 @@ jobs:
git commit -m "Automated deployment: $(date -u)"
- name: push
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' && needs.vars.outputs.marker_expression == 'uc_sanity'
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -655,7 +672,7 @@ jobs:
directory: reports
- name: upload to S3
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' && needs.vars.outputs.marker_expression == 'uc_sanity'
uses: ./wlan-testing/.github/actions/allure-report-to-s3
with:
test_type: sanity

View File

@@ -31,10 +31,10 @@ env:
{
"namespace": "dev01",
"deploy_method": "git",
"chart_version": "v2.4.0-RC2",
"owgw_version": "v2.4.0-RC2",
"owsec_version": "v2.4.0-RC2",
"owfms_version": "v2.4.0-RC2",
"chart_version": "v2.4.0-RC6",
"owgw_version": "v2.4.0-RC5",
"owsec_version": "v2.4.0-RC4",
"owfms_version": "v2.4.0-RC4",
"owprov_version": "main",
"owgwui_version": "v2.4.0-RC2",
"owprovui_version": "main"

View File

@@ -31,10 +31,10 @@ env:
{
"namespace": "qa01",
"deploy_method": "git",
"chart_version": "v2.4.0-RC2",
"owgw_version": "v2.4.0-RC2",
"owsec_version": "v2.4.0-RC2",
"owfms_version": "v2.4.0-RC2",
"chart_version": "v2.4.0-RC6",
"owgw_version": "v2.4.0-RC5",
"owsec_version": "v2.4.0-RC4",
"owfms_version": "v2.4.0-RC4",
"owprov_version": "main",
"owgwui_version": "v2.4.0-RC2",
"owprovui_version": "main"

View File

@@ -1,7 +1,6 @@
import json
import os
from cloudshell.api.cloudshell_api import UpdateTopologyGlobalInputsRequest, UpdateTopologyRequirementsInputsRequest
from cloudshell.api.cloudshell_api import UpdateTopologyGlobalInputsRequest
import argparse
@@ -16,8 +15,8 @@ def main():
parser.add_argument('--openwifi-sec-version', default='main')
parser.add_argument('--openwifi-fms-version', default='main')
parser.add_argument('--openwifi-ui-version', default='main')
parser.add_argument('--ap-model', default='EC420')
parser.add_argument('--wifi-type', default='Wifi5')
parser.add_argument('--ap-model', default='[Any]')
parser.add_argument('--wifi-type', default='[Any]')
args = parser.parse_args()
session = get_session()

1
helm/ucentral/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
wlan-cloud-ucentral-deploy

View File

@@ -9,13 +9,6 @@ usage () {
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 "- OWGW_VERSION - OpenWIFI Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWGWUI_VERSION - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWSEC_VERSION - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWFMS_VERSION - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWPROV_VERSION - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWPROVUI_VERSION - OpenWIFI Provisioning Web UI 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;
@@ -28,20 +21,44 @@ usage () {
echo "- OWSEC_NEW_PASSWORD - password that should be set to default user instead of default password from properties";
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";
echo;
echo "Following environmnet variables may be passed, but will be ignored if CHART_VERSION is set to release (i.e. v2.4.0):"
echo;
echo "- OWGW_VERSION - OpenWIFI Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWGWUI_VERSION - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWSEC_VERSION - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWFMS_VERSION - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWPROV_VERSION - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
echo "- OWPROVUI_VERSION - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required)";
}
# Helper functions
check_if_chart_version_is_release() {
PARSED_CHART_VERSION=$(echo $CHART_VERSION | grep -xP "v\d+\.\d+\.\d+.*")
if [[ -z "$PARSED_CHART_VERSION" ]]; then
return 1
else
return 0
fi
}
# Check if required environment variables were passed
## Environment specifics
[ -z ${NAMESPACE+x} ] && echo "NAMESPACE is unset" && usage && exit 1
[ -z ${OWGW_VERSION+x} ] && echo "OWGW_VERSION is unset" && usage && exit 1
[ -z ${OWGWUI_VERSION+x} ] && echo "OWGWUI_VERSION is unset" && usage && exit 1
[ -z ${OWSEC_VERSION+x} ] && echo "OWSEC_VERSION is unset" && usage && exit 1
[ -z ${OWFMS_VERSION+x} ] && echo "OWFMS_VERSION is unset" && usage && exit 1
[ -z ${OWPROV_VERSION+x} ] && echo "OWPROV_VERSION is unset" && usage && exit 1
[ -z ${OWPROVUI_VERSION+x} ] && echo "OWPROVUI_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
if check_if_chart_version_is_release; then
echo "Chart version ($CHART_VERSION) is release version, ignoring services versions"
else
echo "Chart version ($CHART_VERSION) is not release version, checking if services versions are set"
[ -z ${OWGW_VERSION+x} ] && echo "OWGW_VERSION is unset" && usage && exit 1
[ -z ${OWGWUI_VERSION+x} ] && echo "OWGWUI_VERSION is unset" && usage && exit 1
[ -z ${OWSEC_VERSION+x} ] && echo "OWSEC_VERSION is unset" && usage && exit 1
[ -z ${OWFMS_VERSION+x} ] && echo "OWFMS_VERSION is unset" && usage && exit 1
[ -z ${OWPROV_VERSION+x} ] && echo "OWPROV_VERSION is unset" && usage && exit 1
[ -z ${OWPROVUI_VERSION+x} ] && echo "OWPROVUI_VERSION is unset" && usage && exit 1
fi
## Environment specifics
[ -z ${NAMESPACE+x} ] && echo "NAMESPACE 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
@@ -70,12 +87,14 @@ if [[ "$DEPLOY_METHOD" == "git" ]]; then
cd wlan-cloud-ucentral-deploy
git checkout $CHART_VERSION
cd chart
if ! check_if_chart_version_is_release; then
sed -i '/wlan-cloud-ucentralgw@/s/ref=.*/ref='${OWGW_VERSION}'\"/g' Chart.yaml
sed -i '/wlan-cloud-ucentralgw-ui@/s/ref=.*/ref='${OWGWUI_VERSION}'\"/g' Chart.yaml
sed -i '/wlan-cloud-ucentralsec@/s/ref=.*/ref='${OWSEC_VERSION}'\"/g' Chart.yaml
sed -i '/wlan-cloud-ucentralfms@/s/ref=.*/ref='${OWFMS_VERSION}'\"/g' Chart.yaml
sed -i '/wlan-cloud-owprov@/s/ref=.*/ref='${OWPROV_VERSION}'\"/g' Chart.yaml
sed -i '/wlan-cloud-owprov-ui@/s/ref=.*/ref='${OWPROVUI_VERSION}'\"/g' Chart.yaml
fi
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm dependency update
@@ -143,10 +162,4 @@ helm upgrade --install --create-namespace --wait --timeout 60m \
--set-file owfms.certs."restapi-key\.pem"=$KEY_LOCATION \
--set-file owprov.certs."restapi-cert\.pem"=$CERT_LOCATION \
--set-file owprov.certs."restapi-key\.pem"=$KEY_LOCATION \
--set owgw.images.owgw.tag=$OWGW_VERSION_TAG \
--set owgwui.images.owgwui.tag=$OWGWUI_VERSION_TAG \
--set owsec.images.owsec.tag=$OWSEC_VERSION_TAG \
--set owfms.images.owfms.tag=$OWFMS_VERSION_TAG \
--set owprov.images.owprov.tag=$OWPROV_VERSION_TAG \
--set owprovui.images.owprov.tag=$OWPROVUI_VERSION_TAG \
tip-openwifi $DEPLOY_SOURCE

View File

@@ -1,4 +1,11 @@
owgw:
# https://telecominfraproject.atlassian.net/browse/WIFI-5840
checks:
owgw:
readiness:
exec:
command: ["true"]
services:
owgw:
type: LoadBalancer
@@ -66,6 +73,13 @@ owgw:
-----END CERTIFICATE-----
owsec:
# https://telecominfraproject.atlassian.net/browse/WIFI-5840
checks:
owsec:
readiness:
exec:
command: ["true"]
services:
owsec:
type: LoadBalancer
@@ -176,6 +190,13 @@ owgwui:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
owfms:
# https://telecominfraproject.atlassian.net/browse/WIFI-5840
checks:
owfms:
readiness:
exec:
command: ["true"]
services:
owfms:
type: LoadBalancer
@@ -225,6 +246,12 @@ owfms:
-----END CERTIFICATE-----
owprov:
checks:
owprov:
readiness:
exec:
command: ["true"]
services:
owprov:
type: LoadBalancer

View File

@@ -582,6 +582,24 @@ class APNOS:
pass
return vlan_list
def get_ap_uci_show_ucentral(self):
try:
client = self.ssh_cli_connect()
cmd = "uci show ucentral"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read()
status = output.decode('utf-8').splitlines()
for i in status:
if i.startswith("ucentral.config.server="):
status = i.split("=")[1]
client.close()
except Exception as e:
print(e)
status = "Error"
return status
if __name__ == '__main__':
obj = {

View File

@@ -13,6 +13,7 @@ import allure
import requests
from operator import itemgetter
from pathlib import Path
from configuration import open_flow
from requests.adapters import HTTPAdapter
import logging
@@ -385,6 +386,18 @@ class UProfileUtility:
}
self.mode = None
def set_express_wifi(self):
if self.mode == "NAT":
self.base_profile_config["interfaces"][0]["services"] = ["lldp", "ssh"]
self.base_profile_config["interfaces"][1]["services"] = ["ssh", "lldp", "open-flow"]
self.base_profile_config["interfaces"][1]["ipv4"]["subnet"] = "192.168.97.1/24"
self.base_profile_config["interfaces"][1]["ipv4"]["dhcp"]["lease-count"] = 100
self.base_profile_config['services']["open-flow"] = open_flow
self.base_profile_config['services']['lldp']['describe'] = "OpenWiFi - expressWiFi"
self.base_profile_config['services']['lldp']['location'] = "Hotspot"
def encryption_lookup(self, encryption="psk"):
encryption_mapping = {
"none": "open",

View File

@@ -22,12 +22,13 @@ for folder in 'py-json', 'py-scripts':
sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity")
sys.path.append(f'../libs')
sys.path.append(f'../tools')
sys.path.append(f'../libs/lanforge/')
from sta_connect2 import StaConnect2
import time
import string
import random
from scp_util import SCP_File
S = 12
# from eap_connect import EAPConnect
from test_ipv4_ttls import TTLSTest
@@ -50,6 +51,7 @@ class RunTest:
def __init__(self, lanforge_data=None, local_report_path="../reports/", influx_params=None, debug=False):
self.lanforge_ip = lanforge_data["ip"]
self.lanforge_port = lanforge_data["port"]
self.lanforge_ssh_port = lanforge_data["ssh_port"]
self.twog_radios = lanforge_data["2.4G-Radio"]
self.fiveg_radios = lanforge_data["5G-Radio"]
self.ax_radios = lanforge_data["AX-Radio"]
@@ -129,6 +131,13 @@ class RunTest:
print("test result: " + result)
pytest.exit("Test Failed: Debug True")
self.staConnect.cleanup()
supplicqant = "/home/lanforge/wifi/wpa_supplicant_log_" + self.staConnect.radio.split(".")[2] + ".txt"
obj = SCP_File(ip=self.lanforge_ip, port=self.lanforge_ssh_port, username="root", password="lanforge",
remote_path=supplicqant,
local_path=".")
obj.pull_file()
allure.attach.file(source="wpa_supplicant_log_" + self.staConnect.radio.split(".")[2] + ".txt",
name="supplicant_log")
for result in run_results:
print("test result: " + result)
result = True
@@ -215,6 +224,13 @@ class RunTest:
# print(e)
self.eap_connect.stop()
supplicqant = "/home/lanforge/wifi/wpa_supplicant_log_" + self.eap_connect.radio.split(".")[2] + ".txt"
obj = SCP_File(ip=self.lanforge_ip, port=self.lanforge_ssh_port, username="root", password="lanforge",
remote_path=supplicqant,
local_path=".")
obj.pull_file()
allure.attach.file(source="wpa_supplicant_log_" + self.eap_connect.radio.split(".")[2] + ".txt",
name="supplicant_log")
if not self.eap_connect.passes():
if self.debug:
print("test result: " + self.eap_connect.passes())

View File

@@ -310,7 +310,7 @@ class ChamberView:
if df.empty == True:
return "empty"
else:
result = df.to_string(index=False)
result = df[column_name].values.tolist()
return result
def read_csv_individual_station_throughput(self, dir_name, option):

55
libs/lanforge/scp_util.py Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
import argparse
import paramiko
from scp import SCPClient
class SCP_File:
def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/",
local_path="."):
self.ip = ip
self.port = port
self.remote_path = remote_path
self.local_path = local_path
self.username = username
self.password = password
def pull_file(self):
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=self.ip, username=self.username, password=self.password, port=self.port, allow_agent=False,
look_for_keys=False)
# ssh.close()
with SCPClient(ssh.get_transport()) as scp:
scp.get(remote_path=self.remote_path, local_path=self.local_path, recursive=True)
scp.close()
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="lanforge")
parser.add_argument('--password', type=str, help='--password to use on LANforge', default="lanforge")
parser.add_argument('--remote_path', type=str, help='--password to the given username',
default="/home/lanforge/lf_kinstall.pl")
parser.add_argument('--local_path', type=str, help='--action to perform'
'reboot | run_cmd', default=".")
args = parser.parse_args()
lf_tools = SCP_File(ip=args.host, port=args.port,
username=args.username, password=args.password,
remote_path=args.remote_path, local_path=args.local_path)
lf_tools.pull_file()
if __name__ == '__main__':
main()

View File

@@ -51,6 +51,7 @@ def closeApp(appName, setup_perfectoMobile):
setup_perfectoMobile[1].step_start("Closing App: " + appName)
params = {'identifier': appName}
setup_perfectoMobile[0].execute_script('mobile:application:close', params)
print("Closed App")
def scrollDown(setup_perfectoMobile):
print("Scroll Down")
@@ -59,9 +60,9 @@ def scrollDown(setup_perfectoMobile):
params2["start"] = "50%,90%"
params2["end"] = "50%,20%"
params2["duration"] = "4"
time.sleep(5)
time.sleep(2)
setup_perfectoMobile[0].execute_script('mobile:touch:swipe', params2)
time.sleep(5)
time.sleep(1)
def getDeviceID(setup_perfectoMobile):
@@ -114,6 +115,8 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo
except NoSuchElementException:
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
try:
print("Get Connected Wifi Name if any")
report.step_start("Get Connected Wifi Name if any")
@@ -143,6 +146,7 @@ def set_APconnMobileDevice_android(request, WifiName, WifiPass, setup_perfectoMo
report.step_start("Clicking Wi-Fi")
wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']")
wifiElement.click()
Wifi_AP_Name=""
if Wifi_AP_Name.__eq__(WifiName):
print("Wifi Name Matches - Already Connected To: " + Wifi_AP_Name)
@@ -581,7 +585,7 @@ def verifyUploadDownloadSpeed_android(request, setup_perfectoMobile, get_APToMob
driver.switch_to.context('WEBVIEW_1')
try:
print("Launching Safari")
print("Launching Chrome")
report.step_start("Google Home Page")
driver.get(connData["webURL"])
print("Enter Search Text")
@@ -1060,7 +1064,7 @@ def check_if_no_internet_popup(driver):#To check and kill if any popups related
print("**alert** popup **alert**")
try:
driver.implicitly_wait(3)
driver.implicitly_wait(2)
time.sleep(2)
kill_popup = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/keep_btn']")
kill_popup.click()
@@ -1572,7 +1576,7 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData):
print("Connect Button Not Enabled...Verify if Password is set properly ")
check_if_no_internet_popup(driver)
# -------------------------------------------------------
# //*[@resource-id='com.android.settings:id/summary' and @text="Sign in to the network."]/parent::*/android.widget.TextView[@text='XWF-OWF_DSx']
#Verify if WiFi is connected
# -------------------------------------------------------
try:
@@ -1604,6 +1608,11 @@ def wifi_connect(request, WifiName, WifiPass, setup_perfectoMobile, connData):
ssid_with_internet = True
print("Wifi Successfully Connected")
#allure.attach(name=body=str("Wifi Successfully Connected"))
except:
try:
report.step_start("Unknown WIFI status found")
ssid_with_internet = False
print("Unknown WIFI status found")
except NoSuchElementException:
print("Wifi Connection Error: " + WifiName)
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
@@ -1776,8 +1785,8 @@ def wifi_disconnect_and_forget(request, WifiName, WifiPass, setup_perfectoMobile
def get_all_available_ssids(driver):
active_ssid_list = []
try:
time.sleep(8)
driver.implicitly_wait(10)
time.sleep(5)
driver.implicitly_wait(5)
elements = driver.find_elements_by_xpath("//*[@resource-id='com.android.settings:id/title']")
# print("elements: ", elements)
print(len(elements))
@@ -2678,18 +2687,703 @@ def wifi_connect_eap(request, WifiName, User, ttls_passwd, setup_perfectoMobile,
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
#--------------------CAPTIVE PORTAL Android-----------------------------------------
def captive_portal_and(request, WifiName, WifiPass, setup_perfectoMobile, connData):
print("\n-------------------------------------")
print("Select Wifi/AccessPoint Connection")
print("-------------------------------------")
print("Verifying Wifi Connection Details....")
#allure.attach(name= body=str("\n-------------------------------------"))
report = setup_perfectoMobile[1]
driver = setup_perfectoMobile[0]
ssid_with_internet = False
report.step_start("Switching Driver Context")
print("Switching Context to Native")
contexts = driver.contexts
driver.switch_to.context(contexts[0])
# Open Settings Application
openApp(connData["appPackage-android"], setup_perfectoMobile)
deviceModelName = getDeviceModelName(setup_perfectoMobile)
print("Selected Device Model: " + deviceModelName)
#allure.attach(name= body=str("\Selected Device Model: " + deviceModelName))
if deviceModelName != ("Pixel 4"):
report.step_start("Set Wifi Network to " + WifiName)
# -----------------To Open Connections page-----------------------
try:
print("Verifying Connected Wifi Connection")
report.step_start("Click Connections")
connElement = driver.find_element_by_xpath("//*[@text='Connections']")
connElement.click()
# ---------------------Open WIFI page-------------------------------
try:
report.step_start("Clicking Wi-Fi")
print("Clicking WIFI")
wifiElement = driver.find_element_by_xpath("//*[@text='Wi-Fi']")
wifiElement.click()
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
driver.implicitly_wait(1)
get_switch_text_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_text']")
get_switch_text = get_switch_text_element.text
print("get_switch_text: ",get_switch_text)
print("Find wifi switch")
try: #To Turn on Wi-Fi Switch
if get_switch_text == "Off":
# driver.implicitly_wait(3)
get_switch_element = driver.find_element_by_xpath("//*[@resource-id='com.android.settings:id/switch_widget']")
driver.implicitly_wait(1)
get_switch_element.click()
driver.implicitly_wait(1)
i = 0
for i in range(5):
if get_switch_text == "On":
print("WIFI Switch is ON")
break
else:
try:
get_switch_text_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/switch_text']")
get_switch_text = get_switch_text_element.text
except:
pass
print("Sleeping for: ", i)
time.sleep(i)
pass
if get_switch_text == "Off":
print("Switch is Still OFF")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
else:
print("Switch is already On")
check_if_no_internet_popup(driver)
except:
print("Couldn't turn on WIFI switch")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
#---------------------This is to Forget current connected SSID-------------------------------
try: #To deal with already connected SSID
check_if_no_internet_popup(driver)
network_category = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/connected_network_category']")
try: #To forget exhisting ssid
print("To forget ssid")
check_if_no_internet_popup(driver)
additional_details_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/layout_details']")
additional_details_element.click()
try:
check_if_no_internet_popup(driver)
forget_ssid = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/forget_button']//*[@resource-id='com.android.settings:id/icon']")
forget_ssid.click()
print("Forget old ssid")
except:
print("Couldn't forget ssid")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
except:
print("Couldn't get into additional details")
except:
print("No Connected SSIDS")
#----------------------This is to Forget current connected SSID--------------------------------
print("Searching for Wifi: " + WifiName)
#allure.attach(name= body=str("Searching for Wifi: " + WifiName))
time.sleep(2)
print("Selecting Wifi: " + WifiName)
ssid_found = False
available_ssids = False
# This is To get all available ssids
# ------------------------------------------------------
try:
for check_for_all_ssids in range(2):
available_ssids = get_all_available_ssids(driver)
try:
if WifiName not in available_ssids:
scrollDown(setup_perfectoMobile)
time.sleep(2)
else:
ssid_found = True
print(WifiName + " : Found in Device")
#allure.attach(name= body=str(WifiName + " : Found in Device"))
break
except:
print("1538")
pass
if not ssid_found:
print("could not found" + WifiName + " in device")
#allure.attach(name= body=str("could not found" + WifiName + " in device"))
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
except:
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# -------------------------------------------------------
#Selecting WIFI
# -------------------------------------------------------
try:
report.step_start("Selecting Wifi: " + WifiName)
print("Click wifi")
wifi_selection_element = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']")))
wifi_selection_element.click()
check_if_no_internet_popup(driver)
#allure.attach(name= body=str("Selecting Wifi: " + WifiName))
except Exception as e:
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
#allure.attach(name= body=str("Exception on Selecting Wifi Network. Please check wifi Name or signal"))
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# -------------------------------------------------------
#Set password if Needed
# -------------------------------------------------------
try:
time.sleep(2)
check_if_no_internet_popup(driver)
report.step_start("Set Wifi Password")
print("Enter Wifi password")
wifi_password_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/edittext']")
wifi_password_element.send_keys(WifiPass)
except NoSuchElementException:
print("Password Page Not Loaded, password May be cached in the System")
check_if_no_internet_popup(driver)
# -------------------------------------------------------
#Click on connect button
# -------------------------------------------------------
try:
time.sleep(2)
report.step_start("Click Connect Button")
print("Click Connect Button")
join_btn_element = driver.find_element_by_xpath("//*[@text='Connect']")
join_btn_element.click()
except NoSuchElementException:
print("Connect Button Not Enabled...Verify if Password is set properly ")
check_if_no_internet_popup(driver)
#---------------------Clicking on ssid for captive portal login--------
try:
time.sleep(2)
report.step_start("Selecting Wifi: " + WifiName)
wifi_selection_element = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']")))
wifi_selection_element.click()
except NoSuchElementException:
print("Not connected to Captive portal Ssid.. ")
try:
time.sleep(2)
report.step_start("Click Accept Terms Button")
print("Click Accept Terms Button")
join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't press Accept terms button")
try:
time.sleep(2)
report.step_start("Click Continue Button")
print("Click Continue Button")
join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't press Continue button")
try:
time.sleep(2)
report.step_start("Click Last Terms if needed")
print("Click Last Terms if needed")
join_btn_element = driver.find_element_by_xpath("//*[@text='Done']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't find the last terms page")
#Verify if WiFi is connected
# -------------------------------------------------------
try:
report.step_start("Verify if Wifi is Connected")
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
ssid_with_internet = True
print("Wifi Successfully Connected")
#allure.attach(name= body=str("Wifi Successfully Connected"))
# time.sleep(5)
check_if_no_internet_popup(driver)
except:
try:
check_if_no_internet_popup(driver)
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='"
+ WifiName + "']")))
print("Wifi Successfully Connected without internet")
#allure.attach(name= body=str("Wifi Successfully Connected without internet"))
check_if_no_internet_popup(driver)
except:
try:
report.step_start("Verify if Wifi is Connected")
WifiInternetErrMsg = WebDriverWait(driver, 60).until(EC.presence_of_element_located((
MobileBy.XPATH,
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
ssid_with_internet = True
print("Wifi Successfully Connected")
#allure.attach(name=body=str("Wifi Successfully Connected"))
except NoSuchElementException:
print("Wifi Connection Error: " + WifiName)
#allure.attach(name=body=str("Wifi Connection Error: " + WifiName))
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# -------------------------------------------------------
# Get into Additional Details
# To Get an IP Address
# To Forget connection
# To turn off auto. connect
# -------------------------------------------------------
try:
print("Into additional details")
time.sleep(2)
additional_details_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/layout_details']")
additional_details_element.click()
try:
time.sleep(2)
ip_address_element = driver.find_element_by_xpath(
"//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='com.android.settings:id/summary']")
ip_address_element_text = ip_address_element.text
print("Device IP address is :", ip_address_element_text)
except:
try:
time.sleep(2)
ip_address_element = driver.find_element_by_xpath(
"//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']")
ip_address_element_text = ip_address_element.text
print("Device IP address is :", ip_address_element_text)
except:
print("IP address element not found")
# allure.attach(name= body=str("IP address element not found"))
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
# return ip_address_element_text, ssid_with_internet
try:
check_if_no_internet_popup(driver)
driver.implicitly_wait(3)
time.sleep(2)
auto_reconnect_off = driver.find("//*[@resource-id='android:id/switch_widget']")
auto_reconnect_off_text = auto_reconnect_off.text
if auto_reconnect_off_text != "Off":
auto_reconnect_off.click()
print("Auto reconnect turning off")
else:
print("Auto reconnect is already off")
except:
print("Couldn't find auto reconnect element")
except:
print("Couldn't get into Additional settings")
except NoSuchElementException:
print("No Switch element found")
#allure.attach(name= body=str("No Switch element found"))
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
except NoSuchElementException:
print("Couldn't find wifi Button")
#allure.attach(name= body=str("Couldn't find wifi Button"))
# ------------------Open WIFI page----------------------------------
except NoSuchElementException:
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
#allure.attach(name= body=str("Exception: Verify Xpath - Update/check Xpath for Click Connections"))
# -----------------To Open Connections page---------------------------
# --------------------Pixel 4 code---------------------------
else:
report.step_start("Set Wifi Network to " + WifiName)
# -----------------To Open Connections page-----------------------
try:
print("Verifying Connected Wifi Connection")
report.step_start("Click Network & internet in pixel4")
connElement = driver.find_element_by_xpath("//*[@text='Network & internet']")
connElement.click()
# ---------------------Open WIFI page-------------------------------
try:
report.step_start("Clicking Wi-Fi")
print("Clicking WIFI")
time.sleep(3)
wifiElement = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='WiFi']")))
wifiElement.click()
# --------------------To Turn on WIFi Switch if already OFF--------------------------------
try:
driver.implicitly_wait(1)
report.step_start("Turn on WIFi Switch if already OFF")
get_switch_text_element = driver.find_element_by_xpath(
"//*[@resource-id='android:id/icon']")
get_switch_text = get_switch_text_element.click()
if get_switch_text is not None:
switch_text = "Off"
else:
switch_text = "On"
print("get_switch_text: ", switch_text)
print("Find wifi switch")
try: # To Turn on Wi-Fi Switch
if switch_text == "Off":
# driver.implicitly_wait(3)
get_switch_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/switch_widget']")
driver.implicitly_wait(1)
get_switch_element.click()
driver.implicitly_wait(1)
i = 0
for i in range(5):
if switch_text == "On":
print("WIFI Switch is ON")
break
else:
try:
get_switch_text_element = driver.find_element_by_xpath(
"//*[@text='Add network']")
get_switch_text = get_switch_text_element.text
if get_switch_text == "Add network":
switch_text = "On"
else:
switch_text = "Off"
except NoSuchElementException:
print("Exception: Verify Xpath")
# Scroll Down
scrollDown(setup_perfectoMobile)
print("Sleeping for: ", i)
time.sleep(i)
pass
if switch_text == "Off":
print("Switch is Still OFF")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
else:
print("Switch is already On")
check_if_no_internet_popup(driver)
except:
print("Couldn't turn on WIFI switch")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# ---------------------This is to Forget current connected SSID-------------------------------
try: # To deal with already connected SSID
check_if_no_internet_popup(driver)
network_category = driver.find_element_by_xpath("//*[@text='Connected']")
try: # To forget existing ssid
print("To forget ssid")
report.step_start("To forget ssid")
check_if_no_internet_popup(driver)
additional_details_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/settings_button_no_background']")
additional_details_element.click()
except:
print("Couldn't get into additional details")
try:
check_if_no_internet_popup(driver)
forget_ssid = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/button1']")
forget_ssid.click()
print("Forget old ssid")
except:
print("Couldn't forget ssid")
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
except:
print("No Connected SSIDS")
# ----------------------This is to Forget current connected SSID--------------------------------
# time.sleep(2)
# print("Selecting Wifi: " + WifiName)
# ssid_found = False
# available_ssids = False
# This is To get all available ssids
# ------------------------------------------------------
# try:
# for check_for_all_ssids in range(2):
# available_ssids = WifiName
# try:
# if WifiName not in available_ssids:
# scrollDown(setup_perfectoMobile)
# time.sleep(2)
# else:
# ssid_found = True
# print(WifiName + " : Found in Device")
# # allure.attach(name= body=str(WifiName + " : Found in Device"))
# break
# except:
# print("1538")
# pass
# if not ssid_found:
# print("could not found" + WifiName + " in device")
# # allure.attach(name= body=str("could not found" + WifiName + " in device"))
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
# return ssid_with_internet
# except:
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
# return ssid_with_internet
# # -------------------------------------------------------
# Selecting WIFI
# -------------------------------------------------------
try:
report.step_start("Selecting Wifi: " + WifiName)
print("Click wifi")
wifi_selection_element = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']")))
wifi_selection_element.click()
check_if_no_internet_popup(driver)
# allure.attach(name= body=str("Selecting Wifi: " + WifiName))
except Exception as e:
print("Exception on Selecting Wifi Network")
# allure.attach(name= body=str("Exception on Selecting Wifi Network. Please check wifi Name or signal"))
request.config.cache.set(key="SelectingWifiFailed", value=str(e))
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# -------------------------------------------------------
# Set password if Needed
# -------------------------------------------------------
try:
check_if_no_internet_popup(driver)
report.step_start("Set Wifi Password")
print("Entering password")
wifiPasswordElement = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/password']")
wifiPasswordElement.send_keys(WifiPass)
except NoSuchElementException:
print("Password Page Not Loaded, password May be cached in the System")
check_if_no_internet_popup(driver)
# -------------------------------------------------------
# Click on connect button
# -------------------------------------------------------
try:
report.step_start("Click Connect Button")
joinBTNElement = driver.find_element_by_xpath("//*[@text='Connect']")
joinBTNElement.click()
except NoSuchElementException:
print("Connect Button Not Enabled...Verify if Password is set properly ")
check_if_no_internet_popup(driver)
# -------------------------------------------------------
try:
report.step_start("Selecting Wifi: " + WifiName)
wifiSelectionElement = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH, "//*[@text='" + WifiName + "']")))
wifiSelectionElement.click()
check_if_no_internet_popup(driver)
except Exception as e:
print("Exception on Selecting Wifi Network. Please check wifi Name or signal")
try:
time.sleep(2)
report.step_start("Click Accept Terms Button")
print("Click Accept Terms Button")
join_btn_element = driver.find_element_by_xpath("//*[@text='Accept Terms of Service']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't press Accept terms button")
try:
time.sleep(2)
report.step_start("Click Continue Button")
print("Click Continue Button")
join_btn_element = driver.find_element_by_xpath("//*[@text='Continue']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't press Continue button")
try:
time.sleep(2)
report.step_start("Click Last Terms if needed")
print("Click Last Terms if needed")
join_btn_element = driver.find_element_by_xpath("//*[@text='Done']")
join_btn_element.click()
except NoSuchElementException:
print(" Couldn't find the last terms page")
# Verify if WiFi is connected
# -------------------------------------------------------
try:
report.step_start("Verify if Wifi is Connected")
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@resource-id='android:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
ssid_with_internet = True
print("Wifi Successfully Connected")
# time.sleep(5)
check_if_no_internet_popup(driver)
except:
try:
check_if_no_internet_popup(driver)
WifiInternetErrMsg = WebDriverWait(driver, 35).until(
EC.presence_of_element_located((MobileBy.XPATH,
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected without internet']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
print("Wifi Successfully Connected without internet")
check_if_no_internet_popup(driver)
except:
try:
report.step_start("Verify if Wifi is Connected")
WifiInternetErrMsg = WebDriverWait(driver, 60).until(
EC.presence_of_element_located((
MobileBy.XPATH,
"//*[@resource-id='com.android.settings:id/summary' and @text='Connected']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
ssid_with_internet = True
print("Wifi Successfully Connected")
except NoSuchElementException:
print("Wifi Connection Error: " + WifiName)
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ssid_with_internet
# -------------------------------------------------------
# Get into Additional Details
# To Get an IP Address
# To Forget connection
# To turn off auto. connect
# -------------------------------------------------------
try:
print("Into additional details")
time.sleep(5)
report.step_start("Going for ip address")
additional_details_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/settings_button_no_background']")
additional_details_element.click()
print("Entered ssid")
try:
time.sleep(10)
print("clicking Advanced")
report.step_start("clicking Advanced")
advanced_element = driver.find_element_by_xpath("//*[@text='Advanced']")
advanced_element.click()
print("clicked Advanced")
# print("Device IP address is :", ip_address_element_text)
except:
try:
time.sleep(5)
print("clicking Advanced2")
advanced_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.FrameLayout[2]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]")
advanced_element.click()
# print("Device IP address is :", ip_address_element_text)
except:
try:
time.sleep(5)
print("clicking Advanced2")
advanced_element = driver.find_element_by_xpath(
"//*[@resource-id='com.android.settings:id/recycler_view']/android.widget.LinearLayout[5]/android.widget.LinearLayout[1]/android.widget.ImageView[1]")
advanced_element.click()
except:
print("No advanced options")
# allure.attach(name= body=str("IP address element not found"))
# closeApp(connData["appPackage-android"], setup_perfectoMobile)
# return ip_address_element_text, ssid_with_internet
# Scroll Down
scrollDown(setup_perfectoMobile)
try:
time.sleep(2)
ip_address_element = driver.find_element_by_xpath(
"//*[@text='IP address']/parent::*/android.widget.TextView[@resource-id='android:id/summary']")
ip_address_element_text = ip_address_element.text
print("Device IP address is :", ip_address_element_text)
except:
print("IP address element not found")
except:
print("Couldn't get into Additional settings")
# -------------------------------------------------------
except:
print("No Switch element found")
# ---------------------To Turn on WIFi Switch if already OFF-------------------------------
except:
print("Couldn't find wifi Button")
# ------------------Open WIFI page----------------------------------
except:
print("Exception: Verify Xpath - Update/check Xpath for Click Connections")
# -----------------To Open Connections page---------------------------
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return ip_address_element_text, ssid_with_internet
def close_driver(driver):
driver.close()
driver.quit()
# def capture_start_har(setup_perfectoMobile):
# setup_perfectoMobile[1].step_start("Start HAR capture on Phone...")
# # params = {'generateHarFile', 'true'}
# params = {'generateHarFile' : 'true'}
# setup_perfectoMobile[0].execute_script('mobile:vnetwork:start', params)
#
# def capture_stop_har(setup_perfectoMobile):
# setup_perfectoMobile[1].step_start("Stop HAR capture on Phone...")
# params = {'generateHarFile' : 'true'}
# setup_perfectoMobile[0].execute_script('mobile:vnetwork:stop', params)
def expressWifi(request, WifiName, setup_perfectoMobile, connData):
print("\n-------------------------------------")
print("Express Wifi Verification")
print("-------------------------------------")
report = setup_perfectoMobile[1]
driver = setup_perfectoMobile[0]
try:
click_on_ssid = WebDriverWait(driver, 10).until(EC.presence_of_element_located((
MobileBy.XPATH,
"//*[@resource-id='com.android.settings:id/summary' and @text='Sign in to the network.']/parent::*/android.widget.TextView[@text='" + WifiName + "']")))
click_on_ssid.click()
print("click on expresswifi SSID to open login page")
except:
print("Could not found expresswifi SSID")
try:
print("Express Wifi Home Page Verification")
report.step_start("Express Wifi Home Page Verification")
driver.implicitly_wait(2)
ExpressWifiBytesLeft = driver.find_element_by_xpath("//*[@label='0KB left']")
except NoSuchElementException:
# driver.implicitly_wait(25)
#Add function to Toggle Wifi if Express Wifi Home Page not Triggerd
print("Express Wifi Page Not Logged In - ")
try:
print("ExpressWifi Click on Menu Circle")
report.step_start("ExpressWifi Click on Menu Circle")
ExpressWifiMenu = driver.find_element_by_xpath("//*[@resource-id='dogfood-menu']")
ExpressWifiMenu.click()
except NoSuchElementException:
print("---- Exception ExpressWifi Click on Menu Circle")
try:
print("ExpressWifi Click Run Tests!")
report.step_start("ExpressWifi Click Run Tests!")
ExpressWifiRunTests = driver.find_element_by_xpath("//*[@resource-id='run_tests']")
ExpressWifiRunTests.click()
time.sleep(20)
except NoSuchElementException:
print("Exception ExceptionExpressWifi Click Run Tests!")
try:
print("Verify Results: ")
report.step_start("Verify Results")
expressWifiOutputMsg = "//*[@resource-id='test_result']"
LogOut = driver.find_element_by_xpath(expressWifiOutputMsg)
print("----" + LogOut.text + "\n")
if 'test completed successfully' in LogOut.text:
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return True
else:
closeApp(connData["appPackage-android"], setup_perfectoMobile)
return False
except NoSuchElementException:
print("Exception Verify Results")
closeApp(connData["appPackage-android"], setup_perfectoMobile)

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
allure-pytest
Appium-Python-Client
Appium-Python-Client==1.2.0
bs4
influxdb
influxdb-client

View File

@@ -42,7 +42,6 @@ from LANforge.LFUtils import *
if 'py-json' not in sys.path:
sys.path.append('../py-scripts')
from apnos.apnos import APNOS
from controller.controller_1x.controller import Controller
from controller.controller_1x.controller import FirmwareUtility
import pytest
from lanforge.lf_tests import RunTest
@@ -50,11 +49,10 @@ from cv_test_manager import cv_test
from configuration import CONFIGURATION
from configuration import RADIUS_SERVER_DATA
from configuration import RADIUS_ACCOUNTING_DATA
from lanforge.scp_util import SCP_File
from testrails.testrail_api import APIClient
from testrails.reporting import Reporting
from lf_tools import ChamberView
from sta_connect2 import StaConnect2
from os import path
from typing import Any, Callable, Optional
@@ -266,6 +264,11 @@ def get_sdk_version(fixtures_ver):
version = fixtures_ver.get_sdk_version()
yield version
@pytest.fixture(scope="session")
def get_uci_show(fixtures_ver, get_apnos, get_configuration):
uci_show = fixtures_ver.get_uci_show(get_apnos, get_configuration)
yield uci_show
@pytest.fixture(scope="session")
def skip_lf(request):
@@ -524,6 +527,12 @@ def test_access_point(fixtures_ver, request, get_configuration, get_apnos):
yield status
@pytest.fixture(scope="session")
def test_ap_connection_status(fixtures_ver, request, get_configuration, get_apnos):
"""used to check the manager status of AP, should be used as a setup to verify if ap can reach cloud"""
connection, redirector_value = fixtures_ver.get_ap_status_logs(get_configuration, get_apnos)
yield connection, redirector_value
@pytest.fixture(scope="session")
def traffic_generator_connectivity(testbed, get_configuration):
"""Verify if traffic generator is reachable"""
@@ -679,3 +688,25 @@ def get_ap_logs(request, get_apnos, get_configuration):
pass
request.addfinalizer(collect_logs)
@pytest.fixture(scope="function")
def get_lf_logs(request, get_apnos, get_configuration):
ip = get_configuration["traffic_generator"]["details"]["ip"]
port = get_configuration["traffic_generator"]["details"]["ssh_port"]
def collect_logs_lf():
log_0 = "/home/lanforge/lanforge_log_0.txt"
log_1 = "/home/lanforge/lanforge_log_1.txt"
obj = SCP_File(ip=ip, port=port, username="root", password="lanforge", remote_path=log_0,
local_path=".")
obj.pull_file()
allure.attach.file(source="lanforge_log_0.txt",
name="lanforge_log_0")
obj = SCP_File(ip=ip, port=port, username="root", password="lanforge", remote_path=log_1,
local_path=".")
obj.pull_file()
allure.attach.file(source="lanforge_log_1.txt",
name="lanforge_log_1")
request.addfinalizer(collect_logs_lf)

View File

@@ -0,0 +1,125 @@
"""
Performance Test: Receiver Sensitivity Test: bridge Mode
pytest -m "rxsensitivity and bridge"
"""
import os
import pytest
import allure
pytestmark = [pytest.mark.advance, pytest.mark.rxsensitivity, pytest.mark.bridge]
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
}
@allure.feature("BRIDGE MODE RECEIVER SENSITIVITY TEST")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestRxSensitivityBridge(object):
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2445", name="WIFI-2445")
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@pytest.mark.all_mcs
def test_client_wpa2_personal_bridge_all_mcs_5g(self, lf_test, lf_tools, station_names_fiveg, create_lanforge_chamberview_dut,
get_configuration):
"""
Receiver Sensitivity Bridge Mode
"""
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssid_name = profile_data["ssid_name"]
security_key = profile_data["security_key"]
security = "wpa2"
mode = "BRIDGE"
band = "fiveg"
vlan = 1
dut_name = create_lanforge_chamberview_dut
ser_no = lf_test.attenuator_serial()
print(ser_no)
raw_lines = [['txo_preamble: VHT'],
['txo_mcs: 0 CCK, OFDM, HT, VHT;1 CCK, OFDM, HT, VHT;2 CCK, OFDM, HT, VHT;3 CCK, OFDM, HT, VHT;'
'4 OFDM, HT, VHT;5 OFDM, HT, VHT;6 OFDM, HT, VHT;7 OFDM, HT, VHT;8 VHT;9 VHT'],
['spatial_streams: 2'], ['bandw_options: 80'], ['txo_sgi: OFF'],
['txo_retries: No Retry'], ['attenuator: ' + str(ser_no[0])], ['attenuator2: ' + str(ser_no[1])],
['attenuations: 0..+50..800'], ['attenuations2: 0..+50..800'],
["show_3s: 1"], ['txo_txpower: 17'],
["show_ll_graphs: 1"], ["show_log: 1"]]
station = lf_test.Client_Connect(ssid=ssid_name, security=security,
passkey=security_key, mode=mode, band=band,
station_name=station_names_fiveg, vlan_id=vlan)
if station:
obj = lf_test.rx_sensitivity(station_name=station_names_fiveg, mode=mode,
instance_name="RECEIVER_SENSITIVITY_BRIDGE_5G",
vlan_id=vlan, dut_name=dut_name, raw_lines=raw_lines)
report_name = obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/" + report_name + '/')
lf_tools.attach_report_graphs(report_name=report_name, pdf_name="Receiver sensitivity test")
print("Test Completed... Cleaning up Stations")
lf_test.Client_disconnect(station_name=station_names_fiveg)
assert station
else:
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2445", name="WIFI-2445")
@pytest.mark.wpa2_personal
@pytest.mark.twog
@pytest.mark.all_mcs
def test_client_wpa2_personal_bridge_all_mcs_2g(self, lf_test, lf_tools, station_names_twog,
create_lanforge_chamberview_dut,
get_configuration):
"""
Receiver Sensitivity Bridge Mode
"""
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssid_name = profile_data["ssid_name"]
security_key = profile_data["security_key"]
security = "wpa2"
mode = "BRIDGE"
band = "twog"
vlan = 1
dut_name = create_lanforge_chamberview_dut
ser_no = lf_test.attenuator_serial()
print(ser_no)
raw_lines = [['txo_preamble: VHT'],
['txo_mcs: 0 CCK, OFDM, HT, VHT;1 CCK, OFDM, HT, VHT;2 CCK, OFDM, HT, VHT;3 CCK, OFDM, HT, VHT;'
'4 OFDM, HT, VHT;5 OFDM, HT, VHT;6 OFDM, HT, VHT;7 OFDM, HT, VHT;8 VHT;9 VHT'],
['spatial_streams: 2'], ['bandw_options: 80'], ['txo_sgi: OFF'],
['txo_retries: No Retry'], ['attenuator: ' + str(ser_no[0])], ['attenuator2: ' + str(ser_no[1])],
['attenuations: 0..+50..800'], ['attenuations2: 0..+50..800'],
["show_3s: 1"], ['txo_txpower: 17'],
["show_ll_graphs: 1"], ["show_log: 1"]]
station = lf_test.Client_Connect(ssid=ssid_name, security=security,
passkey=security_key, mode=mode, band=band,
station_name=station_names_twog, vlan_id=vlan)
if station:
obj = lf_test.rx_sensitivity(station_name=station_names_twog, mode=mode,
instance_name="RECEIVER_SENSITIVITY_BRIDGE_2G",
vlan_id=vlan, dut_name=dut_name, raw_lines=raw_lines)
report_name = obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
entries = os.listdir("../reports/" + report_name + '/')
lf_tools.attach_report_graphs(report_name=report_name, pdf_name="Receiver sensitivity test")
print("Test Completed... Cleaning up Stations")
lf_test.Client_disconnect(station_name=station_names_twog)
assert station
else:
assert False

View File

@@ -72,17 +72,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
#print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(60):
if float(str(kpi_val[0])[1:-1]) > float(60):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -141,17 +138,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(90):
if float(str(kpi_val[0])[1:-1]) > float(90):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -210,17 +204,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(45):
if float(str(kpi_val[0])[1:-1]) > float(45):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -279,17 +270,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(90):
if float(str(kpi_val[0])[1:-1]) > float(90):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -348,17 +336,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(250):
if float(str(kpi_val[0])[1:-1]) > float(250):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -417,17 +402,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(500):
if float(str(kpi_val[0])[1:-1]) > float(500):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -486,17 +468,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(250):
if float(str(kpi_val[0])[1:-1]) > float(250):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -555,17 +534,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(500):
if float(str(kpi_val[0])[1:-1]) > float(500):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -624,17 +600,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(45):
if float(str(kpi_val[0])[1:-1]) > float(45):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -693,17 +666,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(90):
if float(str(kpi_val[0])[1:-1]) > float(90):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -762,17 +732,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(45):
if float(str(kpi_val[0])[1:-1]) > float(45):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -831,17 +798,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(90):
if float(str(kpi_val[0])[1:-1]) > float(90):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -900,17 +864,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(250):
if float(str(kpi_val[0])[1:-1]) > float(250):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -969,17 +930,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(500):
if float(str(kpi_val[0])[1:-1]) > float(500):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -1038,17 +996,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(500):
if float(str(kpi_val[0])[1:-1]) > float(500):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -1107,17 +1062,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(45):
if float(str(kpi_val[0])[1:-1]) > float(45):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -1176,17 +1128,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(45):
if float(str(kpi_val[0])[1:-1]) > float(45):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -1245,17 +1194,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(250):
if float(str(kpi_val[0])[1:-1]) > float(250):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True
@@ -1314,17 +1260,14 @@ class Test_SpatialConsistency_Bridge(object):
kpi_val = lf_tools.read_kpi_file(column_name=["numeric-score"], dir_name=report_name)
print(type(kpi_val))
print(str(kpi_val))
val = kpi_val.split(" ")
print(val)
# print(type(val))
print(val[5])
print(kpi_val)
print(str(kpi_val[0])[1:-1])
if str(kpi_val) == "empty":
print("kpi is empty, station did not got ip, Test failed")
allure.attach(name="Kpi Data", body="station did not got ip Test failed.")
assert False
else:
if float(val[5]) > float(500):
if float(str(kpi_val[0])[1:-1]) > float(500):
print("Test passed successfully")
allure.attach(name="Kpi Data", body=str(kpi_val))
assert True

View File

@@ -71,6 +71,7 @@ def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtur
if vlan_list[i] > 4095 or vlan_list[i] < 1:
vlan_list.pop(i)
if request.param["mode"] == "VLAN":
lf_tools.reset_scenario()
lf_tools.add_vlan(vlan_ids=vlan_list)
# call this, if 1.x

View File

@@ -46,7 +46,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -73,7 +73,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, station_names_fiveg, get_ap_logs,
def test_wpa_enterprise_5g(self, station_names_fiveg, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 5g
@@ -98,7 +98,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -126,7 +126,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -154,7 +154,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -181,7 +181,7 @@ class TestBridgeModeEnterpriseTTLSSuiteA(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -239,7 +239,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -267,7 +267,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -295,7 +295,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
""" wpa enterprise 2g
@@ -322,7 +322,7 @@ class TestBridgeModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, exit_on_fail,
test_cases, radius_info):

View File

@@ -50,7 +50,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2809", name="JIRA LINK")
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, setup_profiles, lf_test, update_report,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs, setup_profiles, lf_test,
update_report,
station_names_twog,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -76,7 +77,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK")
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, station_names_fiveg,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, test_cases, station_names_fiveg, get_lf_logs,
update_report):
"""Client Connectivity open ssid 5G
pytest -m "client_connectivity and bridge and general and open and fiveg"
@@ -103,7 +104,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-2801", name="JIRA LINK")
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report,
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa and twog"
@@ -129,7 +130,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, test_cases, station_names_fiveg):
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, lf_test, update_report, get_lf_logs,
test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and bridge and general and wpa and fiveg"
"""
@@ -154,7 +156,8 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, lf_test, update_report, test_cases,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa2_personal and twog"
@@ -181,7 +184,7 @@ class TestBridgeModeConnectivitySuiteA(object):
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, update_report, test_cases,
station_names_fiveg,
station_names_fiveg, get_lf_logs,
lf_test):
"""Client Connectivity wpa2_personal ssid 5G
pytest -m "client_connectivity and bridge and general and wpa2_personal and fiveg"
@@ -270,7 +273,8 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test, test_cases,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg,
lf_test, test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa3_personal and fiveg"
@@ -296,7 +300,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -323,7 +327,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test,
test_cases,
test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa3_personal_mixed and fiveg"
@@ -349,7 +353,7 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.twog
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -376,7 +380,8 @@ class TestBridgeModeConnectivitySuiteTwo(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, lf_test, test_cases,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, station_names_fiveg, get_lf_logs,
lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and bridge and general and wpa_wpa2_personal_mixed and fiveg"

View File

@@ -34,7 +34,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
@@ -59,7 +59,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
@@ -85,7 +85,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
@@ -111,7 +111,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
@@ -136,7 +136,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
@@ -160,7 +160,7 @@ class TestNATModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
@@ -210,7 +210,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test, update_report,
test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0]
@@ -235,7 +235,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1]
@@ -260,7 +260,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0]
@@ -284,7 +284,7 @@ class TestNATModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report, exit_on_fail,
test_cases, radius_info):

View File

@@ -48,7 +48,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, get_vif_state, get_ap_logs,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
station_names_twog,
test_cases):
@@ -77,7 +77,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, get_vif_state, get_ap_logs,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, test_cases, station_names_fiveg,
update_report):
"""Client Connectivity open ssid 5G
@@ -104,7 +104,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report,
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs, update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and NAT and general and wpa and twog"
@@ -129,7 +129,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and NAT and general and wpa and fiveg"
@@ -155,7 +155,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
@@ -182,7 +182,7 @@ class TestNATModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
update_report, test_cases,
station_names_fiveg,
lf_test):
@@ -245,7 +245,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases):
@@ -272,7 +272,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
@@ -300,7 +300,7 @@ class TestNATModeConnectivitySuiteB(object):
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -326,7 +326,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa3_personal_mixed
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test,
test_cases,
update_report):
@@ -353,7 +353,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.twog
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles,
lf_test,
update_report,
@@ -382,7 +382,7 @@ class TestNATModeConnectivitySuiteB(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G

View File

@@ -34,7 +34,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -60,7 +60,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise
@pytest.mark.fiveg
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -87,7 +87,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -114,7 +114,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise
@pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -140,7 +140,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -165,7 +165,7 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise
@pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -216,7 +216,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_enterprise_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases, radius_info, exit_on_fail):
@@ -244,7 +244,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1]
ssid_name = profile_data["ssid_name"]
@@ -268,7 +268,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles,
lf_test,
update_report, test_cases, radius_info, exit_on_fail):
@@ -293,7 +293,7 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_enterprise_mixed_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, setup_profiles,
lf_test,
update_report, exit_on_fail,

View File

@@ -46,7 +46,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_open_ssid_2g(self, get_vif_state, get_ap_logs,
def test_open_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
setup_profiles, lf_test, update_report,
station_names_twog,
test_cases):
@@ -72,7 +72,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.open
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_open_ssid_5g(self, get_vif_state, get_ap_logs,
def test_open_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, test_cases, station_names_fiveg,
update_report):
"""Client Connectivity open ssid 5G
@@ -100,7 +100,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.twog
@allure.story('wpa 2.4 GHZ Band')
def test_wpa_ssid_2g(self, get_vif_state, get_ap_logs,
update_report,
update_report, get_lf_logs,
lf_test, test_cases, station_names_twog):
"""Client Connectivity wpa ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa and twog"
@@ -126,7 +126,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa
@pytest.mark.fiveg
@allure.story('wpa 5 GHZ Band')
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases, station_names_fiveg):
"""Client Connectivity wpa ssid 5G
pytest -m "client_connectivity and vlan and general and wpa and fiveg"
@@ -152,7 +152,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.twog
@allure.story('wpa2_personal 2.4 GHZ Band')
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
lf_test, update_report, test_cases,
station_names_twog):
"""Client Connectivity wpa2_personal ssid 2.4G
@@ -179,7 +179,7 @@ class TestvlanModeConnectivitySuiteA(object):
@pytest.mark.wpa2_personal
@pytest.mark.fiveg
@allure.story('wpa2_personal 5 GHZ Band')
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
update_report, test_cases,
station_names_fiveg,
lf_test):
@@ -243,7 +243,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.twog
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_2g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_twog, setup_profiles, lf_test,
update_report,
test_cases):
@@ -271,7 +271,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa3_personal
@pytest.mark.fiveg
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa3_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G
@@ -299,7 +299,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@allure.story('open 2.4 GHZ Band')
def test_wpa3_personal_mixed_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -327,7 +327,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@allure.story('open 5 GHZ Band')
def test_wpa3_personal_mixed_ssid_5g(self, get_vif_state, get_ap_logs,
station_names_fiveg, lf_test,
test_cases,
test_cases, get_lf_logs,
update_report):
"""Client Connectivity open ssid 2.4G
pytest -m "client_connectivity and vlan and general and wpa3_personal_mixed and fiveg"
@@ -354,7 +354,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@allure.story('wpa wpa2 personal mixed 2.4 GHZ Band')
def test_wpa_wpa2_personal_ssid_2g(self, get_vif_state, get_ap_logs,
station_names_twog, setup_profiles,
lf_test,
lf_test, get_lf_logs,
update_report,
test_cases):
"""Client Connectivity open ssid 2.4G
@@ -381,7 +381,7 @@ class TestvlanModeConnectivitySuiteTwo(object):
@pytest.mark.wpa_wpa2_personal_mixed
@pytest.mark.fiveg
@allure.story('wpa wpa2 personal mixed 5 GHZ Band')
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs,
def test_wpa_wpa2_personal_ssid_5g(self, get_vif_state, get_ap_logs, get_lf_logs,
station_names_fiveg, lf_test, test_cases,
update_report):
"""Client Connectivity open ssid 2.4G

View File

@@ -0,0 +1,68 @@
from logging import exception
import unittest
import warnings
from perfecto.test import TestResultFactory
import pytest
import sys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_android, pytest.mark.expressWifiConnection]
from android_lib import set_APconnMobileDevice_android, ForgetWifiConnection, expressWifi, wifi_connect, wifi_disconnect_and_forget
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [{"ssid_name": "XWF-OWF_DSx", "appliedRadios": ["2G"]}]
},
"rf": {},
"radius": False,
"express-wifi": True
}
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestExpressWifiAndroid(object):
@pytest.mark.twog
@pytest.mark.open
def test_ExpressWifi_Android(self, request, get_ToggleAirplaneMode_data, setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ""
print ("SSID_NAME: " + ssidName)
print ("SSID_PASS: " + ssidPassword)
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_ToggleAirplaneMode_data
#Set Wifi/AP Mode
wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
#Express Wifi
if expressWifi(request, ssidName, setup_perfectoMobile_android, connData):
assert True
else:
assert False
#ForgetWifi
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)

View File

@@ -0,0 +1,68 @@
from logging import exception
import unittest
import warnings
from perfecto.test import TestResultFactory
import pytest
import sys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
pytest.mark.expressWifiConnection]
from iOS_lib import closeApp, ForgetWifiConnection, set_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, \
verifyUploadDownloadSpeediOS, expressWifi, wifi_connect, wifi_disconnect_and_forget
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"open": [{"ssid_name": "XWF-OWF_DSx", "appliedRadios": ["2G"]}]
},
"rf": {},
"radius": False,
"express-wifi": True
}
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestExpressWifi(object):
@pytest.mark.twog
@pytest.mark.open
def test_ExpressWifi(self, request, get_ToggleAirplaneMode_data, setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = ""
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_ToggleAirplaneMode_data
# Set Wifi/AP Mode
wifi_connect(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
# Express Wifi
if expressWifi(request, setup_perfectoMobile_iOS, connData):
assert True
else:
assert False
# ForgetWifi
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)

View File

@@ -0,0 +1,276 @@
from logging import exception
import io
import unittest
import warnings
from perfecto.test import TestResultFactory
import pytest
import sys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from android_lib import closeApp, set_APconnMobileDevice_android, Toggle_AirplaneMode_android, ForgetWifiConnection, openApp, \
get_ip_address_and, verifyUploadDownloadSpeed_android, wifi_connect, wifi_disconnect_and_forget, captive_portal_and
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.android, pytest.mark.interop_and, pytest.mark.captive_portal
,pytest.mark.interop_uc_sanity, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [{"ssid_name": "captive_open_2g", "appliedRadios": ["2G"]},
{"ssid_name": "captive_open_5g", "appliedRadios": ["5G"]}],
"wpa": [{"ssid_name": "captive_wpa_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive_wpa_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}],
"wpa2_personal": [{"ssid_name": "captive_wpa2_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive_wpa2_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}],
"wpa3_personal": [
{"ssid_name": "captive_wpa3_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive_wpa3_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}]},
"rf": {},
"radius": False
}
@allure.suite(suite_name="interop sanity")
@allure.sub_suite(sub_suite_name="Bridge Mode Captive Portal : Suite-A")
@pytest.mark.InteropsuiteA
@allure.feature("BRIDGE MODE CAPTIVE PORTAL")
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
@pytest.mark.usefixtures("setup_profiles")
class TestBridgeModeCaptivePortalSuiteOneBridge(object):
""" Captive Portal SuiteA
pytest -m "captive portal and bridge and InteropsuiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5178", name="WIFI-5178")
@pytest.mark.twog
@pytest.mark.open
def test_Captive_Portal_Open_2g_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5141", name="WIFI-5141")
@pytest.mark.fiveg
@pytest.mark.open
def test_Captive_Portal_Open_5g_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["open"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5180", name="WIFI-5180")
@pytest.mark.twog
@pytest.mark.wpa
def test_Captive_Portal_WPA_2g_Bridge(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5144", name="WIFI-5144")
@pytest.mark.fiveg
@pytest.mark.wpa
def test_Captive_Portal_WPA_5g_Bridge(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["wpa"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5184", name="WIFI-5184")
@pytest.mark.twog
@pytest.mark.wpa2_personal
def test_Captive_Portal_WPA2_2g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5147", name="WIFI-5147")
@pytest.mark.fiveg
@pytest.mark.wpa2_personal
def test_Captive_Portal_WPA2_5g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_android):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_android[1]
driver = setup_perfectoMobile_android[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_and(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeed_android(request, setup_perfectoMobile_android, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_android, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -0,0 +1,350 @@
from logging import exception
import io
import unittest
import warnings
from perfecto.test import TestResultFactory
import pytest
import sys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
import sys
import allure
if 'perfecto_libs' not in sys.path:
sys.path.append(f'../libs/perfecto_libs')
from iOS_lib import closeApp, openApp, get_WifiIPAddress_iOS, ForgetWifiConnection, ping_deftapps_iOS, \
Toggle_AirplaneMode_iOS, set_APconnMobileDevice_iOS, verify_APconnMobileDevice_iOS, Toggle_WifiMode_iOS, tearDown,\
verifyUploadDownloadSpeediOS, get_ip_address_ios, captive_portal_ios, wifi_connect, wifi_disconnect_and_forget
pytestmark = [pytest.mark.sanity, pytest.mark.interop, pytest.mark.ios, pytest.mark.interop_ios,
pytest.mark.captive_portal, pytest.mark.interop_uc_sanity, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"open": [{"ssid_name": "captive_open_2g", "appliedRadios": ["2G"]},
{"ssid_name": "captive_open_5g", "appliedRadios": ["5G"]}],
"wpa": [{"ssid_name": "captive_wpa_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive_wpa_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}],
"wpa2": [{"ssid_name": "captive_wpa2_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive2_wpa_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}],
"wpa3_personal": [
{"ssid_name": "captive_wpa3_2g", "appliedRadios": ["2G"], "security_key": "lanforge"},
{"ssid_name": "captive_wpa3_5g", "appliedRadios": ["5G"],
"security_key": "lanforge"}]},
"rf": {},
"radius": False
}
@allure.suite(suite_name="interop sanity")
@allure.sub_suite(sub_suite_name="Bridge Mode Captive Portal : Suite-A")
@pytest.mark.InteropsuiteA
@allure.feature("BRIDGE MODE CAPTIVE PORTAL")
# @pytest.mark.parametrize(
# 'setup_profiles',
# [setup_params_general],
# indirect=True,
# scope="class"
# )
#@pytest.mark.usefixtures("setup_profiles")
class TestBridgeModeCaptivePortalSuiteOneBridge(object):
""" Captive Portal SuiteA
pytest -m "captive portal and bridge and InteropsuiteA"
"""
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5179", name="WIFI-5179")
@pytest.mark.twog
@pytest.mark.open
def test_Captive_Portal_Open_2g_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5146", name="WIFI-5146")
@pytest.mark.fiveg
@pytest.mark.open
def test_Captive_Portal_Open_5g_BRIDGE(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["open"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = "[BLANK]"
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5182", name="WIFI-5182")
@pytest.mark.twog
@pytest.mark.wpa
def test_Captive_Portal_WPA_2g_Bridge(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5149", name="WIFI-5149")
@pytest.mark.fiveg
@pytest.mark.wpa
def test_Captive_Portal_WPA_5g_Bridge(self, request, get_vif_state, get_ap_logs, get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5186", name="WIFI-5186")
@pytest.mark.twog
@pytest.mark.wpa2_personal
def test_Captive_Portal_WPA2_2g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5153", name="WIFI-5153")
@pytest.mark.fiveg
@pytest.mark.wpa2_personal
def test_Captive_Portal_WPA2_5g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5130", name="WIFI-5130")
@pytest.mark.twog
@pytest.mark.wpa3_personal
def test_Captive_Portal_WPA3_2g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa3_personal"][0]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False
@allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-5140", name="WIFI-5140")
@pytest.mark.sg123
@pytest.mark.fiveg
@pytest.mark.wpa3_personal
def test_Captive_Portal_WPA3_5g_Personal_Bridge(self, request, get_vif_state, get_ap_logs,
get_APToMobileDevice_data,
setup_perfectoMobile_iOS):
profile_data = setup_params_general["ssid_modes"]["wpa3_personal"][1]
ssidName = profile_data["ssid_name"]
ssidPassword = profile_data["security_key"]
print("SSID_NAME: " + ssidName)
print("SSID_PASS: " + ssidPassword)
get_vif_state.append(ssidName)
if ssidName not in get_vif_state:
allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state))
pytest.xfail("SSID NOT AVAILABLE IN VIF STATE")
report = setup_perfectoMobile_iOS[1]
driver = setup_perfectoMobile_iOS[0]
connData = get_APToMobileDevice_data
# Set Wifi/AP Mode
ip, is_internet = captive_portal_ios(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
if is_internet:
if ip:
text_body = ("connected to " + ssidName + " (" + ip + ") " + "with internet")
else:
text_body = ("connected to " + ssidName + "with Internet, couldn't get IP address")
print(text_body)
allure.attach(name="Connection Status: ", body=str(text_body))
assert verifyUploadDownloadSpeediOS(request, setup_perfectoMobile_iOS, connData)
wifi_disconnect_and_forget(request, ssidName, ssidPassword, setup_perfectoMobile_iOS, connData)
else:
allure.attach(name="Connection Status: ", body=str("No Internet access"))
assert False

View File

@@ -433,7 +433,6 @@ def setup_perfectoMobile_android(request):
try:
params = {'property': 'model'}
deviceModel = driver.execute_script('mobile:handset:info', params)
device_name_list.append(deviceModel)
except:
pass
@@ -600,7 +599,6 @@ def setup_perfectoMobile_iOS(request):
try:
params = {'property': 'model'}
deviceModel = driver.execute_script('mobile:handset:info', params)
device_name_list.append(deviceModel)
except:
pass

View File

@@ -318,6 +318,39 @@ class Fixtures_2x:
version_list.append(version)
return version_list
def get_uci_show(self, get_apnos, get_configuration):
version_list = []
for access_point_info in get_configuration['access_point']:
ap_ssh = get_apnos(access_point_info)
connectivity_data = ap_ssh.run_generic_command(cmd="uci show ucentral.config.server")
# connectivity_data.pop(0)
# connectivity_data.pop(1)
break
# version_list.append(connectivity_data)
return connectivity_data[1]
def get_ap_status_logs(self, get_configuration, get_apnos):
connected = 0
redirector_data = None
for access_point_info in get_configuration['access_point']:
ap_ssh = get_apnos(access_point_info, sdk="2.x")
# for i in range(15):
connectivity_data = ap_ssh.run_generic_command(cmd="ubus call ucentral status")
if "disconnected" in str(connectivity_data):
print("AP in disconnected state, sleeping for 30 sec")
# time.sleep(30)
connected = 0
# # if i == 10:
# print("rebooting AP")
# ap_ssh.reboot()
# print("sleep for 300 sec")
# time.sleep(300)
else:
connected = 1
redirector_data = ap_ssh.run_generic_command(cmd="cat /etc/ucentral/redirector.json")
return connected, redirector_data
def get_sdk_version(self):
version = self.controller_obj.get_sdk_version()
return version
@@ -509,6 +542,12 @@ class Fixtures_2x:
print(e)
test_cases["wpa_eap"] = False
try:
if parameter['express-wifi']:
instantiate_profile_obj.set_express_wifi()
except:
pass
ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="2.x")
# Get ucentral status
@@ -701,4 +740,3 @@ class Fixtures_2x:
pytest.fail("AP is disconnected from UC Gateway")

View File

@@ -1,10 +1,12 @@
"""
Test Case Module: Testing Basic Connectivity with Resources
"""
import time
import allure
import pytest
import requests
import json
pytestmark = [pytest.mark.test_resources, pytest.mark.sanity, pytest.mark.uc_sanity,
pytest.mark.sanity_55]
@@ -17,26 +19,133 @@ class TestResources(object):
@pytest.mark.test_cloud_controller
@pytest.mark.uc_sanity
@allure.testcase(name="test_controller_connectivity", url="")
def test_controller_connectivity(self, setup_controller):
def test_controller_connectivity(self, setup_controller, get_configuration):
"""Test case to verify cloud Controller Connectivity"""
login_response_json = setup_controller.login_resp.json()
response_code = setup_controller.login_resp.status_code
allure.attach(name="Login Response Code", body=str(response_code))
allure.attach(name="Login Response JSON",
body=str(login_response_json),
attachment_type=allure.attachment_type.JSON)
version = setup_controller.get_sdk_version()
print(version)
assert response_code == 200
request_url = setup_controller.login_resp.request.url
print("Login_Request_URL: ", str(request_url))
allure.attach(name="Login_Request_URL: ", body=str(request_url))
print("response_code: ", response_code)
allure.attach(name="Login Response Code: ", body=str(response_code))
print("login_response_json: ", login_response_json)
allure.attach(name="Login Response JSON: ", body=str(setup_controller.login_resp.json()))
if response_code != 200:
pytest.exit(
"exiting from pytest, login response is no 200: " + str(setup_controller.login_resp.status_code))
gw_system_info = setup_controller.get_system_gw()
request_url = gw_system_info.request.url
allure.attach(name="get_system_gw_request: ", body=str(request_url))
gw_system_status = gw_system_info.status_code
gw_system_status_json = gw_system_info.json()
print("gw_status_check response from gateway: ", gw_system_status)
allure.attach(name="gw_status_check response from gateway: ", body=str(gw_system_status) +
str(gw_system_status_json))
if gw_system_status != 200:
allure.attach(name="Login_Request_URL: ", body=str(request_url))
pytest.exit("gw_status_check response from gateway: " + str(gw_system_status))
fms_system_info = setup_controller.get_system_fms()
request_url = fms_system_info.request.url
allure.attach(name="get_system_fms_request: ", body=str(request_url))
fms_system_status = fms_system_info.status_code
fms_system_status_json = fms_system_info.json()
print("fms_status_check response from fms: ", fms_system_status)
allure.attach(name="fms_status_check response from fms:", body=str(fms_system_status) +
str(fms_system_status_json))
if fms_system_status != 200:
pytest.exit("fms_status_check response from fms: " + str(fms_system_status))
# if gw_status_check != 200:
# for i in range(10):
# if setup_controller.get_system_gw().status_code != 200 and i < 9:
# print("sleeping for 30 sec, gw service is down with response not equals to 200")
# time.sleep(30)
# elif setup_controller.get_system_gw().status_code != 200 and i == 9:
# pytest.exit("GW service is not up yet, exiting from pytest")
# else:
# break
#
# if fms_status_check != 200:
# for i in range(10):
# if setup_controller.get_system_fms().status_code != 200 and i < 9:
# print("sleeping for 30 sec, fms service is down with response not equals to 200")
# time.sleep(30)
# elif setup_controller.get_system_fms().status_code != 200 and i == 9:
# pytest.exit("fms service is not up yet, exiting from pytest")
# else:
# break
#
# available_device_list = []
# devices = setup_controller.get_devices()
# number_devices = len(devices["devices"])
# for i in range(number_devices):
# available_device_list.append(devices["devices"][i]["serialNumber"])
# print("available_device_list: ", available_device_list)
#
# if get_configuration["access_point"][0]["serial"] not in available_device_list:
# for i in range(10):
# available_device_list = []
# devices = setup_controller.get_devices()
# number_devices = len(devices["devices"])
# for i in range(number_devices):
# available_device_list.append(devices["devices"][i]["serialNumber"])
# print(available_device_list)
#
# if get_configuration["access_point"][0]["serial"] not in available_device_list and i < 9:
# print("unable to find device on UI, Sleeping for 30 sec")
# time.sleep(30)
# elif get_configuration["access_point"][0]["serial"] not in available_device_list and i == 9:
# pytest.exit("Device" + get_configuration["access_point"][0]["serial"] + "not found on UI")
# else:
# break
#
# for ap in get_configuration['access_point']:
#
# ap_ssh = get_apnos(ap, pwd="../libs/apnos/", sdk="2.x")
# uci_show_ucentral = ap_ssh.run_generic_command("uci show ucentral")
# print(uci_show_ucentral)
# print("AP is pointing to: ", ap_ssh.get_ap_uci_show_ucentral())
# expected_sdk = str(get_configuration["controller"]['url'].replace("https://sec", "\'gw").replace(":16001","\'"))
# if ap_ssh.get_ap_uci_show_ucentral() != expected_sdk:
# for i in range(10):
# ucentral_show = str(ap_ssh.get_ap_uci_show_ucentral().strip())
# print("AP pointing to: ", ucentral_show)
# print("AP should point to: ", expected_sdk)
#
# if ucentral_show != expected_sdk and i < 9:
# print("AP is not pointing to right SDK, retry after 30 sec")
# time.sleep(30)
# elif ucentral_show != expected_sdk and i == 9:
# assert False
# pytest.exit("AP is not pointing to right SDK")
# else:
# break
assert True
@pytest.mark.test_access_points_connectivity
@allure.testcase(name="test_access_points_connectivity", url="")
def test_access_points_connectivity(self, test_access_point, fixtures_ver):
def test_access_points_connectivity(self, setup_controller, get_uci_show, test_access_point, get_configuration,
test_ap_connection_status, fixtures_ver):
"""Test case to verify Access Points Connectivity"""
data = []
for status in test_access_point:
data.append(status[0])
connection, redirector = test_ap_connection_status
allure.attach(name="AP - Cloud connectivity info", body=str(fixtures_ver.ubus_connection))
print("test_ap_connection_status: ", connection, redirector)
expected_sdk = str(get_configuration["controller"]['url'].replace("https://sec", "\'gw").replace(":16001", "\'"))
print("Expected SDK: ", expected_sdk)
allure.attach(name="Exoected SDK: ", body=str(expected_sdk))
print("SDK On AP: ", str(get_uci_show.split("=")[1]))
allure.attach(name="SDK Pointed by AP: ", body=str(get_uci_show.split("=")[1]))
if expected_sdk not in get_uci_show:
pytest.exit("AP has invalid Redirector")
if test_ap_connection_status[0] == 0:
pytest.exit("AP in Disconnected State")
assert False not in data
@pytest.mark.traffic_generator_connectivity
@@ -135,9 +244,12 @@ class TestFMS(object):
assert False not in PASS
@pytest.mark.firmware_upgrade
def test_firmware_upgrade_request(self, firmware_upgrade, get_ap_logs):
def test_firmware_upgrade_request(self, firmware_upgrade, get_ap_logs, test_ap_connection_status):
for update in firmware_upgrade:
allure.attach(name='serial: ' + update[0], body="")
if test_ap_connection_status[0] == 0:
assert False
pytest.exit("AP in Disconnected State")
assert True
@pytest.mark.test_firmware_ap

View File

@@ -1,70 +0,0 @@
#!/usr/bin/python3.9
"""
lf_tools : Tools for LANforge
reboot, run_cmd, etc
./lf_tools --host 10.28.3.8 --port 22 --username root --password lanforge --action reboot
./lf_tools --host 10.28.3.8 --port 22 --username root --password lanforge --action run_cmd --cmd ls
"""
import argparse
import paramiko
class LFTools:
def __init__(self, host="", port=22, username="root", password="lanforge"):
self.host = host
self.port = port
self.username = username
self.password = password
def ssh_cli_connect(self):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print("Connecting to LANforge: %s@%s:%s" % (
self.username, self.host, self.port))
client.connect(self.host, username=self.username, password=self.password,
port=self.port, timeout=10, allow_agent=False, banner_timeout=200)
return client
def run_cmd(self, cmd):
client = self.ssh_cli_connect()
stdin, stdout, stderr = client.exec_command(cmd)
output = "Output: " + str(stdout.read())
error = "Error: " + str(stderr.read())
client.close()
return output, error
def run_action(self, action, cmd):
if action == "reboot":
output, error = self.run_cmd("reboot")
print(output, error)
elif action == "run_cmd":
output, error = self.run_cmd(cmd)
print(output, error)
else:
print("Invalid Action")
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="root")
parser.add_argument('--password', type=str, help='--password to the given username', default="lanforge")
parser.add_argument('--action', type=str, help='--action to perform'
'reboot | run_cmd', default="run_cmd")
parser.add_argument('--cmd', type=str, help='--cmd : used when action is "run_cmd"', default="pwd")
args = parser.parse_args()
lf_tools = LFTools(host=args.host, port=args.port, username=args.username, password=args.password)
lf_tools.run_action(args.action, args.cmd)
if __name__ == '__main__':
main()

55
tools/scp_util.py Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env python3
import argparse
import paramiko
from scp import SCPClient
class SCP_File:
def __init__(self, ip="localhost", port=22, username="lanforge", password="lanforge", remote_path="/home/lanforge/",
local_path="."):
self.ip = ip
self.port = port
self.remote_path = remote_path
self.local_path = local_path
self.username = username
self.password = password
def pull_file(self):
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=self.ip, username=self.username, password=self.password, port=self.port, allow_agent=False,
look_for_keys=False)
# ssh.close()
with SCPClient(ssh.get_transport()) as scp:
scp.get(remote_path=self.remote_path, local_path=self.local_path, recursive=True)
scp.close()
def main():
parser = argparse.ArgumentParser(prog="lf_utils",
formatter_class=argparse.RawTextHelpFormatter,
allow_abbrev=True,
epilog="About lf_tools.py",
description="Tools for LANforge System")
parser.add_argument('--host', type=str, help=' --host : IP Address f LANforge System', default="localhost")
parser.add_argument('--port', type=int, help='--passwd of dut', default=22)
parser.add_argument('--username', type=str, help='--username to use on LANforge', default="lanforge")
parser.add_argument('--password', type=str, help='--password to use on LANforge', default="lanforge")
parser.add_argument('--remote_path', type=str, help='--password to the given username',
default="/home/lanforge/lf_kinstall.pl")
parser.add_argument('--local_path', type=str, help='--action to perform'
'reboot | run_cmd', default=".")
args = parser.parse_args()
lf_tools = SCP_File(ip=args.host, port=args.port,
username=args.username, password=args.password,
remote_path=args.remote_path, local_path=args.local_path)
lf_tools.pull_file()
if __name__ == '__main__':
main()