methods removed:
_get_machine_requirements - XML recipe no longer used, meaning
we can use machine requirement dict straight from network
definition in PyRecipe
_prepare_task - XML recipe is no longer used and task defined for them
are now obsolete
_run_task - same as ^
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/NetTestController.py | 127 -----------------------------------
1 file changed, 127 deletions(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 3661f77..fdaf532 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -118,76 +118,6 @@ class NetTestController:
msg = "SSH session terminated with status %s" % status
raise NetTestError(msg)
- def _get_machine_requirements(self):
- recipe = self._recipe
-
- # There must be some machines specified in the recipe
- if "machines" not in recipe or \
- ("machines" in recipe and len(recipe["machines"]) == 0):
- msg = "No hosts specified in the recipe. At least two " \
- "hosts are required to perform a network test."
- raise RecipeError(msg, recipe)
-
- # machine requirements
- mreq = {}
- for machine in recipe["machines"]:
- m_id = machine["id"]
-
- if m_id in mreq:
- msg = "Machine with id='%s' already exists." % m_id
- raise RecipeError(msg, machine)
-
- params = {}
- if "params" in machine:
- for p in machine["params"]:
- if p["name"] in params:
- msg = "Parameter '%s' of host %s was specified
" \
- "multiple times. Overriding the previous value."
\
- % (p["name"], m_id)
- logging.warn(RecipeError(msg, p))
- name = p["name"]
- val = p["value"]
- params[name] = val
-
- # Each machine must have at least one interface
- if "interfaces" not in machine or \
- ("interfaces" in machine and len(machine["interfaces"])
== 0):
- msg = "Host '%s' has no interfaces specified." % m_id
- raise RecipeError(msg, machine)
-
- ifaces = {}
- for iface in machine["interfaces"]:
- if_id = iface["id"]
- if if_id in ifaces:
- msg = "Interface with id='%s' already exists on host
" \
- "'%s'." % (if_id, m_id)
-
- iface_type = iface["type"]
- if iface_type != "eth":
- continue
-
- iface_params = {}
- if "params" in iface:
- for i in iface["params"]:
- if i["name"] in iface_params:
- msg = "Parameter '%s' of interface %s of "
\
- "host %s was defined multiple times. " \
- "Overriding the previous value." \
- % (i["name"], if_id, m_id)
- logging.warn(RecipeError(msg, p))
- name = i["name"]
- val = i["value"]
- iface_params[name] = val
-
- ifaces[if_id] = {
- "network": iface["network"],
- "params": iface_params
- }
-
- mreq[m_id] = {"params": params, "interfaces": ifaces}
-
- return mreq
-
def _prepare_network(self, resource_sync=True):
recipe = self._recipe
@@ -350,55 +280,11 @@ class NetTestController:
if "peer" in iface_xml_data:
iface.set_peer(iface_xml_data["peer"])
- def _prepare_tasks(self):
- self._tasks = []
- for task_data in self._recipe["tasks"]:
- task = {}
- task["quit_on_fail"] = False
- if "quit_on_fail" in task_data:
- task["quit_on_fail"] =
bool_it(task_data["quit_on_fail"])
-
- if "module_dir" in task_data:
- task["module_dir"] = task_data["module_dir"]
-
- if "tools_dir" in task_data:
- task["tools_dir"] = task_data["tools_dir"]
-
- if "python" in task_data:
- root = Path(None, self._recipe_path).get_root()
- path = Path(root, task_data["python"])
- task["python"] = path
- if not path.exists():
- msg = "Task file '%s' not found." % path.to_str()
- raise RecipeError(msg, task_data)
- self._tasks.append(task)
- continue
-
- task["commands"] = task_data["commands"]
- task["skeleton"] = []
- for cmd_data in task["commands"]:
- cmd = {"type": cmd_data["type"]}
-
- if "host" in cmd_data:
- cmd["host"] = cmd_data["host"]
- if cmd["host"] not in self._machines:
- msg = "Invalid host id '%s'." %
cmd["host"]
- raise RecipeError(msg, cmd_data)
-
- if cmd["type"] in ["test", "exec"]:
- if "bg_id" in cmd_data:
- cmd["bg_id"] = cmd_data["bg_id"]
- elif cmd["type"] in ["wait", "intr",
"kill"]:
- cmd["proc_id"] = cmd_data["bg_id"]
- task["skeleton"].append(cmd)
- if self._check_task(task):
- raise RecipeError("Incorrect command sequence.", task_data)
- self._tasks.append(task)
def _prepare_command(self, cmd_data):
cmd = {"type": cmd_data["type"]}
@@ -710,19 +596,6 @@ class NetTestController:
return module.ctl._result
- def _run_task(self, task):
- if "python" in task:
- return self._run_python_task(task)
-
- seq_passed = True
- for cmd_data in task["commands"]:
- cmd = self._prepare_command(cmd_data)
- cmd_res = self._run_command(cmd)
- if not cmd_res["passed"]:
- seq_passed = False
-
- return seq_passed
-
def _run_command(self, command):
logging.info("Executing command: [%s]", str_command(command))
--
2.4.11