summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/30-07-2011/DeviceAddressClass.py
blob: 21c9dc06bb66adce5bfacd56c34babf6550e4cf0 (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
class DeviceAddress:
	
	def __init__(self):
		self.add = None
		self.num = None
		self.portAdd = ''

	def findDevice(self, device):
		file = open('DeviceAddress.txt', 'r')

		for line in file:
     
			first = line.find('[')
			second= line.find(']')         # search for position
			find = line[first+1:second]
	
			stop = line.find(':')
			IPAddress =line[stop+1:]
			stop2 = IPAddress.find(':')
			
			number = IPAddress[stop2+1:]
			stop3 = number.find(':')

			portAddress = number[stop3+1:] 
			stop4 = portAddress.find(':')
			
	
			if find == device:
				print device
				self.add = IPAddress[0:stop2]
				self.num = number[0:stop3]
				if stop4 <> -1:
					self.portAdd = portAddress[0:stop4]
				break
				
				
		file.close()