summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/trueTableClass.py
blob: f8e78cfd5bf5f2eb31d4078d9a7a587b3ad94247 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

class trueTable:
     def __init__(self, resultsList):

		self.resultsList	= resultsList
		self.nanoBTS1		= None
		self.nanoBTS2		= None
		self.nanoBTS3		= None
		self.o2Card         = None
		self.eplusCard		= None
		self.vodaCard		= None
		self.tmobileCard	= None
		self.self.outGoingRZ	= None
		self.asteriskServer 	= None
        	self.incomingRZ     = None
            	self.openBSC    = None

     def initTrueTable(self):

        lists = self.resultsList
        externalRZList = ['GSMExt.Tm','GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','landline'] # should fetch this from DB or mix between external GSM and SIP side.
#fetch list from DB
        nanoBts = list()
        gsmResultList = list()
        outGoingRZ = None
        incomingRZ = None
        i= 1
        for x in lists:
            call=x[0]
            dest=x[1]
    #print call[0:5]
        if call[0:5]=='GSMRZ':
            for y in lists:
                caller = y[0]
                desti=y[1]
            
                if i <= call[5:]:
                    i = call[5:]
        i = int(i)+1#also can get from length of the GSMRZ found in DB,maybe its more easy to use it
        for x in lists: # to find nanoBts, asterik server and open BSC status regarding result test for GSM RZ 
            call=x[0]
            dest=x[1]
            result=x[2]
            stop = False
            j=1
    
            if call[0:5]=='GSMRZ' or dest[0:5]=='GSMRZ':
            	while stop != True:
                	if j != int(i):
                    		key = 'GSMRZ'+str(j)
                    		if key == call or key == dest:
                        		if result == '200':
                            			self.asteriskServer = True #set status of asterik server as working
                            			if len(nanoBts) == 0:
                                			nanoBts.append(['nanoBts '+str(j),True])
                            			else:
                                			found = False
                                			for y in nanoBts: #find the existing nanoBts result
                                    				name = y[0]
                                    				if name == 'nanoBts '+str(j):
                                        				found = True
                                			if found != True: #if doesnt found the nanoBts, add the result to the list, otherwise just ignoring 
                                    				nanoBts.append(['nanoBts '+str(j),True])
                                    				found = False
                            			if key == call:#
                                			for z in externalRZList:# find the result for outgoing call from GSM RZ to external RZ network
                                    				if dest == z:
                                        				self.outGoingRZ = True #set status as working for outgoing RZ
                            			if key == dest and call == 'landline':
                                			for z in externalRZList:
                                    				if dest == z:
                                        				self.incomingRZ = True # find the result for imcoming call to GSM RZ from external RZ network
                        		else:
                            			if key == call:# and dest == 'landline':
                                			for z in externalRZList:
                                    				if dest == z:
                                        				self.outGoingRZ = False
                            			if key == dest:# and call == 'landline':
                                			for z in externalRZList:
                                    				if call == z:
                                        				self.incomingRZ = False
                            			nanoBts.append(['nanoBts '+str(j),False])
                
                
                    		j = j+1
               		elif j == int(i):
                    		stop = True
    
        	if call[0:5]=='GSMEx': # looking for calling from GSMexternal
            		found = False
            		if len(nanoBts) ==0:
                		nanoBts.append([call,result])
                		found = False
            		else:
                		for y in nanoBts: #find the existing result for GSM external in the list
                    			name = y[0]
                    			if name == call:
                        			found = True
                		if found != True:
                    			nanoBts.append([call,result])
    
        	if dest[0:5]=='GSMEx': # looking for destination call to GSMexternal
            		found = False
            		if len(nanoBts) ==0:
                		nanoBts.append([dest,result])
                		found = False
            		else:
                		for y in nanoBts:
                    			name = y[0]
                    			if name == dest:
                        			found = True
                		if found != True:
                    			nanoBts.append([dest,result])