diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-15 09:01:10 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-15 09:01:10 -0700 |
commit | 3dd93c5175de9a4d32cadb7bb0c4f832fb14312d (patch) | |
tree | fad3292cb82c2f49408ecfd1a8bec6467b2095e9 /scripts/VyattaQosTrafficShaper.pm | |
parent | b23c4faf070e8e5dc0eacee19c1dc379a0e9bcf5 (diff) | |
parent | 9a25dee29ff200647e6b0f6b6dc58b0aade39a52 (diff) | |
download | vyatta-cfg-qos-3dd93c5175de9a4d32cadb7bb0c4f832fb14312d.tar.gz vyatta-cfg-qos-3dd93c5175de9a4d32cadb7bb0c4f832fb14312d.zip |
Merge branch 'hollywood' of suva.vyatta.com:/git/vyatta-cfg-qos into hollywood
Diffstat (limited to 'scripts/VyattaQosTrafficShaper.pm')
-rw-r--r-- | scripts/VyattaQosTrafficShaper.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 5ba60dd..f321e9b 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -253,9 +253,27 @@ sub new { bless $self, $class; $self->_define($config); + $self->_validate($config); + return $self; } +sub _validate { + my $self = shift; + + if ( $self->{_rate} ne "auto" ) { + my $classes = $self->{_classes}; + my $default = shift @$classes; + my $rate = VyattaQosUtil::getRate($self->{_rate}); + + $default->rateCheck($rate, "$self->{_level} default"); + + foreach my $class (@$classes) { + $class->rateCheck($rate, "$self->{_level} class $class->{id}"); + } + } +} + # Rate can be something like "auto" or "10.2mbit" sub _getAutoRate { my ($rate, $dev) = @_; |