mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-30 02:02:36 +00:00
Compare commits
15 Commits
v2.6.0-RC2
...
v2.6.0-RC3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
439aa1d07a | ||
|
|
a9293a7717 | ||
|
|
43d7078cb7 | ||
|
|
18f5d42f00 | ||
|
|
70622b2bb8 | ||
|
|
5b24aea47c | ||
|
|
e97617a0db | ||
|
|
ba63a7033f | ||
|
|
e9db2e1a0d | ||
|
|
d85fef7725 | ||
|
|
543c46bf68 | ||
|
|
73eec53fe4 | ||
|
|
8ad2d67c2c | ||
|
|
442f810688 | ||
|
|
2dca5204ea |
9
.github/workflows/cleanup.yml
vendored
9
.github/workflows/cleanup.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'release/*'
|
||||
types: [ closed ]
|
||||
|
||||
defaults:
|
||||
@@ -16,4 +17,10 @@ jobs:
|
||||
steps:
|
||||
- run: |
|
||||
export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
|
||||
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owprov/$PR_BRANCH_TAG"
|
||||
|
||||
if [[ ! $PR_BRANCH_TAG =~ (main|master|release-*) ]]; then
|
||||
echo "PR branch is $PR_BRANCH_TAG, deleting Docker image"
|
||||
curl -s -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owprov/$PR_BRANCH_TAG"
|
||||
else
|
||||
echo "PR branch is $PR_BRANCH_TAG, not deleting Docker image"
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
||||
images:
|
||||
owprov:
|
||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owprov
|
||||
tag: v2.6.0-RC2
|
||||
tag: v2.6.0-RC3
|
||||
pullPolicy: Always
|
||||
# regcred:
|
||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace OpenWifi{
|
||||
for (const auto &i: V.children) {
|
||||
ProvObjects::Venue V2;
|
||||
if (StorageService()->VenueDB().GetRecord("id", i, V2)) {
|
||||
std::copy(V2.devices.begin(),V2.devices.end(),std::back_inserter(R));
|
||||
auto LowerDevs = GetDevices(V2, GetChildren);
|
||||
std::copy(LowerDevs.begin(), LowerDevs.end(), std::back_inserter(R));
|
||||
}
|
||||
|
||||
@@ -213,21 +213,67 @@ namespace OpenWifi {
|
||||
return true;
|
||||
};
|
||||
|
||||
auto FixEntityDevices = [&](const ProvObjects::Entity &E) -> bool {
|
||||
auto FixEntity = [&](const ProvObjects::Entity &E) -> bool {
|
||||
Types::UUIDvec_t NewDevices;
|
||||
bool Modified=false;
|
||||
for(const auto &device:E.devices) {
|
||||
ProvObjects::InventoryTag T;
|
||||
if(InventoryDB().GetRecord("id", device, T)) {
|
||||
NewDevices.emplace_back(device);
|
||||
} else {
|
||||
|
||||
Modified=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(NewDevices!=E.devices) {
|
||||
Types::UUIDvec_t NewContacts;
|
||||
for(const auto &contact:E.contacts) {
|
||||
ProvObjects::Contact C;
|
||||
if(ContactDB().GetRecord("id", contact, C)) {
|
||||
NewContacts.emplace_back(contact);
|
||||
} else {
|
||||
Modified=true;
|
||||
}
|
||||
}
|
||||
|
||||
Types::UUIDvec_t NewLocations;
|
||||
for(const auto &location:E.locations) {
|
||||
ProvObjects::Location L;
|
||||
if(LocationDB().GetRecord("id", location, L)) {
|
||||
NewLocations.emplace_back(location);
|
||||
} else {
|
||||
Modified=true;
|
||||
}
|
||||
}
|
||||
|
||||
Types::UUIDvec_t NewVenues;
|
||||
for(const auto &venue:E.venues) {
|
||||
ProvObjects::Venue V;
|
||||
if(VenueDB().GetRecord("id", venue, V)) {
|
||||
NewVenues.emplace_back(venue);
|
||||
} else {
|
||||
Modified=true;
|
||||
}
|
||||
}
|
||||
|
||||
Types::UUIDvec_t NewVariables;
|
||||
for(const auto &variable:E.variables) {
|
||||
ProvObjects::VariableBlock V;
|
||||
if(VariablesDB().GetRecord("id", variable, V)) {
|
||||
NewVariables.emplace_back(variable);
|
||||
} else {
|
||||
Modified=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(Modified)
|
||||
{
|
||||
Logger().warning(fmt::format(" fixing entity: {}",E.info.name));
|
||||
ProvObjects::Entity NewEntity = E;
|
||||
NewEntity.devices = NewDevices;
|
||||
NewEntity.contacts = NewContacts;
|
||||
NewEntity.locations = NewLocations;
|
||||
NewEntity.venues = NewVenues;
|
||||
NewEntity.variables = NewVariables;
|
||||
EntityDB().UpdateRecord("id", E.info.id, NewEntity);
|
||||
}
|
||||
return true;
|
||||
@@ -236,7 +282,7 @@ namespace OpenWifi {
|
||||
Logger().information("Checking DB consistency: venues");
|
||||
VenueDB().Iterate(FixVenueDevices);
|
||||
Logger().information("Checking DB consistency: entities");
|
||||
EntityDB().Iterate(FixEntityDevices);
|
||||
EntityDB().Iterate(FixEntity);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1167,6 +1167,7 @@ namespace OpenWifi {
|
||||
static const std::string uSERVICE_SUBCRIBER{ "owsub"};
|
||||
static const std::string uSERVICE_INSTALLER{ "owinst"};
|
||||
static const std::string uSERVICE_ANALYTICS{ "owanalytics"};
|
||||
static const std::string uSERVICE_OWRRM{ "owrrm"};
|
||||
|
||||
class ConfigurationEntry {
|
||||
public:
|
||||
@@ -1895,36 +1896,32 @@ namespace OpenWifi {
|
||||
[[nodiscard]] inline bool NeedAdditionalInfo() const { return QB_.AdditionalInfo; }
|
||||
[[nodiscard]] inline const std::vector<std::string> & SelectedRecords() const { return QB_.Select; }
|
||||
|
||||
/* [[nodiscard]] inline const Poco::JSON::Object::Ptr ParseStream() {
|
||||
return IncomingParser_.parse(Request->stream()).extract<Poco::JSON::Object::Ptr>();
|
||||
}
|
||||
*/
|
||||
inline static bool ParseBindings(const std::string & Request, const std::list<std::string> & EndPoints, BindingMap &bindings) {
|
||||
bindings.clear();
|
||||
auto PathItems = Poco::StringTokenizer(Request, "/");
|
||||
|
||||
inline static bool ParseBindings(const std::string & Request, const std::list<std::string> & EndPoints, BindingMap &bindings) {
|
||||
bindings.clear();
|
||||
std::vector<std::string> PathItems = Utils::Split(Request, '/');
|
||||
for(const auto &EndPoint:EndPoints) {
|
||||
auto ParamItems = Poco::StringTokenizer(EndPoint, "/");
|
||||
if (PathItems.count() != ParamItems.count())
|
||||
continue;
|
||||
|
||||
for(const auto &EndPoint:EndPoints) {
|
||||
std::vector<std::string> ParamItems = Utils::Split(EndPoint, '/');
|
||||
if (PathItems.size() != ParamItems.size())
|
||||
continue;
|
||||
|
||||
bool Matched = true;
|
||||
for (size_t i = 0; i != PathItems.size() && Matched; i++) {
|
||||
if (PathItems[i] != ParamItems[i]) {
|
||||
if (ParamItems[i][0] == '{') {
|
||||
auto ParamName = ParamItems[i].substr(1, ParamItems[i].size() - 2);
|
||||
bindings[Poco::toLower(ParamName)] = PathItems[i];
|
||||
} else {
|
||||
Matched = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Matched)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool Matched = true;
|
||||
for (size_t i = 0; i < PathItems.count(); i++) {
|
||||
if (PathItems[i] != ParamItems[i]) {
|
||||
if (ParamItems[i][0] == '{') {
|
||||
auto ParamName = ParamItems[i].substr(1, ParamItems[i].size() - 2);
|
||||
bindings[Poco::toLower(ParamName)] = PathItems[i];
|
||||
} else {
|
||||
Matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Matched)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void PrintBindings() {
|
||||
for (const auto &[key, value] : Bindings_)
|
||||
|
||||
13
src/ow_version.h
Normal file
13
src/ow_version.h
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by stephane bourque on 2021-12-06.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OW_VERSION {
|
||||
inline static const std::string VERSION{"2.6.0"};
|
||||
inline static const std::string BUILD{"128"};
|
||||
inline static const std::string HASH{"3b0f2a0"};
|
||||
}
|
||||
@@ -499,6 +499,14 @@ listvenues() {
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
getvenuedevices() {
|
||||
curl ${FLAGS} -X GET "https://${OWPROV}/api/v1/venue/$1?getDevices=true&getChildren=true" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "Accept: application/json" > ${result_file}
|
||||
jq < ${result_file}
|
||||
}
|
||||
|
||||
shopt -s nocasematch
|
||||
case "$1" in
|
||||
"login") login; echo "You are logged in..." ; logout ;;
|
||||
@@ -546,6 +554,7 @@ case "$1" in
|
||||
"getsignup") login; getsignup $2; logout;;
|
||||
"getsubdevs") login; getsubdevs $2; logout;;
|
||||
"listvenues") login; listvenues $2; logout;;
|
||||
"getvenuedevices") login; getvenuedevices $2; logout;;
|
||||
*) help ;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user