[snmp] Fix a bug in SNMP alias mapping (#473)

* [snmp] Fix a bug in SNMP alias mapping Which was introduced in #448.
This commit is contained in:
Taoyu Li 2017-04-03 21:34:18 -07:00 committed by GitHub
parent 6f04867954
commit 8391d7f8b5
2 changed files with 9 additions and 1 deletions

View File

@ -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 %}
}

View File

@ -1,6 +1,7 @@
import filecmp
import os
import subprocess
import json
from unittest import TestCase
@ -21,6 +22,13 @@ class TestJ2Files(TestCase):
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