aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/Routing.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/Routing.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/Routing.py')
-rw-r--r--resources/libraries/python/Routing.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/resources/libraries/python/Routing.py b/resources/libraries/python/Routing.py
index b22516a7c4..7795e3ffcc 100644
--- a/resources/libraries/python/Routing.py
+++ b/resources/libraries/python/Routing.py
@@ -29,17 +29,16 @@ class Routing(object):
:param prefix_len: Route destination network prefix length.
:param gateway: Route gateway address.
:param interface: Route interface.
- :type node: str
+ :type node: dict
:type network: str
:type prefix_len: int
:type gateway: str
:type interface: str
"""
sw_if_index = Topology.get_interface_sw_index(node, interface)
- vat = VatTerminal(node)
- vat.vat_terminal_exec_cmd_from_template('add_route.vat',
- network=network,
- prefix_length=prefix_len,
- gateway=gateway,
- sw_if_index=sw_if_index)
- vat.vat_terminal_close()
+ with VatTerminal(node) as vat:
+ vat.vat_terminal_exec_cmd_from_template('add_route.vat',
+ network=network,
+ prefix_length=prefix_len,
+ gateway=gateway,
+ sw_if_index=sw_if_index)