Skip to content

Commit

Permalink
Merge branch 'master' into add-downscript
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Nov 18, 2024
2 parents 03ff9f2 + c20a174 commit e3bfc9a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand 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 ##

Expand Down Expand Up @@ -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:
Expand All @@ -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

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 @@ -21,9 +21,6 @@
"mgmt-framework": {
"state": "disabled"
},
"pmon": {
"state": "disabled"
},
"snmp": {
"state": "disabled"
},
Expand Down
2 changes: 2 additions & 0 deletions images/sonic/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
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
8 changes: 4 additions & 4 deletions test/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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"
Expand All @@ -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 ]
Expand All @@ -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"
Expand Down

0 comments on commit e3bfc9a

Please sign in to comment.