Exemple #1
0
def overall_parameters_validation(codeid, ipaddress):
    progressbar(10, 100, 'Check codeid......      ')

    if smartvalidation.check_codeid(codeid) == False:
        return False

    progressbar(20, 100, 'Check RFC ipaddress compliance..      ')
    if smartvalidation.check_ipaddress(ipaddress) == False:
        return False
    else:
        if smartvalidation.check_dns_ipaddress_presence(ipaddress,
                                                        "s") == True:
            return False
        else:
            progressbar(45, 100, 'Check scope...                         ')
            if smartvalidation.check_ipaddress_scope(
                    ipaddress, loadconfig.get_deployment_network_scope_from(),
                    loadconfig.get_deployment_network_scope_to()) == False:
                return False

    progressbar(60, 100, 'Check database inventory..      ')
    idfound = tinydbengine.get_hostdata_by_field('ipaddress', ipaddress,
                                                 'codeid')
    if not idfound:
        print
        print "The codeid " + codeid + " it doesn't exist in the inventory with this ipaddress"
        return False

    progressbar(80, 100, 'Check database inventory..      ')
    ipfound = tinydbengine.get_hostdata_by_field('codeid', codeid, 'ipaddress')

    if not ipfound:
        print
        print "The ipaddress " + ipaddress + " it doesn't exist in the inventory with this codeid"
        return False
    if idfound == codeid and ipaddress == ipfound:
        #Hurra' everything's fine here !! Go ahead
        progressbar(100, 100,
                    'Host founded in the inventory with CodeId ' + idfound)
        return True
    else:
        print
        print "The ipaddress " + ipaddress + " it doesn't match with the code " + idfound + " , this code is assigned to " + ipfound
        return False
Exemple #2
0
def overall_parameters_validation(macaddress, ipaddress, dpl_hostname, prefix):
    progressbar(35, 100, 'Dns validation..      ')

    if smartvalidation.check_dns_configuration(
            "ns." + loadconfig.get_deployment_domain()) == False:
        return False

    progressbar(40, 100, 'Check RFC macaddress compliance..      ')
    if smartvalidation.check_macaddress(macaddress) == False:
        return False

    progressbar(42, 100, 'Check RFC ipaddress compliance..      ')
    if smartvalidation.check_ipaddress(ipaddress) == False:
        return False
    else:
        if smartvalidation.check_dns_ipaddress_presence(ipaddress, "") == True:
            return False
        else:
            progressbar(45, 100, 'Check scope...                         ')
            if smartvalidation.check_ipaddress_scope(
                    ipaddress, loadconfig.get_deployment_network_scope_from(),
                    loadconfig.get_deployment_network_scope_to()) == False:
                return False
    progressbar(50, 100, 'Check RFC fqdn compliance..      ')
    if smartvalidation.check_hostname_syntax(fqdn_hostname) == False:
        return False
    else:
        if smartvalidation.check_dns_hostname_presence(fqdn_hostname,
                                                       "") == True:
            return False

    progressbar(52, 100, 'Check RFC group compliance..      ')

    if smartvalidation.check_group_syntax(group) == False:
        return False

    #Check database
    progressbar(60, 100, 'Check database inventory..      ')
    if tinydbengine.check_db_presence(macaddress, ipaddress,
                                      fqdn_hostname) == True:
        return False
    progressbar(62, 100, 'Check RFC prefix compliance..      ')
    if smartvalidation.check_prefix_syntax(prefix) == False:
        return False

    progressbar(
        70, 100,
        'Check if the macaddress is already present on the network..     ')
    if smartvalidation.check_macaddress_network_presence(
            macaddress, loadconfig.get_deployment_interface(), "") == True:
        return False

    progressbar(
        95, 100,
        'Check if the ipaddress is already present on the network..      ')
    if smartvalidation.check_ipaddress_network_presence(
            ipaddress, loadconfig.get_deployment_interface(), "") == True:
        return False

    progressbar(100, 100,
                'Everything is ok here!! Go to deploy ' + fqdn_hostname)
    print
    #Hurra' everything's fine here !! Go ahead
    return True
Exemple #3
0
            0, 100,
            "No-go, Rollback procedure activated, nothing has been changed")
        print "Someting is going wrong during DNS update"
        #Rollback
        total_rollback()
        quit()
        sys.exit(1)

    progressbar(40, 100, "Adding host lease in the dhcp...")
    if dhcpdbengine.dhcp_add_host(macaddress, ipaddress,
                                  dpl_hostname) == False:
        total_rollback()
        quit()
        sys.exit(1)

    if smartvalidation.check_dns_ipaddress_presence(
            ipaddress,
            "s") == False or smartvalidation.check_dns_hostname_presence(
                fqdn_hostname, "s") == False:
        progressbar(0, 100,
                    "Rollback procedure activated, nothing has been changed")
        total_rollback()
        quit()
        sys.exit(1)

    progressbar(
        100, 100, "Host " + fqdn_hostname + " with ipaddress " + ipaddress +
        " has been deployed!")
    print
    print