#!groovy

funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )

fileRelated.init()
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"
funcs.initializeTrend( "VM" );
triggerFuncs.init( funcs )
wikiContents = ""
testcases = [
    "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
    "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
    "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
    "SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ],
    "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
]
Prefix_organizer = [
    "FU" : "FUNC",
    "HA" : "HA",
    "PL" : "USECASE",
    "SA" : "USECASE",
    "SC" : "SCPF",
    "SR" : "SR",
    "US" : "USECASE",
    "VP" : "USECASE"
]

manually_run = params.manual_run
onos_b = current_version
test_branch = ""
onos_tag = params.ONOSTag
isOldFlow = true

// Set tests based on day of week
def now = funcs.getCurrentTime()
print now.toString()
today = now[ Calendar.DAY_OF_WEEK ]

if ( manually_run ){
    onos_b = params.ONOSVersion
} else {
    if ( today == Calendar.SATURDAY ){
        onos_b = previous_version
    } else if( today == Calendar.SUNDAY ){
        onos_b = before_previous_version
    }
}
AllTheTests = test_lists.getAllTheTests( onos_b )

day = ""
SCPF_choices = ""
USECASE_choices = ""
FUNC_choices = ""
HA_choices = ""
SR_choices = ""
stat_graph_generator_file = fileRelated.histogramMultiple
pie_graph_generator_file = fileRelated.pieMultiple
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"

post_result = params.PostResult
if( !manually_run ){
    testDivider( today )
    FUNC_choices =  triggerFuncs.lastCommaRemover( FUNC_choices )
    HA_choices =  triggerFuncs.lastCommaRemover( HA_choices )
    SCPF_choices =  triggerFuncs.lastCommaRemover( SCPF_choices )
    USECASE_choices =  triggerFuncs.lastCommaRemover( USECASE_choices )
    SR_choices =  triggerFuncs.lastCommaRemover( SR_choices )
}

if ( manually_run ){
    testcases = triggerFuncs.organize_tests( params.Tests, testcases )

    isOldFlow = params.isOldFlow
    println "Tests to be run manually : "
}else{
    testcases[ "SCPF" ][ "tests" ] = SCPF_choices
    testcases[ "USECASE" ][ "tests" ] = USECASE_choices
    testcases[ "FUNC" ][ "tests" ] = FUNC_choices
    testcases[ "HA" ][ "tests" ] = HA_choices
    testcases[ "SR" ][ "tests" ] = SR_choices
    println "Defaulting to " + day + " tests:"
}

triggerFuncs.print_tests( testcases )

def runTest = [
    "VM" : [:],
    "BM" : [:]
]
for( String test in testcases.keySet() ){
    println test
    if ( testcases[ test ][ "tests" ] != "" ){
        runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag )
    }
}
def finalList = [:]
jobName = env.JOB_NAME
finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] )
finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] )
//parallel finalList
if( jobName.take( 2 ) == "vm" )
    finalList[ "VM" ].call()
else
    finalList[ "BM" ].call()

if ( !manually_run ){
    funcs.generateStatGraph( "TestStation-VMs",
                             funcs.branchWithPrefix( onos_b ),
                             AllTheTests,
                             stat_graph_generator_file,
                             pie_graph_generator_file,
                             graph_saved_directory )
}

def testDivider( today ){
    switch ( today ) {
        case Calendar.MONDAY:
            initHtmlForWiki()
            monday( true )
            tuesday( true, false )
            wednesday( true, false )
            thursday( true, false )
            friday( true, false )
            saturday( false, false )
            sunday( false, false )
            day = "Monday"
            closeHtmlForWiki()
            postToWiki( wikiContents )
            slackSend( color:'#FFD988', message:"Tests to be run this weekdays : \n" + triggerFuncs.printDaysForTest( AllTheTests ) )
            break
        case Calendar.TUESDAY:
            tuesday( false, true )
            day = "Tuesday"
            break
        case Calendar.WEDNESDAY:
            wednesday( false, true )
            day = "Wednesday"
            break
        case Calendar.THURSDAY:
            thursday( false, true )
            day = "Thursday"
            break
        case Calendar.FRIDAY:
            friday( false, true )
            day = "Friday"
            break
        case Calendar.SATURDAY:
            saturday( false, true )
            day = "Saturday"
            break
        case Calendar.SUNDAY:
            sunday( false , true )
            day = "Sunday"
            break
    }
}
def monday( getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
    FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", true, "M", getResult )
    HA_choices += adder( "HA", "extra_A", true, "M", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", true, "M", getResult )
    SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", true, "M", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    closingHeader( "USECASE" )
}
def tuesday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult )
    FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "T", getResult )
    HA_choices += adder( "HA", "extra_B", getDay, "T", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult )
    SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "T", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult )
    USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult )
    closingHeader( "USECASE" )
}
def wednesday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult )
    FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "W", getResult )
    HA_choices += adder( "HA", "extra_A", getDay, "W", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult )
    SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "W", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    closingHeader( "USECASE" )
}
def thursday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult )
    FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "Th", getResult )
    HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult )
    SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "Th", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    closingHeader( "USECASE" )
}
def friday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult )
    FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "F", getResult )
    HA_choices += adder( "HA", "extra_A", getDay, "F", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult )
    SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult )
    SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "F", false )
    SR_choices += adder( "SR", "extra_A", getDay, "F", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    closingHeader( "USECASE" )
}
def saturday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "Sa", getResult )
    FUNC_choices += adder( "FUNC", "extra_A", getDay, "Sa", getResult )
    FUNC_choices += adder( "FUNC", "extra_B", getDay, "Sa", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "Sa", getResult )
    HA_choices += adder( "HA", "extra_A", getDay, "Sa", getResult )
    HA_choices += adder( "HA", "extra_B", getDay, "Sa", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "Sa", getResult )
    SCPF_choices += adder( "SCPF", "extra_A", getDay, "Sa", getResult )
    SCPF_choices += adder( "SCPF", "extra_B", getDay, "Sa", getResult )
    SCPF_choices += adder( "SCPF", "extra_C", getDay, "Sa", getResult )
    SCPF_choices += adder( "SCPF", "extra_D", getDay, "Sa", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "Sa", false )
    SR_choices += adder( "SR", "extra_B", getDay, "Sa", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult )
    closingHeader( "USECASE" )
}
def sunday( getDay, getResult ){
    addingHeader( "FUNC" )
    FUNC_choices += adder( "FUNC", "basic", getDay, "S", getResult )
    FUNC_choices += adder( "FUNC", "extra_A", getDay, "S", getResult )
    FUNC_choices += adder( "FUNC", "extra_B", getDay, "S", getResult )
    closingHeader( "FUNC" )
    addingHeader( "HA" )
    HA_choices += adder( "HA", "basic", getDay, "S", getResult )
    HA_choices += adder( "HA", "extra_A", getDay, "S", getResult )
    HA_choices += adder( "HA", "extra_B", getDay, "S", getResult )
    closingHeader( "HA" )
    addingHeader( "SCPF" )
    SCPF_choices += adder( "SCPF", "basic", getDay, "S", getResult )
    SCPF_choices += adder( "SCPF", "extra_A", getDay, "S", getResult )
    SCPF_choices += adder( "SCPF", "extra_B", getDay, "S", getResult )
    SCPF_choices += adder( "SCPF", "extra_C", getDay, "S", getResult )
    SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult )
    closingHeader( "SCPF" )
    addingHeader( "SR" )
    SR_choices += adder( "SR", "basic", getDay, "S", false )
    closingHeader( "SR" )
    addingHeader( "USECASE" )
    USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult )
    closingHeader( "USECASE" )
}
def adder( testCat, set, dayAdding, day, getResult ){
    result = ""
    for( String test in AllTheTests[ testCat ].keySet() ){
        if( AllTheTests[ testCat ][ test ][ set ] ){
            if( getResult )
                result += test + ","
            if( dayAdding )
                dayAdder( testCat, test, day )
            makeHtmlColList( testCat, test )
        }
    }
    return result
}
def initHtmlForWiki(){
    wikiContents = '''
    <table class="wrapped confluenceTable">
        <colgroup>
              <col />
              <col />
              <col />
              <col />
              <col />
              <col />
        </colgroup>
        <tbody>
            <tr>
                <th colspan="1" class="confluenceTh">
                    <br />
                </th>
                <th class="confluenceTh"><p>Monday</p></th>
                <th class="confluenceTh"><p>Tuesday</p></th>
                <th class="confluenceTh"><p>Wednesday</p></th>
                <th class="confluenceTh"><p>Thursday</p></th>
                <th class="confluenceTh"><p>Friday</p></th>
                <th class="confluenceTh"><p>Saturday</p></th>
                <th class="confluenceTh"><p>Sunday</p></th>
            </tr>'''
    for( String test in testcases.keySet() ){
        testcases[ test ][ 'wikiContent' ] = '''
            <tr>
                <th colspan="1" class="confluenceTh">''' + test + '''</th>'''
    }
}
def addingHeader( testCategory ){
    testcases[ testCategory ][ 'wikiContent' ] += '''
                <td class="confluenceTd">
                    <ul>'''
}
def makeHtmlColList( testCategory, testName ){
    testcases[ testCategory ][ 'wikiContent' ] += '''
                        <li>'''+ testName +'''</li>'''

}
def closingHeader( testCategory ){
    testcases[ testCategory ][ 'wikiContent' ] += '''
                    </ul>
                </td>'''
}
def closeHtmlForWiki(){
    for( String test in testcases.keySet() ){
        wikiContents += testcases[ test ][ 'wikiContent' ]
        wikiContents += '''
            </tr>'''
    }
    wikiContents += '''
        </tbody>
    </table>
    <p><strong>Everyday</strong>, all SegmentRouting tests are built and run on every supported branch.</p>
    <p>On <strong>Weekdays</strong>, all the other tests are built and run on the master branch.</p>
    <p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p>
    <p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>'''
}
def postToWiki( contents ){
    node( testMachine ){
        workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/"
        filename = "jenkinsSchedule.txt"
        writeFile file: workspace + filename, text: contents
        funcs.publishToConfluence( "false", "true",
                                   "Automated Test Schedule",
                                   workspace + filename )
    }
}
def dayAdder( testCat, testName, dayOfWeek ){
    AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
}
