diff options
author | selias <samuel.elias@pantheon.tech> | 2016-04-06 16:49:15 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-04-13 13:19:15 +0000 |
commit | e300d155302d493e0f4cf36b20081a1653909521 (patch) | |
tree | 080dc558f4eef26418f7634d071ade41dfd4c533 /resources/libraries/python/L2Util.py | |
parent | dbb26bdddde2556a78a596f236783480dc60bc0f (diff) |
Add keywords for Honeycomb tests
-add interface dump and bridge-domain dump to Vat command templates
-add low level keywords to implement vat dump commands
The resulting data dumps will be used in Honeycomb testing,
to verify data retrieved through Honeycomb API.
Change-Id: I2a913eaf23aa13d7223576220681821007672812
Signed-off-by: selias <samuel.elias@pantheon.tech>
Diffstat (limited to 'resources/libraries/python/L2Util.py')
-rw-r--r-- | resources/libraries/python/L2Util.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py index 0d34ce3e41..724ec0cdce 100644 --- a/resources/libraries/python/L2Util.py +++ b/resources/libraries/python/L2Util.py @@ -18,6 +18,7 @@ from resources.libraries.python.topology import Topology from resources.libraries.python.VatExecutor import VatExecutor, VatTerminal from resources.libraries.python.ssh import exec_cmd_no_error + class L2Util(object): """Utilities for l2 configuration""" @@ -218,3 +219,29 @@ class L2Util(object): """ cmd = 'brctl delbr {0}'.format(br_name) exec_cmd_no_error(node, cmd, sudo=True) + + @staticmethod + def vpp_get_bridge_domain_data(node, bd_id=None): + """Get all bridge domain data from a VPP node. If a domain ID number is + provided, return only data for the matching bridge domain. + + :param node: VPP node to get bridge domain data from. + :param bd_id: Numeric ID of a specific bridge domain. + :type node: dict + :type bd_id: int + :return: List of dictionaries containing data for each bridge domain, or + a single dictionary for the specified bridge domain. + :rtype: list or dict + """ + with VatTerminal(node) as vat: + response = vat.vat_terminal_exec_cmd_from_template("l2_bd_dump.vat") + + data = response[0] + + if bd_id is not None: + for bridge_domain in data: + if bridge_domain["bd_id"] == bd_id: + + return bridge_domain + + return data |