1# -*-coding:utf-8 -*
2
3# Copyright (c) 2011-2015, Intel Corporation
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without modification,
7# are permitted provided that the following conditions are met:
8#
9# 1. Redistributions of source code must retain the above copyright notice, this
10# list of conditions and the following disclaimer.
11#
12# 2. Redistributions in binary form must reproduce the above copyright notice,
13# this list of conditions and the following disclaimer in the documentation and/or
14# other materials provided with the distribution.
15#
16# 3. Neither the name of the copyright holder nor the names of its contributors
17# may be used to endorse or promote products derived from this software without
18# specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31"""
32Rules management testcases
33
34List of tested functions :
35--------------------------
36    - [setRule]  function
37    - [clearRule] function
38    - [getRule] function
39
40Test cases :
41------------
42    - Testing clearRule errors
43    - Testing setRule errors
44    - Testing getRule errors
45    - Testing nominal case
46"""
47from Util.PfwUnitTestLib import PfwTestCase
48from Util import ACTLogging
49log=ACTLogging.Logger()
50
51# Test of Domains - Rules
52class TestCases(PfwTestCase):
53    def setUp(self):
54        self.pfw.sendCmd("setTuningMode", "on")
55        self.domain_name = "domain_test"
56        self.conf_1 = "conf_1"
57        self.conf_2 = "conf_2"
58        self.rule_1 = "Any{Crit_0 Includes State_0x2, Crit_1 IsNot State_1}"
59        self.rule_2 = "All{Crit_0 Includes State_0x1, Crit_1 Is State_1}"
60        self.rule_error_1 = "All{Crit_Error Includes State_0x1, Crit_1 Is State_1}"
61        self.rule_error_2 = "Any{Crit_0 Includes State_0x2, Crit_0 IsNot State_1}"
62        self.rule_error_3 = "Ay{Crit_0 Includes State_0x2, Crit_1 IsNot State_1}"
63        self.rule_error_4 = "All{Crit_0 Includes State_0x4, Crit_1 IsNot State_1}"
64        self.rule_error_5 = "All{Crit_0 Includes State_0x2, Crit_1 IsNot 1}"
65        self.rule_error_nbr = 5
66
67    def tearDown(self):
68        self.pfw.sendCmd("setTuningMode", "off")
69
70    def test_ClearRule_Errors(self):
71        """
72        Testing configuration creation error
73        ------------------------------------
74            Test case description :
75            ~~~~~~~~~~~~~~~~~~~~~~~
76                - Clearing rule on a non-existent configuration
77                - Clearing rule on a non-existent domain
78                - Clearing rule with wrong parameters order
79            Tested commands :
80            ~~~~~~~~~~~~~~~~~
81                - [clearRule] function
82                - [setRule] function
83                - [getRule] function
84                - [createDomain] function
85                - [createConfiguration] function
86                - [deleteDomain] function
87            Expected result :
88            ~~~~~~~~~~~~~~~~~
89                - all errors are detected
90                - no rule is deleted
91        """
92        log.D(self.test_ClearRule_Errors.__doc__)
93        # New domain creation for testing purpose
94        log.I("New domain creation for testing purpose : %s" % (self.domain_name))
95        log.I("command [createDomain]")
96        out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
97        assert out == "Done", out
98        assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
99        log.I("command [createDomain] correctly executed")
100        log.I("Domain %s created" % (self.domain_name))
101
102        # New configurations creation for testing purpose
103        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
104        log.I("command [createConfiguration]")
105        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
106        assert out == "Done", out
107        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
108        log.I("command [createConfiguration] correctly executed")
109        log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
110        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
111        log.I("command [createConfiguration]")
112        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
113        assert out == "Done", out
114        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
115        log.I("command [createConfiguration] correctly executed")
116        log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
117
118        # Applying rules to configurations
119        log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
120        log.I("command [setRule]")
121        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
122        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
123        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
124        log.I("command [setRule] correctly executed")
125        log.I("rule correctly created for configuration %s" % (self.conf_1))
126        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
127        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
128        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
129        log.I("command [setRule] correctly executed")
130        log.I("rule correctly created for configuration %s" % (self.conf_2))
131
132        # Clearing rule errors
133        log.I("Clearing a rule on domain %s to a non-existent configuration" % (self.domain_name))
134        log.I("command [clearRule]")
135        out, err = self.pfw.sendCmd("clearRule",self.domain_name,"Wrong_Config_Name", expectSuccess=False)
136        assert err == None, "ERROR : command [clearRule] - Error while clearing rule on domain %s to a non-existent configuration" % (self.domain_name)
137        assert out != "Done", "ERROR : command [clearRule] - Error not detected while clearing rule on domain %s to a non-existent configuration" % (self.domain_name)
138        log.I("error correctly detected when clearing a rule to a non-existent configuration")
139        log.I("Clearing a rule on a non-existent domain")
140        log.I("command [clearRule]")
141        out, err = self.pfw.sendCmd("clearRule","Wrong_Domain_Name",self.conf_2, expectSuccess=False)
142        assert err == None, "ERROR : command [clearRule] - Error while clearing rule on a non-existent domain"
143        assert out != "Done", "ERROR : command [clearRule] - Error not detected while clearing rule on a non-existent domain"
144        log.I("error correctly detected while clearing rule on a non-existent domain")
145        log.I("Clearing a rule with wrong parameters order")
146        log.I("command [clearRule]")
147        out, err = self.pfw.sendCmd("clearRule",self.conf_1,self.domain_name, expectSuccess=False)
148        assert err == None, "ERROR : command [clearRule] - Error when clearing a rule with incorrect paramaters order"
149        assert out != "Done", "ERROR : command [clearRule] - Error not detected when clearing a rule with incorrect paramaters order"
150        log.I("error correctly detected when clearing a rule with incorrect paramaters order on domain %s and configuration %s" % (self.domain_name,self.conf_1))
151
152        #Checking that no rule has been cleared
153        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
154        assert out == self.rule_1, "FAIL : command [clearRule] - clearRule error has affected configuration %s" % (self.conf_1)
155        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
156        assert out == self.rule_2, "FAIL : command [clearRule] - clearRule error has affected configuration %s" % (self.conf_2)
157        log.I("command [ClearRule] correctly executed, no impact due to clearing errors")
158        log.I("no rule removed from configurations %s and %s on domain %s" % (self.conf_1,self.conf_2,self.domain_name))
159
160        # New domain deletion
161        log.I("Domain %s deletion" % (self.domain_name))
162        log.I("command [deleteDomain]")
163        out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
164        assert out == "Done", out
165        assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
166        log.I("command [deleteDomain] correctly executed")
167        log.I("Domain %s deleted" % (self.domain_name))
168
169    def test_SetRule_Errors(self):
170        """
171        Testing setRule errors
172        ----------------------
173            Test case description :
174            ~~~~~~~~~~~~~~~~~~~~~~~
175                - Setting rule on a non-existent configuration
176                - Setting rule on a non-existent domain
177                - Setting various incorrect format rules
178            Tested commands :
179            ~~~~~~~~~~~~~~~~~
180                - [setRule] function
181                - [getRule] function
182                - [createDomain] function
183                - [createConfiguration] function
184                - [deleteDomain] function
185            Expected result :
186            ~~~~~~~~~~~~~~~~~
187                - all errors are detected
188                - no new rule is created
189        """
190        log.D(self.test_SetRule_Errors.__doc__)
191        # New domain creation for testing purpose
192        log.I("New domain creation for testing purpose : %s" % (self.domain_name))
193        log.I("command [createDomain]")
194        out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
195        assert out == "Done", out
196        assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
197        log.I("command [createDomain] correctly executed")
198        log.I("Domain %s created" % (self.domain_name))
199
200        # New configuration creation for testing purpose
201        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
202        log.I("command [createConfiguration]")
203        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
204        assert out == "Done", out
205        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
206        log.I("command [createConfiguration] correctly executed")
207        log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
208
209        # setRule :basic error cases
210        log.I("Applying a new rule on domain %s to a non-existent configuration" % (self.domain_name))
211        log.I("command [setRule]")
212        out, err = self.pfw.sendCmd("setRule",self.domain_name,"Wrong_Config_Name",self.rule_1, expectSuccess=False)
213        assert err == None, "ERROR : command [setRule] - Error while setting rule on domain %s to a non-existent configuration" % (self.domain_name)
214        assert out != "Done", "ERROR : command [setRule] - Error not detected while setting rule on domain %s to a non-existent configuration" % (self.domain_name)
215        log.I("error correctly detected when creating a rule to a non-existent configuration")
216        log.I("Applying a new rule on a non-existent domain")
217        log.I("command [setRule]")
218        out, err = self.pfw.sendCmd("setRule","Wrong_Domain_Name",self.conf_1,self.rule_1, expectSuccess=False)
219        assert err == None, "ERROR : command [setRule] - Error while setting rule on a non-existent domain"
220        assert out != "Done", "ERROR : command [setRule] - Error not detected while setting rule on a non-existent domain"
221        log.I("error correctly detected while setting rule on a non-existent domain")
222        log.I("Applying a new rule with incorrect format")
223        log.I("command [setRule]")
224        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,"Wrong_Rule_Format", expectSuccess=False)
225        assert err == None, "ERROR : command [setRule] - Error when setting incorrect format rule"
226        assert out != "Done", "ERROR : command [setRule] - Error not detected when setting incorrect format rule"
227        log.I("error correctly detected when setting incorrect format rule on domain %s and configuration %s" % (self.domain_name,self.conf_1))
228
229        # setRule : various rules errors
230        log.I("Various rules errors setting :")
231        for index in range (self.rule_error_nbr):
232            log.I("Rule error number %s" % (str(index)))
233            rule_name = "".join(["self.rule_error_", "_", str(index)])
234            out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1, rule_name, expectSuccess=False)
235            assert err == None, "ERROR : command [setRule] - Error when setting incorrect format rule %s" % (str(rule_name))
236            assert out != "Done", "ERROR : command [setRule] - Error not detected when setting incorrect format rule %s" % (str(rule_name))
237            log.I("error correctly detected when setting incorrect format rule on domain %s and configuration %s" % (self.domain_name,self.conf_1))
238
239        #Checking that no rule has been created
240        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
241        assert out == "<none>", "FAIL : command [setRule] - setRule not working for configuration %s" % (self.conf_1)
242        log.I("command [setRule] correctly executed, no impact due to setting errors")
243        log.I("no rule added to configurations %s on domain %s" % (self.conf_1,self.domain_name))
244
245        # New domain deletion
246        log.I("Domain %s deletion" % (self.domain_name))
247        log.I("command [deleteDomain]")
248        out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
249        assert out == "Done", out
250        assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
251        log.I("command [deleteDomain] correctly executed")
252        log.I("Domain %s deleted" % (self.domain_name))
253
254    def test_GetRule_Errors(self):
255        """
256        Testing getRule errors
257        ----------------------
258            Test case description :
259            ~~~~~~~~~~~~~~~~~~~~~~~
260                - Getting rule on a non-existent configuration
261                - Getting rule on a non-existent domain
262                - Getting rule with wrong parameters order
263            Tested commands :
264            ~~~~~~~~~~~~~~~~~
265                - [getRule] function
266                - [setRule] function
267                - [clearRule] function
268                - [createDomain] function
269                - [createConfiguration] function
270                - [deleteDomain] function
271            Expected result :
272            ~~~~~~~~~~~~~~~~~
273                - all errors are detected
274        """
275        log.D(self.test_GetRule_Errors.__doc__)
276        # New domain creation for testing purpose
277        log.I("New domain creation for testing purpose : %s" % (self.domain_name))
278        log.I("command [createDomain]")
279        out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
280        assert out == "Done", out
281        assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
282        log.I("command [createDomain] correctly executed")
283        log.I("Domain %s created" % (self.domain_name))
284
285        # New configurations creation for testing purpose
286        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
287        log.I("command [createConfiguration]")
288        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
289        assert out == "Done", out
290        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
291        log.I("command [createConfiguration] correctly executed")
292        log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
293        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
294        log.I("command [createConfiguration]")
295        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
296        assert out == "Done", out
297        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
298        log.I("command [createConfiguration] correctly executed")
299        log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
300
301        # Applying rules to configurations
302        log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
303        log.I("command [setRule]")
304        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
305        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
306        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
307        log.I("command [setRule] correctly executed")
308        log.I("rule correctly created for configuration %s" % (self.conf_1))
309        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
310        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
311        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
312        log.I("command [setRule] correctly executed")
313        log.I("rule correctly created for configuration %s" % (self.conf_2))
314
315        # Getting rule errors
316        log.I("Getting a rule on domain %s from a non-existent configuration" % (self.domain_name))
317        log.I("command [getRule]")
318        out, err = self.pfw.sendCmd("getRule",self.domain_name,"Wrong_Config_Name", expectSuccess=False)
319        assert err == None, "ERROR : command [getRule] - Error when getting rule on domain %s from a non-existent configuration" % (self.domain_name)
320        assert out != "Done", "ERROR : command [getRule] - Error not detected while getting rule on domain %s from a non-existent configuration" % (self.domain_name)
321        log.I("error correctly detected when getting a rule from a non-existent configuration")
322        log.I("getting a rule from a non-existent domain")
323        log.I("command [getRule]")
324        out, err = self.pfw.sendCmd("getRule","Wrong_Domain_Name",self.conf_2, expectSuccess=False)
325        assert err == None, "ERROR : command [getRule] - Error when getting rule from a non-existent domain"
326        assert out != "Done", "ERROR : command [getRule] - Error not detected while getting rule from a non-existent domain"
327        log.I("error correctly detected when getting rule from a non-existent domain")
328        log.I("getting a rule with wrong parameters order")
329        log.I("command [getRule]")
330        out, err = self.pfw.sendCmd("getRule",self.conf_1,self.domain_name, expectSuccess=False)
331        assert err == None, "ERROR : command [getRule] - Error when getting a rule with incorrect paramaters order"
332        assert out != "Done", "ERROR : command [getRule] - Error not detected when getting a rule with incorrect paramaters order"
333        log.I("error correctly detected when getting a rule with incorrect paramaters order on domain %s and configuration %s" % (self.domain_name,self.conf_1))
334
335        # New domain deletion
336        log.I("Domain %s deletion" % (self.domain_name))
337        log.I("command [deleteDomain]")
338        out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
339        assert out == "Done", out
340        assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
341        log.I("command [deleteDomain] correctly executed")
342        log.I("Domain %s deleted" % (self.domain_name))
343
344    def test_Nominal_Case(self):
345        """
346        Testing nominal case
347        --------------------
348            Test case description :
349            ~~~~~~~~~~~~~~~~~~~~~~~
350                - setting rules for configurations
351                - getting rules from configurations
352                - Clear created rules
353            Tested commands :
354            ~~~~~~~~~~~~~~~~~
355                - [getRule] function
356                - [setRule] function
357                - [clearRule] function
358                - [createDomain] function
359                - [createConfiguration] function
360                - [deleteConfiguration] function
361                - [deleteDomain] function
362            Expected result :
363            ~~~~~~~~~~~~~~~~~
364                - all operations succeed
365        """
366        log.D(self.test_Nominal_Case.__doc__)
367        # New domain creation for testing purpose
368        log.I("New domain creation for testing purpose : %s" % (self.domain_name))
369        log.I("command [createDomain]")
370        out, err = self.pfw.sendCmd("createDomain",self.domain_name, "")
371        assert out == "Done", out
372        assert err == None, "ERROR : command [createDomain] - Error while creating domain %s" % (self.domain_name)
373        log.I("command [createDomain] correctly executed")
374        log.I("Domain %s created" % (self.domain_name))
375
376        # New configurations creation for testing purpose
377        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_1,self.domain_name))
378        log.I("command [createConfiguration]")
379        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_1)
380        assert out == "Done", out
381        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_1)
382        log.I("command [createConfiguration] correctly executed")
383        log.I("Configuration %s created for domain %s" % (self.conf_1,self.domain_name))
384        log.I("New configuration %s creation for domain %s for testing purpose" % (self.conf_2,self.domain_name))
385        log.I("command [createConfiguration]")
386        out, err = self.pfw.sendCmd("createConfiguration",self.domain_name,self.conf_2)
387        assert out == "Done", out
388        assert err == None, "ERROR : command [createConfiguration] - Error while creating configuration %s" % (self.conf_2)
389        log.I("command [createConfiguration] correctly executed")
390        log.I("Configuration %s created for domain %s" % (self.conf_2,self.domain_name))
391
392        # Applying rules to configurations
393        log.I("Applying rules to configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
394        log.I("command [setRule]")
395        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_1,self.rule_1)
396        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_1)
397        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_1)
398        log.I("command [setRule] correctly executed")
399        log.I("rule correctly created for configuration %s" % (self.conf_1))
400        out, err = self.pfw.sendCmd("setRule",self.domain_name,self.conf_2,self.rule_2)
401        assert err == None, "ERROR : command [setRule] - Error while setting rule for configurations %s" % (self.conf_2)
402        assert out == "Done", "FAIL : command [setRule] - Error while setting rule for configuration %s" % (self.conf_2)
403        log.I("command [setRule] correctly executed")
404        log.I("rule correctly created for configuration %s" % (self.conf_2))
405
406        # Checking rules recovered
407        log.I("Recovering rules for configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
408        log.I("command [getRule]")
409        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
410        assert err == None, "ERROR : command [getRule] - Error while setting rule to configurations %s" % (self.conf_1)
411        assert out == str(self.rule_1), "FAIL : command [getRule] - Error while recovering rule from configuration %s, incorrect value" % (self.conf_1)
412        log.I("command [getRule] correctly executed")
413        log.I("rule correctly recovered from configuration %s" % (self.conf_1))
414        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
415        assert err == None, "ERROR : command [getRule] - Error while setting rule to configurations %s" % (self.conf_2)
416        assert out == str(self.rule_2), "FAIL : command [getRule] - Error while recovering rule from configuration %s, incorrect value" % (self.conf_2)
417        log.I("command [getRule] correctly executed")
418        log.I("rule correctly recovered from configuration %s" % (self.conf_2))
419
420        # Clearing rules
421        log.I("Clear rules for configurations %s and %s from domain %s" % (self.conf_1,self.conf_2,self.domain_name))
422        log.I("command [clearRule]")
423        out, err = self.pfw.sendCmd("clearRule",self.domain_name,self.conf_1)
424        assert err == None, "ERROR : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_1)
425        assert out == "Done", "FAIL : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_1)
426        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_1)
427        assert out == "<none>", "ERROR : command [clearRule] - ClearRule not working for configuration %s" % (self.conf_1)
428        out, err = self.pfw.sendCmd("clearRule",self.domain_name,self.conf_2)
429        assert err == None, "ERROR : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_2)
430        assert out == "Done", "FAIL : command [clearRule] - Error on clearRule for configuration %s" % (self.conf_2)
431        out, err = self.pfw.sendCmd("getRule",self.domain_name,self.conf_2)
432        assert out == "<none>", "ERROR : command [clearRule] - ClearRule not working for configuration %s" % (self.conf_2)
433        log.I("command [clearRule] correctly executed")
434        log.I("ClearRule effective for configurations %s and %s" % (self.conf_1,self.conf_2))
435
436        # New domain deletion
437        log.I("Domain %s deletion" % (self.domain_name))
438        log.I("command [deleteDomain]")
439        out, err = self.pfw.sendCmd("deleteDomain",self.domain_name, "")
440        assert out == "Done", out
441        assert err == None, "ERROR : command [deleteDomain] - Error while delting domain %s" % (self.domain_name)
442        log.I("command [deleteDomain] correctly executed")
443        log.I("Domain %s deleted" % (self.domain_name))
444