[sonic-cfggen]: Remove trailing spaces (#3129)

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
This commit is contained in:
Shuotian Cheng 2019-07-09 08:08:59 -07:00 committed by lguohan
parent cca115de9d
commit 97645896d6
5 changed files with 19 additions and 19 deletions

View File

@ -15,7 +15,7 @@ class TestCfgGen(TestCase):
self.sample_graph_bgp_speaker = os.path.join(self.test_dir, 't0-sample-bgp-speaker.xml')
self.sample_device_desc = os.path.join(self.test_dir, 'device.xml')
self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini')
def run_script(self, argument, check_stderr=False):
print '\n Running sonic-cfggen ' + argument
if check_stderr:
@ -243,8 +243,8 @@ class TestCfgGen(TestCase):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VNET"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
def test_minigraph_vxlan(self):
argument = '-m "' + self.sample_graph_simple + '" -p "' + self.port_config + '" -v "VXLAN_TUNNEL"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
self.assertEqual(output.strip(), "")

View File

@ -25,7 +25,7 @@ class TestCfgGenT2ChassisFe(TestCase):
else:
print ' Output: ({0} lines, {1} bytes)'.format(linecount + 1, len(output))
return output
def test_minigraph_t2_chassis_fe_type(self):
argument = '-m "' + self.sample_graph_t2_chassis_fe + '" -p "' + self.t2_chassis_fe_port_config + '" -v "DEVICE_METADATA[\'localhost\'][\'type\']"'
output = self.run_script(argument)
@ -34,7 +34,7 @@ class TestCfgGenT2ChassisFe(TestCase):
def test_minigraph_t2_chassis_fe_interfaces(self):
argument = '-m "' + self.sample_graph_t2_chassis_fe + '" -p "' + self.t2_chassis_fe_port_config + '" -v "INTERFACE"'
output = self.run_script(argument)
self.assertEqual(output.strip(),
self.assertEqual(output.strip(),
"{'Ethernet8': {}, "
"('Ethernet8', '172.16.0.9/30'): {}, "
"'Ethernet0': {'vnet_name': 'VnetFE'}, "
@ -45,7 +45,7 @@ class TestCfgGenT2ChassisFe(TestCase):
def test_minigraph_t2_chassis_fe_pc_interfaces(self):
argument = '-m "' + self.sample_graph_t2_chassis_fe_pc + '" -p "' + self.t2_chassis_fe_port_config + '" -v "PORTCHANNEL_INTERFACE"'
output = self.run_script(argument)
self.assertEqual(output.strip(),
self.assertEqual(output.strip(),
"{'PortChannel8': {}, "
"('PortChannel0', '192.168.0.2/30'): {}, "
"('PortChannel4', '172.16.0.1/30'): {}, "
@ -60,13 +60,13 @@ class TestCfgGenT2ChassisFe(TestCase):
output = self.run_script(argument)
self.assertEqual(output.strip(), "{'VnetFE': {'vxlan_tunnel': 'TunnelInt', 'vni': 8000}}")
# Test a minigraph file where VNI is specified
# Test a minigraph file where VNI is specified
def test_minigraph_t2_chassis_fe_vnet(self):
argument = '-m "' + self.sample_graph_t2_chassis_fe_vni + '" -p "' + self.t2_chassis_fe_port_config + '" -v "VNET"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "{'VnetFE': {'vxlan_tunnel': 'TunnelInt', 'vni': 9000}}")
def test_minigraph_t2_chassis_fe_vxlan(self):
argument = '-m "' + self.sample_graph_t2_chassis_fe + '" -p "' + self.t2_chassis_fe_port_config + '" -v "VXLAN_TUNNEL"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "{'TunnelInt': {'source_ip': '4.0.0.0'}}")
self.assertEqual(output.strip(), "{'TunnelInt': {'source_ip': '4.0.0.0'}}")

View File

@ -22,7 +22,7 @@ class TestJ2Files(TestCase):
def run_script(self, argument):
print 'CMD: sonic-cfggen ' + argument
return subprocess.check_output(self.script_file + ' ' + argument, shell=True)
def run_diff(self, file1, file2):
return subprocess.check_output('diff -u {} {} || true'.format(file1, file2), shell=True)
@ -124,7 +124,7 @@ class TestJ2Files(TestCase):
argument = '-m ' + self.dell6100_t0_minigraph + ' -p ' + port_config_ini_file + ' -t ' + buffers_file + ' > ' + self.output_file
self.run_script(argument)
# cleanup
buffers_config_file_new = os.path.join(dell_dir_path, 'buffers_config.j2')
os.remove(buffers_config_file_new)
@ -136,4 +136,4 @@ class TestJ2Files(TestCase):
try:
os.remove(self.output_file)
except OSError:
pass
pass

View File

@ -15,11 +15,11 @@ class TestJ2FilesT2ChassisFe(TestCase):
self.t2_chassis_fe_pc_minigraph = os.path.join(self.test_dir, 't2-chassis-fe-graph-pc.xml')
self.t2_chassis_fe_port_config = os.path.join(self.test_dir, 't2-chassis-fe-port-config.ini')
self.output_file = os.path.join(self.test_dir, 'output')
def run_script(self, argument):
print 'CMD: sonic-cfggen ' + argument
return subprocess.check_output(self.script_file + ' ' + argument, shell=True)
# Test zebra.conf in FRR docker for a T2 chassis frontend (fe)
def test_t2_chassis_fe_zebra_frr(self):
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', 'zebra.conf.j2')
@ -32,14 +32,14 @@ class TestJ2FilesT2ChassisFe(TestCase):
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', 'zebra.conf.j2')
argument = '-m ' + self.t2_chassis_fe_pc_minigraph + ' -p ' + self.t2_chassis_fe_port_config + ' -t ' + conf_template + ' > ' + self.output_file
self.run_script(argument)
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 't2-chassis-fe-pc-zebra.conf'), self.output_file))
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 't2-chassis-fe-pc-zebra.conf'), self.output_file))
# Test zebra.conf in FRR docker for a T2 chassis frontend (fe) switch with specified VNI
def test_t2_chassis_fe_pc_zebra_frr(self):
conf_template = os.path.join(self.test_dir, '..', '..', '..', 'dockers', 'docker-fpm-frr', 'zebra.conf.j2')
argument = '-m ' + self.t2_chassis_fe_vni_minigraph + ' -p ' + self.t2_chassis_fe_port_config + ' -t ' + conf_template + ' > ' + self.output_file
self.run_script(argument)
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 't2-chassis-fe-vni-zebra.conf'), self.output_file))
self.assertTrue(filecmp.cmp(os.path.join(self.test_dir, 'sample_output', 't2-chassis-fe-vni-zebra.conf'), self.output_file))
# Test bgpd.conf in FRR docker for a T2 chassis frontend (fe)
def test_t2_chassis_frontend_bgpd_frr(self):

View File

@ -9,7 +9,7 @@ class TestCfgGenCaseInsensitive(TestCase):
self.script_file = os.path.join(self.test_dir, '..', 'sonic-cfggen')
self.sample_graph = os.path.join(self.test_dir, 'simple-sample-graph-case.xml')
self.port_config = os.path.join(self.test_dir, 't0-sample-port-config.ini')
def run_script(self, argument, check_stderr=False):
print '\n Running sonic-cfggen ' + argument
if check_stderr:
@ -128,8 +128,8 @@ class TestCfgGenCaseInsensitive(TestCase):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VNET"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
def test_minigraph_vxlan(self):
argument = '-m "' + self.sample_graph + '" -p "' + self.port_config + '" -v "VXLAN_TUNNEL"'
output = self.run_script(argument)
self.assertEqual(output.strip(), "")
self.assertEqual(output.strip(), "")