mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Adding inventoryHandle API
This commit is contained in:
@@ -49,7 +49,7 @@ login() {
|
||||
exit 13
|
||||
fi
|
||||
echo "${token}" > token.json
|
||||
setfms
|
||||
setprov
|
||||
}
|
||||
|
||||
findbrowser() {
|
||||
@@ -72,7 +72,7 @@ findbrowser() {
|
||||
fi
|
||||
}
|
||||
|
||||
setfms() {
|
||||
setprov() {
|
||||
curl ${FLAGS} -X GET "https://${UCENTRALSEC}/api/v1/systemEndpoints" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: Bearer ${token}" > ${result_file}
|
||||
@@ -131,7 +131,25 @@ setroot() {
|
||||
|
||||
addentity() {
|
||||
payload="{ \"name\" : \"$1\", \"description\" : \"sub entity.\", \"parent\" : \"0000-0000-0000\", \"notes\" : [ {\"note\" : \"CLI added\"} ] }";
|
||||
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/entity/1" \
|
||||
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/inventory/1" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "accept: application/json" \
|
||||
-d "$payload" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
getentities() {
|
||||
curl ${FLAGS} "https://${OWPROV}/api/v1/entity" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "accept: application/json" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
addtag() {
|
||||
payload="{ \"name\" : \"$1\",\"entity\" : \"$2\", \"serialNumber\" : \"$1\", \"deviceType\" : \"linksys_ea8300\" }";
|
||||
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/inventory/1" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "accept: application/json" \
|
||||
@@ -145,6 +163,8 @@ case "$1" in
|
||||
"getroot") login; getroot; logout;;
|
||||
"setroot") login; setroot; logout;;
|
||||
"addentity") login; addentity "$2" ; logout;;
|
||||
"addtag") login; addtag $2 $3; logout;;
|
||||
"getentities") login; getentities ; logout;;
|
||||
*) help ;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user