summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/NetworkEmulator.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-12 08:00:04 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-01-12 08:00:04 -0800
commit092a710bbe0ac05607ca9d4417b534597849aaa9 (patch)
treedce90d3674e31cd196e3f0464e9862970d64b8c0 /lib/Vyatta/Qos/NetworkEmulator.pm
parent1f8762b9f955bd2b4c024012df783a1d51191a86 (diff)
parent33b8a1ebeb7925890bd744d1bda5f5c6c686c537 (diff)
downloadvyatta-cfg-qos-092a710bbe0ac05607ca9d4417b534597849aaa9.tar.gz
vyatta-cfg-qos-092a710bbe0ac05607ca9d4417b534597849aaa9.zip
Merge branch 'kenwood' of suva.vyatta.com:/git/vyatta-cfg-qos into kenwood
Diffstat (limited to 'lib/Vyatta/Qos/NetworkEmulator.pm')
-rw-r--r--lib/Vyatta/Qos/NetworkEmulator.pm31
1 files changed, 12 insertions, 19 deletions
diff --git a/lib/Vyatta/Qos/NetworkEmulator.pm b/lib/Vyatta/Qos/NetworkEmulator.pm
index 2a87407..602393c 100644
--- a/lib/Vyatta/Qos/NetworkEmulator.pm
+++ b/lib/Vyatta/Qos/NetworkEmulator.pm
@@ -46,23 +46,28 @@ sub new {
sub commands {
my ( $self, $dev ) = @_;
my $rate = $self->{_rate};
+ my $limit = $self->{_limit};
+ my $delay = $self->{_delay};
if ($rate) {
my $burst = $self->{_burst};
$burst or $burst = "15K";
- printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s\n",
+ printf "qdisc add dev %s root handle 1:0 tbf rate %s burst %s",
$dev, $rate, $burst;
- printf "qdisc add dev %s parent 1:1 handle 10: netem", $dev;
+ if ($limit) {
+ print " limit $limit";
+ } elsif ($delay) {
+ print " latency $delay";
+ } else {
+ print " latency 50ms";
+ }
+ printf "\nqdisc add dev %s parent 1:1 handle 10: netem", $dev;
} else {
printf "qdisc add dev %s root netem", $dev;
}
-
- my $delay = $self->{_delay};
- print " delay $delay" if ($delay);
-
- my $limit = $self->{_limit};
print " limit $limit" if ($limit);
+ print " delay $delay" if ($delay);
my $drop = $self->{_drop};
print " drop $drop" if ($drop);
@@ -76,16 +81,4 @@ sub commands {
print "\n";
}
-sub isChanged {
- my ( $self, $name ) = @_;
- my $config = new Vyatta::Config;
-
- $config->setLevel("qos-policy network-emulator $name");
- foreach my $attr ( "bandwidth", "burst", "queue-limit", "network-delay",
- "packet-loss", "packet-corruption", "packet-reordering", ) {
- return $attr if ( $config->isChanged($attr) );
- }
- return;
-}
-
1;