Skip to content
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
22 changes: 18 additions & 4 deletions dockers/docker-fpm-frr/TS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ switch_type=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['switch_type']"`
# Check whether the routemap is for internal BGP sessions.
function is_internal_route_map()
{
[[ "$1" =~ .*"_INTERNAL_".* || "$1" =~ .*"VOQ_".* ]]
if [[ "$1" =~ .*"_INTERNAL_".* || "$1" =~ .*"VOQ_".* ]]
then
return 1
else
return 0
fi
}

function check_not_installed()
Expand All @@ -13,7 +18,10 @@ function check_not_installed()
config=$(vtysh -c "show run")
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
do
is_internal_route_map $route_map_name && continue
is_internal_route_map $route_map_name
if [[ $? -eq 1 ]]; then
continue
fi
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
c=$((c+$?))
echo "$config" | egrep -q "^route-map $route_map_name permit 30$"
Expand All @@ -31,7 +39,10 @@ function check_installed()
config=$(vtysh -c "show run")
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
do
is_internal_route_map $route_map_name && continue
is_internal_route_map $route_map_name
if [[ $? -eq 1 ]]; then
continue
fi
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
c=$((c+$?))
e=$((e+1))
Expand All @@ -51,7 +62,10 @@ function find_num_routemap()
config=$(vtysh -c "show run")
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
do
is_internal_route_map $route_map_name && continue
is_internal_route_map $route_map_name
if [[ $? -eq 1 ]]; then
continue
fi
c=$((c+1))
done
return $c
Expand Down
5 changes: 3 additions & 2 deletions dockers/docker-fpm-frr/TSA
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ then
TSA_FILE=$(mktemp)
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | uniq);
do
is_internal_route_map $route_map_name && continue
is_internal_route_map $route_map_name
internal_route_map=$?
case "$route_map_name" in
*V4*)
ip_version=V4
Expand All @@ -30,7 +31,7 @@ then
continue
;;
esac
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"ip_version\": \"$ip_version\", \"ip_protocol\": \"$ip_protocol\"}" -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE"
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"ip_version\": \"$ip_version\", \"ip_protocol\": \"$ip_protocol\", \"internal_route_map\": \"$internal_route_map\"}" -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE"
vtysh -f "$TSA_FILE"
rm -f "$TSA_FILE"
done
Expand Down
5 changes: 3 additions & 2 deletions dockers/docker-fpm-frr/TSB
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ then
TSB_FILE=$(mktemp)
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | uniq);
do
is_internal_route_map $route_map_name && continue
is_internal_route_map $route_map_name
internal_route_map=$?
case "$route_map_name" in
*V4*)
;;
Expand All @@ -26,7 +27,7 @@ then
continue
;;
esac
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\"}" -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.unisolate.conf.j2 > "$TSB_FILE"
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"internal_route_map\": \"$internal_route_map\"}" -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.unisolate.conf.j2 > "$TSB_FILE"
vtysh -f "$TSB_FILE"
rm -f "$TSB_FILE"
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ route-map FROM_BGP_INTERNAL_PEER_V6 permit 2
set originator-id {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback4096") | ip }}
{% elif CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %}
bgp community-list standard DEVICE_INTERNAL_COMMUNITY permit {{ constants.bgp.internal_community }}
bgp community-list standard NO_EXPORT permit no-export
!
route-map FROM_BGP_INTERNAL_PEER_V4 permit 1
match community DEVICE_INTERNAL_COMMUNITY
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag {{ constants.bgp.internal_community_match_tag }}
!
route-map FROM_BGP_INTERNAL_PEER_V4 permit 2
match community NO_EXPORT
set local-preference 80
!
route-map FROM_BGP_INTERNAL_PEER_V6 permit 1
set ipv6 next-hop prefer-global
on-match next
Expand All @@ -31,6 +36,10 @@ route-map FROM_BGP_INTERNAL_PEER_V6 permit 2
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag {{ constants.bgp.internal_community_match_tag }}
!
route-map FROM_BGP_INTERNAL_PEER_V6 permit 3
match community NO_EXPORT
set local-preference 80
!
route-map TO_BGP_INTERNAL_PEER_V4 permit 1
match ip address prefix-list PL_LoopbackV4
set community {{ constants.bgp.internal_community }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
! template: bgpd/templates/voq_chassis/policies.conf.j2
!
bgp community-list standard DEVICE_INTERNAL_COMMUNITY permit {{ constants.bgp.internal_community }}
bgp community-list standard NO_EXPORT permit no-export
!
route-map FROM_VOQ_CHASSIS_V4_PEER permit 1
match community DEVICE_INTERNAL_COMMUNITY
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag {{ constants.bgp.internal_community_match_tag }}
!
route-map FROM_VOQ_CHASSIS_V4_PEER permit 2
match community NO_EXPORT
set local-preference 80
!
route-map FROM_VOQ_CHASSIS_V4_PEER permit 100
!
route-map TO_VOQ_CHASSIS_V4_PEER permit 1
Expand All @@ -26,6 +31,10 @@ route-map FROM_VOQ_CHASSIS_V6_PEER permit 2
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag {{ constants.bgp.internal_community_match_tag }}
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 3
match community NO_EXPORT
set local-preference 80
!
route-map FROM_VOQ_CHASSIS_V6_PEER permit 100
!
route-map TO_VOQ_CHASSIS_V6_PEER permit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{%- if internal_route_map == '1' -%}
route-map {{ route_map_name }} permit 20
set community no-export additive
{# #}
{%- else -%}
route-map {{ route_map_name }} permit 20
match {{ ip_protocol }} address prefix-list PL_Loopback{{ ip_version }}
set community {{ constants.bgp.traffic_shift_community }}
route-map {{ route_map_name }} permit 30
match tag {{ constants.bgp.internal_community_match_tag }}
set community {{ constants.bgp.traffic_shift_community }}
route-map {{ route_map_name }} deny 40
{# #}
{%- endif -%}
!
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{%- if internal_route_map == '1' -%}
no route-map {{ route_map_name }} permit 20
{# #}
{%- else -%}
no route-map {{ route_map_name }} permit 20
no route-map {{ route_map_name }} permit 30
no route-map {{ route_map_name }} deny 40
{# #}
{%- endif -%}
!
8 changes: 4 additions & 4 deletions files/build_templates/qos_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %}
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
{{- generate_tc_to_pg_map() }}
{% else %}
"TC_TO_PRIORITY_GROUP_MAP": {
Expand Down Expand Up @@ -147,7 +147,7 @@
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %}
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
{{- generate_dscp_to_tc_map() }}
{% else %}
"DSCP_TO_TC_MAP": {
Expand Down Expand Up @@ -241,7 +241,7 @@
('type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types) and
('resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI') %}
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI') %}
"SCHEDULER": {
"scheduler.0": {
"type" : "DWRR",
Expand Down Expand Up @@ -406,7 +406,7 @@
{% if 'type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['type'] in backend_device_types and
'resource_type' in DEVICE_METADATA['localhost'] and
DEVICE_METADATA['localhost']['resource_type'] == 'Compute-AI' %}
DEVICE_METADATA['localhost']['resource_type'] == 'ComputeAI' %}
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"scheduler": "scheduler.0"
Expand Down
1 change: 1 addition & 0 deletions files/image_config/sysctl/sysctl-net.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ net.ipv4.conf.all.arp_announce=1
net.ipv4.conf.all.arp_filter=0
net.ipv4.conf.all.arp_notify=1
net.ipv4.conf.all.arp_ignore=2
net.ipv4.ip_local_port_range="32768 50001"
net.ipv4.neigh.default.base_reachable_time_ms=1800000
net.ipv6.neigh.default.base_reachable_time_ms=1800000
net.ipv4.neigh.default.gc_thresh1=1024
Expand Down
20 changes: 12 additions & 8 deletions platform/mellanox/mlnx-platform-api/sonic_platform/thermal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES.
# Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES.
# Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -215,15 +215,15 @@ def create_indexable_thermal(rule, index, sysfs_folder, position, presence_cb=No
index += rule.get('start_index', 1)
name = rule['name'].format(index)
temp_file = os.path.join(sysfs_folder, rule['temperature'].format(index))
_check_thermal_sysfs_existence(temp_file)
_check_thermal_sysfs_existence(temp_file, presence_cb)
if 'high_threshold' in rule:
high_th_file = os.path.join(sysfs_folder, rule['high_threshold'].format(index))
_check_thermal_sysfs_existence(high_th_file)
_check_thermal_sysfs_existence(high_th_file, presence_cb)
else:
high_th_file = None
if 'high_critical_threshold' in rule:
high_crit_th_file = os.path.join(sysfs_folder, rule['high_critical_threshold'].format(index))
_check_thermal_sysfs_existence(high_crit_th_file)
_check_thermal_sysfs_existence(high_crit_th_file, presence_cb)
else:
high_crit_th_file = None
if not presence_cb:
Expand All @@ -244,15 +244,15 @@ def create_single_thermal(rule, sysfs_folder, position, presence_cb=None):
return None

temp_file = os.path.join(sysfs_folder, temp_file)
_check_thermal_sysfs_existence(temp_file)
_check_thermal_sysfs_existence(temp_file, presence_cb)
if 'high_threshold' in rule:
high_th_file = os.path.join(sysfs_folder, rule['high_threshold'])
_check_thermal_sysfs_existence(high_th_file)
_check_thermal_sysfs_existence(high_th_file, presence_cb)
else:
high_th_file = None
if 'high_critical_threshold' in rule:
high_crit_th_file = os.path.join(sysfs_folder, rule['high_critical_threshold'])
_check_thermal_sysfs_existence(high_crit_th_file)
_check_thermal_sysfs_existence(high_crit_th_file, presence_cb)
else:
high_crit_th_file = None
name = rule['name']
Expand All @@ -262,7 +262,11 @@ def create_single_thermal(rule, sysfs_folder, position, presence_cb=None):
return RemovableThermal(name, temp_file, high_th_file, high_crit_th_file, position, presence_cb)


def _check_thermal_sysfs_existence(file_path):
def _check_thermal_sysfs_existence(file_path, presence_cb):
if presence_cb:
status, _ = presence_cb()
if not status:
return
if not os.path.exists(file_path):
logger.log_error('Thermal sysfs {} does not exist'.format(file_path))

Expand Down
6 changes: 4 additions & 2 deletions src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,16 @@ def __generate_routemaps_from_template(self, route_map_names, template):
# For packet-based chassis, the bgp session between the linecards are also considered internal sessions
# While isolating a single linecard, these sessions should not be skipped
if "_INTERNAL_" in rm or "VOQ_" in rm:
continue
is_internal="1"
else:
is_internal="0"
if "V4" in rm:
ipv="V4" ; ipp="ip"
elif "V6" in rm:
ipv="V6" ; ipp="ipv6"
else:
continue
cmd += template.render(route_map_name=rm,ip_version=ipv,ip_protocol=ipp, constants=self.constants)
cmd += template.render(route_map_name=rm,ip_version=ipv,ip_protocol=ipp,internal_route_map=is_internal, constants=self.constants)
cmd += "\n"
return cmd

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
!
! template: bgpd/templates/internal/peer-group.conf.j2
!
neighbor INTERNAL_PEER_V4 peer-group
neighbor INTERNAL_PEER_V6 peer-group
neighbor INTERNAL_PEER_V4 update-source Loopback4096
address-family ipv4
neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V4 allowas-in 1
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
neighbor INTERNAL_PEER_V4 send-community
neighbor INTERNAL_PEER_V4 ttl-security hops 1
exit-address-family
neighbor INTERNAL_PEER_V6 update-source Loopback4096
address-family ipv6
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V6 allowas-in 1
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
neighbor INTERNAL_PEER_V6 send-community
neighbor INTERNAL_PEER_V6 ttl-security hops 1
exit-address-family
!
! end of template: bgpd/templates/internal/peer-group.conf.j2
!


route-map TO_BGP_INTERNAL_PEER_V4 permit 20
set community no-export additive
!
route-map TO_BGP_INTERNAL_PEER_V6 permit 20
set community no-export additive
!

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
!
! template: bgpd/templates/internal/peer-group.conf.j2
!
neighbor INTERNAL_PEER_V4 peer-group
neighbor INTERNAL_PEER_V6 peer-group
neighbor INTERNAL_PEER_V4 update-source Loopback4096
address-family ipv4
neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V4 allowas-in 1
neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in
neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out
neighbor INTERNAL_PEER_V4 send-community
neighbor INTERNAL_PEER_V4 ttl-security hops 1
exit-address-family
neighbor INTERNAL_PEER_V6 update-source Loopback4096
address-family ipv6
neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound
neighbor INTERNAL_PEER_V6 allowas-in 1
neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in
neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out
neighbor INTERNAL_PEER_V6 send-community
neighbor INTERNAL_PEER_V6 ttl-security hops 1
exit-address-family
!
! end of template: bgpd/templates/internal/peer-group.conf.j2
!


no route-map TO_BGP_INTERNAL_PEER_V4 permit 20
!
no route-map TO_BGP_INTERNAL_PEER_V6 permit 20
!

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
! template: bgpd/templates/internal/policies.conf.j2
!
bgp community-list standard DEVICE_INTERNAL_COMMUNITY permit 12345:556
bgp community-list standard NO_EXPORT permit no-export
!
route-map FROM_BGP_INTERNAL_PEER_V4 permit 1
match community DEVICE_INTERNAL_COMMUNITY
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag 101
!
route-map FROM_BGP_INTERNAL_PEER_V4 permit 2
match community NO_EXPORT
set local-preference 80
!
route-map FROM_BGP_INTERNAL_PEER_V6 permit 1
set ipv6 next-hop prefer-global
on-match next
Expand All @@ -17,6 +22,10 @@ route-map FROM_BGP_INTERNAL_PEER_V6 permit 2
set comm-list DEVICE_INTERNAL_COMMUNITY delete
set tag 101
!
route-map FROM_BGP_INTERNAL_PEER_V6 permit 3
match community NO_EXPORT
set local-preference 80
!
route-map TO_BGP_INTERNAL_PEER_V4 permit 1
match ip address prefix-list PL_LoopbackV4
set community 12345:556
Expand Down
Loading