JSON Support

For automation purpose it may be convenient to view and configure polycing settings in JSON format.

The first option

Output of TEST tariff plan polycing settings in json format:

fdpi_ctrl list profile --policing --profile.name TEST --outformat json

Downloading the TEST tariff plan policing settings in json format:

Short format (burst, cburst are calculated automatically):

fdpi_ctrl load profile --policing --profile.name TEST --profile.json '{ "type":"HTB", "outbound":{ "root_rate":"20mbit","root_ceil":"20mbit", "classes" : [ {"class":0, "rate":"8bit", "ceil":"20mbit"},{"class":1, "rate":"8bit", "ceil":"20mbit"},{"class":2, "rate":"8bit", "ceil":"20mbit"},{"class":3, "rate":"8bit", "ceil":"20mbit"},{"class":4, "rate":"8bit", "ceil":"20mbit"},{"class":5, "rate":"8bit", "ceil":"20mbit"},{"class":6, "rate":"8bit", "ceil":"20mbit"},{"class":7, "rate":"8bit", "ceil":"20mbit"} ]}, "inbound":{ "root_rate":"20mbit","root_ceil":"20mbit", "classes" : [ {"class":0, "rate":"8bit", "ceil":"20mbit"},{"class":1, "rate":"8bit", "ceil":"20mbit"},{"class":2, "rate":"8bit", "ceil":"20mbit"},{"class":3, "rate":"8bit", "ceil":"20mbit"},{"class":4, "rate":"8bit", "ceil":"20mbit"},{"class":5, "rate":"8bit", "ceil":"20mbit"},{"class":6, "rate":"8bit", "ceil":"20mbit"},{"class":7, "rate":"8bit", "ceil":"20mbit"} ]}}'

Full format:

fdpi_ctrl load profile --policing --profile.name TEST --profile.json '{ "type":"HTB", "outbound":{ "root_rate":"20mbit","root_ceil":"20mbit","root_burst":"10mbit","root_cburst":"10mbit" , "classes" : [ {"class":0, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":1, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":2, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":3, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":4, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":5, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":6, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":7, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" } ]}, "inbound":{ "root_rate":"20mbit","root_ceil":"20mbit","root_burst":"10mbit","root_cburst":"10mbit" , "classes" : [ {"class":0, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":1, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":2, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":3, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":4, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":5, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":6, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" },{"class":7, "rate":"8bit", "ceil":"20mbit","burst":"8bit","cburst":"10mbit" } ]}}'

The second option

The json2 format outputs more detailed settings - here the units and speed values are separated by individual keys

Output polysing settings in json2 format:

fdpi_ctrl list profile --policing --profile.name TEST2 --outformat=json2

Downloading the TEST tariff plan policing settings in json2 format:

fdpi_ctrl load profile --policing --profile.name TEST2 --profile.json2 '{ "type":"HTB", "outbound":{ "root_rate_value":"100","root_rate_unit":"mbps","root_ceil_value":"100","root_ceil_unit":"mbps","root_burst_value":"50","root_burst_unit":"mbit","root_cburst_value":"50" ,"root_cburst_unit":"mbit" , "classes" : [ {"class":0, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":1, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":2, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":3, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":4, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":5, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":6, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":7, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" } ]}, "inbound":{ "bw_rate_value":"0" , "bw_rate_unit":"bps" , "bw_ceil_value":"0" , "bw_ceil_unit":"bps" , "root_rate_value":"100","root_rate_unit":"mbps","root_ceil_value":"100","root_ceil_unit":"mbps","root_burst_value":"50","root_burst_unit":"mbit","root_cburst_value":"50" ,"root_cburst_unit":"mbit" , "classes" : [ {"class":0, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":1, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":2, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":3, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":4, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":5, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":6, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" },{"class":7, "rate_value":"8", "rate_unit":"bps", "ceil_value":"100", "ceil_unit":"mbps", "burst_value":"8", "burst_unit":"bit", "cburst_value":"50", "cburst_unit":"mbit" } ]}}'