@@ -16,9 +16,13 @@ def setUp(self):
16
16
self .sample_device_desc = os .path .join (self .test_dir , 'device.xml' )
17
17
self .port_config = os .path .join (self .test_dir , 't0-sample-port-config.ini' )
18
18
19
- def run_script (self , argument ):
19
+ def run_script (self , argument , check_stderr = False ):
20
20
print '\n Running sonic-cfggen ' + argument
21
- output = subprocess .check_output (self .script_file + ' ' + argument , shell = True )
21
+ if check_stderr :
22
+ output = subprocess .check_output (self .script_file + ' ' + argument , stderr = subprocess .STDOUT , shell = True )
23
+ else :
24
+ output = subprocess .check_output (self .script_file + ' ' + argument , shell = True )
25
+
22
26
linecount = output .strip ().count ('\n ' )
23
27
if linecount <= 0 :
24
28
print ' Output: ' + output .strip ()
@@ -73,10 +77,12 @@ def test_render_template(self):
73
77
74
78
def test_minigraph_acl (self ):
75
79
argument = '-m "' + self .sample_graph_t0 + '" -p "' + self .port_config + '" -v ACL_TABLE'
76
- output = self .run_script (argument )
77
- self .assertEqual (output .strip (), "{'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []},"
78
- " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']}}" )
79
-
80
+ output = self .run_script (argument , True )
81
+ self .assertEqual (output .strip (), "Warning: Ingore Control Plane ACL NTP_ACL without type\n "
82
+ "{'SSH_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SSH_ACL', 'service': 'SSH', 'ports': []},"
83
+ " 'SNMP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'SNMP_ACL', 'service': 'SNMP', 'ports': []},"
84
+ " 'DATAACL': {'type': 'L3', 'policy_desc': 'DATAACL', 'ports': ['Ethernet112', 'Ethernet116', 'Ethernet120', 'Ethernet124']},"
85
+ " 'NTP_ACL': {'type': 'CTRLPLANE', 'policy_desc': 'NTP_ACL', 'service': 'NTP', 'ports': []}}" )
80
86
def test_minigraph_everflow (self ):
81
87
argument = '-m "' + self .sample_graph_t0 + '" -p "' + self .port_config + '" -v MIRROR_SESSION'
82
88
output = self .run_script (argument )
0 commit comments