-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support building multi-ASIC components #3269
Closed
theasianpianist
wants to merge
5
commits into
sonic-net:master
from
theasianpianist:pr-multi-asic-build
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4afe564
[platform/vs]: Update README
0fdb595
[build systemd]: support multi-ASIC build
ba7b7e0
[build][rules][build_templates][platform/vs]: add network namespace/m…
bf7b16d
[files]: add topology service
95bef6e
[multi-asic build]: address review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,2 @@ | ||
FROM debian:stretch | ||
|
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
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,13 @@ | ||
[Unit] | ||
Description=Network namespace service | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
User=root | ||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start %i | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh wait %i | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop %i | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
File renamed without changes.
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
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,17 @@ | ||
[Unit] | ||
Description=Internal topology service | ||
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] | ||
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] | ||
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] | ||
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] | ||
|
||
[Service] | ||
Type=oneshot | ||
User=root | ||
RemainAfterExit=yes | ||
ExecStart=/usr/bin/topology.sh start | ||
ExecStop=/usr/bin/topology.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
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,75 @@ | ||
#!/bin/bash | ||
|
||
start () { | ||
# Move external links into assigned frontend namespaces | ||
# eth0 - eth15: namespace2 | ||
# eth16 - eth31: namespace3 | ||
# eth32 - eth47: namespace4 | ||
# eth48 - eth63: namespace5 | ||
for NS in `seq 2 5`; do | ||
theasianpianist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for NUM in `seq 1 16`; do | ||
ORIG="eth$((16 * $(($NS - 2)) + $NUM - 1))" | ||
TEMP="ethTemp999" | ||
NEW="eth$(($NUM + 16))" | ||
ip link set dev $ORIG down | ||
ip link set dev $ORIG name $TEMP # rename to prevent conflicts before renaming in new namespace | ||
ip link set dev $TEMP netns namespace$NS | ||
sudo ip netns exec namespace$NS ip link set $TEMP name $NEW # rename to final interface name | ||
theasianpianist marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sudo ip netns exec namespace$NS ip link set $NEW up | ||
done | ||
done | ||
|
||
# Connect all backend namespaces to frontend namespaces | ||
for BACKEND in `seq 0 1`; do | ||
for FRONTEND in `seq 2 5`; do | ||
for LINK in `seq 1 8`; do | ||
BACK_NAME="eth$((8 * $(($FRONTEND - 2)) + $LINK))" | ||
FRONT_NAME="eth$((8 * $BACKEND + $LINK))" | ||
TEMP_BACK="ethBack999" | ||
TEMP_FRONT="ethFront999" | ||
|
||
ip link add $TEMP_BACK type veth peer name $TEMP_FRONT # temporary name to prevent conflicts between interfaces | ||
ip link set dev $TEMP_BACK netns namespace$BACKEND | ||
ip link set dev $TEMP_FRONT netns namespace$FRONTEND | ||
|
||
sudo ip netns exec namespace$BACKEND ip link set $TEMP_BACK name $BACK_NAME | ||
sudo ip netns exec namespace$FRONTEND ip link set $TEMP_FRONT name $FRONT_NAME | ||
|
||
sudo ip netns exec namespace$BACKEND ip link set $BACK_NAME up | ||
sudo ip netns exec namespace$FRONTEND ip link set $FRONT_NAME up | ||
done | ||
done | ||
done | ||
} | ||
|
||
stop() { | ||
for NS in `seq 2 5`; do | ||
for NUM in `seq 1 16`; do | ||
TEMP="eth999" | ||
OLD="eth$(($NUM + 16))" | ||
NAME="eth$((16 * $(( $NS - 2)) + $NUM - 1))" | ||
sudo ip netns exec namespace$NS ip link set dev $OLD down | ||
sudo ip netns exec namespace$NS ip link set dev $OLD name $TEMP | ||
sudo ip netns exec namespace$NS ip link set dev $TEMP netns 1 | ||
ip link set dev $TEMP name $NAME | ||
ip link set dev $NAME up | ||
done | ||
done | ||
|
||
for NS in `seq 0 1`; do | ||
for NUM in `seq 1 32`; do | ||
sudo ip netns exec namespace$NS ip link set dev eth$NUM down | ||
sudo ip netns exec namespace$NS ip link delete dev eth$NUM | ||
done | ||
done | ||
} | ||
|
||
case "$1" in | ||
start|stop) | ||
$1 | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop}" | ||
;; | ||
esac | ||
|
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
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ sudo apt-get install libvirt-clients qemu-kvm libvirt-bin | |
2. Create SONiC VM | ||
|
||
``` | ||
$ virsh | ||
$ sudo virsh | ||
Welcome to virsh, the virtualization interactive terminal. | ||
|
||
Type: 'help' for help with commands | ||
|
@@ -22,14 +22,25 @@ Domain sonic created from sonic.xml | |
virsh # | ||
``` | ||
|
||
2. Connect SONiC VM via console | ||
|
||
``` | ||
$ telnet 127.0.0.1 7000 | ||
``` | ||
|
||
3. Connect SONiC VM via SSH | ||
|
||
``` | ||
$ ssh -p 3040 [email protected] | ||
``` | ||
3. Access virtual switch: | ||
|
||
1. Connect SONiC VM via console | ||
``` | ||
$ telnet 127.0.0.1 7000 | ||
``` | ||
|
||
OR | ||
|
||
2. Connect SONiC VM via SSH | ||
|
||
1. Connect via console (see 3.1 above) | ||
|
||
2. Request a new DHCP address | ||
``` | ||
sudo dhclient -v | ||
``` | ||
|
||
3. Connect via SSH | ||
``` | ||
$ ssh -p 3040 [email protected] | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this docker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use the database as the namespace container, all other containers will use the same namespace as the database container. we do not need a separate namespace container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this since I start the namespaces, then the topology service is started, then the other containers start. I wanted to have the topology set up before any SONiC containers were started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
topology service is only required for kvm image. it is not necessary to have topology build before all containers start. We can build topology after database docker started. in fact, the bgp session will not be able to setup until host interfaces are created.
the only hard requirement I see is that the peer links has to be start before the syncd docker starts. since syncd will link the peer device with the host interface.