Skip to content

[chassis][multi-asic]: Add support for vendor LC ip range for macvlan ip #22008

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 6 commits into from
Mar 25, 2025
Merged
Changes from 2 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
11 changes: 11 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,19 @@ function postStartAction()
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

if [[ -n "$lc_ip_offset" ]]; then
# Use ip offset provided by platform vendor via chassisdb.conf to prevent any conflict
# with any platform IP range, e.g., LC eth1-midplane IP.
ip_offset=$lc_ip_offset
else
# If Vendor has not provided an ip offset, Use 10 as default offset. Platform vendor should
# ensure there is no conflict with platform IP range for any slot.
ip_offset=10
fi

# Configure IP address and enable eth1
slot_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$slot_id.$(($DEV + 10))
slot_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$slot_id.$(($DEV + $ip_offset))
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
Expand Down
Loading