def ConfigRoute():
    print('\n======== Configration Route ========')
    cof = ['cn', 'dn']
    for i in cof:
        if (i == 'cn'):
            ns = 0
            for a in cnhost:
                print(((('\npsql -h ' + cnhost[ns]) + ' -d postgres -p ') + str(cnport[ns])))
                for b in cof:
                    if (b == 'cn'):
                        n = 0
                        for c in cnhost:
                            if (c == a):
                                stmt = (((((('alter node ' + cnname[n]) + " with(host='") + c) + "',port=") + str(cnport[n])) + ')')
                                print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                n = (n + 1)
                            else:
                                stmt = (((((('create node ' + cnname[n]) + " with(type=coordinator,host='") + c) + "',port=") + str(cnport[n])) + ',primary=false,preferred=false)')
                                print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                n = (n + 1)
                    else:
                        n = 0
                        for c in dnhost:
                            stmt = (((((('create node ' + dnname[n]) + " with(type=datanode,host='") + c) + "',port=") + str(dnport[n])) + ',primary=false,preferred=false)')
                            print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                            connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                            n = (n + 1)
                ns = (ns + 1)
        if (i == 'dn'):
            nn = 0
            for a in dnhost:
                print(((('\npsql -h ' + dnhost[nn]) + ' -d postgres -p ') + str(dnport[nn])))
                for b in cof:
                    if (b == 'dn'):
                        n = 0
                        for c in dnhost:
                            if (c == a):
                                stmt = (((((('alter node ' + dnname[n]) + " with(host='") + c) + "',port=") + str(dnport[n])) + ')')
                                print(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                n = (n + 1)
                            else:
                                stmt = (((((('create node ' + dnname[n]) + " with(type=datanode,host='") + c) + "',port=") + str(dnport[n])) + ',primary=false,preferred=false)')
                                print(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                n = (n + 1)
                    else:
                        n = 0
                        for c in cnhost:
                            stmt = (((((('create node ' + cnname[n]) + " with(type=coordinator,host='") + c) + "',port=") + str(cnport[n])) + ',primary=false,preferred=false)')
                            print(cnuser[nn], cnhost[nn], cnport[nn], stmt)
                            connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                            n = (n + 1)
                nn = (nn + 1)
    print('\ncreating sharding')
    alldn = ''
    for i in dnname:
        if (i == dnname[0]):
            alldn = i
        else:
            alldn = ((alldn + ',') + i)
    stmt1 = (('create default node group default_group with(' + alldn) + ')')
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt1)
    stmt2 = 'create sharding group to group default_group'
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt2)
    stmt3 = 'clean sharding'
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt3)
def ConfigRoute():
    print('\n======== Configration Route ========')
    cof = ['cn', 'dn']
    for i in cof:
        if (i == 'cn'):
            ns = 0
            for a in cnhost:
                print(((('\npsql -h ' + cnhost[ns]) + ' -d postgres -p ') + str(cnport[ns])))
                for b in cof:
                    if (b == 'cn'):
                        n = 0
                        for c in cnhost:
                            if (c == a):
                                stmt = (((((('alter node ' + cnname[n]) + " with(host='") + c) + "',port=") + str(cnport[n])) + ')')
                                print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                n = (n + 1)
                            else:
                                stmt = (((((('create node ' + cnname[n]) + " with(type=coordinator,host='") + c) + "',port=") + str(cnport[n])) + ',primary=false,preferred=false)')
                                print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                                n = (n + 1)
                    else:
                        n = 0
                        for c in dnhost:
                            stmt = (((((('create node ' + dnname[n]) + " with(type=datanode,host='") + c) + "',port=") + str(dnport[n])) + ',primary=false,preferred=false)')
                            print(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                            connTemp(cnuser[ns], cnhost[ns], cnport[ns], stmt)
                            n = (n + 1)
                ns = (ns + 1)
        if (i == 'dn'):
            nn = 0
            for a in dnhost:
                print(((('\npsql -h ' + dnhost[nn]) + ' -d postgres -p ') + str(dnport[nn])))
                for b in cof:
                    if (b == 'dn'):
                        n = 0
                        for c in dnhost:
                            if (c == a):
                                stmt = (((((('alter node ' + dnname[n]) + " with(host='") + c) + "',port=") + str(dnport[n])) + ')')
                                print(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                n = (n + 1)
                            else:
                                stmt = (((((('create node ' + dnname[n]) + " with(type=datanode,host='") + c) + "',port=") + str(dnport[n])) + ',primary=false,preferred=false)')
                                print(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                                n = (n + 1)
                    else:
                        n = 0
                        for c in cnhost:
                            stmt = (((((('create node ' + cnname[n]) + " with(type=coordinator,host='") + c) + "',port=") + str(cnport[n])) + ',primary=false,preferred=false)')
                            print(cnuser[nn], cnhost[nn], cnport[nn], stmt)
                            connTemp(dnuser[nn], dnhost[nn], dnport[nn], stmt)
                            n = (n + 1)
                nn = (nn + 1)
    print('\ncreating sharding')
    alldn = 
    for i in dnname:
        if (i == dnname[0]):
            alldn = i
        else:
            alldn = ((alldn + ',') + i)
    stmt1 = (('create default node group default_group with(' + alldn) + ')')
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt1)
    stmt2 = 'create sharding group to group default_group'
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt2)
    stmt3 = 'clean sharding'
    connTemp(cnuser[0], cnhost[0], cnport[0], stmt3)