def initTrueTable(caller): resultsList = [['sip', 'GSMExt.Eplus', '200'], ['sip', 'GSMExt.Tm', '200'], ['sip', 'GSMExt.O2', '200'], ['sip', 'GSMExt.Voda', '200'], ['sip', 'landline', '200'], ['sip', 'unisip', '200'], ['unisip', 'sip', '486']] for x in resultsList: destination = x[1] result = x[2] if caller == x[0]: if destination == 'GSMRZ1': if result =='486': for y in resultsList: destination = y[1] result = y[2] if caller == y[0]: if destination == 'GSMRZ2': if result == '200': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMRZ3': if result == '200': print "BTS RZ 1 Broken" elif result == '486': print "BTS RZ 1 & 3 indicate having Problem" else: print "incomplete test, Handler having error, please do one more test" elif destination == '486': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMRZ3': if result == '200': print "BTS RZ 1 & 2 indicate having Problem" elif result == '486': print "OpenBSc Down" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif result =='200': for y in resultsList: destination = y[1] result = y[2] if caller == y[0]: if destination == 'GSMRZ2': if result == '200': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMRZ3': if result != '200': print "BTS RZ 3 Broken" else: print "All GSM RZ are working" elif result == '486': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMRZ3': if result == '200': print "BTS RZ 2 Broken" elif result == '486': print "BTS RZ 2 & 3 indicate having Problem" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif destination == 'GSMExt.O2': if result == '486': for y in resultsList: destination = y[1] result = y[2] if caller == y[0]: if destination == 'GSMExt.Voda': if result == '200': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMExt.Eplus': if result == '486': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "O2 & E-Plus indicate having Problem" elif result == '486': print "T-Mobile, E-plus and O2 cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" elif result == '200': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "O2 cards indicate having Problem" elif result == '486': print "T-Mobile and O2 cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif result == '486': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMExt.Eplus': if result == '200': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "O2 and Vodaphone cards indicate having problem" elif result == '486': print "T-Mobile, Vodaphone and O2 cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" elif result == '486': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "O2, E-Plus and Vodaphone cards indicate having problem" elif result == '486': print "GSM External Modem broken" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif result == '200': for y in resultsList: destination = y[1] result = y[2] if caller == y[0]: if destination == 'GSMExt.Voda': if result == '200': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMExt.Eplus': if result == '200': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "GSM external modem is working" elif result == '486': print "T-Mobile card indicate having problem" else: print "incomplete test, Handler having error, please do one more test" elif result == '486': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "E-Plus card indicate broken" elif result == '486': print "T-Mobile and E-plus cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif result == '486': for z in resultsList: destination = z[1] result = z[2] if caller == z[0]: if destination == 'GSMExt.Eplus': if result == '200': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "Vodaphone indicate broken" elif result == '486': print "T-Mobile and Vodaphone cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" elif result == '486': for A in resultsList: destination = A[1] result = A[2] if caller == A[0]: if destination == 'GSMExt.Tm': if result == '200': print "Vodaphone and E-plus cards indicate broken" elif result == '486': print "T-Mobile, E-plus and Vodaphone cards indicate having problem" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" else: print "incomplete test, Handler having error, please do one more test" elif destination == 'sip': if result =='486': i=1 for y in resultsList: call = y[0] result = y[2] if call == 'sip': if result == '200': i = i-1 if result == '486': i = i+1 if i > 1: print "bad thing happen" else: print 'Asterisk server working good' elif result =='200': i = 0 for y in resultsList: call = y[0] result = y[2] if call == 'sip': if result == '200': i = i-1 if result == '486': i = i+1 if i > 1: print "bad thing happen" else: print 'Asterisk server working good' callerList = [['sip'],['unisip']] for caller in callerList: initTrueTable(caller[0])