Skip to content

Commit 41f3d49

Browse files
authored
Merge pull request #28 from Sabareesh-Kumar-Anandan/master
Rebasing patches to 202006 branch
2 parents f42ca0c + deaec5c commit 41f3d49

File tree

5 files changed

+144
-8
lines changed

5 files changed

+144
-8
lines changed

files/1140_portstat.patch

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/scripts/portstat b/scripts/portstat
2+
index 42757d3..81761ea 100644
3+
--- a/scripts/portstat
4+
+++ b/scripts/portstat
5+
@@ -251,13 +251,13 @@ class Portstat(object):
6+
table.append((key, self.get_port_state(key),
7+
ns_diff(cntr.rx_ok, old_cntr.rx_ok),
8+
ns_brate(cntr.rx_byt, old_cntr.rx_byt, time_gap),
9+
- ns_util(cntr.rx_byt, old_cntr.rx_byt, time_gap),
10+
+ ns_util(cntr.rx_byt, old_cntr.rx_byt, time_gap, port_speed),
11+
ns_diff(cntr.rx_err, old_cntr.rx_err),
12+
ns_diff(cntr.rx_drop, old_cntr.rx_drop),
13+
ns_diff(cntr.rx_ovr, old_cntr.rx_ovr),
14+
ns_diff(cntr.tx_ok, old_cntr.tx_ok),
15+
ns_brate(cntr.tx_byt, old_cntr.tx_byt, time_gap),
16+
- ns_util(cntr.tx_byt, old_cntr.tx_byt, time_gap),
17+
+ ns_util(cntr.tx_byt, old_cntr.tx_byt, time_gap, port_speed),
18+
ns_diff(cntr.tx_err, old_cntr.tx_err),
19+
ns_diff(cntr.tx_drop, old_cntr.tx_drop),
20+
ns_diff(cntr.tx_ovr, old_cntr.tx_ovr)))
21+
diff --git a/utilities_common/netstat.py b/utilities_common/netstat.py
22+
index 9bf266e..a8d62b5 100755
23+
--- a/utilities_common/netstat.py
24+
+++ b/utilities_common/netstat.py
25+
@@ -23,10 +23,10 @@ def ns_brate(newstr, oldstr, delta):
26+
return STATUS_NA
27+
else:
28+
rate = int(ns_diff(newstr, oldstr).replace(',',''))/delta
29+
- if rate > 1024*1024*10:
30+
- rate = "{:.2f}".format(rate/1024/1024)+' MB'
31+
- elif rate > 1024*10:
32+
- rate = "{:.2f}".format(rate/1024)+' KB'
33+
+ if rate > 1000*1000*10:
34+
+ rate = "{:.2f}".format(rate/1000/1000)+' MB'
35+
+ elif rate > 1000*10:
36+
+ rate = "{:.2f}".format(rate/1000)+' KB'
37+
else:
38+
rate = "{:.2f}".format(rate)+' B'
39+
return rate+'/s'
40+
@@ -49,7 +49,7 @@ def ns_util(newstr, oldstr, delta, port_rate=PORT_RATE):
41+
return STATUS_NA
42+
else:
43+
rate = int(ns_diff(newstr, oldstr).replace(',',''))/delta
44+
- util = rate/(port_rate*1024*1024*1024/8.0)*100
45+
+ util = rate/(port_rate*1000*1000*1000/8.0)*100
46+
return "{:.2f}%".format(util)
47+
48+
def table_as_json(table, header):

files/5252_ebtables.patch

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
diff --git a/build_debian.sh b/build_debian.sh
2+
index 550585c..9e64716 100755
3+
--- a/build_debian.sh
4+
+++ b/build_debian.sh
5+
@@ -518,7 +518,7 @@ fi
6+
sudo cp -f files/image_config/ebtables/ebtables.default $FILESYSTEM_ROOT/etc/default/ebtables
7+
sudo cp -f files/image_config/ebtables/ebtables.init $FILESYSTEM_ROOT/etc/init.d/ebtables
8+
sudo cp -f files/image_config/ebtables/ebtables.service $FILESYSTEM_ROOT/lib/systemd/system/ebtables.service
9+
-sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc
10+
+sudo cp files/image_config/ebtables/ebtables.filter.cfg ${FILESYSTEM_ROOT}/etc
11+
sudo LANG=C chroot $FILESYSTEM_ROOT update-alternatives --set ebtables /usr/sbin/ebtables-legacy
12+
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ebtables.service
13+
14+
Binary files a/files/image_config/ebtables/ebtables.filter and /dev/null differ
15+
diff --git a/files/image_config/ebtables/ebtables.filter.cfg b/files/image_config/ebtables/ebtables.filter.cfg
16+
new file mode 100644
17+
index 0000000..7a2dc5c
18+
--- /dev/null
19+
+++ b/files/image_config/ebtables/ebtables.filter.cfg
20+
@@ -0,0 +1,11 @@
21+
+# SONiC ebtables filter table configuration
22+
+# Generated using ebtables-save
23+
+
24+
+*filter
25+
+:INPUT ACCEPT
26+
+:FORWARD ACCEPT
27+
+:OUTPUT ACCEPT
28+
+-A FORWARD -d BGA -j DROP
29+
+-A FORWARD -p ARP -j DROP
30+
+-A FORWARD -p 802_1Q --vlan-encap ARP -j DROP
31+
+
32+
diff --git a/files/image_config/platform/rc.local b/files/image_config/platform/rc.local
33+
index 2beec75..6a6edbd 100755
34+
--- a/files/image_config/platform/rc.local
35+
+++ b/files/image_config/platform/rc.local
36+
@@ -115,6 +115,13 @@ program_console_speed()
37+
systemctl daemon-reload
38+
}
39+
40+
+ebtables_config()
41+
+{
42+
+ # Generate atomic config file and save it persistent
43+
+ /usr/sbin/ebtables-restore < /etc/ebtables.filter.cfg
44+
+ /usr/sbin/ebtables -t filter --atomic-file /etc/ebtables.filter --atomic-save
45+
+}
46+
+
47+
#### Begin Main Body ####
48+
49+
logger "SONiC version ${SONIC_VERSION} starting up..."
50+
@@ -333,6 +340,9 @@ if [ -f $FIRST_BOOT_FILE ]; then
51+
# Create dir where following scripts put their output files
52+
mkdir -p /var/platform
53+
54+
+ # Firsttime ebtables configuration
55+
+ ebtables_config
56+
+
57+
firsttime_exit
58+
fi
59+

files/shell_utilities.patch

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
diff --git a/config/main.py b/config/main.py
2-
index 3b92f66..5b0bb38 100755
2+
index 3b92f66..1876acd 100755
33
--- a/config/main.py
44
+++ b/config/main.py
5-
@@ -3312,5 +3312,44 @@ def autorestart(container_name, autorestart_status):
6-
5+
@@ -9,6 +9,7 @@ import re
6+
import syslog
7+
import time
8+
import netifaces
9+
+import json
10+
11+
import sonic_device_util
12+
import ipaddress
13+
@@ -3312,5 +3313,44 @@ def autorestart(container_name, autorestart_status):
14+
715
config_db.mod_entry('CONTAINER_FEATURE', container_name, {'auto_restart': autorestart_status})
8-
16+
917
+@config.group(cls=AbbreviationGroup)
1018
+@click.pass_context
1119
+def switch(ctx):
@@ -47,4 +55,3 @@ index 3b92f66..5b0bb38 100755
4755
+
4856
if __name__ == '__main__':
4957
config()
50-

sonic_M0_master_mvl_patch.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ declare -a PATCHES=(P1 P2 P3 P4 P5 P6 P7 P8 P9)
2020
url="https://github.com/Azure"
2121
urlsai="https://patch-diff.githubusercontent.com/raw/opencomputeproject"
2222

23-
declare -A P1=( [NAME]=sonic-buildimage [DIR]=. [PR]="3687 5252 5500" [URL]="$url" [PREREQ]="" [POSTREQ]="buildimage_post_script")
23+
declare -A P1=( [NAME]=sonic-buildimage [DIR]=. [PR]="3687 5500" [URL]="$url" [PREREQ]="" [POSTREQ]="buildimage_post_script")
2424
declare -A P2=( [NAME]=sonic-swss [DIR]=src/sonic-swss [PR]="1325 1273 1369 1407 " [URL]="$url" [PREREQ]="" [POSTREQ]="swss_post_script" )
2525
declare -A P3=( [NAME]=sonic-swss-common [DIR]=src/sonic-swss-common [PR]="" [URL]="$url" [PREREQ]="" )
2626
declare -A P4=( [NAME]=sonic-mgmt-framework [DIR]=src/sonic-mgmt-framework [PR]="" [URL]="$url" [PREREQ]="" )
2727
declare -A P5=( [NAME]=sonic-linux-kernel [DIR]=src/sonic-linux-kernel [PR]="" [URL]="$url" [PREREQ]="apply_buster_kernel" )
2828
declare -A P6=( [NAME]=sonic-platform-common [DIR]=src/sonic-platform-common [PR]="" [URL]="$url" [PREREQ]="" )
2929
declare -A P7=( [NAME]=sonic-snmpagent [DIR]=src/sonic-snmpagent [PR]="134" [URL]="$url" [PREREQ]="" )
3030
declare -A P8=( [NAME]=sonic-sairedis [DIR]=src/sonic-sairedis [PR]="643" [URL]="$url" [PREREQ]="" )
31-
declare -A P9=( [NAME]=sonic-utilities [DIR]=src/sonic-utilities [PR]="1140 " [URL]="$url" [PREREQ]="" [POSTREQ]="utilities_post_script")
31+
declare -A P9=( [NAME]=sonic-utilities [DIR]=src/sonic-utilities [PR]="" [URL]="$url" [PREREQ]="" [POSTREQ]="utilities_post_script")
3232

3333
#
3434
# END of CONFIGURATIONS
@@ -67,17 +67,30 @@ pre_patch_help()
6767
}
6868
swss_post_script()
6969
{
70+
#PR 1454
71+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_swss.patch
7072
patch -p1 < shell_swss.patch
7173
}
7274

7375
buildimage_post_script()
7476
{
77+
#PR 5519
78+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_buildimage.patch
7579
patch -p1 < shell_buildimage.patch
80+
#PR 5252
81+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/5252_ebtables.patch
82+
patch -p1 < 5252_ebtables.patch
83+
rm files/image_config/ebtables/ebtables.filter
7684
}
7785

7886
utilities_post_script()
7987
{
88+
#PR 1146
89+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_utilities.patch
8090
patch -p1 < shell_utilities.patch
91+
#PR 1140
92+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/1140_portstat.patch
93+
patch -p1 < 1140_portstat.patch
8194
}
8295

8396

sonic_falcon_mvl_patch.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ urlsai="https://patch-diff.githubusercontent.com/raw/opencomputeproject"
2222

2323
declare -A P1=( [NAME]=sonic-buildimage [DIR]=. [PR]="3687 5500" [URL]="$url" [PREREQ]="" [POSTREQ]="buildimage_post_script")
2424
declare -A P2=( [NAME]=sonic-swss [DIR]=src/sonic-swss [PR]="1325 1273 1369 1407" [URL]="$url" [PREREQ]="" [POSTREQ]="swss_post_script")
25-
declare -A P3=( [NAME]=sonic-utilities [DIR]=src/sonic-utilities [PR]="1140" [URL]="$url" [PREREQ]="" [POSTREQ]="utilities_post_script")
25+
declare -A P3=( [NAME]=sonic-utilities [DIR]=src/sonic-utilities [PR]="" [URL]="$url" [PREREQ]="" [POSTREQ]="utilities_post_script")
2626
declare -A P4=( [NAME]=sonic-linux-kernel [DIR]=src/sonic-linux-kernel [PR]="" [URL]="$url" [PREREQ]="apply_buster_kernel" )
2727
declare -A P5=( [NAME]=sonic-snmpagent [DIR]=src/sonic-snmpagent [PR]="134" [URL]="$url" [PREREQ]="" )
2828
declare -A P6=( [NAME]=sonic-sairedis [DIR]=src/sonic-sairedis [PR]="643" [URL]="$url" [PREREQ]="" )
@@ -59,17 +59,26 @@ pre_patch_help()
5959

6060
swss_post_script()
6161
{
62+
#PR 1454
63+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_swss.patch
6264
patch -p1 < shell_swss.patch
6365
}
6466

6567
buildimage_post_script()
6668
{
69+
#PR 5519
70+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_buildimage.patch
6771
patch -p1 < shell_buildimage.patch
6872
}
6973

7074
utilities_post_script()
7175
{
76+
#PR 1146
77+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/shell_utilities.patch
7278
patch -p1 < shell_utilities.patch
79+
#PR 1140
80+
wget -c https://raw.githubusercontent.com/Marvell-switching/sonic-scripts/master/files/1140_portstat.patch
81+
patch -p1 < 1140_portstat.patch
7382
}
7483

7584
installer_patch()

0 commit comments

Comments
 (0)