示例#1
0
 def __checkIPAddr(self, ip):
     """
         check if "ip" is valid, raise an exception if not
     """
     if not iplib.checkIPAddrWithoutMask(ip):
         raise GeneralException(
             errorText("GENERAL", "INVALID_IP_ADDRESS") % ip)
示例#2
0
    def __updateRasCheckInput(self, ras_id, ras_ip, ras_description, ras_type,
                              radius_secret, comment):
        ras_obj = ras_main.getLoader()[ras_id]
        if ras_obj.getRasIP() != ras_ip:
            if not iplib.checkIPAddrWithoutMask(ras_ip):
                raise GeneralException(
                    errorText("RAS", "INVALID_RAS_IP") % ras_ip)

            if ras_main.getLoader().rasIPExists(ras_ip):
                raise GeneralException(
                    errorText("RAS", "RAS_IP_ALREADY_EXISTS") % ras_ip)

            if self.__rasIPExistsInDB(ras_ip):
                raise GeneralException(
                    errorText("RAS", "RAS_IS_INACTIVE") % ras_ip)

        if ras_obj.getRasDesc() != ras_description and ras_main.getLoader(
        ).rasDescExists(ras_description):
            raise GeneralException(
                errorText("RAS", "RAS_DESCRIPTION_ALREADY_EXISTS") %
                ras_description)

        self.__checkValidRasDescription(ras_description)

        if not ras_main.getFactory().hasType(ras_type):
            raise GeneralException(
                errorText("RAS", "RAS_TYPE_NOT_REGISTERED") % ras_type)
示例#3
0
    def __addNewRasCheckInput(self,ras_ip,ras_type,radius_secret):
	if not iplib.checkIPAddrWithoutMask(ras_ip):
	    raise GeneralException(errorText("RAS","INVALID_RAS_IP")%ras_ip)

	if ras_main.getLoader().rasIPExists(ras_ip):
	    raise GeneralException(errorText("RAS","RAS_IP_ALREADY_EXISTS")%ras_ip)

	if self.__rasIPExistsInDB(ras_ip):
	    raise GeneralException(errorText("RAS","RAS_IS_INACTIVE")%ras_ip)


	if not ras_main.getFactory().hasType(ras_type):
	    raise GeneralException(errorText("RAS","RAS_TYPE_NOT_REGISTERED")%ras_type)
示例#4
0
 def checkIPs(self, ips):
     for ip in ips:
         if not iplib.checkIPAddrWithoutMask(ip):
             raise GeneralException(
                 errorText("GENERAL", "INVALID_IP_ADDRESS") % ip)
示例#5
0
    def __creditChangeCheckInput(self,remote_address,credit_change_comment):
	"""
	    check credit changed related inputs and raise exception on errors
	"""
	if iplib.checkIPAddrWithoutMask(remote_address)==0:
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%remote_address)
示例#6
0
    def __checkIPAddr(self,ip):
	"""
	    check if "ip" is valid, raise an exception if not
	"""
	if not iplib.checkIPAddrWithoutMask(ip):
	    raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%ip)