Debian Codegraph @

os_vif/objects/fields.py

raw symbols SCIP
1 # Copyright 2016 Red Hat, 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 from oslo_versionedobjects import fields
16
17
18 class VIFDirectMode(fields.Enum):
19 VEPA = 'vepa'
20 PASSTHROUGH = 'passthrough'
21 BRIDGE = 'bridge'
22
23 ALL = (VEPA, PASSTHROUGH, BRIDGE)
24
25 def __init__(self):
26 super(VIFDirectMode, self).__init__(
27 valid_values=VIFDirectMode.ALL)
28
29
30 class VIFDirectModeField(fields.BaseEnumField):
31 AUTO_TYPE = VIFDirectMode()
32
33
34 class VIFVHostUserMode(fields.Enum):
35 CLIENT = "client"
36 SERVER = "server"
37
38 ALL = (CLIENT, SERVER)
39
40 def __init__(self):
41 super(VIFVHostUserMode, self).__init__(
42 valid_values=VIFVHostUserMode.ALL)
43
44
45 class VIFVHostUserModeField(fields.BaseEnumField):
46 AUTO_TYPE = VIFVHostUserMode()
47
48
49 class ListOfIPAddressField(fields.AutoTypedField):
50 AUTO_TYPE = fields.List(fields.IPAddress())
51
52
53 class VIFHostDeviceDevType(fields.Enum):
54 ETHERNET = 'ethernet'
55 GENERIC = 'generic'
56
57 ALL = (ETHERNET, GENERIC)
58
59 def __init__(self):
60 super(VIFHostDeviceDevType, self).__init__(
61 valid_values=VIFHostDeviceDevType.ALL)
62
63
64 class VIFHostDeviceDevTypeField(fields.BaseEnumField):
65 AUTO_TYPE = VIFHostDeviceDevType()