|
| 1 | +package Testeaux; |
| 2 | + |
| 3 | +package combineaux |
| 4 | +{ |
| 5 | + sub combine |
| 6 | + { |
| 7 | + my ($workloads, $troubles) = @_; |
| 8 | + |
| 9 | + my $cluster = starteaux->deploy('lxc'); |
| 10 | + |
| 11 | + foreach my $workload (@$workloads) |
| 12 | + { |
| 13 | + foreach my $trouble (@$troubles) |
| 14 | + { |
| 15 | + print("run workload $workload during trouble $trouble\n"); |
| 16 | + # FIXME: generate proper id instead of 'hello' |
| 17 | + stresseaux::start('hello', $workload, $cluster); |
| 18 | + # FIXME: add a time gap here |
| 19 | + troubleaux::cause($cluster, $trouble); |
| 20 | + # FIXME: add a time gap here |
| 21 | + stresseaux::stop('hello'); |
| 22 | + troubleaux::fix($cluster); |
| 23 | + } |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +package stresseaux |
| 29 | +{ |
| 30 | + sub start |
| 31 | + { |
| 32 | + my ($id, $workload, $cluster) = @_; |
| 33 | + print("start stress $id: workload $workload, cluster $cluster\n"); |
| 34 | + # fixme: implement |
| 35 | + } |
| 36 | + |
| 37 | + sub stop |
| 38 | + { |
| 39 | + my $id = shift; |
| 40 | + print("stop stress $id\n"); |
| 41 | + # FIXME: implement |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +package starteaux |
| 46 | +{ |
| 47 | + sub deploy |
| 48 | + { |
| 49 | + my ($class, $driver, @args) = @_; |
| 50 | + my $self = {}; |
| 51 | + print("deploy cluster using driver $driver\n"); |
| 52 | + # fixme: implement |
| 53 | + return bless $self, 'starteaux'; |
| 54 | + } |
| 55 | + |
| 56 | + sub up |
| 57 | + { |
| 58 | + my ($self, $id) = @_; |
| 59 | + print("up node $id\n"); |
| 60 | + # FIXME: implement |
| 61 | + } |
| 62 | + |
| 63 | + sub down |
| 64 | + { |
| 65 | + my ($self, $id = @_; |
| 66 | + print("down node $id\n"); |
| 67 | + # FIXME: implement |
| 68 | + } |
| 69 | + |
| 70 | + sub drop |
| 71 | + { |
| 72 | + my ($self, $src, $dst, $ratio) = @_; |
| 73 | + print("drop $ratio packets from $src to $dst\n"); |
| 74 | + # FIXME: implement |
| 75 | + } |
| 76 | + |
| 77 | + sub delay |
| 78 | + { |
| 79 | + my ($self, $src, $dst, $msec) = @_; |
| 80 | + print("delay packets from $src to $dst by $msec msec\n"); |
| 81 | + # FIXME: implement |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +1; |
0 commit comments