Skip to content

Commit 43b95e6

Browse files
mwindowerrobertvolkmanniljarotarsimcod
authored
Introduce new mini-lab flavor for Enterprise SONiC and fix capi-lab (#272)
This adds yet another flavor (`dell_sonic`) to the mini-lab for Enterprise SONiC (Dell, Broadcom). Version 4.4.3. was tested initially. By default we test against version 4.5.1. * Add flavor for dell sonic * DROP ME: use image with installed sshpass * Fix README * Use known working metal-core for Enterprise SONiC * Fix metal_core_spine_uplinks * The kind dell_sonic only supports 10 interfaces * Fix Makefile targets for dell_sonic * Set hello timer for LLDP * Activate IP MASQUERADE and IPv4 forwarding on eth0 * Reformat task names * Adjust README.md * trying to fix issues with docker pull and lldp ports config * login to r.metal-stack.io * use proper image * pull dell_sonic image within CI * add a Makefile dev target to build vrnetlab/dell_sonic with a given sonic-vs.img * use old metal-core version * check for queued routes * use dell_sonic for capms flavor * capi needs more disk space + fix lldp for Ethernet2 to also get machine03 * Add fourth machine * adapt README.md * ipv6 lla at vlan interfaces + longer wait time for metal-core * wait * fix * use released version of metal-core * use version 4.5.1 * use common deployment image * enterprise sonic 4.4.3 and 4.5.1 * use metal-core@fix-ethernet-packet-overflow * use [email protected] * use metal-core from release_version develop * remove unnecessary files * use deployment_base_image from release vector * use proper database version 4.5.3 for Enterprise SONiC 4.5.1 --------- Co-authored-by: Robert Volkmann <[email protected]> Co-authored-by: Ilja Rotar <[email protected]> Co-authored-by: Simon Mayer <[email protected]>
1 parent d4a2b3e commit 43b95e6

File tree

15 files changed

+676
-30
lines changed

15 files changed

+676
-30
lines changed

.github/workflows/integration.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
flavors:
9898
- name: sonic
9999
- name: gardener
100+
- name: dell_sonic
100101

101102
steps:
102103
- name: Gain back workspace permissions # https://github.com/actions/checkout/issues/211
@@ -111,6 +112,13 @@ jobs:
111112
# set if required:
112113
# DESIRED_VERSION: v0.59.0
113114

115+
- name: Log in to the container registry
116+
uses: docker/login-action@v3
117+
with:
118+
registry: r.metal-stack.io
119+
username: ${{ secrets.R_METALSTACK_IO_READ_USER }}
120+
password: ${{ secrets.R_METALSTACK_IO_READ_PASSWORD }}
121+
114122
- name: Checkout
115123
uses: actions/checkout@v4
116124

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ files/certs/*.pem
1717
files/certs/**/*.pem
1818
files/certs/**/*.crt
1919
.vscode
20+
vrnetlab

Makefile

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ ANSIBLE_EXTRA_VARS_FILE := $(or $(ANSIBLE_EXTRA_VARS_FILE),)
2222
MINI_LAB_FLAVOR := $(or $(MINI_LAB_FLAVOR),sonic)
2323
MINI_LAB_VM_IMAGE := $(or $(MINI_LAB_VM_IMAGE),ghcr.io/metal-stack/mini-lab-vms:latest)
2424
MINI_LAB_SONIC_IMAGE := $(or $(MINI_LAB_SONIC_IMAGE),ghcr.io/metal-stack/mini-lab-sonic:latest)
25+
MINI_LAB_DELL_SONIC_VERSION := $(or $(MINI_LAB_DELL_SONIC_VERSION),4.5.1)
2526

2627
MACHINE_OS=debian-12.0
2728
MAX_RETRIES := 30
2829

2930
# Machine flavors
3031
ifeq ($(MINI_LAB_FLAVOR),sonic)
3132
LAB_TOPOLOGY=mini-lab.sonic.yaml
33+
else ifeq ($(MINI_LAB_FLAVOR),dell_sonic)
34+
LAB_TOPOLOGY=mini-lab.dell_sonic.yaml
35+
MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION)
3236
else ifeq ($(MINI_LAB_FLAVOR),capms)
3337
LAB_TOPOLOGY=mini-lab.capms.yaml
38+
MINI_LAB_SONIC_IMAGE=r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION)
3439
else ifeq ($(MINI_LAB_FLAVOR),gardener)
3540
GARDENER_ENABLED=true
3641
# usually gardener restricts the maximum version for k8s:
@@ -59,13 +64,10 @@ up: env gen-certs control-plane-bake partition-bake
5964
# for some reason an allocated machine will not be able to phone home
6065
# without restarting the metal-core
6166
# TODO: should be investigated and fixed if possible
67+
# check that underlay gets working
6268
sleep 10
6369
ssh -F files/ssh/config leaf01 'systemctl restart metal-core'
6470
ssh -F files/ssh/config leaf02 'systemctl restart metal-core'
65-
# TODO: for community SONiC versions > 202311 a bgp restart is needed in the virtual environment
66-
sleep 15
67-
ssh -F files/ssh/config leaf01 'systemctl restart bgp'
68-
ssh -F files/ssh/config leaf02 'systemctl restart bgp'
6971

7072
.PHONY: restart
7173
restart: down up
@@ -113,7 +115,12 @@ partition: partition-bake
113115
.PHONY: partition-bake
114116
partition-bake: external_network
115117
docker pull $(MINI_LAB_VM_IMAGE)
118+
ifeq ($(CI),true)
119+
docker pull $(MINI_LAB_SONIC_IMAGE)
120+
endif
121+
ifneq ($(filter $(MINI_LAB_FLAVOR),dell_sonic capms),$(MINI_LAB_FLAVOR))
116122
docker pull $(MINI_LAB_SONIC_IMAGE)
123+
endif
117124
@if ! sudo $(CONTAINERLAB) --topo $(LAB_TOPOLOGY) inspect | grep -i leaf01 > /dev/null; then \
118125
sudo --preserve-env $(CONTAINERLAB) deploy --topo $(LAB_TOPOLOGY) --reconfigure && \
119126
./scripts/deactivate_offloading.sh; fi
@@ -152,6 +159,7 @@ cleanup-control-plane:
152159
.PHONY: cleanup-partition
153160
cleanup-partition:
154161
mkdir -p clab-mini-lab
162+
sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.dell_sonic.yaml
155163
sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.sonic.yaml
156164
sudo --preserve-env $(CONTAINERLAB) destroy --topo mini-lab.capms.yaml
157165
docker network rm --force mini_lab_ext
@@ -249,6 +257,10 @@ power-on-machine02:
249257
power-on-machine03:
250258
@$(MAKE) --no-print-directory _ipmi_power VM=machine03 COMMAND=on
251259

260+
.PHONY: power-on-machine04
261+
power-on-machine04:
262+
@$(MAKE) --no-print-directory _ipmi_power VM=machine04 COMMAND=on
263+
252264
.PHONY: power-reset-machine01
253265
power-reset-machine01:
254266
@$(MAKE) --no-print-directory _ipmi_power VM=machine01 COMMAND=reset
@@ -261,6 +273,10 @@ power-reset-machine02:
261273
power-reset-machine03:
262274
@$(MAKE) --no-print-directory _ipmi_power VM=machine03 COMMAND=reset
263275

276+
.PHONY: power-reset-machine04
277+
power-reset-machine04:
278+
@$(MAKE) --no-print-directory _ipmi_power VM=machine04 COMMAND=reset
279+
264280
.PHONY: power-off-machine01
265281
power-off-machine01:
266282
@$(MAKE) --no-print-directory _ipmi_power VM=machine01 COMMAND=off
@@ -273,6 +289,10 @@ power-off-machine02:
273289
power-off-machine03:
274290
@$(MAKE) --no-print-directory _ipmi_power VM=machine03 COMMAND=off
275291

292+
.PHONY: power-off-machine04
293+
power-off-machine04:
294+
@$(MAKE) --no-print-directory _ipmi_power VM=machine04 COMMAND=off
295+
276296
.PHONY: _console
277297
_console:
278298
docker exec --interactive --tty $(VM) ipmitool -C 3 -I lanplus -U ADMIN -P ADMIN -H 127.0.0.1 sol activate
@@ -289,6 +309,10 @@ console-machine02:
289309
console-machine03:
290310
@$(MAKE) --no-print-directory _console VM=machine03
291311

312+
.PHONY: console-machine04
313+
console-machine04:
314+
@$(MAKE) --no-print-directory _console VM=machine04
315+
292316
.PHONY: _password
293317
_password: env
294318
docker compose run $(DOCKER_COMPOSE_RUN_ARG) metalctl machine consolepassword $(MACHINE_UUID)
@@ -301,6 +325,14 @@ password-machine01:
301325
password-machine02:
302326
@$(MAKE) --no-print-directory _password MACHINE_NAME=machine02 MACHINE_UUID=00000000-0000-0000-0000-000000000002
303327

328+
.PHONY: password-machine03
329+
password-machine03:
330+
@$(MAKE) --no-print-directory _password MACHINE_NAME=machine03 MACHINE_UUID=00000000-0000-0000-0000-000000000003
331+
332+
.PHONY: password-machine04
333+
password-machine04:
334+
@$(MAKE) --no-print-directory _password MACHINE_NAME=machine04 MACHINE_UUID=00000000-0000-0000-0000-000000000004
335+
304336
.PHONY: password-machine0%
305337
password-machine0%:
306338
@$(MAKE) --no-print-directory _password MACHINE_NAME=machine0$* MACHINE_UUID=00000000-0000-0000-0000-00000000000$*
@@ -371,6 +403,17 @@ dev-env:
371403
@echo "export METALCTL_HMAC=${METALCTL_HMAC}"
372404
@echo "export KUBECONFIG=$(KUBECONFIG)"
373405

406+
build-dell-sonic:
407+
if [ ! -f "sonic-vs.img" ]; then \
408+
@echo "sonic-vs.img is expected in this directory"; exit; fi
409+
410+
@git clone https://github.com/srl-labs/vrnetlab.git
411+
@cd vrnetlab && git checkout e41f48bc5cae777b56b71b67e3c5642fdbd8f315
412+
@cp ./sonic-vs.img vrnetlab/dell/dell_sonic/dell-sonic-$(MINI_LAB_DELL_SONIC_VERSION).qcow2
413+
@cd vrnetlab/dell/dell_sonic && make
414+
docker tag vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION) r.metal-stack.io/vrnetlab/dell_sonic:$(MINI_LAB_DELL_SONIC_VERSION)
415+
@rm -rf ./vrnetlab
416+
374417
## Gardener integration
375418

376419
.PHONY: fetch-virtual-kubeconfig

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,12 @@ make power-<on,reset,off>-<machine name>
190190

191191
## Flavors
192192

193-
There are two versions, or flavors, of the mini-lab environment which differ in regards to the NOS running on the leaves:
193+
There are four flavors of the mini-lab environment:
194194

195-
- `sonic`: runs 2 SONiC switches
196-
- `capms`: runs the SONiC flavor but with three instead of two machines (this is used for [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack) in order to have dedicated hosts for control plane / worker / firewall)
197-
- `gardener`: installs the [Gardener](https://gardener.cloud) in the mini-lab
195+
- `sonic`: runs two Community SONiC switches
196+
- `dell_sonic`: runs two Enterprise SONiC switches with a [locally built vrnetlab image](https://github.com/srl-labs/vrnetlab/tree/master/dell/dell_sonic)
197+
- `capms`: runs the `dell_sonic` flavor but with four instead of two machines (this is used for [cluster-provider-metal-stack](https://github.com/metal-stack/cluster-api-provider-metal-stack) in order to have dedicated hosts for control plane / worker / firewall)
198+
- `gardener`: runs the `sonic` flavor and installs the [Gardener](https://gardener.cloud) in the mini-lab
198199

199200
In order to start specific flavor, you can define the flavor as follows:
200201

deploy_partition.yaml

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
- name: Configure leaves
3-
hosts: leaves
2+
- name: Configure leaves (Community SONiC)
3+
hosts: leaves:!dell_sonic
44
any_errors_fatal: true
55
gather_facts: false
66
pre_tasks:
@@ -16,8 +16,44 @@
1616
- name: sonic
1717
tags: sonic
1818

19-
- name: Deploy dhcp server and pixiecore on leaf01
20-
hosts: leaf01
19+
- name: Configure leaves (Enterprise SONiC)
20+
hosts: dell_sonic
21+
any_errors_fatal: true
22+
become: true
23+
tasks:
24+
- name: Check for bgpd.conf presence
25+
ansible.builtin.stat:
26+
path: /etc/sonic/frr/bgpd.conf
27+
register: bgpd_conf_stat
28+
29+
- name: Restart bgp service when non-split docker_routing_config_mode is still active
30+
ansible.builtin.service:
31+
name: bgp
32+
state: restarted
33+
when: bgpd_conf_stat.stat.exists
34+
35+
- name: Ensure root has authorized_key
36+
ansible.builtin.authorized_key:
37+
user: root
38+
state: present
39+
key: "{{ lookup('file', 'ssh/id_rsa.pub') }}"
40+
41+
- name: Activate IP MASQUERADE on eth0
42+
ansible.builtin.iptables:
43+
chain: POSTROUTING
44+
jump: MASQUERADE
45+
out_interface: eth0
46+
table: nat
47+
48+
- name: Activate IPv4 forwarding on eth0
49+
ansible.posix.sysctl:
50+
name: net.ipv4.conf.eth0.forwarding
51+
reload: no
52+
sysctl_set: yes
53+
value: "1"
54+
55+
- name: Deploy dhcp server on leaf01 (Community SONiC)
56+
hosts: leaf01:!dell_sonic
2157
pre_tasks:
2258
- name: Temporary workaround for EOL debian bullseye backports repository (using archive.debian.org)
2359
lineinfile:
@@ -29,12 +65,36 @@
2965
tags: always
3066
- name: metal-roles/partition/roles/dhcp
3167
tags: dhcp
68+
69+
# FIXME: For some reason, the first docker pull always fails on dell_sonic but succeeds on second attempt.
70+
# Investigate the cause and remove this play
71+
- name: Intentionally fail on first docker pull
72+
hosts: dell_sonic
73+
tasks:
74+
- community.docker.docker_container:
75+
name: hello-world
76+
image: library/hello-world:latest
77+
cleanup: true
78+
pull: true
79+
failed_when: false
80+
81+
- name: Deploy pixiecore on leaf01
82+
hosts: leaf01
83+
become: true
84+
roles:
85+
- name: ansible-common
86+
tags: always
3287
- name: metal-roles/partition/roles/pixiecore
3388
tags: pixiecore
3489

3590
- name: Deploy metal-core
3691
hosts: leaves
3792
any_errors_fatal: true
93+
become: true
94+
pre_tasks:
95+
- name: Wait some time
96+
pause:
97+
seconds: 120
3898
roles:
3999
- name: ansible-common
40100
tags: always
@@ -58,9 +118,36 @@
58118
- name: Wait for switches to register
59119
command: echo
60120
changed_when: false
61-
retries: 60
121+
retries: 100
62122
delay: 3
63123
until:
64124
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key) | length == 2
65125
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[0]["last_sync"] != None
66126
- lookup('metal', 'search', 'switch', api_url=metal_partition_metal_api_protocol+'://'+metal_partition_metal_api_addr+':'+metal_partition_metal_api_port|string+metal_partition_metal_api_basepath, api_hmac=metal_partition_metal_api_hmac_edit_key)[1]["last_sync"] != None
127+
128+
- name: Wait for underlay (Community SONiC)
129+
hosts: leaves:!dell_sonic
130+
any_errors_fatal: true
131+
gather_facts: false
132+
pre_tasks:
133+
- name: Wait until no route entries have "queued"
134+
include_tasks: tasks/check_queued.yaml
135+
136+
- name: Configure IPv6 and LLDP ports (Enterprise SONiC)
137+
hosts: dell_sonic
138+
any_errors_fatal: true
139+
become: true
140+
tasks:
141+
- name: Enable IPv6 to also have LLA at VLAN interfaces
142+
sysctl:
143+
name: net.ipv6.conf.default.disable_ipv6
144+
value: '0'
145+
state: present
146+
sysctl_file: /etc/sysctl.conf
147+
- name: Configure LLDP port IDs and descriptions
148+
ansible.builtin.command: "{{ item }}"
149+
with_items:
150+
- lldpcli configure ports Ethernet0 lldp portidsubtype local Eth1/1
151+
- lldpcli configure ports Ethernet1 lldp portidsubtype local Eth1/2
152+
- lldpcli configure ports Ethernet2 lldp portidsubtype local Eth1/3
153+
- lldpcli configure ports Ethernet3 lldp portidsubtype local Eth1/4

files/kea.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"Dhcp4": {
3+
"option-data": [
4+
{
5+
"name": "domain-name-servers",
6+
"data": "1.1.1.1, 8.8.8.8",
7+
"always-send": true
8+
}
9+
],
10+
"subnet4": [
11+
{
12+
"id": 1,
13+
"subnet": "10.0.1.0/25",
14+
"pools": [
15+
{
16+
"pool": "10.0.1.2 - 10.0.1.127"
17+
}
18+
],
19+
"option-data": [
20+
{
21+
"name": "routers",
22+
"data": "10.0.1.1"
23+
}
24+
]
25+
}
26+
],
27+
"interfaces-config": {
28+
"interfaces": [
29+
"lo"
30+
],
31+
"dhcp-socket-type": "udp",
32+
"outbound-interface": "use-routing"
33+
},
34+
"control-socket": {
35+
"socket-type": "unix",
36+
"socket-name": "/run/kea/control_socket_4"
37+
},
38+
"loggers": [
39+
{
40+
"name": "kea-dhcp4",
41+
"output_options": [
42+
{
43+
"output": "stdout"
44+
}
45+
],
46+
"severity": "DEBUG"
47+
}
48+
],
49+
"lease-database": {
50+
"type": "memfile"
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)