Skip to content

Commit

Permalink
[snmp] Fix a bug in SNMP alias mapping (#473)
Browse files Browse the repository at this point in the history
* [snmp] Fix a bug in SNMP alias mapping Which was introduced in #448.
  • Loading branch information
taoyl-ms authored Apr 4, 2017
1 parent 6f04867 commit 8391d7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dockers/docker-snmp-sv2/alias_map.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
{% for member in minigraph_ports.keys() %}
"{{member}}": "{{minigraph_ports[member]['alias']}}"
"{{member}}": "{{minigraph_ports[member]['alias']}}"{% if not loop.last %},{% endif %}
{% endfor %}
}
8 changes: 8 additions & 0 deletions src/sonic-config-engine/tests/test_j2files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import filecmp
import os
import subprocess
import json

from unittest import TestCase

Expand All @@ -21,6 +22,13 @@ def test_interfaces(self):
argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + interfaces_template + '"'
output = self.run_script(argument)

def test_alias_map(self):
alias_map_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-snmp-sv2', 'alias_map.j2')
argument = '-m "' + self.t0_minigraph + '" -p "' + self.t0_port_config + '" -t "' + alias_map_template + '"'
output = self.run_script(argument)
data = json.loads(output)
self.assertEqual(data["Ethernet4"], "fortyGigE0/4")

def test_teamd(self):
argument = '-m ' + self.t0_minigraph + ' -p ' + self.t0_port_config + ' -v "minigraph_portchannels.keys() | join(\' \')"'
output = self.run_script(argument) # Mock the output via config.sh in docker-teamd
Expand Down

0 comments on commit 8391d7f

Please sign in to comment.