Adding configuration block management.

This commit is contained in:
stephb9959
2021-09-08 23:06:17 -07:00
parent 0dce31238b
commit 274c6f13eb
5 changed files with 118 additions and 3 deletions

102
test_scripts/curl/cfg1.json Normal file
View File

@@ -0,0 +1,102 @@
{
"name" : "newbigconfig" ,
"deviceTypes" : ["*"] ,
"configuration" : [
{ "name" : "radio_section ",
"weight" : 100 ,
"configuration" : {
"radios": [
{
"band": "5G",
"channel": 52,
"channel-mode": "HE",
"channel-width": 80,
"country": "CA"
},
{
"band": "2G",
"channel": 11,
"channel-mode": "HE",
"channel-width": 20,
"country": "CA"
}
]
}
},
{ "name" : "iface_section",
"weight" : 0,
"configuration" :
{
"interfaces": [
{
"name": "WAN",
"role": "upstream",
"services": [ "lldp" ],
"ethernet": [
{
"select-ports": [
"WAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ssids": [
{
"name": "OpenWifi",
"wifi-bands": [
"2G", "5G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
}
}
]
},
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh", "lldp" ],
"ethernet": [
{
"select-ports": [
"LAN*"
]
}
],
"ipv4": {
"addressing": "static",
"subnet": "192.168.1.1/24",
"dhcp": {
"lease-first": 10,
"lease-count": 100,
"lease-time": "6h"
}
}
}
]}
},
{ "name" : "metrics_section",
"weight" : 0,
"configuration" :
{
"metrics": {
"statistics": {
"interval": 120,
"types": [ "ssids", "lldp", "clients" ]
},
"health": {
"interval": 120
},
"wifi-frames": {
"filters": [ "probe", "auth" ]
}
}
}
}
]
}

View File

@@ -319,6 +319,15 @@ addconfigmetrics() {
jq < ${result_file}
}
addconfigfile() {
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/configurations/1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${token}" \
-H "accept: application/json" \
-d @"$1" > ${result_file}
jq < ${result_file}
}
getconfig() {
curl ${FLAGS} "https://${OWPROV}/api/v1/configurations/$1" \
-H "Content-Type: application/json" \
@@ -403,6 +412,7 @@ case "$1" in
"setentityconfig") login; setentityconfig "$2" "$3"; logout;;
"adddeviceconfig") login; adddeviceconfig "$2" "$3"; logout;;
"addconfigmetrics") login; addconfigmetrics "$2" ; logout;;
"addconfigfile") login; addconfigfile "$2" ; logout;;
*) help ;;
esac