From 97645896d671e9127366513a5f094c0a5662061d Mon Sep 17 00:00:00 2001 From: Shuotian Cheng Date: Tue, 9 Jul 2019 08:08:59 -0700 Subject: [PATCH] [sonic-cfggen]: Remove trailing spaces (#3129) Signed-off-by: Shu0T1an ChenG --- src/sonic-config-engine/tests/test_cfggen.py | 6 +++--- .../tests/test_cfggen_t2_chassis_fe.py | 12 ++++++------ src/sonic-config-engine/tests/test_j2files.py | 6 +++--- .../tests/test_j2files_t2_chassis_fe.py | 8 ++++---- src/sonic-config-engine/tests/test_minigraph_case.py | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index eedaf6782722..ba29cc1abb5e 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -15,7 +15,7 @@ def setUp(self): 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 @@ def test_minigraph_vnet(self): 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(), "") \ No newline at end of file + self.assertEqual(output.strip(), "") diff --git a/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py b/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py index cc438896a033..b43559e5c481 100644 --- a/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py +++ b/src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py @@ -25,7 +25,7 @@ def run_script(self, argument, check_stderr=False): 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 @@ def test_minigraph_t2_chassis_fe_type(self): 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 @@ def test_minigraph_t2_chassis_fe_interfaces(self): 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 @@ def test_minigraph_t2_chassis_fe_vnet_default(self): 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'}}") \ No newline at end of file + self.assertEqual(output.strip(), "{'TunnelInt': {'source_ip': '4.0.0.0'}}") diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 525b5e79aa2a..2f0df12e7700 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -22,7 +22,7 @@ def setUp(self): 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 @@ def test_buffers_dell6100_render_template(self): 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 @@ def tearDown(self): try: os.remove(self.output_file) except OSError: - pass \ No newline at end of file + pass diff --git a/src/sonic-config-engine/tests/test_j2files_t2_chassis_fe.py b/src/sonic-config-engine/tests/test_j2files_t2_chassis_fe.py index 2215d4e8ca94..388f1b2885a6 100644 --- a/src/sonic-config-engine/tests/test_j2files_t2_chassis_fe.py +++ b/src/sonic-config-engine/tests/test_j2files_t2_chassis_fe.py @@ -15,11 +15,11 @@ def setUp(self): 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 @@ 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_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): diff --git a/src/sonic-config-engine/tests/test_minigraph_case.py b/src/sonic-config-engine/tests/test_minigraph_case.py index 093aea05b588..ded5d6182341 100644 --- a/src/sonic-config-engine/tests/test_minigraph_case.py +++ b/src/sonic-config-engine/tests/test_minigraph_case.py @@ -9,7 +9,7 @@ def setUp(self): 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 @@ def test_minigraph_vnet(self): 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(), "") \ No newline at end of file + self.assertEqual(output.strip(), "")