Skip to content

Commit

Permalink
[sonic-cfggen]: Remove trailing spaces (sonic-net#3129)
Browse files Browse the repository at this point in the history
Signed-off-by: Shu0T1an ChenG <[email protected]>
  • Loading branch information
stcheng authored and lguohan committed Jul 9, 2019
1 parent cca115d commit 9764589
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/sonic-config-engine/tests/test_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(), "")
self.assertEqual(output.strip(), "")
12 changes: 6 additions & 6 deletions src/sonic-config-engine/tests/test_cfggen_t2_chassis_fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'}, "
Expand All @@ -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'): {}, "
Expand All @@ -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'}}")
self.assertEqual(output.strip(), "{'TunnelInt': {'source_ip': '4.0.0.0'}}")
6 changes: 3 additions & 3 deletions src/sonic-config-engine/tests/test_j2files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -136,4 +136,4 @@ def tearDown(self):
try:
os.remove(self.output_file)
except OSError:
pass
pass
8 changes: 4 additions & 4 deletions src/sonic-config-engine/tests/test_j2files_t2_chassis_fe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions src/sonic-config-engine/tests/test_minigraph_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(), "")
self.assertEqual(output.strip(), "")

0 comments on commit 9764589

Please sign in to comment.