~niedbalski/ubuntu/vivid/neutron/fixes-1447803

« back to all changes in this revision

Viewing changes to neutron/plugins/bigswitch/plugin.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-10-03 18:45:23 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20141003184523-4mt6dy1q3j8n30c9
Tags: 1:2014.2~rc1-0ubuntu1
* New upstream release candidate:
  - d/p/*: Refreshed.
  - d/control: Add python-requests-mock to BD's.
  - d/control: Align versioned requirements with upstream.
* Transition linuxbridge and openvswitch plugin users to modular
  layer 2 plugin (LP: #1323729):
  - d/control: Mark removed plugin packages as transitional, depend
    on neutron-plugin-ml2, mark oldlibs/extra.
  - d/neutron-plugin-{linuxbridge,openvswitch}.install: Drop.
  - d/control: Depend on neutron-plugin-ml2 for linuxbridge
    agent package.
  - d/neutron-plugin-linuxbridge-agent.upstart: Use ml2 plugin
    configuration files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
13
#    License for the specific language governing permissions and limitations
14
14
#    under the License.
15
 
#
16
 
# @author: Mandeep Dhami, Big Switch Networks, Inc.
17
 
# @author: Sumit Naiksatam, sumitnaiksatam@gmail.com, Big Switch Networks, Inc.
18
15
 
19
16
"""
20
17
Neutron REST Proxy Plug-in for Big Switch and FloodLight Controllers.
115
112
class SecurityGroupServerRpcMixin(sg_db_rpc.SecurityGroupServerRpcMixin):
116
113
 
117
114
    def get_port_from_device(self, device):
118
 
        port_id = re.sub(r"^tap", "", device)
 
115
        port_id = re.sub(r"^%s" % const.TAP_DEVICE_PREFIX, "", device)
119
116
        port = self.get_port_and_sgs(port_id)
120
117
        if port:
121
118
            port['device'] = device
357
354
        # In ML2, the host_id is already populated
358
355
        if portbindings.HOST_ID in port:
359
356
            hostid = port[portbindings.HOST_ID]
360
 
        else:
 
357
        elif 'id' in port:
361
358
            hostid = porttracker_db.get_port_hostid(context, port['id'])
 
359
        else:
 
360
            hostid = None
362
361
        if hostid:
363
362
            port[portbindings.HOST_ID] = hostid
364
363
            override = self._check_hostvif_override(hostid)
446
445
def put_context_in_serverpool(f):
447
446
    @functools.wraps(f)
448
447
    def wrapper(self, context, *args, **kwargs):
449
 
        self.servers.set_context(context)
 
448
        # core plugin: context is top level object
 
449
        # ml2: keeps context in _plugin_context
 
450
        self.servers.set_context(getattr(context, '_plugin_context', context))
450
451
        return f(self, context, *args, **kwargs)
451
452
    return wrapper
452
453