<commit_before>"""
NSI state machine.

Author: <NAME> <<EMAIL>>
Copyright: NORDUnet (2011)
"""

from opennsa import error



# Reservation states
INITIAL                 = 'Initial'             # Also used in LSM
RESERVE_CHECKING        = 'ReserveChecking'
RESERVE_HELD            = 'ReserveHeld'
RESERVE_COMMITTING      = 'ReserveComitting'
RESERVED                = 'Reserved'
RESERVE_FAILED          = 'ReserveFailed'
RESERVE_ABORTING        = 'ReserveAborting'
RESERVE_TIMEOUT         = 'ReserveTimeout'      # Only UPA

# Provision
SCHEDULED               = 'Scheduled'
PROVISIONING            = 'Provisioning'
PROVISIONED             = 'Provisioned'
RELEASING               = 'Releasing'

# Lifecycle
# NO CREATED - Use Initial
TERMINATING             = 'Terminating'
TERMINATED              = 'Terminated'

# Dataplane
INACTIVE                = 'Inactive'
ACTIVATING              = 'Activating'
ACTIVE                  = 'Active'
DEACTIVATING            = 'Deactivating'


RESERVE_TRANSITIONS = {
    INITIAL             : [ RESERVE_CHECKING                                       ],
    RESERVE_CHECKING    : [ RESERVE_HELD,       RESERVE_FAILED                     ],
    RESERVE_HELD        : [ RESERVE_COMMITTING, RESERVE_ABORTING, RESERVE_TIMEOUT  ],
    RESERVE_COMMITTING  : [ RESERVED                                               ],
    RESERVE_FAILED      : [ RESERVE_ABORTING                                       ],
    RESERVE_TIMEOUT     : [ RESERVE_ABORTING                                       ],
    RESERVE_ABORTING    : [ RESERVED                                               ],
    RESERVED            : [ RESERVE_CHECKING                                       ]
}

PROVISION_TRANSITIONS = {
    SCHEDULED       : [ PROVISIONING  ],
    PROVISIONING    : [ PROVISIONED   ],
    PROVISIONED     : [ RELEASING     ],
    RELEASING       : [ SCHEDULED     ]
}

ACTIVATION_TRANSITIONS = {
    INACTIVE        : [ ACTIVATING                ],
    ACTIVATING      : [ ACTIVE,        INACTIVE   ],
    ACTIVE          : [ DEACTIVATING              ],
    DEACTIVATING    : [ INACTIVE                  ]
}

LIFECYCLE_TRANSITIONS = {
    INITIAL         : [ TERMINATING ],
    TERMINATING     : [ TERMINATED  ],
    TERMINATED      : []<commit_msg>allow transition directly from initial to terminated in lifecycle state machine<commit_after>"""
NSI state machine.

Author: <NAME> <<EMAIL>>
Copyright: NORDUnet (2011)
"""

from opennsa import error



# Reservation states
INITIAL                 = 'Initial'             # Also used in LSM
RESERVE_CHECKING        = 'ReserveChecking'
RESERVE_HELD            = 'ReserveHeld'
RESERVE_COMMITTING      = 'ReserveComitting'
RESERVED                = 'Reserved'
RESERVE_FAILED          = 'ReserveFailed'
RESERVE_ABORTING        = 'ReserveAborting'
RESERVE_TIMEOUT         = 'ReserveTimeout'      # Only UPA

# Provision
SCHEDULED               = 'Scheduled'
PROVISIONING            = 'Provisioning'
PROVISIONED             = 'Provisioned'
RELEASING               = 'Releasing'

# Lifecycle
# NO CREATED - Use Initial
TERMINATING             = 'Terminating'
TERMINATED              = 'Terminated'

# Dataplane
INACTIVE                = 'Inactive'
ACTIVATING              = 'Activating'
ACTIVE                  = 'Active'
DEACTIVATING            = 'Deactivating'


RESERVE_TRANSITIONS = {
    INITIAL             : [ RESERVE_CHECKING                                       ],
    RESERVE_CHECKING    : [ RESERVE_HELD,       RESERVE_FAILED                     ],
    RESERVE_HELD        : [ RESERVE_COMMITTING, RESERVE_ABORTING, RESERVE_TIMEOUT  ],
    RESERVE_COMMITTING  : [ RESERVED                                               ],
    RESERVE_FAILED      : [ RESERVE_ABORTING                                       ],
    RESERVE_TIMEOUT     : [ RESERVE_ABORTING                                       ],
    RESERVE_ABORTING    : [ RESERVED                                               ],
    RESERVED            : [ RESERVE_CHECKING                                       ]
}

PROVISION_TRANSITIONS = {
    SCHEDULED       : [ PROVISIONING  ],
    PROVISIONING    : [ PROVISIONED   ],
    PROVISIONED     : [ RELEASING     ],
    RELEASING       : [ SCHEDULED     ]
}

ACTIVATION_TRANSITIONS = {
    INACTIVE        : [ ACTIVATING                ],
    ACTIVATING      : [ ACTIVE,        INACTIVE   ],
    ACTIVE          : [ DEACTIVATING              ],
    DEACTIVATING    : [ INACTIVE                  ]
}

LIFECYCLE_TRANSITIONS = {
    INITIAL         : [ TERMINATING,    TERMINATED ],
    TERMINATING     : [ TERMINATED  ],
    TERMINATED      : []
{'fraction_non_alphanumeric': 0.07345612134344529, 'fraction_numerical': 0.001733477789815818, 'mean_word_length': 1.3757076685537828, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1950922', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1368, 'n_words': 231}