mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 20:38:05 +00:00
33
.github/workflows/quali.yml
vendored
Normal file
33
.github/workflows/quali.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Quali example pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
quali:
|
||||||
|
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: 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: Stop reservation
|
||||||
|
run: python .quali/stop_reservation.py ${{ steps.start.outputs.res_id }}
|
||||||
@@ -3,7 +3,7 @@ import time
|
|||||||
|
|
||||||
from cloudshell.api.cloudshell_api import CloudShellAPISession
|
from cloudshell.api.cloudshell_api import CloudShellAPISession
|
||||||
|
|
||||||
TIMEOUT=600
|
TIMEOUT=1200
|
||||||
|
|
||||||
def get_session():
|
def get_session():
|
||||||
url = os.environ['CLOUDSHELL_URL']
|
url = os.environ['CLOUDSHELL_URL']
|
||||||
@@ -12,12 +12,11 @@ def get_session():
|
|||||||
|
|
||||||
return CloudShellAPISession(url, user, password, "Global")
|
return CloudShellAPISession(url, user, password, "Global")
|
||||||
|
|
||||||
|
def __wait_for_status(session, res_id, field, target_status):
|
||||||
def wait_for_reservation_status(session, res_id, target_status):
|
|
||||||
timer = 0
|
timer = 0
|
||||||
sleep_time = 5
|
sleep_time = 5
|
||||||
while True:
|
while True:
|
||||||
status = session.GetReservationStatus(res_id).ReservationSlimStatus.ProvisioningStatus
|
status = session.GetReservationStatus(res_id).ReservationSlimStatus.__dict__[field]
|
||||||
|
|
||||||
if status == target_status:
|
if status == target_status:
|
||||||
break
|
break
|
||||||
@@ -27,3 +26,9 @@ def wait_for_reservation_status(session, res_id, target_status):
|
|||||||
|
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
timer += sleep_time
|
timer += sleep_time
|
||||||
|
|
||||||
|
def wait_for_provisioning_status(session, res_id, target_status):
|
||||||
|
__wait_for_status(session, res_id, 'ProvisioningStatus', target_status)
|
||||||
|
|
||||||
|
def wait_for_reservation_status(session, res_id, target_status):
|
||||||
|
__wait_for_status(session, res_id, 'Status', target_status)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from common import wait_for_reservation_status, get_session
|
from common import wait_for_provisioning_status, get_session
|
||||||
|
|
||||||
run_id = os.environ.get('GITHUB_RUN_NUMBER', 1)
|
run_id = os.environ.get('GITHUB_RUN_NUMBER', 1)
|
||||||
|
|
||||||
@@ -11,12 +11,12 @@ def main():
|
|||||||
reservationName=f'sanity-{run_id}',
|
reservationName=f'sanity-{run_id}',
|
||||||
owner=session.username,
|
owner=session.username,
|
||||||
durationInMinutes=60,
|
durationInMinutes=60,
|
||||||
topologyFullPath='API TESTING'
|
topologyFullPath='Testing - Basic Lab01'
|
||||||
).Reservation
|
).Reservation
|
||||||
|
|
||||||
print(reservation.Id)
|
print(reservation.Id)
|
||||||
|
|
||||||
wait_for_reservation_status(session, reservation.Id, 'Ready')
|
wait_for_provisioning_status(session, reservation.Id, 'Ready')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ def main():
|
|||||||
session = get_session()
|
session = get_session()
|
||||||
res_id = sys.argv[1]
|
res_id = sys.argv[1]
|
||||||
session.EndReservation(res_id)
|
session.EndReservation(res_id)
|
||||||
wait_for_reservation_status(session, res_id, 'Teardown')
|
wait_for_reservation_status(session, res_id, 'Completed')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user