aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/IPv6Setup.py
diff options
context:
space:
mode:
authorMatej Klotton <mklotton@cisco.com>2016-03-02 16:51:30 +0100
committerStefan Kobza <skobza@cisco.com>2016-03-07 16:17:01 +0100
commit799c246c1783b534df0ce7731c9078463be33bdd (patch)
tree95056726292c3334cd3f71c4e154c01993800efa /resources/libraries/python/IPv6Setup.py
parentcdf3213528f5f560d8d8b92c642f655cef706745 (diff)
Add with-statment support to VatTerminal.
Change-Id: I7b4b32ce07b9247ccf80bf6b5d3339d00bc0999f Signed-off-by: Matej Klotton <mklotton@cisco.com>
Diffstat (limited to 'resources/libraries/python/IPv6Setup.py')
-rw-r--r--resources/libraries/python/IPv6Setup.py34
1 files changed, 16 insertions, 18 deletions
diff --git a/resources/libraries/python/IPv6Setup.py b/resources/libraries/python/IPv6Setup.py
index 86c8876e89..e04668f953 100644
--- a/resources/libraries/python/IPv6Setup.py
+++ b/resources/libraries/python/IPv6Setup.py
@@ -161,15 +161,14 @@ class IPv6Setup(object):
:type prefix: str
"""
sw_if_index = Topology.get_interface_sw_index(node, interface)
- vat = VatTerminal(node)
- vat.vat_terminal_exec_cmd_from_template('add_ip_address.vat',
- sw_if_index=sw_if_index,
- address=addr,
- prefix_length=prefix)
- vat.vat_terminal_exec_cmd_from_template('set_if_state.vat',
- sw_if_index=sw_if_index,
- state='admin-up')
- vat.vat_terminal_close()
+ with VatTerminal(node) as vat:
+ vat.vat_terminal_exec_cmd_from_template('add_ip_address.vat',
+ sw_if_index=sw_if_index,
+ address=addr,
+ prefix_length=prefix)
+ vat.vat_terminal_exec_cmd_from_template('set_if_state.vat',
+ sw_if_index=sw_if_index,
+ state='admin-up')
ssh = SSH()
ssh.connect(node)
@@ -194,15 +193,14 @@ class IPv6Setup(object):
:type prefix: str
"""
sw_if_index = Topology.get_interface_sw_index(node, interface)
- vat = VatTerminal(node)
- vat.vat_terminal_exec_cmd_from_template('del_ip_address.vat',
- sw_if_index=sw_if_index,
- address=addr,
- prefix_length=prefix)
- vat.vat_terminal_exec_cmd_from_template('set_if_state.vat',
- sw_if_index=sw_if_index,
- state='admin-down')
- vat.vat_terminal_close()
+ with VatTerminal(node) as vat:
+ vat.vat_terminal_exec_cmd_from_template('del_ip_address.vat',
+ sw_if_index=sw_if_index,
+ address=addr,
+ prefix_length=prefix)
+ vat.vat_terminal_exec_cmd_from_template('set_if_state.vat',
+ sw_if_index=sw_if_index,
+ state='admin-down')
@staticmethod
def vpp_ra_supress_link_layer(node, interface):