11package Testeaux ;
22
3- package combineaux
3+ package Combineaux
44{
55sub combine
66{
77my ($workloads ,$troubles ) =@_ ;
88
9- my $cluster =starteaux -> deploy(' lxc' );
9+ my $cluster =Starteaux -> deploy(' lxc' );
1010
1111foreach my $workload (@$workloads )
1212{
1313foreach my $trouble (@$troubles )
1414{
1515print (" run workload$workload during trouble$trouble \n " );
1616# 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 );
17+ Stresseaux ::start(' hello' ,$workload ,$cluster );
18+ sleep (1); # FIXME:will this work?
19+ Troubleaux ::cause($cluster ,$trouble );
20+ sleep (1); # FIXME:will this work?
21+ Stresseaux ::stop(' hello' );
22+ Troubleaux ::fix($cluster );
2323}
2424}
25+
26+ $cluster -> destroy();
2527}
2628}
2729
28- package stresseaux
30+ package Stresseaux
2931{
3032sub start
3133{
@@ -42,15 +44,15 @@ package stresseaux
4244}
4345}
4446
45- package starteaux
47+ package Starteaux
4648{
4749sub deploy
4850{
4951my ($class ,$driver ,@args ) =@_ ;
5052my $self = {};
5153print (" deploy cluster using driver$driver \n " );
5254# fixme: implement
53- return bless $self ,' starteaux ' ;
55+ return bless $self ,' Starteaux ' ;
5456}
5557
5658sub up
@@ -62,7 +64,7 @@ package starteaux
6264
6365sub down
6466{
65- my ($self ,$id =@_ ;
67+ my ($self ,$id ) =@_ ;
6668print (" down node$id \n " );
6769# FIXME: implement
6870}
@@ -80,6 +82,30 @@ package starteaux
8082print (" delay packets from$src to$dst by$msec msec\n " );
8183# FIXME: implement
8284}
85+
86+ sub destroy
87+ {
88+ my ($self ) =@_ ;
89+ print (" destroy cluster$cluster \n " );
90+ # FIXME: implement
91+ }
92+ }
93+
94+ package Troubleaux
95+ {
96+ sub cause
97+ {
98+ my ($cluster ,$trouble ) =@_ ;
99+ print (" cause$trouble in cluster$cluster \n " );
100+ # fixme: implement
101+ }
102+
103+ sub fix
104+ {
105+ my ($cluster ) =@_ ;
106+ print (" fix cluster$cluster \n " );
107+ # fixme: implement
108+ }
83109}
84110
851111;