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

« back to all changes in this revision

Viewing changes to quantum/api/v2/router.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:
30
30
 
31
31
 
32
32
LOG = logging.getLogger(__name__)
 
33
 
 
34
RESOURCES = {'network': 'networks',
 
35
             'subnet': 'subnets',
 
36
             'port': 'ports'}
 
37
SUB_RESOURCES = {}
33
38
COLLECTION_ACTIONS = ['index', 'create']
34
39
MEMBER_ACTIONS = ['show', 'update', 'delete']
35
40
REQUIREMENTS = {'id': attributes.UUID_PATTERN, 'format': 'xml|json'}
75
80
        col_kwargs = dict(collection_actions=COLLECTION_ACTIONS,
76
81
                          member_actions=MEMBER_ACTIONS)
77
82
 
78
 
        resources = {'network': 'networks',
79
 
                     'subnet': 'subnets',
80
 
                     'port': 'ports'}
81
 
 
82
 
        def _map_resource(collection, resource, params):
 
83
        def _map_resource(collection, resource, params, parent=None):
83
84
            allow_bulk = cfg.CONF.allow_bulk
84
85
            controller = base.create_resource(collection, resource,
85
86
                                              plugin, params,
86
 
                                              allow_bulk=allow_bulk)
 
87
                                              allow_bulk=allow_bulk,
 
88
                                              parent=parent)
 
89
            path_prefix = None
 
90
            if parent:
 
91
                path_prefix = "/%s/{%s_id}/%s" % (parent['collection_name'],
 
92
                                                  parent['member_name'],
 
93
                                                  collection)
87
94
            mapper_kwargs = dict(controller=controller,
88
95
                                 requirements=REQUIREMENTS,
 
96
                                 path_prefix=path_prefix,
89
97
                                 **col_kwargs)
90
98
            return mapper.collection(collection, resource,
91
99
                                     **mapper_kwargs)
92
100
 
93
 
        mapper.connect('index', '/', controller=Index(resources))
94
 
        for resource in resources:
95
 
            _map_resource(resources[resource], resource,
96
 
                          attributes.RESOURCE_ATTRIBUTE_MAP.get(
97
 
                              resources[resource], dict()))
 
101
        mapper.connect('index', '/', controller=Index(RESOURCES))
 
102
        for resource in RESOURCES:
 
103
            _map_resource(RESOURCES[resource], resource,
 
104
                          attributes.RESOURCE_ATTRIBUTE_MAP.get(
 
105
                              RESOURCES[resource], dict()))
 
106
 
 
107
        for resource in SUB_RESOURCES:
 
108
            _map_resource(SUB_RESOURCES[resource]['collection_name'], resource,
 
109
                          attributes.RESOURCE_ATTRIBUTE_MAP.get(
 
110
                              SUB_RESOURCES[resource]['collection_name'],
 
111
                              dict()),
 
112
                          SUB_RESOURCES[resource]['parent'])
98
113
 
99
114
        super(APIRouter, self).__init__(mapper)