[Distem] add (specific) network emulation feature
This feature can be implemented through the Distem Ruby Client via viface_update
method: http://distem.gforge.inria.fr/doc/Distem/NetAPI/Client.html#viface_update-instance_method
Network interface can be configured with the following scheme: http://distem.gforge.inria.fr/doc/file.resources_desc.html#Network_interface
Here is an example :
#!/usr/bin/ruby
require 'distem'
ifname = 'if0'
Distem.client do |cl|
desc = {
'output' => {
'latency' => {
'delay' => nil
},
'bandwidth' => {
'rate' => nil
}
}
}
if ARGV[0] == "delay" then
desc['output']['latency']['delay'] = ARGV[1]
end
if ARGV[0] == "rate" then
desc['output']['bandwidth']['rate'] = ARGV[1]
end
cl.viface_update('node-1',ifname,desc)
cl.viface_update('node-2',ifname,desc)
puts ARGV[0] + " " + ARGV[1]
end
Maybe enoslib can retrieve the topology from the configuration (or create a function to update vifaces) and apply it after vnodes are up (enos_distem/provider.py)