Поддержка JSON

Для решения задач автоматизации более удобным может оказаться просмотр и задание настроек полисинга в формате JSON

Первый вариант

Вывод настроек полисинга тарифного плана TEST в формате json:

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

Загрузка настроек полисинга тарифного плана TEST в формате json:

Сокращенный формат (burst, cburst вычисляются автоматически):

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"} ]}}'

Полный формат:

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" } ]}}'

Второй вариант

Формат json2 выводит более подробные настройки — здесь разделены единицы измерения и значения скорости по отдельным ключам

Вывод настроек полисинга в формате json2:

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

Загрузка настроек полисинга тарифного плана TEST в формате json2:

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" } ]}}'