From 799c246c1783b534df0ce7731c9078463be33bdd Mon Sep 17 00:00:00 2001 From: Matej Klotton Date: Wed, 2 Mar 2016 16:51:30 +0100 Subject: Add with-statment support to VatTerminal. Change-Id: I7b4b32ce07b9247ccf80bf6b5d3339d00bc0999f Signed-off-by: Matej Klotton --- resources/libraries/python/L2Util.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'resources/libraries/python/L2Util.py') diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py index a89130814c..c0a764fa2d 100644 --- a/resources/libraries/python/L2Util.py +++ b/resources/libraries/python/L2Util.py @@ -167,11 +167,10 @@ class L2Util(object): """ sw_iface1 = Topology().get_interface_sw_index(node, interface1) sw_iface2 = Topology().get_interface_sw_index(node, interface2) - vat = VatTerminal(node) - vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', - interface1=sw_iface1, - interface2=sw_iface2) - vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', - interface1=sw_iface2, - interface2=sw_iface1) - vat.vat_terminal_close() + with VatTerminal(node) as vat: + vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', + interface1=sw_iface1, + interface2=sw_iface2) + vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', + interface1=sw_iface2, + interface2=sw_iface1) -- cgit 1.2.3-korg