1# 2# Copyright (c) 2021, The OpenThread Authors. 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are met: 7# 1. Redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer. 9# 2. Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# 3. Neither the name of the copyright holder nor the 13# names of its contributors may be used to endorse or promote products 14# derived from this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26# POSSIBILITY OF SUCH DAMAGE. 27# 28 29name: Border Router 30 31on: 32 push: 33 branches-ignore: 34 - 'dependabot/**' 35 pull_request: 36 branches: 37 - 'main' 38 39concurrency: 40 group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/ot-br-posix' && github.run_id) || github.ref }} 41 cancel-in-progress: true 42 43jobs: 44 45 border-router: 46 runs-on: ubuntu-22.04 47 48 strategy: 49 fail-fast: false 50 matrix: 51 include: 52 - name: "Border Router (mDNSResponder)" 53 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=OFF -DOTBR_DNS_UPSTREAM_QUERY=ON" 54 border_routing: 1 55 internet: 0 56 dnssd_plat: 0 57 otbr_mdns: "mDNSResponder" 58 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 59 packet_verification: 1 60 - name: "Border Router (Avahi)" 61 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=OFF -DOTBR_DNS_UPSTREAM_QUERY=ON" 62 border_routing: 1 63 internet: 0 64 dnssd_plat: 0 65 otbr_mdns: "avahi" 66 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 67 packet_verification: 1 68 - name: "Border Router TREL (mDNSResponder)" 69 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=ON -DOTBR_DNS_UPSTREAM_QUERY=ON" 70 border_routing: 1 71 internet: 0 72 dnssd_plat: 0 73 otbr_mdns: "mDNSResponder" 74 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 75 packet_verification: 2 76 - name: "Border Router TREL (Avahi)" 77 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=ON -DOTBR_DNS_UPSTREAM_QUERY=ON" 78 border_routing: 1 79 internet: 0 80 dnssd_plat: 0 81 otbr_mdns: "avahi" 82 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 83 packet_verification: 2 84 - name: "Border Router MATN (mDNSResponder)" 85 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=OFF -DOTBR_DNS_UPSTREAM_QUERY=ON" 86 border_routing: 1 87 internet: 0 88 dnssd_plat: 0 89 otbr_mdns: "mDNSResponder" 90 cert_scripts: ./tests/scripts/thread-cert/border_router/MATN/*.py 91 packet_verification: 1 92 - name: "Border Router Internet Access Features (mDNSResponder)" 93 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=OFF -DOTBR_DNS_UPSTREAM_QUERY=ON -DOTBR_DHCP6_PD=ON" 94 border_routing: 1 95 internet: 1 96 dnssd_plat: 0 97 otbr_mdns: "mDNSResponder" 98 cert_scripts: ./tests/scripts/thread-cert/border_router/internet/*.py 99 packet_verification: 1 100 - name: "Backbone Router" 101 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=OFF -DOTBR_DNS_UPSTREAM_QUERY=ON" 102 border_routing: 0 103 internet: 0 104 dnssd_plat: 0 105 otbr_mdns: "mDNSResponder" 106 cert_scripts: ./tests/scripts/thread-cert/backbone/*.py 107 packet_verification: 1 108 - name: "Border Router TREL with FEATURE_FLAG (avahi)" 109 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_FEATURE_FLAGS=ON -DOTBR_TELEMETRY_DATA_API=ON -DOTBR_TREL=ON -DOTBR_DNS_UPSTREAM_QUERY=ON" 110 border_routing: 1 111 internet: 0 112 dnssd_plat: 0 113 otbr_mdns: "avahi" 114 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 115 packet_verification: 2 116 - name: "Border Router with OT Core Advertising Proxy (avahi)" 117 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=ON -DOTBR_DNS_UPSTREAM_QUERY=ON" 118 border_routing: 1 119 internet: 0 120 dnssd_plat: 1 121 otbr_mdns: "avahi" 122 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 123 packet_verification: 1 124 - name: "Border Router with OT Core Advertising Proxy (mDNSResponder)" 125 otbr_options: "-DOT_DUA=ON -DOT_ECDSA=ON -DOT_MLR=ON -DOT_SERVICE=ON -DOT_SRP_SERVER=ON -DOTBR_COVERAGE=ON -DOTBR_DUA_ROUTING=ON -DOTBR_TREL=ON -DOTBR_DNS_UPSTREAM_QUERY=ON" 126 border_routing: 1 127 internet: 0 128 dnssd_plat: 1 129 otbr_mdns: "mDNSResponder" 130 cert_scripts: ./tests/scripts/thread-cert/border_router/*.py 131 packet_verification: 1 132 133 name: ${{ matrix.name }} 134 env: 135 PACKET_VERIFICATION: ${{ matrix.packet_verification }} 136 THREAD_VERSION: 1.4 137 VIRTUAL_TIME: 0 138 PYTHONUNBUFFERED: 1 139 REFERENCE_DEVICE: 1 140 OTBR_COVERAGE: 1 141 READLINE: readline 142 INTER_OP: 0 143 INTER_OP_BBR: 0 144 BORDER_ROUTING: ${{ matrix.border_routing }} 145 NAT64: ${{ matrix.internet }} 146 DNSSD_PLAT: ${{ matrix.dnssd_plat }} 147 MAX_JOBS: 3 148 VERBOSE: 1 149 steps: 150 - uses: actions/checkout@v4 151 with: 152 submodules: true 153 - name: Get Border Router Test ID 154 id: unique_action_id 155 run: | 156 echo "id=${GITHUB_WORKFLOW}-${GITHUB_JOB}-${GITHUB_RUN_ID}-${{matrix.name}}" >> $GITHUB_OUTPUT 157 - name: Check cached result 158 id: check_cache_result 159 uses: actions/cache@v4 160 with: 161 path: | 162 _test_complete_ 163 key: "_test_complete_${{ steps.unique_action_id.outputs.id }}" 164 - name: Build OTBR Docker Image 165 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 166 run: | 167 # We need the `-DOT_SRP_SERVER=ON` option because the `bbr_5_11_01.py` script is referring SRP server. 168 # This should be fixed by enhancing the test script to handle SRP server situations properly. 169 otbr_options="${{ matrix.otbr_options }}" 170 otbr_image_name="otbr-ot12-backbone-ci" 171 docker build -t "${otbr_image_name}" -f etc/docker/Dockerfile . \ 172 --build-arg BORDER_ROUTING=${{ matrix.border_routing }} \ 173 --build-arg INFRA_IF_NAME=eth0 \ 174 --build-arg BACKBONE_ROUTER=1 \ 175 --build-arg REFERENCE_DEVICE=1 \ 176 --build-arg OT_BACKBONE_CI=1 \ 177 --build-arg NAT64="${{ matrix.internet }}" \ 178 --build-arg NAT64_SERVICE=openthread \ 179 --build-arg DNS64="${{ matrix.internet }}" \ 180 --build-arg MDNS="${{ matrix.otbr_mdns }}" \ 181 --build-arg DNSSD_PLAT="${{ matrix.dnssd_plat }}" \ 182 --build-arg OTBR_OPTIONS="${otbr_options} -DCMAKE_CXX_FLAGS='-DOPENTHREAD_CONFIG_DNSSD_SERVER_BIND_UNSPECIFIED_NETIF=1'" 183 - name: Bootstrap OpenThread Test 184 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 185 run: | 186 sudo rm /etc/apt/sources.list.d/* && sudo apt-get update 187 sudo apt-get --no-install-recommends install -y python3-setuptools python3-wheel ninja-build nodejs npm 188 python3 -m pip install -r third_party/openthread/repo/tests/scripts/thread-cert/requirements.txt 189 sudo bash third_party/openthread/repo/script/install_socat 190 - name: Build OpenThread 191 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 192 run: | 193 (cd third_party/openthread/repo && ./script/test build) 194 - name: Get Thread-Wireshark 195 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 196 run: | 197 (cd third_party/openthread/repo && ./script/test get_thread_wireshark) 198 - name: Run Test 199 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 200 run: | 201 export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e OTBR_COVERAGE" 202 echo "CI_ENV=${CI_ENV}" 203 (cd third_party/openthread/repo && sudo -E ./script/test cert_suite ${{ matrix.cert_scripts }} || (sudo chmod a+r ot_testing/* && false)) 204 - uses: actions/upload-artifact@v4 205 if: ${{ failure() && steps.check_cache_result.outputs.cache-hit != 'true' }} 206 with: 207 name: thread-1-4-backbone-results 208 path: | 209 third_party/openthread/repo/ot_testing/*.pcap 210 third_party/openthread/repo/ot_testing/*.json 211 third_party/openthread/repo/ot_testing/*.log 212 - name: Codecov 213 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 214 uses: codecov/codecov-action@v5 215 - name: Cache test result 216 if: ${{ success() && steps.check_cache_result.outputs.cache-hit != 'true' }} 217 run: | 218 mkdir _test_complete_ 219