<s> import commands <EOL> import logging <EOL> import sys <EOL> from libs import config_libs <EOL> from libs import utils_libs <EOL> from libs import verify_libs <EOL> def main ( ) : <EOL> test = test_gbp_pa_neg ( ) <EOL> if test . test_pa_invalid_act_type ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> if test . test_pa_valid_type_inval_val ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> if test . test_pa_invalid_act_value ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> if test . test_pa_update_act_type ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> if test . test_pa_update_invalid_act_val ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> if test . test_pa_delete_invalid_pa ( ) == <NUM_LIT:0> : <EOL> test . cleanup ( tc_name = '<STR_LIT>' ) <EOL> test . cleanup ( ) <EOL> utils_libs . report_results ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> class test_gbp_pa_neg ( object ) : <EOL> logging . basicConfig ( <EOL> format = '<STR_LIT>' , <EOL> level = logging . WARNING ) <EOL> _log = logging . getLogger ( __name__ ) <EOL> cmd = '<STR_LIT>' <EOL> commands . getoutput ( cmd ) <EOL> hdlr = logging . FileHandler ( '<STR_LIT>' ) <EOL> formatter = logging . Formatter ( '<STR_LIT>' ) <EOL> hdlr . setFormatter ( formatter ) <EOL> _log . addHandler ( hdlr ) <EOL> _log . setLevel ( logging . INFO ) <EOL> _log . setLevel ( logging . DEBUG ) <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> self . gbpcfg = config_libs . Gbp_Config ( ) <EOL> self . gbpverify = verify_libs . Gbp_Verify ( ) <EOL> self . act_name = '<STR_LIT>' <EOL> def cleanup ( self , tc_name = '<STR_LIT>' ) : <EOL> if tc_name != '<STR_LIT>' : <EOL> self . _log . info ( '<STR_LIT>' % ( tc_name ) ) <EOL> for obj in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:action>' ] : <EOL> self . gbpcfg . gbp_del_all_anyobj ( obj ) <EOL> def test_pa_invalid_act_type ( self ) : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> for _type in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> if self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:1> , self . act_name , action_type = _type ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % <EOL> ( _type ) ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpverify . gbp_action_verify ( <NUM_LIT:1> , self . act_name ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> def test_pa_valid_type_inval_val ( self ) : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:1> , <EOL> self . act_name , <EOL> action_type = '<STR_LIT>' , <EOL> action_value = '<STR_LIT>' ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpverify . gbp_action_verify ( <NUM_LIT:1> , self . act_name ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> def test_pa_invalid_act_value ( self ) : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:1> , self . act_name , action_value = '<STR_LIT>' ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpverify . gbp_action_verify ( <NUM_LIT:1> , self . act_name ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> def test_pa_update_act_type ( self ) : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> act_uuid = self . gbpcfg . gbp_action_config ( <NUM_LIT:1> , self . act_name ) <EOL> if act_uuid == <NUM_LIT:0> : <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:2> , <EOL> act_uuid , <EOL> name = '<STR_LIT>' , <EOL> action_type = '<STR_LIT>' ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpverify . gbp_action_verify ( <EOL> <NUM_LIT:1> , <EOL> self . act_name , <EOL> id = act_uuid , <EOL> action_type = '<STR_LIT>' , <EOL> shared = '<STR_LIT:False>' ) == <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> def test_pa_update_invalid_act_val ( self ) : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> act_uuid = self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:1> , '<STR_LIT>' , action_type = '<STR_LIT>' ) <EOL> if act_uuid == <NUM_LIT:0> : <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpcfg . gbp_action_config ( <EOL> <NUM_LIT:2> , <EOL> act_uuid , <EOL> name = '<STR_LIT>' , <EOL> action_value = '<STR_LIT>' ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> if self . gbpverify . gbp_action_verify ( <EOL> <NUM_LIT:1> , <EOL> '<STR_LIT>' , <EOL> id = act_uuid , <EOL> action_type = '<STR_LIT>' , <EOL> shared = '<STR_LIT:False>' ) == <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> def test_pa_delete_invalid_pa ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if self . gbpcfg . gbp_action_config ( <NUM_LIT:0> , '<STR_LIT>' ) != <NUM_LIT:0> : <EOL> self . _log . info ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return <NUM_LIT:0> <EOL> self . _log . info ( "<STR_LIT>" ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
