4
4
5
5
from unittest import TestCase
6
6
7
- class TestJ2Files (TestCase ):
7
+ class TestAcl (TestCase ):
8
8
def setUp (self ):
9
9
self .test_dir = os .path .dirname (os .path .realpath (__file__ ))
10
10
self .script_file = os .path .join (self .test_dir , '..' , 'sonic-cfggen' )
@@ -16,11 +16,23 @@ def setUp(self):
16
16
17
17
def run_script (self , argument ):
18
18
print 'CMD: sonic-cfggen ' + argument
19
- return subprocess .check_output (self .script_file + ' ' + argument , shell = True )
19
+ output = ''
20
+ try :
21
+ output = subprocess .check_output (self .script_file + ' ' + argument , shell = True , stderr = subprocess .STDOUT )
22
+ except subprocess .CalledProcessError , (p ):
23
+ print 'subprocess.CalledProcessError: cmd:%s returncode:%s' % (p .cmd , p .returncode )
24
+ print output
25
+ return output
20
26
21
27
def run_acl_script (self , argument ):
22
28
print 'CMD: translate_acl ' + argument
23
- return subprocess .check_output (self .acl_script_file + ' ' + argument , shell = True )
29
+ output = ''
30
+ try :
31
+ output = subprocess .check_output (self .acl_script_file + ' ' + argument , shell = True , stderr = subprocess .STDOUT )
32
+ except subprocess .CalledProcessError , (p ):
33
+ print 'subprocess.CalledProcessError: cmd:%s returncode:%s' % (p .cmd , p .returncode )
34
+ print output
35
+ return output
24
36
25
37
def test_translate_acl (self ):
26
38
argument = '-m ' + self .t0_minigraph + ' -p ' + self .t0_port_config + ' -o ' + self .test_dir + ' ' + self .t0_acl
@@ -30,7 +42,7 @@ def test_translate_acl(self):
30
42
output_file = os .path .join (self .test_dir , filename )
31
43
assert filecmp .cmp (sample_output_file , output_file )
32
44
33
- def test_translate_everflor (self ):
45
+ def test_translate_everflow (self ):
34
46
argument = '-m ' + self .t0_minigraph_everflow + ' -p ' + self .t0_port_config + ' -o ' + self .test_dir + ' ' + self .t0_acl
35
47
self .run_acl_script (argument )
36
48
for filename in ['rules_for_everflow.json' ,'table_everflow.json' ]:
0 commit comments