def __init__(self, module_config, test_object): """Constructor Arguments: module_config Dictionary containing test configuration test_object The test object for the running test. """ self.set_pcap_defaults(module_config) VOIPListener.__init__(self, module_config, test_object) self.test_object = test_object self.token = test_object.create_fail_token("Haven't handled all " "expected NOTIFY packets.") self.expected_config = module_config['expected_body'] self.expected_notifies = int(module_config['expected_notifies']) self.body_type = module_config['expected_body_type'] self.notify_count = 0 if self.body_type.upper() not in ('PIDF', 'XPIDF'): msg = "Body type of '{0}' not supported." raise Exception(msg.format(self.body_type)) if self.expected_config.get('namespaces') is not None: if self.expected_config['namespaces'].get('default') is None: msg = "Namespaces configuration does not include a 'default'." raise Exception(msg) # Add calback for SIP packets self.add_callback('SIP', self.packet_handler)
def __init__(self, module_config, test_object): """Constructor Arguments: module_config Dictionary containing test configuration test_object used to manipulate reactor and set/remove failure tokens """ self.set_pcap_defaults(module_config) VOIPListener.__init__(self, module_config, test_object) self.test_object = test_object self.token = test_object.create_fail_token("Haven't handled all " "expected NOTIFY packets.") self.resources = module_config['resources'] self.list_name = module_config['list_name'] self.full_state = module_config['full_state'] self.ami_action = module_config.get('ami_action') self.stop_after_notifys = module_config.get('stop_after_notifys', True) self.version = 0 self.ami = None self.test_object.register_ami_observer(self.ami_connect) if hasattr(self.test_object, 'register_scenario_started_observer'): self.test_object.register_scenario_started_observer( self.scenario_started) self.add_callback('SIP', self.multipart_handler)
def __init__(self, module_config, test_object): """Create listener, add callback, and add AMI observer. Keyword Arguments: module_config Dict of module configuration test_object Test object """ self.set_pcap_defaults(module_config) VOIPListener.__init__(self, module_config, test_object) self.test_object = test_object self.ami = None self.test_object.register_ami_observer(self.ami_connect) self.add_callback('SIP', self.__check_sip_packet) self.calls = {'alice': [], 'bob': [], 'charlie': []}
def __init__(self, module_config, test_object): """Create listener and add AMI observer/callbacks.""" self.set_pcap_defaults(module_config) VOIPListener.__init__(self, module_config, test_object) self.test_object = test_object self.token = test_object.create_fail_token("Haven't handled all " "expected NOTIFY packets.") self.resources = module_config['resources'] self.list_name = module_config['list_name'] self.full_state = module_config['full_state'] self.ami_action = module_config.get('ami_action') self.stop_after_notifys = module_config.get('stop_after_notifys', True) self.version = 0 self.ami = None self.test_object.register_ami_observer(self.ami_connect) if hasattr(self.test_object, 'register_scenario_started_observer'): self.test_object.register_scenario_started_observer( self.scenario_started) self.add_callback('SIP', self.multipart_handler)