|
1 | 1 | --- |
2 | | -# OSLAT test task for Telco-KPIs |
3 | | -# TODO: Implement actual oslat test logic |
4 | | -# For now: validates connection and cluster access |
| 2 | +# Run OSLAT latency test |
| 3 | +# Test: OSLAT (OS-level latency test) |
| 4 | +# Purpose: Measure OS latency on isolated CPUs with PerformanceProfile |
| 5 | +# Duration: Configurable via duration parameter (default: 10m) |
5 | 6 |
|
6 | | -- name: Display bastion hostname information |
7 | | - ansible.builtin.command: hostnamectl |
8 | | - register: hostnamectl_output |
9 | | - changed_when: false |
| 7 | +- name: Ensure test-runner container image exists on bastion |
| 8 | + ansible.builtin.import_tasks: setup-test-runner.yml |
10 | 9 |
|
11 | | -- name: Show hostnamectl output |
12 | | - ansible.builtin.debug: |
13 | | - var: hostnamectl_output.stdout_lines |
14 | | - |
15 | | -- name: Verify hub kubeconfig file exists |
16 | | - ansible.builtin.stat: |
17 | | - path: "{{ hub_kubeconfig }}" |
18 | | - register: hub_kubeconfig_stat |
| 10 | +- name: Create artifacts directory on bastion |
| 11 | + ansible.builtin.tempfile: |
| 12 | + state: directory |
| 13 | + suffix: .oslat-{{ spoke_cluster }} |
| 14 | + path: /tmp |
| 15 | + register: artifacts_dir |
19 | 16 |
|
20 | | -- name: Assert hub kubeconfig exists |
21 | | - ansible.builtin.assert: |
22 | | - that: hub_kubeconfig_stat.stat.exists |
23 | | - fail_msg: "Hub kubeconfig file not found: {{ hub_kubeconfig }}" |
24 | | - success_msg: "Hub kubeconfig exists: {{ hub_kubeconfig }}" |
| 17 | +- name: Display test configuration |
| 18 | + ansible.builtin.debug: |
| 19 | + msg: |
| 20 | + - "==========================================" |
| 21 | + - "OSLAT Test Configuration" |
| 22 | + - "==========================================" |
| 23 | + - "Spoke Cluster: {{ spoke_cluster }}" |
| 24 | + - "Kubeconfig: {{ spoke_kubeconfig }}" |
| 25 | + - "Duration: {{ duration | default(telco_kpis_default_duration_oslat) }}" |
| 26 | + - "Artifacts: {{ artifacts_dir.path }}" |
| 27 | + - "==========================================" |
25 | 28 |
|
26 | | -- name: Verify spoke kubeconfig file exists |
27 | | - ansible.builtin.stat: |
| 29 | +- name: Ensure kubeconfig is readable by podman container |
| 30 | + ansible.builtin.file: |
28 | 31 | path: "{{ spoke_kubeconfig }}" |
29 | | - register: spoke_kubeconfig_stat |
30 | | - |
31 | | -- name: Assert spoke kubeconfig exists |
32 | | - ansible.builtin.assert: |
33 | | - that: spoke_kubeconfig_stat.stat.exists |
34 | | - fail_msg: "Spoke kubeconfig file not found: {{ spoke_kubeconfig }}" |
35 | | - success_msg: "Spoke kubeconfig exists: {{ spoke_kubeconfig }}" |
36 | | - |
37 | | -- name: Get hub cluster nodes |
38 | | - ansible.builtin.command: > |
39 | | - oc --kubeconfig {{ hub_kubeconfig }} get nodes -o wide |
40 | | - register: hub_nodes_output |
41 | | - changed_when: false |
42 | | - |
43 | | -- name: Get hub cluster version |
44 | | - ansible.builtin.command: > |
45 | | - oc --kubeconfig {{ hub_kubeconfig }} get clusterversion -o wide |
46 | | - register: hub_version_output |
47 | | - changed_when: false |
48 | | - |
49 | | -- name: Display hub cluster information |
| 32 | + mode: '0644' |
| 33 | + |
| 34 | +- name: Display monitoring instructions for real-time log viewing |
50 | 35 | ansible.builtin.debug: |
51 | 36 | msg: |
52 | | - - "=== HUB CLUSTER NODES ===" |
53 | | - - "{{ hub_nodes_output.stdout }}" |
| 37 | + - "==========================================" |
| 38 | + - "To monitor test execution in real-time:" |
| 39 | + - "==========================================" |
| 40 | + - "SSH to bastion: ssh {{ ansible_user }}@{{ ansible_host }}" |
| 41 | + - "Tail the log: tail -f {{ artifacts_dir.path }}/podman-run.log" |
54 | 42 | - "" |
55 | | - - "=== HUB CLUSTER VERSION ===" |
56 | | - - "{{ hub_version_output.stdout }}" |
57 | | - |
58 | | -- name: Get spoke cluster nodes |
59 | | - ansible.builtin.command: > |
60 | | - oc --kubeconfig {{ spoke_kubeconfig }} get nodes -o wide |
61 | | - register: spoke_nodes_output |
62 | | - changed_when: false |
63 | | - |
64 | | -- name: Get spoke cluster version |
65 | | - ansible.builtin.command: > |
66 | | - oc --kubeconfig {{ spoke_kubeconfig }} get clusterversion -o wide |
67 | | - register: spoke_version_output |
68 | | - changed_when: false |
69 | | - |
70 | | -- name: Display spoke cluster information |
| 43 | + - "Or from local:" |
| 44 | + - "ssh {{ ansible_user }}@{{ ansible_host }} 'tail -f {{ artifacts_dir.path }}/podman-run.log'" |
| 45 | + - "==========================================" |
| 46 | + - "Container name: telco-kpis-oslat-{{ spoke_cluster }}" |
| 47 | + - "Podman logs: podman logs -f telco-kpis-oslat-{{ spoke_cluster }}" |
| 48 | + - "==========================================" |
| 49 | + |
| 50 | +- name: Run OSLAT test in podman container |
| 51 | + ansible.builtin.shell: | |
| 52 | + set -o pipefail |
| 53 | + podman run --rm \ |
| 54 | + --name telco-kpis-oslat-{{ spoke_cluster }} \ |
| 55 | + -v {{ spoke_kubeconfig }}:/tmp/kubeconfig-ro:ro,Z \ |
| 56 | + -v {{ artifacts_dir.path }}:/workspace/artifacts:rw,Z \ |
| 57 | + telco-kpis-test-runner:latest \ |
| 58 | + bash -c ' |
| 59 | + set -e |
| 60 | + cp /tmp/kubeconfig-ro /tmp/kubeconfig |
| 61 | + export KUBECONFIG=/tmp/kubeconfig |
| 62 | + export GIT_SSL_NO_VERIFY=true |
| 63 | + export RAN_METRICS_URL=https://pushgateway.ran-metrics.telco5g.corp.redhat.com/metrics/job/pipeline1/ |
| 64 | +
|
| 65 | + echo "Cloning ran-integration repository..." |
| 66 | + git clone --depth 1 {{ telco_kpis_ran_integration_repo | default('https://gitlab.cee.redhat.com/ran/ran-integration.git') }} /workspace/ran-integration |
| 67 | + cd /workspace/ran-integration |
| 68 | +
|
| 69 | + echo "Cloning oslat repository..." |
| 70 | + git clone --depth 1 {{ telco_kpis_oslat_repo | default('https://gitlab.cee.redhat.com/ran/oslat.git') }} oslat |
| 71 | +
|
| 72 | + export WORKSPACE=/workspace/ran-integration |
| 73 | + export SCRIPTS_DIR=/workspace/ran-integration/scripts |
| 74 | +
|
| 75 | + echo "Creating artifacts symlink..." |
| 76 | + ln -sfn /workspace/artifacts /workspace/ran-integration/artifacts |
| 77 | +
|
| 78 | + echo "Starting OSLAT test (duration={{ duration | default(telco_kpis_default_duration_oslat) }})..." |
| 79 | + set +e |
| 80 | + bash scripts/test_oslat.sh oslat={{ duration | default(telco_kpis_default_duration_oslat) }} |
| 81 | + exit_code=$? |
| 82 | +
|
| 83 | + echo "OSLAT test completed with exit code: $exit_code" |
| 84 | + exit $exit_code |
| 85 | + ' 2>&1 | tee {{ artifacts_dir.path }}/podman-run.log |
| 86 | + register: oslat_result |
| 87 | + failed_when: false |
| 88 | + args: |
| 89 | + executable: /bin/bash |
| 90 | + |
| 91 | +- name: Display test execution result |
71 | 92 | ansible.builtin.debug: |
72 | 93 | msg: |
73 | | - - "=== SPOKE CLUSTER ({{ spoke_cluster }}) NODES ===" |
74 | | - - "{{ spoke_nodes_output.stdout }}" |
75 | | - - "" |
76 | | - - "=== SPOKE CLUSTER VERSION ===" |
77 | | - - "{{ spoke_version_output.stdout }}" |
| 94 | + - "Test exit code: {{ oslat_result.rc }}" |
| 95 | + - "{{ 'Test PASSED' if oslat_result.rc == 0 else 'Test FAILED' }}" |
| 96 | + |
| 97 | +- name: Manage test artifacts (collect, share, report) |
| 98 | + ansible.builtin.include_role: |
| 99 | + name: artifact-management |
| 100 | + vars: |
| 101 | + artifact_management_test_name: "oslat" |
| 102 | + artifact_management_spoke_cluster: "{{ spoke_cluster }}" |
| 103 | + artifact_management_temp_dir: "{{ artifacts_dir.path }}" |
| 104 | + artifact_management_test_rc: "{{ oslat_result.rc }}" |
| 105 | + artifact_management_test_duration: "{{ duration_seconds }}" |
| 106 | + artifact_management_junit_source_pattern: "oslat_report.xml" |
| 107 | + |
| 108 | +- name: Cleanup artifacts directory on bastion |
| 109 | + ansible.builtin.file: |
| 110 | + path: "{{ artifacts_dir.path }}" |
| 111 | + state: absent |
| 112 | + |
| 113 | +- name: Fail if test failed |
| 114 | + ansible.builtin.fail: |
| 115 | + msg: "OSLAT test failed with exit code {{ oslat_result.rc }}" |
| 116 | + when: oslat_result.rc != 0 |
0 commit comments