1
# Copyright (c) 2012 OpenStack, LLC.
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
16
from quantum.api.v2 import attributes
18
# The service will return the vif type for the specific port.
19
VIF_TYPE = 'binding:vif_type'
20
# In some cases different implementations may be run on different hosts.
21
# The host on which the port will be allocated.
22
HOST_ID = 'binding:host_id'
23
# The profile will be a dictionary that enables the application running
24
# on the specific host to pass and receive vif port specific information to
26
PROFILE = 'binding:profile'
29
VIF_TYPE_BRIDGE = 'bridge'
30
VIF_TYPE_802_QBG = '802.1qbg'
31
VIF_TYPE_802_QBH = '802.1qbh'
32
VIF_TYPE_OTHER = 'other'
34
EXTENDED_ATTRIBUTES_2_0 = {
36
VIF_TYPE: {'allow_post': False, 'allow_put': False,
37
'default': attributes.ATTR_NOT_SPECIFIED,
39
HOST_ID: {'allow_post': True, 'allow_put': True,
40
'default': attributes.ATTR_NOT_SPECIFIED,
42
PROFILE: {'allow_post': True, 'allow_put': True,
43
'default': attributes.ATTR_NOT_SPECIFIED,
49
class Portbindings(object):
50
"""Extension class supporting port bindings.
52
This class is used by quantum's extension framework to make
53
metadata about the port bindings available to external applications.
55
With admin rights one will be able to update and read the values.
67
def get_description(cls):
68
return "Expose port bindings of a virtual port to external application"
71
def get_namespace(cls):
72
return "http://docs.openstack.org/ext/binding/api/v1.0"
76
return "2012-11-14T10:00:00-00:00"
78
def get_extended_resources(self, version):
80
return EXTENDED_ATTRIBUTES_2_0