Skip to content

Commit

Permalink
Update template file
Browse files Browse the repository at this point in the history
  • Loading branch information
shi-su committed Nov 18, 2020
1 parent ba7fda7 commit fd962aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sonic-config-engine/data/l2switch.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
{%- if ns.firstPrinted %},{% endif %}

"{{ key }}": {
"alias": "{{ value.alias }}",
"lanes": "{{ value.lanes }}",
{%- for k,v in value.items() %}

"{{ k }}": "{{ v }}",
{%- endfor %}

"admin_status": "up"
}
{%- if ns.update({'firstPrinted': True}) %}{% endif -%}
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-config-engine/tests/test_j2files.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ def test_l2switch_template(self):

self.assertTrue(json.dumps(sample_output_json, sort_keys=True) == json.dumps(output_json, sort_keys=True))

template_dir = os.path.join(self.test_dir, '..', 'data', 'l2switch.j2')
argument = '-t ' + template_dir + ' -k Mellanox-SN2700-D48C8 -p ' + self.t0_port_config
output = self.run_script(argument)
print(json.dumps(output_json, sort_keys=True))
print(json.dumps(sample_output_json, sort_keys=True))

self.assertTrue(json.dumps(sample_output_json, sort_keys=True) == json.dumps(output_json, sort_keys=True))

def test_qos_arista7050_render_template(self):
arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7050_qx32s', 'Arista-7050-QX-32S')
qos_file = os.path.join(arista_dir_path, 'qos.json.j2')
Expand Down

0 comments on commit fd962aa

Please sign in to comment.