def checkStatus(totalThreatValue):
    global current_state
    global previousTotalThreatValue

    if current_state == "Low":
        thresold = 20
    elif current_state == "Medium":
        thresold = 40
    elif current_state == "High":
        thresold = 60
    elif current_state == "Critical":
        thresold = 80

    if totalThreatValue >= previousTotalThreatValue:
        if current_state != "Critical":
            if totalThreatValue > thresold:
                alarm_action = "rise"
                current_state = FSM.alarm_FSM(current_state, alarm_action)

    else:
        if totalThreatValue < (thresold - 20):
            if thresold == 20:
                current_state = "Low"
            else:
                alarm_action = "decrease"
                current_state = FSM.alarm_FSM(current_state, alarm_action)

    previousTotalThreatValue = totalThreatValue
def checkStatus(totalThreatValue):
    global current_state
    global previousTotalThreatValue

    if current_state == "Low":
        thresold = 20
    elif current_state == "Medium":
        thresold = 40
    elif current_state == "High":
        thresold = 60
    elif current_state == "Critical":
        thresold = 80

    if totalThreatValue >= previousTotalThreatValue:
        if current_state != "Critical":      
            if totalThreatValue > thresold:
                alarm_action = "rise"
                current_state = FSM.alarm_FSM(current_state,alarm_action)

    else:
        if totalThreatValue < (thresold-20):
            if thresold == 20:
                current_state = "Low"
            else:
                alarm_action = "decrease"
                current_state = FSM.alarm_FSM(current_state,alarm_action)
    
    previousTotalThreatValue = totalThreatValue
def singlePacketAttack(code, severity):
    global current_state

    print('ALERT:\t', alarmCodeList[code], '\t', severity, '\t',
          datetime.datetime.now())

    alarm_action = "rise"
    current_state = FSM.alarm_FSM(current_state, alarm_action)
def singlePacketAttack(code,severity):
    global current_state

    print ('ALERT:\t', alarmCodeList[code] , '\t', 
           severity , '\t', datetime.datetime.now())

    alarm_action = "rise"
    current_state = FSM.alarm_FSM(current_state,alarm_action)