Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 1 | # Copyright 2016 Mirantis, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | import collections |
| 16 | |
| 17 | from enum import IntEnum |
| 18 | |
| 19 | |
| 20 | def enum(*values, **kwargs): |
| 21 | names = kwargs.get('names') |
| 22 | if names: |
| 23 | return collections.namedtuple('Enum', names)(*values) |
| 24 | return collections.namedtuple('Enum', values)(*values) |
| 25 | |
| 26 | UNDERLAY_NODE_ROLE = enum( |
Dennis Dmitriev | b5d7424 | 2016-10-18 14:05:29 +0300 | [diff] [blame^] | 27 | 'salt_master', |
| 28 | 'salt_minion', |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 29 | ) |
| 30 | |
| 31 | NETWORK_TYPE = enum( |
| 32 | 'private', |
| 33 | 'public' |
| 34 | ) |
| 35 | |
| 36 | SNAPSHOT = enum( |
| 37 | 'hardware', |
| 38 | 'underlay', |
| 39 | 'tcp_deployed', |
| 40 | 'os_deployed', |
| 41 | ) |
| 42 | |
| 43 | LOG_LEVELS = enum( |
| 44 | 'INFO', |
| 45 | 'WARNING', |
| 46 | 'ERROR', |
| 47 | 'CRITICAL', |
| 48 | 'DEBUG', |
| 49 | 'NOTE' |
| 50 | ) |