Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -16,14 +16,14 @@ namespace GuezIedManagement
|
||||
DdsHandler::DdsHandler(int domainId, int exerciseId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise, exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if(!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsFts = GuezIedManagement::Interface::Fts::create(m_ddsConnector);
|
||||
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG() << "Dts initialised";
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG() << "Fts initialised";
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> dds() const { return m_ddsConnector; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
|
||||
|
||||
@@ -52,17 +52,17 @@ bool HandlerIed::init()
|
||||
m_ppmDtc = ParticipantManagement::Interface::Dtc::create(m_ddsHandler->dds());
|
||||
if (!m_ppmDtc->enableParticipantPosition())
|
||||
{
|
||||
ERROR_LOG() << "PPM DTC enableParticipantPosition() failed.";
|
||||
ERROR_LOG(m_logger) << "PPM DTC enableParticipantPosition() failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_ppmDtc->enableParticipant())
|
||||
{
|
||||
ERROR_LOG() << "PPM DTC enableParticipant() failed.";
|
||||
ERROR_LOG(m_logger) << "PPM DTC enableParticipant() failed.";
|
||||
return false;
|
||||
}
|
||||
if (!m_ppmDtc->enableParty())
|
||||
{
|
||||
ERROR_LOG() << "PPM DTC enableParty() failed.";
|
||||
ERROR_LOG(m_logger) << "PPM DTC enableParty() failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ bool HandlerIed::init()
|
||||
// read all Ieds from database
|
||||
if (!m_db->select(dataVec))
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,13 +82,13 @@ bool HandlerIed::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
m_iedObjMap.insert(ifs->getId(), ifs);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "m_exeObjMap.size() = " << m_iedObjMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_exeObjMap.size() = " << m_iedObjMap.size();
|
||||
|
||||
// Initialize RecordReplay to get initial IedPosition
|
||||
RecordReplayPlugin recordReplay;
|
||||
@@ -101,7 +101,7 @@ bool HandlerIed::init()
|
||||
// key is sampleTime -> multiMap
|
||||
QMultiMap<qint64, GuezIedManagement::IedPosition> latestPositions = recordReplay.getIedPositionMap();
|
||||
|
||||
DEBUG_LOG() << "Starting to read IED positions from record replay. Size: "
|
||||
DEBUG_LOG(m_logger) << "Starting to read IED positions from record replay. Size: "
|
||||
<< latestPositions.size();
|
||||
|
||||
for (auto it = latestPositions.begin(); it != latestPositions.end(); ++it)
|
||||
@@ -111,10 +111,10 @@ bool HandlerIed::init()
|
||||
|
||||
if (currentIed == nullptr)
|
||||
{
|
||||
INFO_LOG() << "Got position for non existing IED-Id: " << pos.id();
|
||||
INFO_LOG(m_logger) << "Got position for non existing IED-Id: " << pos.id();
|
||||
continue;
|
||||
}
|
||||
DEBUG_LOG() << "Setting position for IED-Id " << pos.id();
|
||||
DEBUG_LOG(m_logger) << "Setting position for IED-Id " << pos.id();
|
||||
currentIed->setPosition(it.value());
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ bool HandlerIed::init()
|
||||
if (!m_tabDtc->enableDefinitionIed() ||
|
||||
!m_tabDtc->enableStateIed())
|
||||
{
|
||||
ERROR_LOG() << "Could not initialize TraininAreaBase data topic client";
|
||||
ERROR_LOG(m_logger) << "Could not initialize TraininAreaBase data topic client";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ void HandlerIed::onDefinitionIed(const TrainingAreaBase::DefinitionIed &data, Da
|
||||
if (modType != DataModification::eAdded && modType != DataModification::eModified)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "onDefinitionIed: " << data;
|
||||
DEBUG_LOG(m_logger) << "onDefinitionIed: " << data;
|
||||
|
||||
Database::GimIed newData;
|
||||
|
||||
@@ -237,7 +237,7 @@ void HandlerIed::onDefinitionIed(const TrainingAreaBase::DefinitionIed &data, Da
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return;
|
||||
}
|
||||
m_iedObjMap.insert(ifs->getId(), ifs);
|
||||
@@ -276,7 +276,7 @@ void HandlerIed::onStateIed(const TrainingAreaBase::StateIed &data, DataModifica
|
||||
if (modType != DataModification::eAdded && modType != DataModification::eModified)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "onStateIed: " << data;
|
||||
DEBUG_LOG(m_logger) << "onStateIed: " << data;
|
||||
|
||||
// only overwrite state for existing IEDs
|
||||
if (m_iedObjMap.contains(getIdByEquipmentnumber(data.iedId())))
|
||||
@@ -294,7 +294,7 @@ void HandlerIed::onStateIed(const TrainingAreaBase::StateIed &data, DataModifica
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG() << "StateIed without an existing IED - got no DefinitionIED? " << data;
|
||||
WARNING_LOG(m_logger) << "StateIed without an existing IED - got no DefinitionIED? " << data;
|
||||
m_orphanedStateIed.insert(data.iedId(), data);
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ void HandlerIed::onPairIedRequest(const rti::core::SampleIdentity &cookie,
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
INFO_LOG() << "onPairIedRequest id = " << request.id();
|
||||
INFO_LOG(m_logger) << "onPairIedRequest id = " << request.id();
|
||||
|
||||
ObjectIed *ifs = m_iedObjMap.value(request.id());
|
||||
if (ifs == nullptr)
|
||||
@@ -336,7 +336,7 @@ void HandlerIed::onPairIedRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
ret = ifs->updatePairingState(data);
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
|
||||
m_ddsHandler->fts()->pairIedReply(cookie, ret);
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ private slots:
|
||||
void onStateIed(const TrainingAreaBase::StateIed &data, DataModification modType);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPairIedRequest(const rti::core::SampleIdentity &cookie,
|
||||
const PairIedRequest &request) override;
|
||||
int getIdByEquipmentnumber(const int number) const;
|
||||
int getPartyIdFromParticipantEquipmentNumber(const int equipmentNumber) const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QMap<int, ObjectIed *> m_iedObjMap;
|
||||
QMap<int, TrainingAreaBase::StateIed> m_orphanedStateIed;
|
||||
MainHandler *m_mainHandler;
|
||||
|
||||
@@ -21,15 +21,14 @@
|
||||
|
||||
using namespace GuezIedManagement;
|
||||
|
||||
MainHandler::MainHandler()
|
||||
: m_handlerIed(nullptr)
|
||||
MainHandler::MainHandler() : m_handlerIed(nullptr)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
, m_codService(nullptr)
|
||||
, m_esmService(nullptr)
|
||||
, m_gmpService(nullptr)
|
||||
, m_exerciseId(0)
|
||||
{}
|
||||
, m_exerciseId(0),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
@@ -47,7 +46,7 @@ bool MainHandler::init(int domainId, int exerciseId)
|
||||
const QString errStr = initInternal(domainId, exerciseId);
|
||||
if (!errStr.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << errStr;
|
||||
ERROR_LOG(m_logger) << errStr;
|
||||
if (m_ddsHandler && m_ddsHandler->pacemaker())
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError, errStr);
|
||||
return false;
|
||||
@@ -97,7 +96,7 @@ bool MainHandler::loadFromDatabase()
|
||||
return false;
|
||||
if (!m_handlerIed->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation HandlerIED failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerIED failed.";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -47,8 +47,10 @@ public:
|
||||
bool loadFromDatabase();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QString initInternal(int domainId, int exerciseId);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<HandlerIed> m_handlerIed;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
|
||||
@@ -43,10 +43,10 @@ Core::FunctionReplyObject ObjectIed::createObject(const Database::GimIed &data)
|
||||
}
|
||||
|
||||
// Id is serial -> will be generated by db => inside m_data after db-insert
|
||||
DEBUG_LOG() << "New IED-Id: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "New IED-Id: " << m_data.id;
|
||||
}
|
||||
|
||||
INFO_LOG() << "Ied created sucessfully.";
|
||||
INFO_LOG(m_logger) << "Ied created sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -163,10 +163,10 @@ void ObjectIed::onPublishData()
|
||||
ddsData.symbol(m_data.symbol.toStdString());
|
||||
ddsData.sampleTime(m_data.sampleTime);
|
||||
|
||||
INFO_LOG() << "Publish IED-data to dds (" << m_data.id << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish IED-data to dds (" << m_data.id << ") ...";
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(ddsData))
|
||||
ERROR_LOG() << "Error publishing IED-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing IED-data to dds";
|
||||
}
|
||||
|
||||
void ObjectIed::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
@@ -219,15 +219,15 @@ Core::FunctionReplyObject ObjectIed::updateObject()
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Trying to update an already removed IED object"));
|
||||
|
||||
INFO_LOG() << "Trying to updateObject IedData with id = " << m_data.id;
|
||||
INFO_LOG(m_logger) << "Trying to updateObject IedData with id = " << m_data.id;
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update IedData with id = " << m_data.id;
|
||||
ERROR_LOG(m_logger) << "Failed to update IedData with id = " << m_data.id;
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error updating IED-data with id %1 in database")).arg(m_data.id);
|
||||
}
|
||||
|
||||
INFO_LOG() << "IED-Data changed sucessfully.";
|
||||
INFO_LOG(m_logger) << "IED-Data changed sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -238,7 +238,7 @@ Core::FunctionReplyObject ObjectIed::updateObject()
|
||||
void ObjectIed::publishPosition()
|
||||
{
|
||||
if (!m_ddsHandler->dts()->publish(m_position))
|
||||
ERROR_LOG() << "Error publishing IED-position to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing IED-position to dds";
|
||||
}
|
||||
|
||||
bool ObjectIed::isValid() const
|
||||
|
||||
@@ -47,6 +47,7 @@ private slots:
|
||||
void onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void assignBaseData(const Database::GimIed &data);
|
||||
void assignPairingState(const Database::GimIed &data);
|
||||
Core::FunctionReplyObject updateObject();
|
||||
|
||||
Reference in new issue
Block a user