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

« back to all changes in this revision

Viewing changes to neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.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:
18
18
# Performs per host Linux Bridge configuration for Neutron.
19
19
# Based on the structure of the OpenVSwitch agent in the
20
20
# Neutron OpenVSwitch Plugin.
21
 
# @author: Sumit Naiksatam, Cisco Systems, Inc.
22
21
 
23
22
import os
24
23
import sys
51
50
LOG = logging.getLogger(__name__)
52
51
 
53
52
BRIDGE_NAME_PREFIX = "brq"
54
 
TAP_INTERFACE_PREFIX = "tap"
55
53
BRIDGE_FS = "/sys/devices/virtual/net/"
56
54
BRIDGE_NAME_PLACEHOLDER = "bridge_name"
57
55
BRIDGE_INTERFACES_FS = BRIDGE_FS + BRIDGE_NAME_PLACEHOLDER + "/brif/"
110
108
        if not interface_id:
111
109
            LOG.warning(_("Invalid Interface ID, will lead to incorrect "
112
110
                          "tap device name"))
113
 
        tap_device_name = TAP_INTERFACE_PREFIX + interface_id[0:11]
 
111
        tap_device_name = constants.TAP_DEVICE_PREFIX + interface_id[0:11]
114
112
        return tap_device_name
115
113
 
116
114
    def get_vxlan_device_name(self, segmentation_id):
142
140
            try:
143
141
                if_list = os.listdir(bridge_interface_path)
144
142
                return len([interface for interface in if_list if
145
 
                            interface.startswith(TAP_INTERFACE_PREFIX)])
 
143
                            interface.startswith(constants.TAP_DEVICE_PREFIX)])
146
144
            except OSError:
147
145
                return 0
148
146
 
510
508
    def get_tap_devices(self):
511
509
        devices = set()
512
510
        for device in os.listdir(BRIDGE_FS):
513
 
            if device.startswith(TAP_INTERFACE_PREFIX):
 
511
            if device.startswith(constants.TAP_DEVICE_PREFIX):
514
512
                devices.add(device)
515
513
        return devices
516
514
 
1018
1016
def main():
1019
1017
    common_config.init(sys.argv[1:])
1020
1018
 
1021
 
    common_config.setup_logging(cfg.CONF)
 
1019
    common_config.setup_logging()
1022
1020
    try:
1023
1021
        interface_mappings = q_utils.parse_mappings(
1024
1022
            cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)