Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #271 from nre-learning/cumulus_vx_fix
Browse files Browse the repository at this point in the history
Cumulus VX fix.  Closes #265
  • Loading branch information
Mierdin authored Sep 20, 2019
2 parents b0bd002 + 7804ff0 commit 49f2ee7
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## In development

- Fixed Cumulus PTR demo [#271](https://github.com/nre-learning/nrelabs-curriculum/pull/271)
- Added Cumulus PTR demo [#253](https://github.com/nre-learning/nrelabs-curriculum/pull/253)
- Updated collection in BASH lesson file to 9 (PacketPushers) [#258](https://github.com/nre-learning/nrelabs-curriculum/pull/258)
- Disable caching for all image builds [#260](https://github.com/nre-learning/nrelabs-curriculum/pull/260)
Expand Down
2 changes: 1 addition & 1 deletion images/cvx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TARGET_VERSION ?= latest
all: docker

docker:
gsutil cp "gs://nrelabs-curriculum-base-images/cvx/cvx.qcow2" "./cvx.qcow2"
gsutil cp "gs://nrelabs-curriculum-base-images/cvx-3.7.8/cvx-3.7.8.qcow2" "./cvx.qcow2"
docker build --pull --no-cache -t antidotelabs/cvx:$(TARGET_VERSION) .
docker push antidotelabs/cvx:$(TARGET_VERSION)

23 changes: 15 additions & 8 deletions images/cvx/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

mount -o rw,remount /sys

random_mac () {
hexchars="0123456789abcdef"
end=$( for i in {1..6} ; do echo -n ${hexchars:$(( $RANDOM % 16 )):1} ; done | sed -e 's/\(..\)/:\1/g' )

# QEMU OUI space - important to use this
echo 52:54:00$end
}

ethlist=$(ls /sys/class/net | grep 'net' | grep -v 'eth0')

Expand All @@ -28,23 +35,23 @@ do
# Enable LLDP
echo 16384 > /sys/class/net/$bridge/bridge/group_fwd_mask

NETDEVS="$NETDEVS -netdev tap,id=dev$COUNTER,ifname=$tap,script=no,downscript=no -device virtio-net-pci,netdev=dev$COUNTER,id=swp$COUNTER1,mac=$(random_mac),multifunction=on,addr=6.$COUNTER"
if [ $COUNTER -eq 0 ]; then
mf=on
else
mf=off
fi

NETDEVS="$NETDEVS -netdev tap,id=dev$COUNTER,ifname=$tap,script=no,downscript=no -device virtio-net-pci,netdev=dev$COUNTER,id=swp$COUNTER1,mac=$(random_mac),multifunction=$mf,addr=6.$COUNTER"
let COUNTER=COUNTER+1
done

printf "%s\n" $NETDEVS

screen -d -m socat TCP-LISTEN:22,fork TCP:127.0.0.1:2022
screen -d -m socat UDP-LISTEN:161,fork UDP:127.0.0.1:2161
screen -d -m socat TCP-LISTEN:830,fork TCP:127.0.0.1:2830
screen -d -m socat TCP-LISTEN:8080,fork TCP:127.0.0.1:2880

random_mac () {
hexchars="0123456789abcdef"
end=$( for i in {1..6} ; do echo -n ${hexchars:$(( $RANDOM % 16 )):1} ; done | sed -e 's/\(..\)/:\1/g' )

# QEMU OUI space - important to use this
echo 52:54:00$end
}


/usr/bin/qemu-system-x86_64 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ def createSSHClient(server, port, user, password):
client.connect(server, port, user, password)
return client

ssh=createSSHClient(host,22,"root","antidotepassword")
ssh=createSSHClient(host,22,"antidote","antidotepassword")

scp=SCPClient(ssh.get_transport())

scp.put('/antidote/stage1/configs/leaf1/interfaces', '/etc/network/interfaces')
scp.put('/antidote/stage1/configs/leaf1/daemons', '/etc/frr/daemons')
scp.put('/antidote/stage1/configs/leaf1/frr.conf', '/etc/frr/frr.conf')
scp.put('/antidote/stage1/configs/leaf1/interfaces', '/home/antidote/interfaces')
scp.put('/antidote/stage1/configs/leaf1/daemons', '/home/antidote/daemons')
scp.put('/antidote/stage1/configs/leaf1/frr.conf', '/home/antidote/frr.conf')


ssh.exec_command('systemctl restart frr.service')
ssh.exec_command('ifreload -a')
ssh.exec_command('sudo cp /home/antidote/interfaces /etc/network/interfaces')
ssh.exec_command('sudo cp /home/antidote/daemons /etc/frr/daemons')
ssh.exec_command('sudo cp /home/antidote/frr.conf /etc/frr/frr.conf')
ssh.exec_command('sudo systemctl restart frr.service')
ssh.exec_command('sudo ifreload -a')

scp.close()
ssh.close()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
router bgp 65002
bgp router-id 10.1.1.2
neighbor 10.10.10.1 remote-as 65001
address-family ipv4 unicast
neighbor 10.10.10.1 remote-as 65001
neighbor 10.10.10.1 activate
redistribute connected

Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ def createSSHClient(server, port, user, password):
client.connect(server, port, user, password)
return client

ssh=createSSHClient(host,22,"root","antidotepassword")
ssh=createSSHClient(host,22,"antidote","antidotepassword")

scp=SCPClient(ssh.get_transport())

scp.put('/antidote/stage1/configs/leaf2/interfaces', '/etc/network/interfaces')
scp.put('/antidote/stage1/configs/leaf2/daemons', '/etc/frr/daemons')
scp.put('/antidote/stage1/configs/leaf2/frr.conf', '/etc/frr/frr.conf')
scp.put('/antidote/stage1/configs/leaf2/interfaces', '/home/antidote/interfaces')
scp.put('/antidote/stage1/configs/leaf2/daemons', '/home/antidote/daemons')
scp.put('/antidote/stage1/configs/leaf2/frr.conf', '/home/antidote/frr.conf')


ssh.exec_command('systemctl restart frr.service')
ssh.exec_command('ifreload -a')
ssh.exec_command('sudo cp /home/antidote/interfaces /etc/network/interfaces')
ssh.exec_command('sudo cp /home/antidote/daemons /etc/frr/daemons')
ssh.exec_command('sudo cp /home/antidote/frr.conf /etc/frr/frr.conf')
ssh.exec_command('sudo systemctl restart frr.service')
ssh.exec_command('sudo ifreload -a')

scp.close()
ssh.close()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
router bgp 65003
bgp router-id 10.1.1.3
neighbor 10.10.20.1 remote-as 65001
address-family ipv4 unicast
neighbor 10.10.20.1 remote-as 65001
neighbor 10.10.20.1 activate
redistribute connected

Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ def createSSHClient(server, port, user, password):
client.connect(server, port, user, password)
return client

ssh=createSSHClient(host,22,"root","antidotepassword")
ssh=createSSHClient(host,22,"antidote","antidotepassword")

scp=SCPClient(ssh.get_transport())

scp.put('/antidote/stage1/configs/spine/interfaces', '/etc/network/interfaces')
scp.put('/antidote/stage1/configs/spine/daemons', '/etc/frr/daemons')
scp.put('/antidote/stage1/configs/spine/frr.conf', '/etc/frr/frr.conf')
scp.put('/antidote/stage1/configs/spine/interfaces', '/home/antidote/interfaces')
scp.put('/antidote/stage1/configs/spine/daemons', '/home/antidote/daemons')
scp.put('/antidote/stage1/configs/spine/frr.conf', '/home/antidote/frr.conf')

ssh.exec_command('systemctl restart frr.service')
ssh.exec_command('ifreload -a')

ssh.exec_command('sudo cp /home/antidote/interfaces /etc/network/interfaces')
ssh.exec_command('sudo cp /home/antidote/daemons /etc/frr/daemons')
ssh.exec_command('sudo cp /home/antidote/frr.conf /etc/frr/frr.conf')
ssh.exec_command('sudo systemctl restart frr.service')
ssh.exec_command('sudo ifreload -a')

scp.close()
ssh.close()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
router bgp 65001
bgp router-id 10.1.1.1
neighbor 10.10.10.2 remote-as 65002
neighbor 10.10.20.2 remote-as 65003
address-family ipv4 unicast
neighbor 10.10.10.2 remote-as 65002
neighbor 10.10.10.2 activate
neighbor 10.10.20.2 remote-as 65003
neighbor 10.10.20.2 activate
redistribute connected

0 comments on commit 49f2ee7

Please sign in to comment.