mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Adding Venue/Entity self-discovery and device tracking.
This commit is contained in:
@@ -58,7 +58,7 @@ namespace OpenWifi {
|
||||
}
|
||||
}
|
||||
if(!SerialNumber.empty()) {
|
||||
std::cout << "SerialNUmber: " << SerialNumber << " CID: " << ConnectedIP << " DeviceType: " << DeviceType << std::endl;
|
||||
// std::cout << "SerialNUmber: " << SerialNumber << " CID: " << ConnectedIP << " DeviceType: " << DeviceType << std::endl;
|
||||
Storage()->InventoryDB().CreateFromInventory(SerialNumber,ConnectedIP,DeviceType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,8 +407,6 @@ namespace ORM {
|
||||
(Where.empty() ? "" : " where " + Where) +
|
||||
ComputeRange(Offset, HowMany) ;
|
||||
|
||||
// std::cout << "GetRecords: " << St << std::endl;
|
||||
|
||||
Select << St ,
|
||||
Poco::Data::Keywords::into(RL);
|
||||
|
||||
|
||||
@@ -73,22 +73,19 @@ namespace OpenWifi {
|
||||
NewDevice.info.notes.push_back(SecurityObjects::NoteInfo{.created=Now,.createdBy="*system",.note="Auto discovered"});
|
||||
NewDevice.serialNumber = SerialNumber;
|
||||
NewDevice.deviceType = DeviceType;
|
||||
std::string UUID;
|
||||
if(!IP.empty()) {
|
||||
Storage()->VenueDB().GetByIP(IP,UUID);
|
||||
if(!UUID.empty()) {
|
||||
NewDevice.venue = UUID;
|
||||
} else {
|
||||
Storage()->EntityDB().GetByIP(IP,UUID);
|
||||
NewDevice.entity = UUID;
|
||||
Storage()->VenueDB().GetByIP(IP,NewDevice.venue);
|
||||
if(NewDevice.venue.empty()) {
|
||||
Storage()->EntityDB().GetByIP(IP,NewDevice.entity);
|
||||
}
|
||||
}
|
||||
|
||||
if(CreateRecord(NewDevice)) {
|
||||
std::cout << "Added " << SerialNumber << " to DB with IP=" << IP << " and UUID=" << UUID << std::endl;
|
||||
if(!IP.empty()) {
|
||||
Logger().information(Poco::format("Adding %s to inventory.",SerialNumber));
|
||||
}
|
||||
if(!NewDevice.entity.empty())
|
||||
Storage()->EntityDB().AddDevice("id",NewDevice.entity,NewDevice.info.id);
|
||||
else if(!NewDevice.venue.empty())
|
||||
Storage()->VenueDB().AddDevice("id",NewDevice.venue,NewDevice.info.id);
|
||||
Logger().information(Poco::format("Adding %s to inventory.",SerialNumber));
|
||||
return true;
|
||||
} else {
|
||||
Logger().information(Poco::format("Could not add %s to inventory.",SerialNumber));
|
||||
|
||||
@@ -87,8 +87,6 @@ namespace OpenWifi {
|
||||
};
|
||||
Iterate(Function);
|
||||
uuid=UUID;
|
||||
if(!uuid.empty())
|
||||
std::cout << "Found venue: " << uuid << std::endl;
|
||||
} catch (const Poco::Exception &E) {
|
||||
Logger().log(E);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user