diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 10c622c..d85b686 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -8,777 +8,777 @@ on: push: jobs: - lint: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup Python test prerequisites - run: | - ./do.sh prepytest - - name: Lint Python Code - run: | - ./do.sh pylint - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/.cache/golangci-lint - ~/go/pkg/mod - key: lint_${{ hashFiles('go.sum') }} - restore-keys: | - lint_ - - name: Lint Go Code - run: | - ./do.sh golint + # lint: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup Python test prerequisites + # run: | + # ./do.sh prepytest + # - name: Lint Python Code + # run: | + # ./do.sh pylint + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/.cache/golangci-lint + # ~/go/pkg/mod + # key: lint_${{ hashFiles('go.sum') }} + # restore-keys: | + # lint_ + # - name: Lint Go Code + # run: | + # ./do.sh golint - examples_curl: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Push Configuration - run: | - curl -skL https://localhost:8443/config -H "Content-Type: application/json" -d @examples/quickstart_config.json - - name: Start Flow Transmit - run: | - curl -skL https://localhost:8443/control/state -H "Content-Type: application/json" -d @examples/quickstart_control.json - - name: Get Flow Metrics - run: | - curl -skL https://localhost:8443/monitor/metrics -H "Content-Type: application/json" -d @examples/quickstart_metrics.json - - name: Get container logs - if: always() - run: | - ./do.sh topo logs - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: examples_curl - path: | - logs - - name: Teardown back-to-back DP distribution of ixia-c - run: | - ./do.sh topo rm dp + # examples_curl: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Push Configuration + # run: | + # curl -skL https://localhost:8443/config -H "Content-Type: application/json" -d @examples/quickstart_config.json + # - name: Start Flow Transmit + # run: | + # curl -skL https://localhost:8443/control/state -H "Content-Type: application/json" -d @examples/quickstart_control.json + # - name: Get Flow Metrics + # run: | + # curl -skL https://localhost:8443/monitor/metrics -H "Content-Type: application/json" -d @examples/quickstart_metrics.json + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: examples_curl + # path: | + # logs + # - name: Teardown back-to-back DP distribution of ixia-c + # run: | + # ./do.sh topo rm dp - examples_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back DP distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python example tests - run: | - ./do.sh pytest ./examples/ - - name: Get container logs - if: always() - run: | - ./do.sh topo logs - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: examples_py - path: | - logs - - name: Teardown back-to-back DP distribution of ixia-c - run: | - ./do.sh topo rm dp + # examples_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back DP distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python example tests + # run: | + # ./do.sh pytest ./examples/ + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: examples_py + # path: | + # logs + # - name: Teardown back-to-back DP distribution of ixia-c + # run: | + # ./do.sh topo rm dp - examples_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back DP distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: examples_go_${{ hashFiles('go.sum') }} - restore-keys: | - examples_go_ - - name: Run Go example tests - run: | - ./do.sh gotest -tags=all ./examples/... - - name: Get container logs - if: always() - run: | - ./do.sh topo logs - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: examples_go - path: | - logs - - name: Teardown back-to-back DP distribution of ixia-c - run: | - ./do.sh topo rm dp + # examples_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back DP distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: examples_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # examples_go_ + # - name: Run Go example tests + # run: | + # ./do.sh gotest -tags=all ./examples/... + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: examples_go + # path: | + # logs + # - name: Teardown back-to-back DP distribution of ixia-c + # run: | + # ./do.sh topo rm dp - dp_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python DP-only tests - run: | - ./do.sh pytest -m dp ./feature/b2b/ - - name: Get container logs - if: always() - run: | - ./do.sh topo logs - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: dp_py - path: | - logs - - name: Teardown back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo rm dp + # dp_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python DP-only tests + # run: | + # ./do.sh pytest -m dp ./feature/b2b/ + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: dp_py + # path: | + # logs + # - name: Teardown back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo rm dp - dp_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: dp_go_${{ hashFiles('go.sum') }} - restore-keys: | - dp_go_ - - name: Run Go DP-only tests - run: | - ./do.sh gotest -tags="dp" ./feature/b2b/... - - name: Get container logs - if: always() - run: | - ./do.sh topo logs - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: dp_go - path: | - logs - - name: Teardown back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo rm dp + # dp_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: dp_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # dp_go_ + # - name: Run Go DP-only tests + # run: | + # ./do.sh gotest -tags="dp" ./feature/b2b/... + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: dp_go + # path: | + # logs + # - name: Teardown back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo rm dp - cpdp_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python tests - run: | - ./do.sh pytest ./feature/b2b/ - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: cpdp_py - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # cpdp_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python tests + # run: | + # ./do.sh pytest ./feature/b2b/ + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: cpdp_py + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - cpdp_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: cpdp_go_${{ hashFiles('go.sum') }} - restore-keys: | - cpdp_go_ - - name: Run Go tests - run: | - ./do.sh gotest -tags=all ./feature/b2b/... - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: cpdp_go - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # cpdp_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: cpdp_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # cpdp_go_ + # - name: Run Go tests + # run: | + # ./do.sh gotest -tags=all ./feature/b2b/... + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: cpdp_go + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - cpdp_ipv6_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp ipv6 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python tests - run: | - ./do.sh pytest ./feature/b2b/ - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: cpdp_ipv6_py - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # cpdp_ipv6_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp ipv6 + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python tests + # run: | + # ./do.sh pytest ./feature/b2b/ + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: cpdp_ipv6_py + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - cpdp_ipv6_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp ipv6 - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: cpdp_ipv6_go_${{ hashFiles('go.sum') }} - restore-keys: | - cpdp_ipv6_go_ - - name: Run Go tests - run: | - ./do.sh gotest -tags=all ./feature/b2b/... - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: cpdp_ipv6_go - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # cpdp_ipv6_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp ipv6 + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: cpdp_ipv6_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # cpdp_ipv6_go_ + # - name: Run Go tests + # run: | + # ./do.sh gotest -tags=all ./feature/b2b/... + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: cpdp_ipv6_go + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - kne_b2b_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - name: Setup KNE cluster - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne - - name: Deploy KNE OTG back-to-back topology - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new kneb2b - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python tests - run: | - ./do.sh pytest ./feature/b2b/ - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: kne_b2b_py - path: | - logs - - name: Teardown KNE OTG back-to-back topology - run: | - ./do.sh topo rm kneb2b + # kne_b2b_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - name: Setup KNE cluster + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne + # - name: Deploy KNE OTG back-to-back topology + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new kneb2b + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python tests + # run: | + # ./do.sh pytest ./feature/b2b/ + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: kne_b2b_py + # path: | + # logs + # - name: Teardown KNE OTG back-to-back topology + # run: | + # ./do.sh topo rm kneb2b - kne_b2b_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: kne_b2b_go_${{ hashFiles('go.sum') }} - restore-keys: | - kne_b2b_go_ - - name: Setup KNE cluster - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne - - name: Deploy KNE OTG back-to-back topology - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new kneb2b - - name: Run Go tests - run: | - ./do.sh gotest -tags=all ./feature/b2b/... - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: kne_b2b_go - path: | - logs - - name: Teardown KNE OTG back-to-back topology - run: | - ./do.sh topo rm kneb2b + # kne_b2b_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: kne_b2b_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # kne_b2b_go_ + # - name: Setup KNE cluster + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne + # - name: Deploy KNE OTG back-to-back topology + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new kneb2b + # - name: Run Go tests + # run: | + # ./do.sh gotest -tags=all ./feature/b2b/... + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: kne_b2b_go + # path: | + # logs + # - name: Teardown KNE OTG back-to-back topology + # run: | + # ./do.sh topo rm kneb2b - kne_pdp_arista_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: kne_pdp_arista_go_${{ hashFiles('go.sum') }} - restore-keys: | - kne_pdp_arista_go_ - - name: Setup KNE cluster - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne arista - - name: Deploy KNE OTG port-dut-port topology - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new knepdp arista - - name: Run Go tests - run: | - ./do.sh gotest -tags=all ./feature/pdp/... - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: kne_pdp_arista_go - path: | - logs - - name: Teardown KNE OTG port-dut-port topology - run: | - ./do.sh topo rm knepdp arista + # kne_pdp_arista_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: kne_pdp_arista_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # kne_pdp_arista_go_ + # - name: Setup KNE cluster + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster kne arista + # - name: Deploy KNE OTG port-dut-port topology + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new knepdp arista + # - name: Run Go tests + # run: | + # ./do.sh gotest -tags=all ./feature/pdp/... + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: kne_pdp_arista_go + # path: | + # logs + # - name: Teardown KNE OTG port-dut-port topology + # run: | + # ./do.sh topo rm knepdp arista - kne_b2b_eth0: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: kne_b2b_eth0_${{ hashFiles('go.sum') }} - restore-keys: | - kne_b2b_eth0_ - - name: Setup K8S cluster - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster - - name: Deploy OTG back-to-back topology with eth0 - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new k8seth0 - - name: Run Go eth0 tests - run: | - ./do.sh gotest feature/b2b/packet/udp/udp_port_value_eth0_test.go - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: kne_b2b_eth0 - path: | - logs - - name: Teardown OTG back-to-back topology with eth0 - run: | - ./do.sh topo rm k8seth0 + # kne_b2b_eth0: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: kne_b2b_eth0_${{ hashFiles('go.sum') }} + # restore-keys: | + # kne_b2b_eth0_ + # - name: Setup K8S cluster + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh new_k8s_cluster + # - name: Deploy OTG back-to-back topology with eth0 + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new k8seth0 + # - name: Run Go eth0 tests + # run: | + # ./do.sh gotest feature/b2b/packet/udp/udp_port_value_eth0_test.go + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: kne_b2b_eth0 + # path: | + # logs + # - name: Teardown OTG back-to-back topology with eth0 + # run: | + # ./do.sh topo rm k8seth0 - b2blag: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back LAG CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new b2blag - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: b2blag_${{ hashFiles('go.sum') }} - restore-keys: | - b2blag_ - - name: Run Go LAG tests - run: | - ./do.sh gotest -tags="all" ./feature/b2blag/3p3p/... - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: b2blag - path: | - logs - - name: Teardown back-to-back LAG CP/DP distribution of ixia-c - run: | - ./do.sh topo rm b2blag + # b2blag: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back LAG CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new b2blag + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: b2blag_${{ hashFiles('go.sum') }} + # restore-keys: | + # b2blag_ + # - name: Run Go LAG tests + # run: | + # ./do.sh gotest -tags="all" ./feature/b2blag/3p3p/... + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: b2blag + # path: | + # logs + # - name: Teardown back-to-back LAG CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm b2blag - client_perf_py: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Setup test prerequisites - run: | - ./do.sh prepytest - - name: Run Python tests - run: | - OTG_ITERATIONS=2 ./do.sh pytest ./performance/client/ - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: client_perf_py - path: | - logs + # client_perf_py: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + # - name: Setup test prerequisites + # run: | + # ./do.sh prepytest + # - name: Run Python tests + # run: | + # OTG_ITERATIONS=2 ./do.sh pytest ./performance/client/ + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: client_perf_py + # path: | + # logs - client_perf_go: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: client_perf_go_${{ hashFiles('go.sum') }} - restore-keys: | - client_perf_go_ - - name: Run Go tests - run: | - OTG_ITERATIONS=10 ./do.sh gotest -tags="all" ./performance/client/... - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: client_perf_go - path: | - logs + # client_perf_go: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: client_perf_go_${{ hashFiles('go.sum') }} + # restore-keys: | + # client_perf_go_ + # - name: Run Go tests + # run: | + # OTG_ITERATIONS=10 ./do.sh gotest -tags="all" ./performance/client/... + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: client_perf_go + # path: | + # logs - dp_tput_perf: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo new dp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: dp_tput_perf_${{ hashFiles('go.sum') }} - restore-keys: | - dp_tput_perf_ - - name: Run Throughput test - run: | - ./do.sh gotest ./performance/b2b/udp_tput_perf_test.go - - name: Get container logs - if: always() - run: | - ./do.sh topo logs dp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: dp_tput_perf - path: | - logs - - name: Teardown back-to-back DP-only distribution of ixia-c - run: | - ./do.sh topo rm dp + # dp_tput_perf: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo new dp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: dp_tput_perf_${{ hashFiles('go.sum') }} + # restore-keys: | + # dp_tput_perf_ + # - name: Run Throughput test + # run: | + # ./do.sh gotest ./performance/b2b/udp_tput_perf_test.go + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs dp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: dp_tput_perf + # path: | + # logs + # - name: Teardown back-to-back DP-only distribution of ixia-c + # run: | + # ./do.sh topo rm dp - dp_http_perf: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: dp_http_perf_${{ hashFiles('go.sum') }} - restore-keys: | - dp_http_perf_ - - name: Run DP perf test (HTTP) - run: | - OTG_ITERATIONS=2 ./do.sh gotest performance/b2b/udp_mesh_flows_perf_test.go - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: dp_http_perf - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # dp_http_perf: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: dp_http_perf_${{ hashFiles('go.sum') }} + # restore-keys: | + # dp_http_perf_ + # - name: Run DP perf test (HTTP) + # run: | + # OTG_ITERATIONS=2 ./do.sh gotest performance/b2b/udp_mesh_flows_perf_test.go + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: dp_http_perf + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - dp_grpc_perf: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: dp_grpc_perf_${{ hashFiles('go.sum') }} - restore-keys: | - dp_grpc_perf_ - - name: Run DP perf test (gRPC) - run: | - OTG_ITERATIONS=2 OTG_GRPC_TRANSPORT=true OTG_HOST="localhost:40051" ./do.sh gotest performance/b2b/udp_mesh_flows_perf_test.go - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: dp_grpc_perf - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # dp_grpc_perf: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: dp_grpc_perf_${{ hashFiles('go.sum') }} + # restore-keys: | + # dp_grpc_perf_ + # - name: Run DP perf test (gRPC) + # run: | + # OTG_ITERATIONS=2 OTG_GRPC_TRANSPORT=true OTG_HOST="localhost:40051" ./do.sh gotest performance/b2b/udp_mesh_flows_perf_test.go + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: dp_grpc_perf + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp - cp_http_perf: - runs-on: ubuntu-22.04 - steps: - - name: Checkout source - uses: actions/checkout@v3 - - name: Setup docker - uses: docker-practice/actions-setup-docker@master - - name: Deploy back-to-back CP/DP distribution of ixia-c - run: | - GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: cp_http_perf_${{ hashFiles('go.sum') }} - restore-keys: | - cp_http_perf_ - - name: Run DP perf test (HTTP) - run: | - OTG_ITERATIONS=10 ./do.sh gotest performance/b2b/ebgp_route_prefix_perf_test.go - - name: Get container logs - if: always() - run: | - ./do.sh topo logs cpdp - - name: Archive logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: cp_http_perf - path: | - logs - - name: Teardown back-to-back CP/DP distribution of ixia-c - run: | - ./do.sh topo rm cpdp + # cp_http_perf: + # runs-on: ubuntu-22.04 + # steps: + # - name: Checkout source + # uses: actions/checkout@v3 + # - name: Setup docker + # uses: docker-practice/actions-setup-docker@master + # - name: Deploy back-to-back CP/DP distribution of ixia-c + # run: | + # GITHUB_USER=${{ secrets.ENV_GITHUB_USER }} GITHUB_PAT=${{ secrets.ENV_GITHUB_PAT }} ./do.sh topo new cpdp + # - name: Setup Go + # uses: actions/setup-go@v3 + # with: + # go-version: ${{ env.GO_VERSION }} + # - uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: cp_http_perf_${{ hashFiles('go.sum') }} + # restore-keys: | + # cp_http_perf_ + # - name: Run DP perf test (HTTP) + # run: | + # OTG_ITERATIONS=10 ./do.sh gotest performance/b2b/ebgp_route_prefix_perf_test.go + # - name: Get container logs + # if: always() + # run: | + # ./do.sh topo logs cpdp + # - name: Archive logs + # if: always() + # uses: actions/upload-artifact@v3 + # with: + # name: cp_http_perf + # path: | + # logs + # - name: Teardown back-to-back CP/DP distribution of ixia-c + # run: | + # ./do.sh topo rm cpdp cp_grpc_perf: runs-on: ubuntu-22.04 @@ -804,7 +804,8 @@ jobs: cp_grpc_perf_ - name: Run DP perf test (gRPC) run: | - OTG_ITERATIONS=10 OTG_GRPC_TRANSPORT=true OTG_HOST="localhost:40051" ./do.sh gotest performance/b2b/ebgp_route_prefix_perf_test.go + OTG_ITERATIONS=10 OTG_GRPC_TRANSPORT=true OTG_HOST="localhost:40051" ./do.sh gotest performance/b2b/ip_neighbors_perf_test.go + # OTG_ITERATIONS=10 OTG_GRPC_TRANSPORT=true OTG_HOST="localhost:40051" ./do.sh gotest performance/b2b/ebgp_route_prefix_perf_test.go - name: Get container logs if: always() run: | diff --git a/performance/b2b/ip_neighbors_perf_test.go b/performance/b2b/ip_neighbors_perf_test.go new file mode 100644 index 0000000..dfd8d09 --- /dev/null +++ b/performance/b2b/ip_neighbors_perf_test.go @@ -0,0 +1,164 @@ +//go:build all || cpdp + +package b2b + +import ( + "fmt" + "testing" + + "github.com/open-traffic-generator/conformance/helpers/otg" + "github.com/open-traffic-generator/snappi/gosnappi" +) + +func TestIpNeighborsPerf(t *testing.T) { + // TODO: add support for IPv6 as well + testConst := map[string]interface{}{ + "pktRate": uint64(50), + "pktCount": uint32(100), + "pktSize": uint32(128), + "txMac": "00:00:01:01:01:01", + "txIp": "1.1.1.1", + "txGateway": "1.1.1.2", + "txPrefix": uint32(24), + "rxMac": "00:00:01:01:01:02", + "rxIp": "1.1.1.2", + "rxGateway": "1.1.1.1", + "rxPrefix": uint32(24), + } + + distTables := []string{} + testCase := fmt.Sprintf("IpNeighborsIpHeader2Ports2Devices1Flow") + + api := otg.NewOtgApi(t) + c := ipNeighborsConfig(api, testConst) + + t.Log("TEST CASE: ", testCase) + for i := 1; i <= api.TestConfig().OtgIterations; i++ { + t.Logf("ITERATION: %d\n\n", i) + + api.SetConfig(c) + + api.WaitFor( + func() bool { return ipNeighborsIpv4NeighborsOk(api, testConst) }, + &otg.WaitForOpts{FnName: "WaitForIpv4Neighbors"}, + ) + + api.StartTransmit() + + api.WaitFor( + func() bool { return flowMetricsOk(api, testConst) }, + &otg.WaitForOpts{FnName: "WaitForFlowMetrics"}, + ) + api.Plot().AppendZero() + } + + api.LogPlot(testCase) + + tb, err := api.Plot().ToTable() + if err != nil { + t.Fatal("ERROR:", err) + } + distTables = append(distTables, tb) + + for _, d := range distTables { + t.Log(d) + } +} + +func ipNeighborsConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Config { + c := api.Api().NewConfig() + + ptx := c.Ports().Add().SetName("ptx").SetLocation(api.TestConfig().OtgPorts[0]) + prx := c.Ports().Add().SetName("prx").SetLocation(api.TestConfig().OtgPorts[1]) + + c.Layer1().Add(). + SetName("ly"). + SetPortNames([]string{ptx.Name(), prx.Name()}). + SetSpeed(gosnappi.Layer1SpeedEnum(api.TestConfig().OtgSpeed)) + + dtx := c.Devices().Add().SetName("dtx") + drx := c.Devices().Add().SetName("drx") + + dtxEth := dtx.Ethernets(). + Add(). + SetName("dtxEth"). + SetMac(tc["txMac"].(string)). + SetMtu(1500) + + dtxEth.Connection().SetPortName(ptx.Name()) + + dtxIp := dtxEth. + Ipv4Addresses(). + Add(). + SetName("dtxIp"). + SetAddress(tc["txIp"].(string)). + SetGateway(tc["txGateway"].(string)). + SetPrefix(tc["txPrefix"].(uint32)) + + drxEth := drx.Ethernets(). + Add(). + SetName("drxEth"). + SetMac(tc["rxMac"].(string)). + SetMtu(1500) + + drxEth.Connection().SetPortName(prx.Name()) + + drxIp := drxEth. + Ipv4Addresses(). + Add(). + SetName("drxIp"). + SetAddress(tc["rxIp"].(string)). + SetGateway(tc["rxGateway"].(string)). + SetPrefix(tc["rxPrefix"].(uint32)) + + flow := c.Flows().Add() + flow.SetName("ftxV4") + flow.Duration().FixedPackets().SetPackets(tc["pktCount"].(uint32)) + flow.Rate().SetPps(tc["pktRate"].(uint64)) + flow.Size().SetFixed(tc["pktSize"].(uint32)) + flow.Metrics().SetEnable(true) + + flow.TxRx().Device(). + SetTxNames([]string{dtxIp.Name()}). + SetRxNames([]string{drxIp.Name()}) + + ftxV4Eth := flow.Packet().Add().Ethernet() + ftxV4Eth.Src().SetValue(dtxEth.Mac()) + + ftxV4Ip := flow.Packet().Add().Ipv4() + ftxV4Ip.Src().SetValue(tc["txIp"].(string)) + ftxV4Ip.Dst().SetValue(tc["rxIp"].(string)) + + api.Testing().Logf("Config:\n%v\n", c) + return c +} + +func flowMetricsOk(api *otg.OtgApi, tc map[string]interface{}) bool { + pktCount := uint64(tc["pktCount"].(uint32)) + + for _, m := range api.GetFlowMetrics() { + if m.Transmit() != gosnappi.FlowMetricTransmit.STOPPED || + m.FramesTx() != pktCount || + m.FramesRx() != pktCount { + return false + } + + } + + return true +} + +func ipNeighborsIpv4NeighborsOk(api *otg.OtgApi, tc map[string]interface{}) bool { + count := 0 + for _, n := range api.GetIpv4Neighbors() { + if n.HasLinkLayerAddress() { + for _, key := range []string{"txGateway", "rxGateway"} { + if n.Ipv4Address() == tc[key].(string) { + count += 1 + } + } + } + } + + return count == 2 +}