this method is run from Task match(), it runs
matching algorithm, prints match desc, when
match_setup run mode is used it ends here
otherwise it prepares network, binds Machine objects
to its HostAPI counterparts and Device objects to
its InterfaceAPI counterparts
summary - it returns True if it found match and if
run or config_only mode is used, it also prepares network
and initializes HostAPI and InterfaceAPI objects created
in setup phase
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/NetTestController.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 8c1d24f..3e7eb69 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -496,6 +496,25 @@ class NetTestController:
return res
+ def prepare_test_env(self):
+ try:
+ self.provision_machines()
+ self.print_match_description()
+ if self.run_mode == "match_setup":
+ return True
+ self._prepare_network()
+ Task.ctl.init_hosts(self._machines)
+ return True
+ except (NoMatchError) as exc:
+ self._cleanup_slaves()
+ raise exc
+ return False
+ except (KeyboardInterrupt, Exception) as exc:
+ msg = "Exception raised during configuration."
+ logging.error(msg)
+ self._cleanup_slaves()
+ raise
+
def _run_recipe(self):
overall_res = {"passed": True}
--
2.4.11