Skip to content

Commit 2469413

Browse files
authored
Merge pull request #31 from open-traffic-generator/ixia-c-te-frr-ci
Added CI to `clab/ixia-c-te-frr` lab
2 parents e2edf3f + ffba2a6 commit 2469413

File tree

4 files changed

+116
-4
lines changed

4 files changed

+116
-4
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- 'clab/ixia-c-b2b/**'
2020
- '!clab/ixia-c-b2b/**.md'
2121
- '!clab/ixia-c-b2b/**.png'
22+
- 'clab/ixia-c-te-frr/**'
23+
- '!clab/ixia-c-te-frr/**.md'
24+
- '!clab/ixia-c-te-frr/**.png'
2225
- 'clab/rtbh/**'
2326
- '!clab/rtbh/**.md'
2427
- '!clab/rtbh/**.png'
@@ -40,6 +43,9 @@ on:
4043
- 'clab/ixia-c-b2b/**'
4144
- '!clab/ixia-c-b2b/**.md'
4245
- '!clab/ixia-c-b2b/**.png'
46+
- 'clab/ixia-c-te-frr/**'
47+
- '!clab/ixia-c-te-frr/**.md'
48+
- '!clab/ixia-c-te-frr/**.png'
4349
- 'clab/rtbh/**'
4450
- '!clab/rtbh/**.md'
4551
- '!clab/rtbh/**.png'
@@ -56,6 +62,7 @@ jobs:
5662
docker-compose-cpdp-frr: ${{ steps.changes.outputs.docker-compose-cpdp-frr }}
5763
clab-cpdp-frr: ${{ steps.changes.outputs.clab-cpdp-frr }}
5864
clab-ixia-c-b2b: ${{ steps.changes.outputs.clab-ixia-c-b2b }}
65+
clab-ixia-c-te-frr: ${{ steps.changes.outputs.clab-ixia-c-te-frr }}
5966
clab-rtbh: ${{ steps.changes.outputs.clab-rtbh }}
6067
steps:
6168
- uses: actions/checkout@v3
@@ -77,6 +84,8 @@ jobs:
7784
- 'docker-compose/cpdp-frr/**'
7885
clab-ixia-c-b2b:
7986
- 'clab/ixia-c-b2b/**'
87+
clab-ixia-c-te-frr:
88+
- 'clab/ixia-c-te-frr/**'
8089
clab-rtbh:
8190
- 'clab/rtbh/**'
8291
- name: docker-compose b2b
@@ -97,6 +106,9 @@ jobs:
97106
- name: clab ixia-c-b2b
98107
if: steps.changes.outputs.clab-ixia-c-b2b == 'true'
99108
run: echo "Run Clab ixia-c-b2b CI"
109+
- name: clab ixia-c-te-frr
110+
if: steps.changes.outputs.clab-ixia-c-te-frr == 'true'
111+
run: echo "Run Clab ixia-c-te-frr CI"
100112
- name: clab rtbh
101113
if: steps.changes.outputs.clab-rtbh == 'true'
102114
run: echo "Run Clab RTBH CI"
@@ -208,6 +220,20 @@ jobs:
208220
submodules: 'true'
209221
- name: Run all
210222
run: make all
223+
clab-ixia-c-te-frr:
224+
name: Run Clab ixia-c-te-frr CI
225+
runs-on: ubuntu-20.04
226+
needs: paths-filter
227+
defaults:
228+
run:
229+
working-directory: ./clab/ixia-c-te-frr
230+
if: needs.paths-filter.outputs.clab-ixia-c-te-frr == 'true'
231+
steps:
232+
- uses: actions/checkout@v3
233+
with:
234+
submodules: 'true'
235+
- name: Run all
236+
run: make all
211237
clab-rtbh:
212238
name: Run Clab RTBH CI
213239
runs-on: ubuntu-20.04

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ To manage deployment of the example labs, we use one of the following declarativ
3838
## CI with Github Actions
3939

4040
[![CI](https://github.com/open-traffic-generator/otg-examples/actions/workflows/ci.yml/badge.svg)](https://github.com/open-traffic-generator/otg-examples/actions/workflows/ci.yml)
41-
Some of the lab examples include Github Action workflow for executing OTG tests on any changes to the lab code. This could serve as a template for your CI workflow.
41+
Most of the lab examples include Github Action workflow for executing OTG tests on any changes to the lab code. This could serve as a template for your CI workflow.
4242

4343
## Reference
4444

4545
| Lab | OTG Tool | DUT | Client | Infrastructure | CI |
4646
| ---------------------------------------------------------------------------------------------------------------------------- | ----------- | ---- | ------------------ | -------------- | --- |
4747
| [B2B Ixia-c Traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/docker-compose/b2b) | Ixia-c TE | B2B | `otgen` | Compose | yes |
48-
| [FRR Ixia-c Traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/clab/ixia-c-te-frr) | Ixia-c TE | FRR | `otgen` | Containerlab | no |
48+
| [FRR Ixia-c Traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/clab/ixia-c-te-frr) | Ixia-c TE | FRR | `otgen` | Containerlab | yes |
4949
| [3xB2B KENG Traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/docker-compose/b2b-3pair) | KENG TE | B2B | `otgen` | Compose | yes |
5050
| [B2B KENG BGP and traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/docker-compose/cpdp-b2b) | KENG PE+TE | B2B | `gosnappi` | Compose | yes |
5151
| [FRR KENG ARP, BGP and traffic](https://github.com/open-traffic-generator/otg-examples/blob/main/docker-compose/cpdp-frr) | KENG PE+TE | FRR | `curl` & `otgen` | Compose & Clab | yes |

clab/ixia-c-te-frr/Makefile

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
SHELL = /bin/bash
2+
3+
.PHONY: all
4+
all: install deploy run
5+
6+
.PHONY: clean
7+
clean: remove-clab
8+
9+
.PHONY: clean-all
10+
clean-all: clean install-clean
11+
12+
###############################
13+
# Install components
14+
###############################
15+
16+
.PHONY: install
17+
install: install-clab install-otgen
18+
19+
install-clab: /usr/bin/containerlab
20+
/usr/bin/containerlab:
21+
bash -c "$$(curl -sL https://get.containerlab.dev)"
22+
23+
install-otgen: /usr/local/bin/otgen
24+
/usr/local/bin/otgen:
25+
curl -L "https://github.com/open-traffic-generator/otgen/releases/download/v0.4.0/otgen_0.4.0_$$(uname -s)_$$(uname -m).tar.gz" | tar xzv otgen
26+
sudo mv otgen /usr/local/bin/otgen
27+
sudo chmod +x /usr/local/bin/otgen
28+
29+
install-clean:
30+
-sudo rm -f `command -v otgen`
31+
-sudo apt remove containerlab -y
32+
33+
###############################
34+
# Deploy lab
35+
###############################
36+
37+
.PHONY: deploy
38+
deploy: deploy-clab
39+
40+
deploy-clab:
41+
sudo containerlab deploy --reconfigure
42+
43+
remove-clab:
44+
sudo containerlab destroy --cleanup
45+
46+
###############################
47+
# Run tests
48+
###############################
49+
50+
.PHONY: run
51+
run: run-otgen
52+
53+
OTG_HOST="https://localhost"
54+
55+
.PHONY: run-otgen
56+
run-otgen:
57+
TE1SMAC=$$(cat clab-ixctedut/topology-data.json | jq -r '.links[0]["a"].mac'); \
58+
TE1DMAC=$$(cat clab-ixctedut/topology-data.json | jq -r '.links[0]["z"].mac'); \
59+
TE2SMAC=$$(cat clab-ixctedut/topology-data.json | jq -r '.links[1]["a"].mac'); \
60+
TE2DMAC=$$(cat clab-ixctedut/topology-data.json | jq -r '.links[1]["z"].mac'); \
61+
cat otg.yml | \
62+
sed "s/00:00:00:00:11:aa/$${TE1SMAC}/g" | sed "s/00:00:00:00:11:bb/$${TE1DMAC}/g" | \
63+
sed "s/00:00:00:00:22:aa/$${TE2SMAC}/g" | sed "s/00:00:00:00:22:bb/$${TE2DMAC}/g" | \
64+
otgen run -k | \
65+
otgen transform -m port | \
66+
otgen display -m table

clab/ixia-c-te-frr/README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ In this setup, we demonstrate how to deploy Ixia-c Traffic Engine nodes in Conta
1111

1212
![IP Diagram](./ip-diagram.png)
1313

14+
## Quick start
15+
16+
Follow this sections for a quick version of how to run the lab using `make`. This is how CI pipeline in GitHub Actions runs it.
17+
18+
1. Clone this repository
19+
20+
```Shell
21+
git clone https://github.com/open-traffic-generator/otg-examples.git
22+
cd otg-examples/clab/ixia-c-te-frr
23+
```
24+
25+
2. To run all the steps below at once, execute:
26+
27+
```Shell
28+
make all
29+
make clean
30+
```
31+
32+
Otherwise, follow step-by-step instructions below.
33+
1434
## Prerequisites
1535

1636
* Linux host or VM with sudo permissions and Docker support
@@ -20,7 +40,7 @@ In this setup, we demonstrate how to deploy Ixia-c Traffic Engine nodes in Conta
2040
* [otgen](https://github.com/open-traffic-generator/otgen)
2141

2242
```Shell
23-
curl -L "https://github.com/open-traffic-generator/otgen/releases/download/v0.2.0/otgen_0.2.0_$(uname -s)_$(uname -m).tar.gz" | tar xzv otgen
43+
curl -L "https://github.com/open-traffic-generator/otgen/releases/download/v0.4.0/otgen_0.4.0_$(uname -s)_$(uname -m).tar.gz" | tar xzv otgen
2444
sudo mv otgen /usr/local/bin/otgen
2545
sudo chmod +x /usr/local/bin/otgen
2646
```
@@ -74,7 +94,7 @@ sudo containerlab deploy
7494
cat otg.yml | \
7595
sed "s/00:00:00:00:11:aa/$TE1SMAC/g" | sed "s/00:00:00:00:11:bb/$TE1DMAC/g" | \
7696
sed "s/00:00:00:00:22:aa/$TE2SMAC/g" | sed "s/00:00:00:00:22:bb/$TE2DMAC/g" | \
77-
otgen run -k 2>/dev/null| \
97+
otgen run -k | \
7898
otgen transform -m port | \
7999
otgen display -m table
80100
```

0 commit comments

Comments
 (0)