[Tunnel PFC][Fix bug] Fix bug and Tests for adding property 'sai_remap_prio_on_tnl_egress' (#11027)
* [Tunnel PFC] Tests for adding property 'sai_remap_prio_on_tnl_egress' Add tests for adding property 'sai_remap_prio_on_tnl_egress', this property should only be added in dual tor environment. Test done: Run test test_j2files.py Co-authored-by: richardyu <richardyu@contoso.com>
This commit is contained in:
parent
245884a97f
commit
356b51f4d6
@ -7,7 +7,7 @@
|
||||
{%- set IPinIP_sock = 'sai_tunnel_support=1
|
||||
sai_tunnel_underlay_route_mode=1
|
||||
host_as_route_disable=1
|
||||
l3_ecmp_levels=2' -%} -%}
|
||||
l3_ecmp_levels=2' -%}
|
||||
{%- set map_prio = 'sai_remap_prio_on_tnl_egress=1' -%}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
28
src/sonic-config-engine/tests/data/j2_template/config.bcm.j2
Normal file
28
src/sonic-config-engine/tests/data/j2_template/config.bcm.j2
Normal file
@ -0,0 +1,28 @@
|
||||
{# Construct config.bcm to include additional soc properties per specific device metadata requirement #}
|
||||
{%- set mmu_sock = 'mmu_init_config="MSFT-TH2-Tier1"' -%}
|
||||
{%- set IPinIP_sock = '' -%}
|
||||
{%- set map_prio = '' -%}
|
||||
{%- if DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined -%}
|
||||
{%- if DEVICE_METADATA['localhost']['type'] is defined -%}
|
||||
{%- set switch_role = DEVICE_METADATA['localhost']['type'] -%}
|
||||
{%- if 'torrouter' in switch_role.lower() or 'torswitch' in switch_role.lower() %}
|
||||
{%- set mmu_sock = 'mmu_init_config="MSFT-TH2-Tier0"' -%}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if DEVICE_METADATA['localhost']['subtype'] is defined -%}
|
||||
{%- set switch_subtype = DEVICE_METADATA['localhost']['subtype'] -%}
|
||||
{%- if 'dualtor' in switch_subtype.lower() %}
|
||||
{%- set IPinIP_sock = 'sai_tunnel_support=1
|
||||
sai_tunnel_underlay_route_mode=1
|
||||
host_as_route_disable=1
|
||||
l3_ecmp_levels=2' -%}
|
||||
{%- set map_prio = 'sai_remap_prio_on_tnl_egress=1' -%}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{# The following is the common soc properties that used to be named "th2-a7260cx3-64-64x100G-t1.config.bcm" #}
|
||||
|
||||
l3_alpm_hit_skip=1
|
||||
{{ map_prio }}
|
||||
{{ mmu_sock }}
|
||||
{{ IPinIP_sock }}
|
@ -0,0 +1,67 @@
|
||||
# name lanes alias index speed
|
||||
Ethernet0 77,78,79,80 Ethernet1/1 1 100000
|
||||
Ethernet4 65,66,67,68 Ethernet2/1 2 100000
|
||||
Ethernet8 85,86,87,88 Ethernet3/1 3 100000
|
||||
Ethernet12 89,90,91,92 Ethernet4/1 4 100000
|
||||
Ethernet16 109,110,111,112 Ethernet5/1 5 100000
|
||||
Ethernet20 97,98,99,100 Ethernet6/1 6 100000
|
||||
Ethernet24 5,6,7,8 Ethernet7/1 7 100000
|
||||
Ethernet28 13,14,15,16 Ethernet8/1 8 100000
|
||||
Ethernet32 25,26,27,28 Ethernet9/1 9 100000
|
||||
Ethernet36 21,22,23,24 Ethernet10/1 10 100000
|
||||
Ethernet40 37,38,39,40 Ethernet11/1 11 100000
|
||||
Ethernet44 45,46,47,48 Ethernet12/1 12 100000
|
||||
Ethernet48 57,58,59,60 Ethernet13/1 13 100000
|
||||
Ethernet52 53,54,55,56 Ethernet14/1 14 100000
|
||||
Ethernet56 117,118,119,120 Ethernet15/1 15 100000
|
||||
Ethernet60 121,122,123,124 Ethernet16/1 16 100000
|
||||
Ethernet64 141,142,143,144 Ethernet17/1 17 100000
|
||||
Ethernet68 133,134,135,136 Ethernet18/1 18 100000
|
||||
Ethernet72 197,198,199,200 Ethernet19/1 19 100000
|
||||
Ethernet76 205,206,207,208 Ethernet20/1 20 100000
|
||||
Ethernet80 217,218,219,220 Ethernet21/1 21 100000
|
||||
Ethernet84 213,214,215,216 Ethernet22/1 22 100000
|
||||
Ethernet88 229,230,231,232 Ethernet23/1 23 100000
|
||||
Ethernet92 237,238,239,240 Ethernet24/1 24 100000
|
||||
Ethernet96 249,250,251,252 Ethernet25/1 25 100000
|
||||
Ethernet100 245,246,247,248 Ethernet26/1 26 100000
|
||||
Ethernet104 149,150,151,152 Ethernet27/1 27 100000
|
||||
Ethernet108 153,154,155,156 Ethernet28/1 28 100000
|
||||
Ethernet112 173,174,175,176 Ethernet29/1 29 100000
|
||||
Ethernet116 161,162,163,164 Ethernet30/1 30 100000
|
||||
Ethernet120 181,182,183,184 Ethernet31/1 31 100000
|
||||
Ethernet124 185,186,187,188 Ethernet32/1 32 100000
|
||||
Ethernet128 69,70,71,72 Ethernet33/1 33 100000
|
||||
Ethernet132 73,74,75,76 Ethernet34/1 34 100000
|
||||
Ethernet136 93,94,95,96 Ethernet35/1 35 100000
|
||||
Ethernet140 81,82,83,84 Ethernet36/1 36 100000
|
||||
Ethernet144 101,102,103,104 Ethernet37/1 37 100000
|
||||
Ethernet148 105,106,107,108 Ethernet38/1 38 100000
|
||||
Ethernet152 9,10,11,12 Ethernet39/1 39 100000
|
||||
Ethernet156 1,2,3,4 Ethernet40/1 40 100000
|
||||
Ethernet160 17,18,19,20 Ethernet41/1 41 100000
|
||||
Ethernet164 29,30,31,32 Ethernet42/1 42 100000
|
||||
Ethernet168 41,42,43,44 Ethernet43/1 43 100000
|
||||
Ethernet172 33,34,35,36 Ethernet44/1 44 100000
|
||||
Ethernet176 49,50,51,52 Ethernet45/1 45 100000
|
||||
Ethernet180 61,62,63,64 Ethernet46/1 46 100000
|
||||
Ethernet184 125,126,127,128 Ethernet47/1 47 100000
|
||||
Ethernet188 113,114,115,116 Ethernet48/1 48 100000
|
||||
Ethernet192 129,130,131,132 Ethernet49/1 49 100000
|
||||
Ethernet196 137,138,139,140 Ethernet50/1 50 100000
|
||||
Ethernet200 201,202,203,204 Ethernet51/1 51 100000
|
||||
Ethernet204 193,194,195,196 Ethernet52/1 52 100000
|
||||
Ethernet208 209,210,211,212 Ethernet53/1 53 100000
|
||||
Ethernet212 221,222,223,224 Ethernet54/1 54 100000
|
||||
Ethernet216 233,234,235,236 Ethernet55/1 55 100000
|
||||
Ethernet220 225,226,227,228 Ethernet56/1 56 100000
|
||||
Ethernet224 241,242,243,244 Ethernet57/1 57 100000
|
||||
Ethernet228 253,254,255,256 Ethernet58/1 58 100000
|
||||
Ethernet232 157,158,159,160 Ethernet59/1 59 100000
|
||||
Ethernet236 145,146,147,148 Ethernet60/1 60 100000
|
||||
Ethernet240 165,166,167,168 Ethernet61/1 61 100000
|
||||
Ethernet244 169,170,171,172 Ethernet62/1 62 100000
|
||||
Ethernet248 189,190,191,192 Ethernet63/1 63 100000
|
||||
Ethernet252 177,178,179,180 Ethernet64/1 64 100000
|
||||
Ethernet256 257 Ethernet65 65 10000
|
||||
Ethernet260 259 Ethernet66 66 10000
|
@ -0,0 +1,8 @@
|
||||
|
||||
l3_alpm_hit_skip=1
|
||||
sai_remap_prio_on_tnl_egress=1
|
||||
mmu_init_config="MSFT-TH2-Tier0"
|
||||
sai_tunnel_support=1
|
||||
sai_tunnel_underlay_route_mode=1
|
||||
host_as_route_disable=1
|
||||
l3_ecmp_levels=2
|
@ -0,0 +1,8 @@
|
||||
|
||||
l3_alpm_hit_skip=1
|
||||
sai_remap_prio_on_tnl_egress=1
|
||||
mmu_init_config="MSFT-TH2-Tier0"
|
||||
sai_tunnel_support=1
|
||||
sai_tunnel_underlay_route_mode=1
|
||||
host_as_route_disable=1
|
||||
l3_ecmp_levels=2
|
@ -0,0 +1,5 @@
|
||||
|
||||
l3_alpm_hit_skip=1
|
||||
|
||||
mmu_init_config="MSFT-TH2-Tier1"
|
||||
|
@ -364,6 +364,37 @@ class TestJ2Files(TestCase):
|
||||
assert utils.cmp(sample_output_file, test_output)
|
||||
os.remove(test_output)
|
||||
|
||||
def test_config_brcm_render_template(self):
|
||||
if utils.PYvX_DIR != 'py3':
|
||||
#Skip on python2 as the change will not be backported to previous version
|
||||
return
|
||||
|
||||
config_bcm_sample_outputs = [
|
||||
'arista7050cx3-dualtor.config.bcm',
|
||||
'arista7260-dualtor.config.bcm',
|
||||
'arista7260-t1.config.bcm'
|
||||
]
|
||||
sample_minigraph_files = [
|
||||
'sample-arista-7050cx3-dualtor-minigraph.xml',
|
||||
'sample-arista-7260-dualtor-minigraph.xml',
|
||||
'sample-arista-7260-t1-minigraph.xml'
|
||||
]
|
||||
for i, config in enumerate(config_bcm_sample_outputs):
|
||||
device_template_path = os.path.join(self.test_dir, './data/j2_template')
|
||||
config_sample_output = config_bcm_sample_outputs[i]
|
||||
sample_minigraph_file = os.path.join(self.test_dir,sample_minigraph_files[i])
|
||||
port_config_ini_file = os.path.join(device_template_path, 'port_config.ini')
|
||||
config_bcm_file = os.path.join(device_template_path, 'config.bcm.j2')
|
||||
config_test_output = os.path.join(self.test_dir, 'config_output.bcm')
|
||||
|
||||
argument = '-m ' + sample_minigraph_file + ' -p ' + port_config_ini_file + ' -t ' + config_bcm_file + ' > ' + config_test_output
|
||||
self.run_script(argument)
|
||||
|
||||
#check output config.bcm
|
||||
config_sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, config_sample_output)
|
||||
assert utils.cmp(config_sample_output_file, config_test_output)
|
||||
os.remove(config_test_output)
|
||||
|
||||
def _test_buffers_render_template(self, vendor, platform, sku, minigraph, buffer_template, expected):
|
||||
file_exist, dir_exist = self.create_machine_conf(platform, vendor)
|
||||
dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', vendor, platform, sku)
|
||||
|
Loading…
Reference in New Issue
Block a user