-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'aristanetworks:main' into campus-evpnvxlan-dg
- Loading branch information
Showing
12 changed files
with
223 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{ | ||
"name": "AVD Universal", | ||
"image": "ghcr.io/aristanetworks/avd/universal:python3.11-avd-devel" | ||
"image": "ghcr.io/aristanetworks/aclabs/dev:latest" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: Create pre-built container for acLabs development | ||
|
||
on: | ||
push: | ||
branches: ['**'] # branches will be filtered in the jobs | ||
paths: | ||
- .github/workflows/container_build_dev.yml | ||
- .github/workflows/container_build_child.yml | ||
- containers/dev/** | ||
workflow_dispatch: | ||
branches: ['**'] # branches will be filtered in the jobs | ||
|
||
jobs: | ||
build-demo-container: | ||
# fork - build container from any branch for testing | ||
# parent repo - build on main branch only | ||
if: github.repository != 'aristanetworks/acLabs' || github.ref == 'refs/heads/main' | ||
uses: ./.github/workflows/container_build_child.yml | ||
with: | ||
container_name: "dev" | ||
image_tags: "latest" | ||
from_image: "mcr.microsoft.com/devcontainers/base" | ||
from_variant: "ubuntu-22.04" | ||
username: "vscode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: Create alpine host container image | ||
|
||
on: | ||
push: | ||
branches: ['**'] # branches will be filtered in the jobs | ||
paths: | ||
- .github/workflows/container_build_host_alpine.yml | ||
- .github/workflows/container_build_child.yml | ||
- containers/host-alpine/** | ||
workflow_dispatch: | ||
branches: ['**'] # branches will be filtered in the jobs | ||
|
||
jobs: | ||
build-demo-container: | ||
# fork - build container from any branch for testing | ||
# parent repo - build on main branch only | ||
if: github.repository != 'aristanetworks/acLabs' || github.ref == 'refs/heads/main' | ||
uses: ./.github/workflows/container_build_child.yml | ||
with: | ||
container_name: "host-alpine" | ||
image_tags: "latest" | ||
from_image: "alpine" | ||
from_variant: "latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ARG FROM_IMAGE | ||
ARG FROM_VARIANT | ||
|
||
FROM ${FROM_IMAGE}:${FROM_VARIANT} | ||
|
||
RUN apk update && \ | ||
apk add libteam && \ | ||
apk add open-lldp && \ | ||
apk add sudo && \ | ||
apk add tcpdump && \ | ||
apk add scapy && \ | ||
apk add iperf3 | ||
|
||
RUN adduser -u 1000 -G wheel -D alpine && \ | ||
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
COPY ./entrypoint.sh /bin/entrypoint.sh | ||
RUN chmod +x /bin/entrypoint.sh | ||
|
||
USER alpine | ||
|
||
ENTRYPOINT [ "/bin/entrypoint.sh" ] | ||
|
||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"build": { | ||
"dockerfile": "./Dockerfile", | ||
"context": ".", | ||
"args": { | ||
"FROM_IMAGE": "${localEnv:FROM_IMAGE}", | ||
"FROM_VARIANT": "${localEnv:FROM_VARIANT}", | ||
"USERNAME": "${localEnv:USERNAME}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#!/bin/sh | ||
|
||
UPLINK='eth' | ||
|
||
# TMODE is expected to be set via the containerlab topology file prior to deployment | ||
# Expected values are "lacp" or "static" or "active-backup" which will bond eth1 and eth2 | ||
if [ -z "$TMODE" ]; then | ||
TMODE='none' | ||
fi | ||
|
||
# TACTIVE and TBACKUP to be set via the containerlab topology file for active-backup runner | ||
# expected values are "eth1" or "eth2" default is "eth1" active and "eth2" backup | ||
if [ -z "$TACTIVE" ]; then | ||
TACTIVE='eth1' | ||
TBACKUP='eth2' | ||
elif [ "$TACTIVE" == 'eth1' ]; then | ||
TBACKUP='eth2' | ||
elif [ "$TACTIVE" == 'eth2' ]; then | ||
TBACKUP='eth1' | ||
fi | ||
|
||
echo "teaming mode is " $TMODE | ||
|
||
####################### | ||
# Re-run script as sudo | ||
####################### | ||
|
||
if [ "$(id -u)" != "0" ]; then | ||
exec sudo --preserve-env=TMODE,TACTIVE,TBACKUP "$0" "$@" | ||
fi | ||
|
||
########################## | ||
# Check operation status | ||
########################## | ||
|
||
check=$( cat /sys/class/net/eth1/operstate 2>/dev/null ) | ||
|
||
while [ "up" != "$check" ] ; do | ||
echo "waiting for interface to come up" | ||
check=$( cat /sys/class/net/eth1/operstate 2>/dev/null ) | ||
done | ||
|
||
check=$( cat /sys/class/net/eth2/operstate 2>/dev/null ) | ||
|
||
while [ "up" != "$check" ] ; do | ||
echo "waiting for interface to come up" | ||
check=$( cat /sys/class/net/eth1/operstate 2>/dev/null ) | ||
done | ||
|
||
cat /sys/class/net/eth1/operstate | ||
cat /sys/class/net/eth1/operstate | ||
|
||
############### | ||
# Enabling LLDP | ||
############### | ||
|
||
lldpad -d | ||
for i in `ls /sys/class/net/ | grep 'eth\|ens\|eno'` | ||
do | ||
lldptool set-lldp -i $i adminStatus=rxtx | ||
lldptool -T -i $i -V sysName enableTx=yes | ||
lldptool -T -i $i -V portDesc enableTx=yes | ||
lldptool -T -i $i -V sysDesc enableTx=yes | ||
done | ||
|
||
################ | ||
# Teaming setup | ||
################ | ||
|
||
cat << EOF > /home/alpine/teamd-lacp.conf | ||
{ | ||
"device": "team0", | ||
"runner": { | ||
"name": "lacp", | ||
"active": true, | ||
"fast_rate": true, | ||
"tx_hash": ["eth", "ipv4", "ipv6"] | ||
}, | ||
"link_watch": {"name": "ethtool"}, | ||
"ports": {"eth1": {}, "eth2": {}} | ||
} | ||
EOF | ||
|
||
cat << EOF > /home/alpine/teamd-static.conf | ||
{ | ||
"device": "team0", | ||
"runner": {"name": "roundrobin"}, | ||
"ports": {"eth1": {}, "eth2": {}} | ||
} | ||
EOF | ||
|
||
cat << EOF > /home/alpine/teamd-active-backup.conf | ||
{ | ||
"device": "team0", | ||
"runner": {"name": "activebackup"}, | ||
"link_watch": {"name": "ethtool"}, | ||
"ports": { | ||
"$TACTIVE": { | ||
"prio": 100 | ||
}, | ||
"$TBACKUP": { | ||
"prio": -10 | ||
} | ||
} | ||
} | ||
EOF | ||
|
||
if [ "$TMODE" == 'lacp' ]; then | ||
TARG='/home/alpine/teamd-lacp.conf' | ||
elif [ "$TMODE" == 'static' ]; then | ||
TARG='/home/alpine/teamd-static.conf' | ||
elif [ "$TMODE" == 'active-backup' ]; then | ||
TARG='/home/alpine/teamd-active-backup.conf' | ||
fi | ||
|
||
if [ "$TMODE" == 'lacp' ] || [ "$TMODE" == 'static' ] || [ "$TMODE" == 'active-backup' ]; then | ||
teamd -v | ||
teamd -k -f $TARG | ||
ip link set eth1 down | ||
ip link set eth2 down | ||
teamd -d -r -f $TARG | ||
|
||
ip link set team0 up | ||
UPLINK="team" | ||
fi | ||
|
||
##################### | ||
# Enter sleeping loop | ||
##################### | ||
|
||
while sleep 3600; do :; done |