~ubuntu-branches/ubuntu/raring/quantum/raring-proposed

« back to all changes in this revision

Viewing changes to quantum/extensions/portbindings.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Yolanda Robla, James Page, Maru Newby
  • Date: 2013-01-11 09:14:35 UTC
  • mfrom: (2.1.17)
  • Revision ID: package-import@ubuntu.com-20130111091435-vaup7dwmtmajy5oe
Tags: 2013.1~g2-0ubuntu1
[ Chuck Short ]
* New upstream version. 
* debian/patches/fix-quantum-configuration.patch: Refreshed.

[ Yolanda Robla ]
* debian/quantum-l3-agent.quantum-metadata-agent.upstart: Add
  upstart configuration for Metadata Agent.
* debian/quantum-l3-agent.install: Added quantum-ns-metadata-proxy,
  quantum-metadata-agent and metadata_agent.ini.
* debian/patches/fix-quantum-configuration.patch: Update rootwrap
  configuration in metadata_agent.ini file.
* debian/changelog: Updated package version
* d/p/fix-quantum-configuration.patch: refresh patches

[ James Page ]
* d/*.install: Install entry points from bin directory instead
  of easy-install ones generated during the package build process
  (LP: #1085038).
* d/control: Drop BD on python-dev-all; its not required.
* d/rules: Install multiple upstart configurations for quantum-l3-agent.
* d/control: Tidy package descriptions.
* d/*.postrm: Drop as debhelper will generate update-rc.d calls in
  maintainer scripts if required.
* d/quantum-common.postinst: Tweak permissions setting so that /etc/quantum
  is not owned/writable by the quantum user, ensure that /etc/quantum/rootwrap*
  is owned by root:root.
* d/*agent*.postinst: Dropped as permissions now correctly set in
  quantum-common.
* d/patches/fix-quantum-configuration.patch: Re-add dropped fixes rootwrap and
  sqlite defaults for all plugins.
* d/control: Added new BD on alembic (>= 0.4.1~), version python-mock >= 1.0b1.

[ Maru Newby ]
* debian/control: Remove unnecessary openvswitch-vswitch dependency
  from quantum-plugin-openvswitch (LP: #1076747).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2012 OpenStack, LLC.
 
2
#
 
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
 
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,
 
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 
12
# implied.
 
13
# See the License for the specific language governing permissions and
 
14
# limitations under the License.
 
15
 
 
16
from quantum.api.v2 import attributes
 
17
 
 
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
 
25
# the plugin.
 
26
PROFILE = 'binding:profile'
 
27
 
 
28
VIF_TYPE_OVS = 'ovs'
 
29
VIF_TYPE_BRIDGE = 'bridge'
 
30
VIF_TYPE_802_QBG = '802.1qbg'
 
31
VIF_TYPE_802_QBH = '802.1qbh'
 
32
VIF_TYPE_OTHER = 'other'
 
33
 
 
34
EXTENDED_ATTRIBUTES_2_0 = {
 
35
    'ports': {
 
36
        VIF_TYPE: {'allow_post': False, 'allow_put': False,
 
37
                   'default': attributes.ATTR_NOT_SPECIFIED,
 
38
                   'is_visible': True},
 
39
        HOST_ID: {'allow_post': True, 'allow_put': True,
 
40
                  'default': attributes.ATTR_NOT_SPECIFIED,
 
41
                  'is_visible': True},
 
42
        PROFILE: {'allow_post': True, 'allow_put': True,
 
43
                  'default': attributes.ATTR_NOT_SPECIFIED,
 
44
                  'is_visible': True},
 
45
    }
 
46
}
 
47
 
 
48
 
 
49
class Portbindings(object):
 
50
    """Extension class supporting port bindings.
 
51
 
 
52
    This class is used by quantum's extension framework to make
 
53
    metadata about the port bindings available to external applications.
 
54
 
 
55
    With admin rights one will be able to update and read the values.
 
56
    """
 
57
 
 
58
    @classmethod
 
59
    def get_name(cls):
 
60
        return "Port Binding"
 
61
 
 
62
    @classmethod
 
63
    def get_alias(cls):
 
64
        return "binding"
 
65
 
 
66
    @classmethod
 
67
    def get_description(cls):
 
68
        return "Expose port bindings of a virtual port to external application"
 
69
 
 
70
    @classmethod
 
71
    def get_namespace(cls):
 
72
        return "http://docs.openstack.org/ext/binding/api/v1.0"
 
73
 
 
74
    @classmethod
 
75
    def get_updated(cls):
 
76
        return "2012-11-14T10:00:00-00:00"
 
77
 
 
78
    def get_extended_resources(self, version):
 
79
        if version == "2.0":
 
80
            return EXTENDED_ATTRIBUTES_2_0
 
81
        else:
 
82
            return {}