def OnPage4(self, event):
		self.data.Kickstart_PrivateInterface = str(self.cb.Value)
		self.data.Kickstart_PrivateAddress = str(self.tc1.Value)
		self.data.Kickstart_PrivateNetmask = str(self.tc2.Value)

		#incomplete entries
		if not self.data.Kickstart_PrivateInterface or not self.data.Kickstart_PrivateAddress or not \
			self.data.Kickstart_PrivateNetmask:
                	wx.MessageBox('Please fill out all entries', 'Incomplete', wx.OK | wx.ICON_ERROR)	
		else:
			self.data.Kickstart_PrivateKickstartHost = self.data.Kickstart_PrivateAddress
			self.data.Kickstart_PrivateNTPHost = self.data.Kickstart_PrivateAddress
			self.data.Kickstart_PrivateGateway = self.data.Kickstart_PrivateAddress
			self.data.Kickstart_PrivateDNSServers = self.data.Kickstart_PrivateAddress
			self.data.Kickstart_PrivateSyslogHost = self.data.Kickstart_PrivateAddress

			#calculate private network interfaces
			try:
				ip = stack.ip.IPGenerator(self.data.Kickstart_PrivateAddress, \
					self.data.Kickstart_PrivateNetmask)
				self.data.Kickstart_PrivateNetwork = ip.get_network()
				self.data.Kickstart_PrivateBroadcast = ip.broadcast()
				self.data.Kickstart_PrivateNetmaskCIDR = ip.cidr()
				self.data.Kickstart_PrivateEthernet = self.data.devices[self.data.Kickstart_PrivateInterface]

				#configure network immediately
				setNetwork(self.data.Kickstart_PrivateInterface,
					self.data.Kickstart_PrivateEthernet,
					self.data.Kickstart_PrivateAddress,
					self.data.Kickstart_PrivateNetmask)
			except:
                		wx.MessageBox('Please check IP and Netmask input', 'Input Error', wx.OK | wx.ICON_ERROR)
				return
			wx.PostEvent(self.parent, PageChangeEvent(page=Page4))
Exemple #2
0
	def validateNetwork(self, tup, config_net=False):

		fqhn, eth, ip, subnet, gateway, dns = tup

		self.data.Info_FQDN = str(fqhn)
		self.data.Kickstart_PrivateInterface = str(eth)
		self.data.Kickstart_PrivateAddress = str(ip)
		self.data.Kickstart_PrivateNetmask = str(subnet)
		self.data.Kickstart_PrivateGateway = str(gateway)
		self.data.Kickstart_PrivateDNSServers = str(dns)

		#incomplete entry
		if not self.data.Kickstart_PrivateInterface or not \
			self.data.Kickstart_PrivateAddress or not \
			self.data.Kickstart_PrivateNetmask or not \
			self.data.Kickstart_PrivateGateway or not \
			self.data.Kickstart_PrivateDNSServers or not \
			self.data.Info_FQDN:
			return (False, "Please fill out all entries", "Incomplete")
		else:
			self.data.Kickstart_PrivateKickstartHost = \
				self.data.Kickstart_PrivateAddress
			self.data.Info_ClusterURL = \
				"http://" + self.data.Info_FQDN + "/"
			self.data.Kickstart_PrivateNTPHost = \
				self.data.Kickstart_PrivateAddress
			#self.data.Kickstart_PrivateHostname =
			#	self.data.Kickstart_PrivateHostname.split(".")[0]

			#calculate public dns domain
			n = self.data.Info_FQDN
			n = n.split(".")
			self.data.Kickstart_PrivateHostname = n.pop(0)
			dns = ""
			for i in range(len(n)):
				dns += n[i]
				if i != len(n)-1:
					dns += "."
			self.data.Kickstart_PrivateDNSDomain = dns

			#calculate public network interfaces
			try:
				ip = stack.ip.IPGenerator( \
					self.data.Kickstart_PrivateAddress, \
					self.data.Kickstart_PrivateNetmask)
				self.data.Kickstart_PrivateNetwork = ip.get_network()
				self.data.Kickstart_PrivateBroadcast = ip.broadcast()
				self.data.Kickstart_PrivateNetmaskCIDR = ip.cidr()
				self.data.Kickstart_PrivateEthernet = \
					self.data.devices[ \
						self.data.Kickstart_PrivateInterface]
				self.data.devices.pop(self.data.Kickstart_PrivateInterface)

				if config_net:
					self.configNetwork()

				return (True, "", "")
			except:
				print traceback.format_exc()
				return (False, "Incorrect input", "Input Error")
Exemple #3
0
    def validateNetwork(self, tup, config_net=False):

        fqhn, eth, ip, subnet, gateway, dns = tup

        self.data.Info_FQDN = str(fqhn)
        self.data.Kickstart_PrivateInterface = str(eth)
        self.data.Kickstart_PrivateAddress = str(ip)
        self.data.Kickstart_PrivateNetmask = str(subnet)
        self.data.Kickstart_PrivateGateway = str(gateway)
        self.data.Kickstart_PrivateDNSServers = str(dns)

        #incomplete entry
        if not self.data.Kickstart_PrivateInterface or not \
         self.data.Kickstart_PrivateAddress or not \
         self.data.Kickstart_PrivateNetmask or not \
         self.data.Kickstart_PrivateGateway or not \
         self.data.Kickstart_PrivateDNSServers or not \
         self.data.Info_FQDN:
            return (False, "Please fill out all entries", "Incomplete")
        else:
            self.data.Kickstart_PrivateKickstartHost = \
             self.data.Kickstart_PrivateAddress
            self.data.Info_ClusterURL = \
             "http://" + self.data.Info_FQDN + "/"
            self.data.Kickstart_PrivateNTPHost = \
             self.data.Kickstart_PrivateAddress
            #self.data.Kickstart_PrivateHostname =
            #	self.data.Kickstart_PrivateHostname.split(".")[0]

            #calculate public dns domain
            n = self.data.Info_FQDN
            n = n.split(".")
            self.data.Kickstart_PrivateHostname = n.pop(0)
            dns = ""
            for i in range(len(n)):
                dns += n[i]
                if i != len(n) - 1:
                    dns += "."
            self.data.Kickstart_PrivateDNSDomain = dns

            #calculate public network interfaces
            try:
                ip = stack.ip.IPGenerator( \
                 self.data.Kickstart_PrivateAddress, \
                 self.data.Kickstart_PrivateNetmask)
                self.data.Kickstart_PrivateNetwork = ip.get_network()
                self.data.Kickstart_PrivateBroadcast = ip.broadcast()
                self.data.Kickstart_PrivateNetmaskCIDR = ip.cidr()
                self.data.Kickstart_PrivateEthernet = \
                 self.data.devices[ \
                  self.data.Kickstart_PrivateInterface]
                self.data.devices.pop(self.data.Kickstart_PrivateInterface)

                if config_net:
                    self.configNetwork()

                return (True, "", "")
            except:
                print traceback.format_exc()
                return (False, "Incorrect input", "Input Error")
	def OnPage3(self, event):
		self.data.Kickstart_PublicInterface = str(self.cb.Value)
		self.data.Kickstart_PublicAddress = str(self.tc1.Value)
		self.data.Kickstart_PublicNetmask = str(self.tc2.Value)
		self.data.Kickstart_PublicGateway = str(self.tc3.Value)
		self.data.Kickstart_PublicDNSServers = str(self.tc4.Value)
		self.data.Kickstart_PublicKickstartHost = self.data.Kickstart_PublicAddress

		#incomplete entry
		if not self.data.Kickstart_PublicInterface or not self.data.Kickstart_PublicAddress or not \
			self.data.Kickstart_PublicNetmask or not self.data.Kickstart_PublicGateway or not \
			self.data.Kickstart_PublicDNSServers:
                	wx.MessageBox('Please fill out all entries', 'Incomplete', wx.OK | wx.ICON_ERROR)	
		else:
			#calculate public network interfaces
			try:
				ip = stack.ip.IPGenerator(self.data.Kickstart_PublicAddress, \
					self.data.Kickstart_PublicNetmask)
				self.data.Kickstart_PublicNetwork = ip.get_network()
				self.data.Kickstart_PublicBroadcast = ip.broadcast()
				self.data.Kickstart_PublicNetmaskCIDR = ip.cidr()
				self.data.Kickstart_PublicEthernet = self.data.devices[self.data.Kickstart_PublicInterface]
				self.data.devices.pop(self.data.Kickstart_PublicInterface)

				#configure network immediately
				setNetwork(self.data.Kickstart_PublicInterface,
					self.data.Kickstart_PublicEthernet,
					self.data.Kickstart_PublicAddress,
					self.data.Kickstart_PublicNetmask)

				# Add default Gateway
				cmd = ['/sbin/route', 'add', 'default', 'gw',
					self.data.Kickstart_PublicGateway]
				p = subprocess.Popen(cmd, stdout=subprocess.PIPE)

				# Set hostname of host to Public Hostname
				setHostname(self.data.Kickstart_PublicHostname)

				# Set resolv.conf
				setResolv(self.data.Kickstart_PublicDNSDomain,
					self.data.Kickstart_PublicDNSServers)
			except:
                		wx.MessageBox('Incorrect input', 'Input Error', wx.OK | wx.ICON_ERROR)
				return
			wx.PostEvent(self.parent, PageChangeEvent(page=Page3))