diff --git a/Makefile b/Makefile index 7e9e445..4a27c03 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,9 @@ KIND_ARGS=--image kindest/node:v$(K8S_VERSION) endif ifeq ($(CI),true) - DOCKER_COMPOSE_TTY_ARG=-T + DOCKER_COMPOSE_RUN_ARG=--no-TTY --rm else - DOCKER_COMPOSE_TTY_ARG= + DOCKER_COMPOSE_RUN_ARG=--rm endif .PHONY: up @@ -124,23 +124,23 @@ cleanup-partition: .PHONY: _privatenet _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 + docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl network list --name user-private-network | grep user-private-network || docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl network allocate --partition mini-lab --project 00000000-0000-0000-0000-000000000001 --name user-private-network .PHONY: machine machine: _privatenet - 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" --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}') + docker compose run $(DOCKER_COMPOSE_RUN_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" --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}') .PHONY: firewall firewall: _privatenet - 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" --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 }}') + docker compose run $(DOCKER_COMPOSE_RUN_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" --firewall-rules-file=/tmp/rules.yaml --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl network list --name user-private-network -o template --template '{{ .id }}') .PHONY: public-ip public-ip: - @docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl network ip list --name test --network internet-mini-lab -o template --template "{{ .ipaddress }}" + @docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl network ip list --name test --network internet-mini-lab -o template --template "{{ .ipaddress }}" .PHONY: ls ls: env - docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine ls + docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl machine ls ## SWITCH MANAGEMENT ## @@ -173,7 +173,7 @@ start-machines: .PHONY: _password _password: env - docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine consolepassword $(MACHINE_UUID) + docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl machine consolepassword $(MACHINE_UUID) .PHONY: password-machine01 password-machine01: @@ -185,7 +185,7 @@ password-machine02: .PHONY: _free-machine _free-machine: env - docker compose run $(DOCKER_COMPOSE_TTY_ARG) metalctl machine rm $(MACHINE_UUID) + docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl machine rm $(MACHINE_UUID) docker exec vms /mini-lab/manage_vms.py --names $(MACHINE_NAME) kill --with-disks docker exec vms /mini-lab/manage_vms.py --names $(MACHINE_NAME) create diff --git a/images/sonic/config_db.json b/images/sonic/config_db.json index b34fca1..56f4742 100644 --- a/images/sonic/config_db.json +++ b/images/sonic/config_db.json @@ -21,9 +21,6 @@ "mgmt-framework": { "state": "disabled" }, - "pmon": { - "state": "disabled" - }, "snmp": { "state": "disabled" }, diff --git a/images/sonic/launch.py b/images/sonic/launch.py index 1f3af01..7f350af 100755 --- a/images/sonic/launch.py +++ b/images/sonic/launch.py @@ -91,6 +91,8 @@ def initial_configuration(g: GuestFS) -> None: g.ln_s(linkname=systemd_system + 'tacacs-config.timer', target='/dev/null') # After boot Host configuration # Started by featured g.ln_s(linkname=sonic_target_wants + 'lldp.service', target='/lib/systemd/system/lldp.service') + 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') # Workaround: Only useful for BackEndToRRouter g.ln_s(linkname=systemd_system + 'backend-acl.service', target='/dev/null') diff --git a/roles/sonic/tasks/fix-network-performance.yaml b/roles/sonic/tasks/fix-network-performance.yaml new file mode 100644 index 0000000..c1ccac0 --- /dev/null +++ b/roles/sonic/tasks/fix-network-performance.yaml @@ -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 }}" diff --git a/roles/sonic/tasks/main.yaml b/roles/sonic/tasks/main.yaml index 8303d57..537c608 100644 --- a/roles/sonic/tasks/main.yaml +++ b/roles/sonic/tasks/main.yaml @@ -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 diff --git a/test/integration.sh b/test/integration.sh index 84c7f42..702499a 100755 --- a/test/integration.sh +++ b/test/integration.sh @@ -5,7 +5,7 @@ echo "Starting mini-lab" make up echo "Waiting for machines to get to waiting state" -waiting=$(docker compose run -T metalctl machine ls | grep Waiting | wc -l) +waiting=$(docker compose run --no-TTY --rm metalctl machine ls | grep Waiting | wc -l) minWaiting=2 declare -i attempts=0 until [ "$waiting" -ge $minWaiting ] @@ -16,7 +16,7 @@ do fi echo "$waiting/$minWaiting machines are waiting" sleep 5 - waiting=$(docker compose run -T metalctl machine ls | grep Waiting | wc -l) + waiting=$(docker compose run --no-TTY --rm metalctl machine ls | grep Waiting | wc -l) attempts=$attempts+1 done echo "$waiting/$minWaiting machines are waiting" @@ -26,7 +26,7 @@ make firewall make machine echo "Waiting for machines to get to Phoned Home state" -phoned=$(docker compose run -T metalctl machine ls | grep Phoned | wc -l) +phoned=$(docker compose run --no-TTY --rm metalctl machine ls | grep Phoned | wc -l) minPhoned=2 declare -i attempts=0 until [ "$phoned" -ge $minPhoned ] @@ -37,7 +37,7 @@ do fi echo "$phoned/$minPhoned machines have phoned home" sleep 5 - phoned=$(docker compose run -T metalctl machine ls | grep Phoned | wc -l) + phoned=$(docker compose run --no-TTY --rm metalctl machine ls | grep Phoned | wc -l) attempts+=1 done echo "$phoned/$minPhoned machines have phoned home"