summaryrefslogtreecommitdiffstats
path: root/vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2016-03-25 03:55:53 -0400
committerMatthewLi <matthew.lijun@huawei.com>2016-03-25 03:55:53 -0400
commitf84c8dcc22f1499128893e62b0e15b4b592c47ba (patch)
treeee14029aa59c076fdfde1c504a385f3389477a6a /vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py
parent7ba76747d55669e2bbaf70a3061e1c0b5dea912e (diff)
adjust project directories
JIRA: BOTTLENECK-56 Change-Id: Ic9acad5eaa4917093bdb85a80960f796f5b4ba7f Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py')
-rw-r--r--vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py71
1 files changed, 0 insertions, 71 deletions
diff --git a/vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py b/vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py
deleted file mode 100644
index 21b8f82c..00000000
--- a/vstf/vstf/agent/env/vswitch_plugins/bridge_plugin.py
+++ /dev/null
@@ -1,71 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from vstf.agent.env.vswitch_plugins import model
-from vstf.common.utils import check_call, get_eth_by_bdf, check_output
-
-
-class BridgePlugin(model.VswitchPlugin):
- def __init__(self):
- pass
-
- def clean(self):
- """clean brs created before.
-
- """
- out = check_output(r"brctl show | grep -v '^\s' | awk '{print $1}'|sed '1,1d'", shell=True)
- print out
- for br in out.split():
- if br != 'br0':
- self._del_br(br)
-
- return True
-
- def init(self):
- pass
-
- def _del_br(self, name):
- check_call('ip link set dev %s down' % name, shell=True)
- check_call('brctl delbr %s' % name, shell=True)
-
- def create_br(self, br_cfg):
- """Create a bridge(virtual switch). Return True for success, return False for failure.
-
- :param dict br_cfg: configuration for bridge creation like
- {
- "name": "br1",
- "uplinks": [
- {
- "bdf": "04:00.0",
- },
- {
- "bdf": "04:00.1",
- }
- ]
- }
-
- """
- name, uplinks = br_cfg['name'], br_cfg['uplinks']
- check_call("brctl addbr %s" % name, shell=True)
- for uplink in uplinks:
- device = get_eth_by_bdf(uplink['bdf'])
- check_call("ip link set dev %s up" % device, shell=True)
- check_call("brctl addif %s %s" % (name, device), shell=True)
- check_call("ip link set dev %s up" % name, shell=True)
- return True
-
- def set_tap_vid(self, tap_cfg):
- """linux bridge doesn't support vlan id setting.
- """
- return True
-
- def set_fastlink(self, br_cfg):
- """linux bridge doesn't support openflow protocol.
- """
- return True