From cf7f65c44ce2ba32518ed8763b8c4cbcb1e73d1c Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 22 Sep 2021 16:28:09 +0200 Subject: [PATCH] add config generation from Quali attributes (#149) * add config generation from Quali attributes * adjust quali config generation --- .github/workflows/quali.yml | 563 ++++++++++++++++++++++++++++++++++-- .quali/get_configuration.py | 90 ++++++ .quali/start_reservation.py | 27 +- 3 files changed, 656 insertions(+), 24 deletions(-) create mode 100644 .quali/get_configuration.py diff --git a/.github/workflows/quali.yml b/.github/workflows/quali.yml index c958f1c98..86ac24ab3 100644 --- a/.github/workflows/quali.yml +++ b/.github/workflows/quali.yml @@ -1,33 +1,560 @@ name: Quali example pipeline +env: + # thirdparties + DOCKER_SERVER: tip-tip-wlan-cloud-docker-repo.jfrog.io + DOCKER_USER_NAME: wlan-testing-cicd + # 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: + ucentral_revision: + required: true + default: 'main' + description: 'revision of the uCentral Helm chart' + ucentral_gw_revision: + required: true + default: 'master' + description: 'revision of the uCentral gateway service' + ucentral_sec_revision: + required: true + default: 'main' + description: 'revision of the uCentral security service' + ucentral_fms_revision: + required: true + default: 'main' + description: 'revision of the uCentral fms service' + ucentral_ui_revision: + required: true + default: 'main' + description: 'revision of the uCentral UI' + ap_model: + required: true + default: 'ec420' + description: 'the AP model to test' + ap_revision: + required: true + default: 'latest' + description: 'NOT IN USE! revision of firmware to flash on AP' jobs: - quali: + vars: + runs-on: ubuntu-latest + outputs: + ucentral_revision: ${{ steps.vars.outputs.ucentral}} + ucentral_gw_revision: ${{ steps.vars.outputs.gw}} + ucentral_sec_revision: ${{ steps.vars.outputs.sec}} + ucentral_fms_revision: ${{ steps.vars.outputs.fms}} + ucentral_ui_revision: ${{ steps.vars.outputs.ui}} + ap_model: ${{ steps.vars.outputs.ap_model}} + ap_version: ${{ steps.vars.outputs.ap_version}} + + steps: + - name: set variables + id: vars + run: | + echo ::set-output name=ucentral::$(echo "${{ github.event.inputs.ucentral_revision || 'main' }}") + echo ::set-output name=gw::$(echo "${{ github.event.inputs.ucentral_gw_revision || 'master' }}") + echo ::set-output name=sec::$(echo "${{ github.event.inputs.ucentral_sec_revision || 'main' }}") + echo ::set-output name=fms::$(echo "${{ github.event.inputs.ucentral_fms_revision || 'main' }}") + echo ::set-output name=ui::$(echo "${{ github.event.inputs.ucentral_ui_revision || 'main' }}") + echo ::set-output name=ap_model::$(echo "${{ github.event.inputs.ap_model || 'ec420' }}") + echo ::set-output name=ap_version::$(echo "${{ github.event.inputs.ap_revision || 'latest' }}") + + start-reservation: + needs: vars + runs-on: ubuntu-latest + outputs: + reservation_id: ${{ steps.start.outputs.res_id }} + env: + CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build + CLOUDSHELL_USER: admin + CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }} + 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 + run: echo ::set-output name=res_id::$(python .quali/start_reservation.py --ucentral-version "${{ needs.vars.outputs.ucentral_revision }}" --ucentral-gw-version "${{ needs.vars.outputs.ucentral_gw_revision }}" --ucentral-sec-version "${{ needs.vars.outputs.ucentral_sec_revision }}" --ucentral-fms-version "${{ needs.vars.outputs.ucentral_fms_revision }}" --ucentral-ui-version "${{ needs.vars.outputs.ucentral_ui_revision }}") + + - name: wait for DNS to propagate + run: sleep 300 + + build: + runs-on: ubuntu-latest + 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 + working-directory: wlan-testing + run: ./sync_repos.bash + + - name: docker login + run: docker login ${{ env.DOCKER_SERVER }} -u ${{ env.DOCKER_USER_NAME }} -p ${{ secrets.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: + needs: ['start-reservation', 'build'] runs-on: ubuntu-latest env: CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build CLOUDSHELL_USER: admin CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }} steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' + - uses: actions/checkout@v2 - - name: Install dependencies - run: pip install -r .quali/requirements.txt + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' - - name: Start reservation - id: start - run: echo ::set-output name=res_id::$(python .quali/start_reservation.py) - - - name: Run tests - run: | - echo "simulating test execution" - sleep 30 + - name: install dependencies + run: pip install -r .quali/requirements.txt - - name: Stop reservation - run: python .quali/stop_reservation.py ${{ steps.start.outputs.res_id }} \ No newline at end of file + - 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::testing-${{ github.run_number }}" + + - name: prepare namespace + id: namespace + run: | + NAMESPACE="testing-${{ github.run_id }}-basic" + kubectl create ns $NAMESPACE + kubectl config set-context --current --namespace=$NAMESPACE + echo "::set-output name=name::${NAMESPACE}" + + - name: prepare configuration + run: | + cat << EOF > configuration.py + Customer = "" + server = "" + CONFIGURATION = { + "basic": $(python .quali/get_configuration.py ${{ needs.start-reservation.outputs.reservation_id }}) + } + + RADIUS_SERVER_DATA = { + "ip": "10.10.10.72", + "port": 1812, + "secret": "testing123", + "user": "user", + "password": "password", + "pk_password": "whatever" + } + + RADIUS_ACCOUNTING_DATA = { + "ip": "10.10.10.72", + "port": 1812, + "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 </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: 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 + with: + name: allure-results + path: allure-results + + - name: cleanup + if: always() + run: | + kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true + + stop-reservation: + needs: ['start-reservation', test] + if: always() + runs-on: ubuntu-latest + env: + CLOUDSHELL_URL: quali-cloudshell.lab.wlan.tip.build + CLOUDSHELL_USER: admin + CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }} + 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: stop reservation + run: python .quali/stop_reservation.py ${{ needs.start-reservation.outputs.reservation_id }} + + cleanup: + needs: [ test ] + runs-on: ubuntu-latest + if: always() + steps: + - name: cleanup Docker image + run: curl -u${{ env.DOCKER_USER_NAME }}:${{ secrets.DOCKER_USER_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/cloud-sdk-nightly/${{ github.run_id }}" diff --git a/.quali/get_configuration.py b/.quali/get_configuration.py new file mode 100644 index 000000000..89e370721 --- /dev/null +++ b/.quali/get_configuration.py @@ -0,0 +1,90 @@ +import json +import sys + +from cloudshell.api.cloudshell_api import UpdateTopologyGlobalInputsRequest, UpdateTopologyRequirementsInputsRequest + +from common import get_session + +def main(): + session = get_session() + res_id = sys.argv[1] + + reservation_details = session.GetReservationDetails(res_id).ReservationDescription + resources_in_reservation = reservation_details.Resources + services_in_reservation = reservation_details.Services + + config = { + 'controller': {}, + 'access_point':[], + 'traffic_generator': {} + } + + for service in services_in_reservation: + if service.ServiceName != 'Helm Service V2': + continue + + config['controller']['url'] = f'https://sec-ucentral-{res_id.split("-")[0]}.cicd.lab.wlan.tip.build:16001' + config['controller']['username'] = next(attr.Value for attr in service.Attributes if attr.Name == f'{service.ServiceName}.User') + #config['controller']['password'] = next(attr.Value for attr in service.Attributes if attr.Name == f'{service.ServiceName}.Password') + config['controller']['password'] = 'openwifi' + + for resource in resources_in_reservation: + if resource.ResourceModelName == 'Ap': + details = session.GetResourceDetails(resource.Name) + ap_config = {} + + for attribute in details.ResourceAttributes: + key = attribute.Name.replace(f"{resource.ResourceModelName}.", '') + key = 'username' if key == 'uname' else key + key = 'password' if key == 'passkey' else key + + if attribute.Type == 'Boolean': + value = True if attribute.Value == 'True' else False + elif attribute.Type == 'Numeric': + value = int(attribute.Value) + else: + value = attribute.Value + + ap_config[key] = value + + config['access_point'].append(ap_config) + + elif resource.ResourceModelName == 'Trafficgenerator': + details = session.GetResourceDetails(resource.Name) + tf_config = {} + for attribute in details.ResourceAttributes: + key = attribute.Name.replace(f"{resource.ResourceModelName}.", '') + + if attribute.Type == 'Boolean': + value = True if attribute.Value == 'True' else False + elif attribute.Type == 'Numeric': + value = int(attribute.Value) + else: + value = attribute.Value + + tf_config[key] = value + + config['traffic_generator'] = { + 'name': 'lanforge', + 'details': { + 'ip': tf_config['ip'], + 'port': tf_config['port'], + 'ssh_port': tf_config['ssh_port'], + '2.4G-Radio': [tf_config['lf_2dot4G_Radio']], + '5G-Radio': [tf_config['lf_5G_Radio']], + 'AX-Radio': tf_config['AX_Radio'].replace(' ', '').split(','), + 'upstream': tf_config['Upstream'], + 'upstream_subnet': tf_config['upstream_subnet'], + 'uplink': tf_config['uplink'], + '2.4G-Station-Name': tf_config['lf_2dot4G_Station_Name'], + '5G-Station-Name': tf_config['lf_5G_Station_Name'], + 'AX-Station-Name': tf_config['AX_Station_Name'] + } + } + else: + continue + + print(repr(config)) + +if __name__ == '__main__': + main() diff --git a/.quali/start_reservation.py b/.quali/start_reservation.py index 479eed961..85dba126f 100644 --- a/.quali/start_reservation.py +++ b/.quali/start_reservation.py @@ -1,25 +1,40 @@ +import json import os from cloudshell.api.cloudshell_api import UpdateTopologyGlobalInputsRequest, UpdateTopologyRequirementsInputsRequest +import argparse + from common import wait_for_provisioning_status, get_session run_id = os.environ.get('GITHUB_RUN_NUMBER', 1) def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--ucentral-version', default='main') + parser.add_argument('--ucentral-gw-version', default='master') + parser.add_argument('--ucentral-sec-version', default='main') + parser.add_argument('--ucentral-fms-version', default='main') + parser.add_argument('--ucentral-ui-version', default='main') + parser.add_argument('--ap-model', default='EC420') + parser.add_argument('--wifi-type', default='Wifi5') + args = parser.parse_args() + session = get_session() reservation = session.CreateImmediateTopologyReservation( reservationName=f'sanity-{run_id}', owner=session.username, - durationInMinutes=60, + durationInMinutes=360, topologyFullPath='Basic Lab', globalInputs=[ - UpdateTopologyGlobalInputsRequest('Cloud Controller Version', '1.1.0-RC1'), - ], - requirementsInputs=[ - UpdateTopologyRequirementsInputsRequest('Access Point', 'Ap.Wifi type', 'Wifi5', 'Attributes'), - UpdateTopologyRequirementsInputsRequest('Access Point', 'Ap.AP Model', 'ECW5410', 'Attributes') + UpdateTopologyGlobalInputsRequest('Chart Version', args.ucentral_version), + UpdateTopologyGlobalInputsRequest('ucentralgw Version', args.ucentral_gw_version), + UpdateTopologyGlobalInputsRequest('ucentralsec Version', args.ucentral_sec_version), + UpdateTopologyGlobalInputsRequest('ucentralfms Version', args.ucentral_fms_version), + UpdateTopologyGlobalInputsRequest('ucentralgwui Version', args.ucentral_ui_version), + UpdateTopologyGlobalInputsRequest('AP Model', args.ap_model), + UpdateTopologyGlobalInputsRequest('Wifi type', args.wifi_type), ] ).Reservation