0

In Cisco 29xx routers with IOS 15.7, we have upload queues (with the classic service-policy output command and the policy-map:

policy-map wan-shaping
 class class-default
  shape average 1024000

where 1024000 should be really variable because xDSL circuits could train at different bandwidths every time. Is there a way to let the shape average value dynamically reconfigure itself every time the upload bandwidth changes?

EDIT: to tell you the truth, because we have hundreds of routers and the provided circuit is not always known beforehand if it is going to be an aDSL or VDSL, the actual requirement is that we want a single template configuration to match every case.

3
  • 1
    That is why your business contract with the ISP is for a minimum performance SLA. You are not going to get a one-size-fits-all for something like that unless you go with the lowest common denominator.
    – Ron Maupin
    Oct 8, 2020 at 12:34
  • 1
    Unfortunately, no. Just getting the actual trained rate is a pain. As I recall, the DSL interface doesn't communicate that back to IOS. sho dsl int will show it. Plus, the rate at which it trained is not necessarily the rate currently available -- bin usage is adaptive. The only thing I can think of would be some complicated EEM setup. (I don't have DSL anymore, so I couldn't test anything. My sync rate was always higher than provisioned/usable rate.)
    – Ricky
    Oct 8, 2020 at 17:32
  • I suppose I COULD look into the EEM idea... hmm...thanks anyway
    – Elias Bats
    Oct 15, 2020 at 13:39

1 Answer 1

1

We have alot of Cisco 800 Series routers and the same issue. I create a TCL script that i scheduled on the router to run, so it would read out the xDSL synched upload bandwidth and configure the policy map accordingly. Here is the script:

# Create empty variables because TCLshell is not very bright
set errlevel 0

# Set the amount of percentage that the upload is utilizing from the total bandwidth
# Internal bandidth analisation of multiple branches have shown that currently (june 2020) about 22% of the bandidth is used for uploads
set uploadpercent 22

# Gets the hostname of the device
set rohostname [lindex [exec "show running-config | include ^hostname"] 1]

# Gets the current speed
set currentspeed [lindex [exec "show policy-map QOS_OUT | include cir"] 1]

# Gets the model of the router
set getModel [exec "show running-config | include license"]
if {[lindex $getModel 3] == "C892FSP-K9"} {
    # We assume a bandwidth of at least 100Mbit/s and will configure a corresponding bandwidth of 80Mbit/s (80%)
    set newspeed [expr 800000 * $uploadpercent]
    # We calculate what amount of this speed falls to upload, as only the upload is limited
} elseif {[lindex $getModel 3] == "C897VA-K9"} {
    # Checking, if VDSL is synchronized
    set VDSLSTATUS [exec "show controllers vDSL 0 | include Modem Status:"]
    if {[regexp {TC\sSync} $VDSLSTATUS]} {
        set vdslupspeed [lindex [exec "show controllers vDSL 0 | include ^Speed"] 5]
        set kbitfilling "000"
        set newspeed [expr $vdslupspeed$kbitfilling / 100 *80]
    } else {
        # VDSL link is currently down, so there is no way to read the synched speed
        set errlevel 1
        set errdescription "VDSL Link down"
    }
} else {
    set errlevel 1
    set errdescription "Unsupported model"
}

# Check if there is a speed difference and configure new speed
if {$errlevel == 0} {
    if {$newspeed != $currentspeed} {
        ios_config "policy-map QOS_OUT" "class class-default" "shape average $newspeed"
        exec "write"
    }
}

# Create human understandable speeds
if {$errlevel == 0} {
    set currentspeedhuman [expr $currentspeed /1000]
    if {[string length $currentspeedhuman] >= 4} {
        set currentspeedhuman "[string range $currentspeedhuman 0 end-3]'[string range $currentspeedhuman end-2 end]"
    }
    set newspeedhuman [expr $newspeed /1000]
    if {[string length $newspeedhuman] >= 4} {
        set newspeedhuman "[string range $newspeedhuman 0 end-3]'[string range $newspeedhuman end-2 end]"
    }
}

# Report back to Splunk
if {$errlevel == 0} {
    if {$newspeed == $currentspeed} {
        puts "The speed of the QoS policy remains unchanged at $newspeedhuman Kbit/s"
        [exec "send log facility MANAGEMENT severity 6 mnemonics LOG The speed of the QoS policy remains unchanged at $newspeedhuman Kbit/s"]
    } else {
        puts "The speed of the QoS policy has been adjusted from $currentspeedhuman Kbit/s to $newspeedhuman Kbit/s"
        [exec "send log facility MANAGEMENT severity 6 mnemonics LOG The speed of the QoS policy has been adjusted from $currentspeedhuman Kbit/s to $newspeedhuman Kbit/s"]
    }
} else {
    puts "The script encountered an issue and did not change anything. Error description: $errdescription"
    [exec "send log facility MANAGEMENT severity 6 mnemonics LOG he script encountered an issue and did not change anything. Error description: $errdescription"]
}

You would need to adjust the values for your devices and configuration of course. You can then create a EEM applet, that runs the script on a weekly basis:

event manager applet SETQOSBANDWIDTH
 event timer cron cron-entry "0 3 * * 1"
 action 1.0 cli command "enable"
 action 2.0 cli command "tclsh flash:qosbandwidth.tcl"
 action 3.0 syslog priority informational msg "CronJob for setting QoS bandwidth ran successful" facility "MANAGEMENT"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.