Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPerf #182

Closed
wants to merge 9 commits into from
Closed

iPerf #182

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,20 @@ cleanup-partition:
_privatenet: env
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network | grep user-private-network || docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network allocate --partition mini-lab --project 00000000-0000-0000-0000-000000000001 --name user-private-network

.PHONY: _public_ips
_public_ips: env
.PHONY: firewall
firewall: _privatenet
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip list --name firewall | grep firewall || docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip create --network internet-mini-lab --project 00000000-0000-0000-0000-000000000001 --ipaddress 203.0.113.129 --name firewall
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip list --name machine | grep machine || docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip create --network internet-mini-lab --project 00000000-0000-0000-0000-000000000001 --ipaddress 203.0.113.130 --name machine
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl firewall create --description firewall --name firewall --hostname firewall --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --userdata "@/tmp/ignition.json" --ips 203.0.113.129 --firewall-rules-file=/tmp/rules.yaml --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}')

.PHONY: machine
machine: _privatenet _public_ips
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine create --description test --name test --hostname test --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image $(MACHINE_OS) --size v1-small-x86 --userdata "@/tmp/ignition.json" --ips 203.0.113.130 --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}')
.PHONY: machine01
machine01: _privatenet
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip list --name machine01 | grep machine01 || docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip create --network internet-mini-lab --project 00000000-0000-0000-0000-000000000001 --ipaddress 203.0.113.130 --name machine01
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine create --description machine01 --name machine01 --hostname machine01 --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image $(MACHINE_OS) --size v1-small-x86 --userdata "@/tmp/ignition.json" --ips 203.0.113.130 --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}')

.PHONY: firewall
firewall: _privatenet _public_ips
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --userdata "@/tmp/ignition.json" --ips 203.0.113.129 --firewall-rules-file=/tmp/rules.yaml --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}')
.PHONY: machine02
machine02: _privatenet
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip list --name machine02 | grep machine02 || docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip create --network internet-mini-lab --project 00000000-0000-0000-0000-000000000001 --ipaddress 203.0.113.131 --name machine02
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine create --description machine02 --name machine02 --hostname machine02 --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image $(MACHINE_OS) --size v1-small-x86 --userdata "@/tmp/ignition.json" --ips 203.0.113.131 --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}')

.PHONY: ls
ls: env
Expand Down Expand Up @@ -172,6 +174,10 @@ ssh-leaf02:
start-machines:
docker exec vms /mini-lab/manage_vms.py --names $(LAB_MACHINES) create

.PHONY: start-machine03
start-machine03:
docker exec vms /mini-lab/manage_vms.py --names machine03 create

.PHONY: _password
_password: env
docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine consolepassword $(MACHINE_UUID)
Expand Down Expand Up @@ -232,9 +238,16 @@ ssh-firewall:
))
ssh -F files/ssh/config $(fw) $(COMMAND)

.PHONY: ssh-machine
ssh-machine:
$(eval machine = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp vrf $(VRF) neighbors test json' | \
.PHONY: ssh-machine01
ssh-machine01:
$(eval machine = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp vrf $(VRF) neighbors machine01 json' | \
python3 -c 'import sys, json; data = json.load(sys.stdin); key = next(iter(data)); print(data[key][\"bgpNeighborAddr\"] + \"%\" + key)'" \
))
ssh -F files/ssh/config $(machine) $(COMMAND)

.PHONY: ssh-machine02
ssh-machine02:
$(eval machine = $(shell ssh -F files/ssh/config leaf01 "vtysh -c 'show bgp vrf $(VRF) neighbors machine02 json' | \
python3 -c 'import sys, json; data = json.load(sys.stdin); key = next(iter(data)); print(data[key][\"bgpNeighborAddr\"] + \"%\" + key)'" \
))
ssh -F files/ssh/config $(machine) $(COMMAND)
Expand All @@ -243,7 +256,7 @@ ssh-machine:
connect-to-cloudflare:
@echo "Attempting to connect to Cloudflare..."
@for i in $$(seq 1 $(MAX_RETRIES)); do \
if $(MAKE) ssh-machine COMMAND="sudo curl --connect-timeout 1 --fail --silent https://1.1.1.1" > /dev/null 2>&1; then \
if $(MAKE) ssh-machine01 COMMAND="sudo curl --connect-timeout 1 --fail --silent https://1.1.1.1" > /dev/null 2>&1; then \
echo "Connected successfully"; \
exit 0; \
else \
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ Free a machine with `make free-machine01` or
docker compose run --rm metalctl machine rm e0ab02d2-27cd-5a5e-8efc-080ba80cf258
```

## iPerf

To test network performance between the machines run:

```bash
make start-machine03
make machine02
./test/iperf.sh
```

## Flavors

There's few versions of mini-lab environment that you can run. We call them flavors. There's 2 flavors at the moment:
Expand Down
6 changes: 6 additions & 0 deletions files/rules.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
---
egress:
- comment: allow outgoing http
ports:
- 80
protocol: TCP
to:
- 0.0.0.0/0
- comment: allow outgoing https
ports:
- 443
Expand Down
3 changes: 0 additions & 3 deletions images/sonic/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"mgmt-framework": {
"state": "disabled"
},
"pmon": {
"state": "disabled"
},
"snmp": {
"state": "disabled"
},
Expand Down
2 changes: 2 additions & 0 deletions images/sonic/sonic_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def initial_configuration(g: GuestFS) -> None:
g.ln_s(linkname=systemd_system + 'featured.timer', target='/dev/null') # Feature handling not necessary
g.ln_s(linkname=systemd_system + 'hostcfgd.timer', target='/dev/null') # After boot Host configuration
# Started by featured
g.ln_s(linkname=systemd_system + 'pmon.service', target='/lib/systemd/system/pmon.service')
g.ln_s(linkname=sonic_target_wants + 'pmon.service', target='/lib/systemd/system/pmon.service')
g.ln_s(linkname=sonic_target_wants + 'lldp.service', target='/lib/systemd/system/lldp.service')

# Workaround: Only useful for BackEndToRRouter
Expand Down
16 changes: 16 additions & 0 deletions roles/sonic/tasks/fix-network-performance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Collect facts about interfaces
ansible.builtin.setup:
gather_subset:
- '!all'
- '!min'
- interfaces

- name: Gather all network interfaces except eth0
set_fact:
interfaces: "{{ ansible_interfaces | select('match', '^eth[0-9]+$') | reject('equalto', 'eth0') | list }}"

- name: Disable GRO on all network interfaces except eth0
shell: ethtool -K {{ item }} gro off
become: true
with_items: "{{ interfaces }}"
3 changes: 3 additions & 0 deletions roles/sonic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
- name: Install frr-pythontools
ansible.builtin.import_tasks: frr-reload.yaml

- name: Fix Network Performance
ansible.builtin.import_tasks: fix-network-performance.yaml

- name: Set lldp tx-interval to 10
ansible.builtin.command: lldpcli configure lldp tx-interval 10
retries: 10
Expand Down
4 changes: 2 additions & 2 deletions test/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ do
done
echo "$waiting/$minWaiting machines are waiting"

echo "Create firewall and machine"
echo "Create firewall and machine01"
make firewall
make machine
make machine01

echo "Waiting for machines to get to Phoned Home state"
phoned=$(docker compose run -T metalctl machine ls | grep Phoned | wc -l)
Expand Down
12 changes: 12 additions & 0 deletions test/iperf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -o errexit

echo "Install iperf3"
ssh -o StrictHostKeyChecking=no -o "PubkeyAcceptedKeyTypes +ssh-rsa" -i files/ssh/id_rsa [email protected] "sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes iperf3"
ssh -o StrictHostKeyChecking=no -o "PubkeyAcceptedKeyTypes +ssh-rsa" -i files/ssh/id_rsa [email protected] "sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes iperf3"

echo "Start iperf3 server on machine01"
ssh -o StrictHostKeyChecking=no -o "PubkeyAcceptedKeyTypes +ssh-rsa" -i files/ssh/id_rsa [email protected] "sudo iperf3 --server --one-off --daemon --bind 203.0.113.130"

echo "Run iperf3 test on machine02"
ssh -o StrictHostKeyChecking=no -o "PubkeyAcceptedKeyTypes +ssh-rsa" -i files/ssh/id_rsa [email protected] "iperf3 --client 203.0.113.130"