Debian Codegraph @

neutron_lib/api/definitions/portbindings.py

raw
1 # Copyright (c) 2012 OpenStack Foundation.
2 # All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from neutron_lib.api.definitions import port
17 from neutron_lib import constants
18
19
20 # The type of vnic that this port should be attached to
21 VNIC_TYPE = 'binding:vnic_type'
22 # The service will return the vif type for the specific port.
23 VIF_TYPE = 'binding:vif_type'
24 # The service may return a dictionary containing additional
25 # information needed by the interface driver. The set of items
26 # returned may depend on the value of VIF_TYPE.
27 VIF_DETAILS = 'binding:vif_details'
28 # In some cases different implementations may be run on different hosts.
29 # The host on which the port will be allocated.
30 HOST_ID = 'binding:host_id'
31 # The profile will be a dictionary that enables the application running
32 # on the specific host to pass and receive vif port specific information to
33 # the plugin.
34 PROFILE = 'binding:profile'
35
36 # The keys below are used in the VIF_DETAILS attribute to convey
37 # information to the VIF driver.
38
39 # TODO(rkukura): Replace CAP_PORT_FILTER, which nova no longer
40 # understands, with the new set of VIF security details to be used in
41 # the VIF_DETAILS attribute.
42 #
43 # - port_filter : Boolean value indicating Neutron provides port filtering
44 # features such as security group and anti MAC/IP spoofing
45 # - ovs_hybrid_plug: Boolean used to inform Nova that the hybrid plugging
46 # strategy for OVS should be used
47 CAP_PORT_FILTER = 'port_filter'
48 OVS_HYBRID_PLUG = 'ovs_hybrid_plug'
49 VIF_DETAILS_VLAN = 'vlan'
50 VIF_DETAILS_MACVTAP_SOURCE = 'macvtap_source'
51 VIF_DETAILS_MACVTAP_MODE = 'macvtap_mode'
52 VIF_DETAILS_PHYSICAL_INTERFACE = 'physical_interface'
53 VIF_DETAILS_BRIDGE_NAME = 'bridge_name'
54 VIF_DETAILS_CONNECTIVITY = 'connectivity'
55 VIF_DETAILS_BOUND_DRIVERS = 'bound_drivers'
56
57 # OVS bridge datapath type: String value used to define if the bridge uses
58 # kernel or userspace datapath.
59 OVS_DATAPATH_TYPE = 'datapath_type'
60
61 # The keys below are used in the VIF_DETAILS attribute to convey
62 # information related to the configuration of the vhost-user VIF driver.
63
64 # - vhost_user_mode: String value used to declare the mode of a
65 # vhost-user socket
66 VHOST_USER_MODE = 'vhostuser_mode'
67 # - server: socket created by hypervisor
68 VHOST_USER_MODE_SERVER = 'server'
69 # - client: socket created by vswitch
70 VHOST_USER_MODE_CLIENT = 'client'
71 # - vhostuser_socket String value used to declare the vhostuser socket name
72 VHOST_USER_SOCKET = 'vhostuser_socket'
73 # - vhost_user_ovs_plug: Boolean used to inform Nova that the ovs plug
74 # method should be used when binding the
75 # vhost-user vif.
76 VHOST_USER_OVS_PLUG = 'vhostuser_ovs_plug'
77
78 # VIF_TYPE: vif_types are required by Nova to determine which vif_driver to
79 # use to attach a virtual server to the network
80
81 # - vhost-user: The vhost-user interface type is a standard virtio interface
82 # provided by qemu 2.1+. This constant defines the neutron side
83 # of the vif binding type to provide a common definition
84 # to enable reuse in multiple agents and drivers.
85 VIF_TYPE_VHOST_USER = 'vhostuser'
86
87 VIF_TYPE_UNBOUND = 'unbound'
88 VIF_TYPE_BINDING_FAILED = 'binding_failed'
89 VIF_TYPE_DISTRIBUTED = 'distributed'
90 VIF_TYPE_OVS = 'ovs'
91 VIF_TYPE_BRIDGE = 'bridge'
92 VIF_TYPE_OTHER = 'other'
93 VIF_TYPE_TAP = 'tap'
94 # vif_type_macvtap: Tells Nova that the macvtap vif_driver should be used to
95 # create a vif. It does not require the VNIC_TYPE_MACVTAP,
96 # which is defined further below. E.g. Macvtap agent uses
97 # vnic_type 'normal'.
98 VIF_TYPE_MACVTAP = 'macvtap'
99 # vif_type_agilio_ovs: Tells Nova that the Agilio OVS vif_driver should be
100 # used to create a vif. In addition to the normal OVS
101 # vif types exposed, VNIC_DIRECT and
102 # VNIC_VIRTIO_FORWARDER are supported.
103 VIF_TYPE_AGILIO_OVS = 'agilio_ovs'
104 # SR-IOV VIF types
105 VIF_TYPE_HW_VEB = 'hw_veb'
106 VIF_TYPE_HOSTDEV_PHY = 'hostdev_physical'
107
108 VIF_UNPLUGGED_TYPES = (VIF_TYPE_BINDING_FAILED, VIF_TYPE_UNBOUND)
109
110 # VNIC_TYPE: It's used to determine which mechanism driver to use to bind a
111 # port. It can be specified via the Neutron API. Default is normal,
112 # used by OVS and LinuxBridge agent.
113 VNIC_NORMAL = 'normal'
114 VNIC_DIRECT = 'direct'
115 VNIC_MACVTAP = 'macvtap'
116 VNIC_BAREMETAL = 'baremetal'
117 VNIC_DIRECT_PHYSICAL = 'direct-physical'
118 VNIC_VIRTIO_FORWARDER = 'virtio-forwarder'
119 VNIC_SMARTNIC = 'smart-nic'
120 # - vdpa: The vHost-vdpa transport is a new vHost backend type introduced
121 # in qemu 5.1. vHost-vdpa leverages the vdpa framework introduced in
122 # kernel 5.7 to implement a vhost offload of a standard virtio-net
123 # interface to a software or hardware backend.
124 VNIC_VHOST_VDPA = 'vdpa'
125 # - accelerator: Refers to any device that supports hardware acceleration of
126 # any kind and is provided by Cyborg
127 # (https://wiki.openstack.org/wiki/Cyborg).
128 VNIC_ACCELERATOR_DIRECT = 'accelerator-direct'
129 VNIC_ACCELERATOR_DIRECT_PHYSICAL = 'accelerator-direct-physical'
130 VNIC_REMOTE_MANAGED = 'remote-managed'
131
132 VNIC_TYPES = [VNIC_NORMAL, VNIC_DIRECT, VNIC_MACVTAP, VNIC_BAREMETAL,
133 VNIC_DIRECT_PHYSICAL, VNIC_VIRTIO_FORWARDER, VNIC_SMARTNIC,
134 VNIC_VHOST_VDPA, VNIC_ACCELERATOR_DIRECT,
135 VNIC_ACCELERATOR_DIRECT_PHYSICAL, VNIC_REMOTE_MANAGED]
136
137 # VIF_DETAILS_CONNECTIVITY: Indicates what kind of connectivity the network
138 # back-end provides: L2, L3 or not specified.
139 CONNECTIVITY_L2 = 'l2'
140 CONNECTIVITY_L3 = 'l3'
141 CONNECTIVITY_LEGACY = 'legacy'
142
143 # The alias of the extension.
144 ALIAS = 'binding'
145
146 # Whether or not this extension is simply signaling behavior to the user
147 # or it actively modifies the attribute map.
148 IS_SHIM_EXTENSION = False
149
150 # Whether the extension is marking the adoption of standardattr model for
151 # legacy resources, or introducing new standardattr attributes. False or
152 # None if the standardattr model is adopted since the introduction of
153 # resource extension.
154 # If this is True, the alias for the extension should be prefixed with
155 # 'standard-attr-'.
156 IS_STANDARD_ATTR_EXTENSION = False
157
158 # The name of the extension.
159 NAME = 'Port Binding'
160
161 # A prefix for API resources. An empty prefix means that the API is going
162 # to be exposed at the v2/ level as any other core resource.
163 API_PREFIX = ''
164
165 # The description of the extension.
166 DESCRIPTION = "Expose port bindings of a virtual port to external application"
167
168 # A timestamp of when the extension was introduced.
169 UPDATED_TIMESTAMP = "2014-02-03T10:00:00-00:00"
170
171 # The name of the resource.
172 RESOURCE_NAME = port.RESOURCE_NAME
173
174 # The plural for the resource.
175 COLLECTION_NAME = port.COLLECTION_NAME
176
177 RESOURCE_ATTRIBUTE_MAP = {
178 COLLECTION_NAME: {
179 VIF_TYPE: {'allow_post': False, 'allow_put': False,
180 'default': constants.ATTR_NOT_SPECIFIED,
181 'enforce_policy': True,
182 'is_visible': True},
183 VIF_DETAILS: {'allow_post': False, 'allow_put': False,
184 'default': constants.ATTR_NOT_SPECIFIED,
185 'enforce_policy': True,
186 'is_visible': True},
187 VNIC_TYPE: {'allow_post': True, 'allow_put': True,
188 'default': VNIC_NORMAL,
189 'is_visible': True,
190 'validate': {'type:values': VNIC_TYPES},
191 'enforce_policy': True},
192 HOST_ID: {'allow_post': True, 'allow_put': True,
193 'default': constants.ATTR_NOT_SPECIFIED,
194 'is_visible': True,
195 'is_filter': True,
196 'enforce_policy': True},
197 PROFILE: {'allow_post': True, 'allow_put': True,
198 'default': constants.ATTR_NOT_SPECIFIED,
199 'enforce_policy': True,
200 'validate': {'type:dict_or_none': None},
201 'is_visible': True},
202 }
203 }
204
205 # The subresource attribute map for the extension. It adds child resources
206 # to main extension's resource. The subresource map must have a parent and
207 # a parameters entry. If an extension does not need such a map, None can
208 # be specified (mandatory).
209 SUB_RESOURCE_ATTRIBUTE_MAP = None
210
211 # The action map: it associates verbs with methods to be performed on
212 # the API resource. For example:
213 #
214 # ACTION_MAP = {
215 # RESOURCE_NAME: {
216 # 'add_my_foo_bars': 'PUT',
217 # 'remove_my_foo_bars': 'PUT',
218 # 'get_my_foo_bars': 'GET'
219 # }
220 # }
221 ACTION_MAP = {
222 }
223
224 # The action status.
225 ACTION_STATUS = {
226 }
227
228 # The list of required extensions.
229 REQUIRED_EXTENSIONS = [
230 ]
231
232 # The list of optional extensions.
233 OPTIONAL_EXTENSIONS = [
234 ]