Пример #1
0
	def _findSwitchNameAndNetworkOfDest(self, destIp):
		dest = IPAddr(destIp)
		ans = []
		for entry in self.routingTable:
			if dest.inNetwork(entry.network):
				ans.append( (entry.name, entry.network) )
		return ans
Пример #2
0
	def getOutPortForIp(self, switch, destIp):
		if DEBUG:
			print '*** _getOutPortForIp:'
			print switch, destIp
		dest = IPAddr(destIp)
		for entry in self.routingTable:
			if dest.inNetwork(entry.network) and \
						switch.name == entry.name:
				return entry.port	# port number
		return None