Example #1
0
    def testAlarms(self):
        #Jenifer sends out messages to all short codes (6767, 8500) via the various modems (mtn-modem, utl-modem) etc
        call_command('send_qos_messages')

        #Only a few modems reply with messages to Jenny
        for connection in Connection.objects.filter(
                backend__name__endswith='modem').exclude(identity__in=[
                    '256777773260', '256752145316', '256711957281',
                    '256701205129'
                ])[:5]:
            self.fake_incoming(datetime.now().strftime('%Y-%m-%d %H'),
                               connection)

        #Jennifer kicks in with the monitoring service
        call_command('monitor_qos_messages')
        alarms = get_alarms()

        #Jenny complains about her missing replies
        self.assertEquals(len(alarms), 8)

        #Poor Jenny spams everyone in protest
        msgs = []
        for msg in Message.objects.filter(direction='O').exclude(
                connection__identity__in=Message.objects.filter(
                    direction='I').values_list('connection__identity')):
            identity = msg.connection.identity
            modem = msg.connection.backend
            network = msg.connection.backend.name.split('-')[0]
            msgs.append(
                'Jennifer did not get a reply from %s using the %s, %s appears to be down!'
                % (identity, modem, network.upper()))
        self.assertEquals(msgs, get_alarms())
Example #2
0
 def testAlarms(self):
     #Jenifer sends out messages to all short codes (6767, 8500) via the various modems (mtn-modem, utl-modem) etc
     call_command('send_qos_messages')
     
     #Only a few modems reply with messages to Jenny
     for connection in Connection.objects.filter(backend__name__endswith='modem').exclude(identity__in=['256777773260', '256752145316', '256711957281', '256701205129'])[:5]:
         self.fake_incoming(datetime.now().strftime('%Y-%m-%d %H'), connection)
     
     #Jennifer kicks in with the monitoring service
     call_command('monitor_qos_messages')
     alarms = get_alarms()
     
     #Jenny complains about her missing replies
     self.assertEquals(len(alarms), 8)
     
     #Poor Jenny spams everyone in protest
     msgs = []
     for msg in Message.objects.filter(direction='O').exclude(connection__identity__in=Message.objects.filter(direction='I').values_list('connection__identity')):
         identity = msg.connection.identity
         modem = msg.connection.backend
         network = msg.connection.backend.name.split('-')[0]
         msgs.append('Jennifer did not get a reply from %s using the %s, %s appears to be down!' % (identity, modem, network.upper()))
     self.assertEquals(msgs, get_alarms())
Example #3
0
 def testNoAlarms(self):
     #Jenifer sends out messages to all short codes (6767, 8500) via the various modems (mtn-modem, utl-modem) etc
     call_command('send_qos_messages')
     
     #Through the various apps, all short codes send back replies to Jennifer
     for connection in Connection.objects.filter(backend__name__endswith='modem'):
         self.fake_incoming(datetime.now().strftime('%Y-%m-%d %H'), connection)
         
     #Jennifer kicks in with the monitoring service
     call_command('monitor_qos_messages')
     alarms = get_alarms()
     
     #no alarms expected since all apps replied
     self.assertEquals(len(alarms), 0)
Example #4
0
    def testNoAlarms(self):
        #Jenifer sends out messages to all short codes (6767, 8500) via the various modems (mtn-modem, utl-modem) etc
        call_command('send_qos_messages')

        #Through the various apps, all short codes send back replies to Jennifer
        for connection in Connection.objects.filter(
                backend__name__endswith='modem'):
            self.fake_incoming(datetime.now().strftime('%Y-%m-%d %H'),
                               connection)

        #Jennifer kicks in with the monitoring service
        call_command('monitor_qos_messages')
        alarms = get_alarms()

        #no alarms expected since all apps replied
        self.assertEquals(len(alarms), 0)