Skip to content

[chassis] Configure midplane network on supervisor #11725

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

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions device/arista/x86_64-arista_7800_sup/chassisdb.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
start_chassis_db=1
chassis_db_address=127.100.1.1
midplane_subnet=127.100.0.0/16

lag_id_start=1
lag_id_end=128
20 changes: 15 additions & 5 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,26 @@ function postStartAction()
ip netns exec "$NET_NS" ip addr add 127.0.0.1/16 dev lo
ip netns exec "$NET_NS" ip addr del 127.0.0.1/8 dev lo

slot_id=$(python3 -c 'import sonic_platform.platform; platform_chassis = sonic_platform.platform.Platform().get_chassis(); print(platform_chassis.get_my_slot())' 2>/dev/null)
supervisor_slot_id=$(python3 -c 'import sonic_platform.platform; platform_chassis = sonic_platform.platform.Platform().get_chassis(); print(platform_chassis.get_supervisor_slot())' 2>/dev/null)

# Create eth1 in database instance
if [[ "${slot_id}" == "${supervisor_slot_id}" ]]; then
ip link add name ns-eth1"$NET_NS" type veth peer name eth1@"$NET_NS"
ip link set dev eth1@"$NET_NS" master br1
ip link set dev eth1@"$NET_NS" up
else
ip link add name ns-eth1"$NET_NS" link eth1-midplane type macvlan mode bridge
fi

# Create eth1 in database instance
ip link add name ns-eth1"$NET_NS" link eth1-midplane type macvlan mode bridge
ip link set dev ns-eth1"$NET_NS" netns "$NET_NS"
ip netns exec "$NET_NS" ip link set ns-eth1"$NET_NS" name eth1

# Configure IP address and enable eth1
lc_slot_id=$(python3 -c 'import sonic_platform.platform; platform_chassis = sonic_platform.platform.Platform().get_chassis(); print(platform_chassis.get_my_slot())' 2>/dev/null)
lc_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$lc_slot_id.$(($DEV + 10))
lc_subnet_mask=${midplane_subnet#*/}
ip netns exec "$NET_NS" ip addr add $lc_ip_address/$lc_subnet_mask dev eth1
slot_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$slot_id.$(($DEV + 10))
slot_subnet_mask=${midplane_subnet#*/}
ip netns exec "$NET_NS" ip addr add $slot_ip_address/$slot_subnet_mask dev eth1
ip netns exec "$NET_NS" ip link set dev eth1 up

# Allow localnet routing on the new interfaces if midplane is using a
Expand Down