Example #1
0
    def popupVlanConfig(self, type, vlanIndex, vlanID):
        """ Dialog window to input IP addresses for a VLAN configuration """
        logging.debugv("menu/config.py->popupIfConfig(self, type, vlanIndex, vlanID)", [type, vlanIndex, vlanID])

        vlanConf = self.c.getVlan(vlanIndex)
        savedInput = vlanConf[type]

        if type == "tunnel":
            title = "\\Zb... > Network > VLAN %s > Local IP\\n\\ZB" % str(vlanID)
            subtitle = "Enter the IP address of the VLAN interface"
        elif type == "netmask":
            title = "\\Zb... > Network > VLAN %s > Subnet mask\\n\\ZB" % str(vlanID)
            subtitle = "Enter the subnet mask address of the local interface"
        elif type == "gateway":
            title = "\\Zb... > Network > VLAN %s > Gateway\\n\\ZB" % str(vlanID)
            subtitle = "Enter the gateway address of the local interface"
        elif type == "broadcast":
            title = "\\Zb... > Network > VLAN %s > Broadcast\\n\\ZB" % str(vlanID)
            subtitle = "Enter the broadcast address of the local interface"
        title += subtitle

        while True:
            output = self.d.inputbox(title, 10, 50, savedInput, colors=1, ok_label="Ok")
            if output[0]: return
            if t.ipv4check(output[1]):
                address = output[1]
                logging.info("Setting %s for %s to %s" % (type, vlanID, output[1]))
                self.changed = True
                self.c.setVlanProp(vlanIndex, type, output[1])
                self.changed = True
                return                  # returns to setVlanConfig()
            else:
                self.d.msgbox("Please enter a valid address")
Example #2
0
 def dnsPrim(self):
     """ Set primary DNS server """
     logging.debugv("menu/config.py->dnsPrim(self)", [])
     (type, prim, sec) = self.c.getDNS()
     while True:
         input = self.d.inputbox("Primary DNS server:", 10, 50, prim)
         if input[0]: return
         if t.ipv4check(input[1]):
             prim = input[1]
             break
     self.changed = True
     self.c.setDNS(type, prim, sec)
Example #3
0
 def dnsPrim(self):
     """ Set primary DNS server """
     logging.debugv("menu/config.py->dnsPrim(self)", [])
     (type, prim, sec) = self.c.getDNS()
     while True:
         input = self.d.inputbox("Primary DNS server:", 10, 50, prim)
         if input[0]: return
         if t.ipv4check(input[1]):
             prim = input[1]
             break
     self.changed = True
     self.c.setDNS(type, prim, sec)
Example #4
0
 def dnsSec(self):
     """ Set secondary DNS server """
     logging.debugv("menu/config.py->dnsSec(self)", [])
     (type, prim, sec) = self.c.getDNS()
     while True:
         input = self.d.inputbox("Secondary DNS server:", 10, 50, sec)
         if input[0]: return
         if input[1] == "":
             sec = ""
             break
         elif t.ipv4check(input[1]):
             sec = input[1]
             break
     self.changed = True
     self.c.setDNS(type, prim, sec)
Example #5
0
 def dnsSec(self):
     """ Set secondary DNS server """
     logging.debugv("menu/config.py->dnsSec(self)", [])
     (type, prim, sec) = self.c.getDNS()
     while True:
         input = self.d.inputbox("Secondary DNS server:", 10, 50, sec)
         if input[0]: return
         if input[1] == "":
             sec = ""
             break
         elif t.ipv4check(input[1]):
             sec = input[1]
             break
     self.changed = True
     self.c.setDNS(type, prim, sec)
Example #6
0
    def popupIfConfig(self, type, inf):
        """ Dialog window to input IP addresses for an interface configuration """
        logging.debugv("menu/config.py->popupIfConfig(self, type, inf)",
                       [type, inf])

        infConf = self.c.getIf(inf)
        savedInput = infConf[type]

        if type == "address":
            title = "\\Zb... > Network > IP config %s > Local IP\\n\\ZB" % str(
                inf)
            subtitle = "Enter the IP address of the local interface"
        elif type == "tunnel":
            title = "\\Zb... > Network > IP config %s > Endpoint IP\\n\\ZB" % str(
                inf)
            subtitle = "Enter the IP address of the endpoint interface"
        elif type == "netmask":
            title = "\\Zb... > Network > IP config %s > Subnet mask\\n\\ZB" % str(
                inf)
            subtitle = "Enter the subnet mask address of the local interface"
        elif type == "gateway":
            title = "\\Zb... > Network > IP config %s > Gateway\\n\\ZB" % str(
                inf)
            subtitle = "Enter the gateway address of the local interface"
        elif type == "broadcast":
            title = "\\Zb... > Network > IP config %s > Broadcast\\n\\ZB" % str(
                inf)
            subtitle = "Enter the broadcast address of the local interface"
        title += subtitle

        while True:
            output = self.d.inputbox(title,
                                     10,
                                     50,
                                     savedInput,
                                     colors=1,
                                     ok_label="Ok")
            if output[0]: return
            if t.ipv4check(output[1]):
                address = output[1]
                logging.info("Setting %s for %s to %s" %
                             (type, inf, output[1]))
                self.changed = True
                self.c.setIfProp(inf, type, output[1])
                self.changed = True
                return  # returns to setIfConfig()
            else:
                self.d.msgbox("Please enter a valid address")
Example #7
0
 def editIpmiGatewayIP(self):
     """ Edit the statically set IPMI gateway IP address """
     logging.debugv("menu/config.py->editIpmiGatewayIP(self)", [])
     gw = self.c.getIpmiGatewayIP()
     while True:
         output = self.d.inputbox("IPMI gateway IP address", 10, 50, gw)
         if output[0]: return
         if t.ipv4check(output[1]):
             gw = output[1]
             try:
                 f.ipmiSetNet(["defgw", "ipaddr", gw])
                 logging.debug("Setting IPMI gateway address to %s" % (gw))
                 self.c.ipmi["gwip"] = gw
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox("Could not set the gateway IP address for the IPMI interface", 8, 60)
             return
         else:
             self.d.msgbox("Please enter a valid IP address")
Example #8
0
 def editIpmiNetmask(self):
     """ Edit the statically set IPMI netmask """
     logging.debugv("menu/config.py->editIpmiNetmask(self)", [])
     netmask = self.c.getIpmiNetmask()
     while True:
         output = self.d.inputbox("IPMI Netmask", 10, 50, netmask)
         if output[0]: return
         if t.ipv4check(output[1]):
             netmask = output[1]
             try:
                 f.ipmiSetNet(["netmask", netmask])
                 logging.debug("Setting IPMI netmask to %s" % (netmask) )
                 self.c.ipmi["netmask"] = netmask
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox("Could not set the subnet mask for the IPMI interface", 8, 55)
             return
         else:
             self.d.msgbox("Please enter a valid netmask address")
Example #9
0
 def editIpmiAddress(self):
     """ Edit the statically set IPMI IP address """
     logging.debugv("menu/config.py->editIpmiAddress(self)", [])
     address = self.c.getIpmiAddress()
     while True:
         output = self.d.inputbox("IPMI Address", 10, 50, address)
         if output[0]: return
         if t.ipv4check(output[1]):
             address = output[1]
             try:
                 f.ipmiSetNet(["ipaddr", address])
                 logging.debug("Setting IPMI address to %s" % (address) )
                 self.c.ipmi["address"] = address
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox("Could not set the IP address for the IPMI interface", 8, 55)
             return
         else:
             self.d.msgbox("Please enter a valid IP address")
Example #10
0
 def editIpmiGatewayIP(self):
     """ Edit the statically set IPMI gateway IP address """
     logging.debugv("menu/config.py->editIpmiGatewayIP(self)", [])
     gw = self.c.getIpmiGatewayIP()
     while True:
         output = self.d.inputbox("IPMI gateway IP address", 10, 50, gw)
         if output[0]: return
         if t.ipv4check(output[1]):
             gw = output[1]
             try:
                 f.ipmiSetNet(["defgw", "ipaddr", gw])
                 logging.debug("Setting IPMI gateway address to %s" % (gw))
                 self.c.ipmi["gwip"] = gw
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox(
                     "Could not set the gateway IP address for the IPMI interface",
                     8, 60)
             return
         else:
             self.d.msgbox("Please enter a valid IP address")
Example #11
0
 def editIpmiNetmask(self):
     """ Edit the statically set IPMI netmask """
     logging.debugv("menu/config.py->editIpmiNetmask(self)", [])
     netmask = self.c.getIpmiNetmask()
     while True:
         output = self.d.inputbox("IPMI Netmask", 10, 50, netmask)
         if output[0]: return
         if t.ipv4check(output[1]):
             netmask = output[1]
             try:
                 f.ipmiSetNet(["netmask", netmask])
                 logging.debug("Setting IPMI netmask to %s" % (netmask))
                 self.c.ipmi["netmask"] = netmask
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox(
                     "Could not set the subnet mask for the IPMI interface",
                     8, 55)
             return
         else:
             self.d.msgbox("Please enter a valid netmask address")
Example #12
0
 def editIpmiAddress(self):
     """ Edit the statically set IPMI IP address """
     logging.debugv("menu/config.py->editIpmiAddress(self)", [])
     address = self.c.getIpmiAddress()
     while True:
         output = self.d.inputbox("IPMI Address", 10, 50, address)
         if output[0]: return
         if t.ipv4check(output[1]):
             address = output[1]
             try:
                 f.ipmiSetNet(["ipaddr", address])
                 logging.debug("Setting IPMI address to %s" % (address))
                 self.c.ipmi["address"] = address
                 self.c.ipmi.write()
             except excepts.RunException:
                 self.d.msgbox(
                     "Could not set the IP address for the IPMI interface",
                     8, 55)
             return
         else:
             self.d.msgbox("Please enter a valid IP address")