2016-05-16 8:37 GMT+02:00 Ondrej Lichtner <olichtne(a)redhat.com>:
On Fri, Apr 22, 2016 at 10:52:06AM +0200, Jiri Prochazka wrote:
> support for loopback devices has been temporarily removed
> support for netem has been temporarily removed
>
> we should consider if we want to define IP address of eth
> interface in setup phase or if we want to keep it in task
>
> _prepare_interface() now works only with eth ifaces
>
> soft interfaces are created dynamically in task phase so
> if statements can be removed from this method
>
> Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
> ---
> lnst/Controller/NetTestController.py | 89 +++++++++++++++++-------------------
> 1 file changed, 41 insertions(+), 48 deletions(-)
>
> diff --git a/lnst/Controller/NetTestController.py
b/lnst/Controller/NetTestController.py
> index a4b48f0..fd54a09 100644
> --- a/lnst/Controller/NetTestController.py
> +++ b/lnst/Controller/NetTestController.py
> @@ -239,55 +239,48 @@ class NetTestController:
> raise RecipeError(msg, cmd)
> machine.sync_resources(sync_table)
>
> - def _prepare_interface(self, m_id, iface_xml_data):
> + def _prepare_interface(self, m_id, if_id, iface_data):
> machine = self._machines[m_id]
> - if_id = iface_xml_data["id"]
> - if_type = iface_xml_data["type"]
> -
> - try:
> - iface = machine.get_interface(if_id)
> - except MachineError:
> - if if_type == 'lo':
> - iface = machine.new_loopback_interface(if_id)
> - else:
> - iface = machine.new_soft_interface(if_id, if_type)
> -
> - if "slaves" in iface_xml_data:
> - for slave in iface_xml_data["slaves"]:
> - slave_id = slave["id"]
> - iface.add_slave(machine.get_interface(slave_id))
> -
> - # Some soft devices (such as team) use per-slave options
> - if "options" in slave:
> - for opt in slave["options"]:
> - iface.set_slave_option(slave_id, opt["name"],
> - opt["value"])
> -
> - if "addresses" in iface_xml_data:
> - for addr in iface_xml_data["addresses"]:
> - iface.add_address(addr)
> -
> - if "options" in iface_xml_data:
> - for opt in iface_xml_data["options"]:
> - iface.set_option(opt["name"], opt["value"])
> -
> - if "netem" in iface_xml_data:
> - iface.set_netem(iface_xml_data["netem"].to_dict())
> -
> - if "ovs_conf" in iface_xml_data:
> - iface.set_ovs_conf(iface_xml_data["ovs_conf"].to_dict())
> -
> - if iface_xml_data["netns"] != None:
> - iface.set_netns(iface_xml_data["netns"])
> -
> - if "peer" in iface_xml_data:
> - iface.set_peer(iface_xml_data["peer"])
> -
> -
> -
> -
> -
> -
> + #if_type = iface_data["type"]
> +
> + #try:
> + iface = machine.get_interface(if_id)
> + #except MachineError:
> + #if if_type == 'lo':
> + # iface = machine.new_loopback_interface(if_id)
> + #else:
> + # iface = machine.new_soft_interface(if_id, if_type)
> +
> + #if "slaves" in iface_data:
> + # for slave in iface_data["slaves"]:
> + # slave_id = slave["id"]
> + # iface.add_slave(machine.get_interface(slave_id))
> +
> + # # Some soft devices (such as team) use per-slave options
> + # if "options" in slave:
> + # for opt in slave["options"]:
> + # iface.set_slave_option(slave_id, opt["name"],
> + # opt["value"])
> +
> + #if "addresses" in iface_data:
> + # for addr in iface_data["addresses"]:
> + # iface.add_address(addr)
> +
> + #if "options" in iface_data:
> + # for opt in iface_data["options"]:
> + # iface.set_option(opt["name"], opt["value"])
> +
> + #if "netem" in iface_data:
> + # iface.set_netem(iface_data["netem"].to_dict())
> +
> + #if "ovs_conf" in iface_data:
> + # iface.set_ovs_conf(iface_data["ovs_conf"].to_dict())
> +
> + if iface_data["netns"] != None:
> + iface.set_netns(iface_data["netns"])
> +
> + #if "peer" in iface_data:
> + # iface.set_peer(iface_data["peer"])
Why do we want all of this commented code here?
It's just for me so I don't forget about stuff like netem and loopback
interfaces support, I should've erase it, sorry for confusion
>>
>> def _prepare_command(self, cmd_data):
>> cmd = {"type": cmd_data["type"]}
>> --
>> 2.4.11
>> _______________________________________________
>> LNST-developers mailing list
>> lnst-developers(a)lists.fedorahosted.org
>>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...