Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created May 13, 2014 13:02
Show Gist options
  • Save hiroyuki-sato/d9af8a829ffbb271a03d to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/d9af8a829ffbb271a03d to your computer and use it in GitHub Desktop.
set traffic-policy shaper ICMP-OUTGOING default bandwidth 500Mbps

Before

vyos@vyos# set traffic-policy shaper ICMP-OUTGOING default bandwidth 500Mbps
Possible completions:
   <number>     Bandwidth in Kbps
   <number>%    Percentage of overall rate (default 100%)
   <number><suffix>
                Value with scaling suffix (kbit, kbps, ...)

After

vyos@vyos# set traffic-policy shaper ICMP-OUTGOING default bandwidth 500Mbps
Possible completions:
   <number>     Bandwidth in Kbps
   <number>%    Percentage of overall rate (default 100%)
   <number><suffix>
                Available suffixes
                bit
                bit(1), kbit(10^3), mbit(10^6), gbit, tbit
                kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
                
                byte
                kibps(1024*8), mibps(1024^2*8), gibps, tibps
                bps(8),kbps(8*10^3),mbps(8*10^6), gbps, tbps
@ebiken
Copy link

ebiken commented May 14, 2014

Since is 10^3 "bit" per sec, we might want to show it explicitly like below.
Bandwidth in Kbps (10^3 bits per second)

Else, people might see later part of help message and think it's kbps(8*10^3).

@ebiken
Copy link

ebiken commented May 14, 2014

Also I found typo.

  • Original:
    kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
  • It should be:
    kibit(1024), mibit(1024^2), gibit(1024^3), tbit(1024^4)
  • Or maybe we can omit last one to be inline with byte.
    kibit(1024), mibit(1024^2), gibit(1024^3), tbit

@hiroyuki-sato
Copy link
Author

Thank you for your comment.
This is final proposal.

vyos@vyos# set traffic-policy shaper ICMP-OUTGOING default bandwidth 500Mbps
Possible completions:
   <number>     Bandwidth in Kbps(10^3 bits per second)
   <number>%    Percentage of overall rate (default 100%)
   <number><suffix>
                Available suffixes
                Bit per second
                bit(1), kbit(10^3), mbit(10^6), gbit, tbit
                kibit(1024), mibit(1024^2), gibit(1024^3), tibit

                Byte per second
                kibps(1024*8), mibps(1024^2*8), gibps, tibps
                bps(8),kbps(8*10^3),mbps(8*10^6), gbps, tbps

@ebiken
Copy link

ebiken commented May 14, 2014

Looks good. Thanks!

@hiroyuki-sato
Copy link
Author

For implementation reason, I change message format.

vyos@vyos# set traffic-policy shaper test default bandwidth   
Possible completions:
   <number>     Bandwidth in Kbps(10^3 bits per second)
   <number>%    Percentage of overall rate (default 100%)
   <number>bit  bit(1), kbit(10^3), mbit(10^6), gbit, tbit
   <number>ibit kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
   <number>ibps kibps(1024*8), mibps(1024^2*8), gibps, tibps *Byte/sec*
   <number>bps  bps(8),kbps(8*10^3),mbps(8*10^6), gbps, tbps *Byte/sec*

VyOS code

val_help: <number>; Bandwidth in Kbps(10^3 bits per second)
val_help: <number>%%; Percentage of overall rate (default 100%%)
val_help: <number>bit; bit(1), kbit(10^3), mbit(10^6), gbit, tbit
val_help: <number>ibit; kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
val_help: <number>ibps; kibps(1024*8), mibps(1024^2*8), gibps, tibps *Byte/sec*
val_help: <number>bps; bps(8),kbps(8*10^3),mbps(8*10^6), gbps, tbps *Byte/sec*

@hiroyuki-sato
Copy link
Author

ibit, ibpsのところにX (kmgtがはいるという意味) の文字を追加した場合はバランスがわるくなってしまうため上のフォーマットに落ち着いています。

   <number>     Bandwidth in Kbps(10^3 bits per second)
   <number>%    Percentage of overall rate (default 100%)
   <number>bit  bit(1), kbit(10^3), mbit(10^6), gbit, tbit
   <number>Xibit
                kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
   <number>Xibps
                kibps(1024*8), mibps(1024^2*8), gibps, tibps *Byte/sec*
   <number>bps  bps(8),kbps(8*10^3),mbps(8*10^6), gbps, tbps *Byte/sec*

@ebiken
Copy link

ebiken commented May 16, 2014

すっきりしてよいですね。
1個Typo発見しました。

kibit(1024), mibit(1024^3), gibit(1024^4), tbit(1024^5)
 => kibit(1024), mibit(1024^2), gibit(1024^3), tbit(1024^4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment