FIX: fixed the incorect setting of the command port and chnaged to connecet to the virtual console in the cms

This commit is contained in:
Henry Winkel
2024-03-12 18:29:40 +01:00
parent d6b18f560d
commit fb6b8f6178
3 changed files with 34 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
#include <cstddef>
#include <exception> #include <exception>
#include <fstream> #include <fstream>
#include <functional> #include <functional>
@@ -40,7 +41,12 @@ namespace SimControl {
SimControl::SimControl(bool online,std::string CommandPort,std::string GroundTruthAddr, ushort GroundTruthPort,std::string Namespace): SimControl::SimControl(bool online,std::string CommandPort,std::string GroundTruthAddr, ushort GroundTruthPort,std::string Namespace):
online_(online),CommandPort_(CommandPort),GroundTruthAddr_(GroundTruthAddr),GroundTruthPort_(GroundTruthPort),Namespace_(Namespace),ID_(SimCore::Identifier(xg::newGuid())) online_(online),
CommandPort_(CommandPort),
GroundTruthAddr_(GroundTruthAddr),
GroundTruthPort_(GroundTruthPort),
Namespace_(Namespace),
ID_(SimCore::Identifier(xg::newGuid()))
{ {
// BroadcastListener_ = std::make_shared<WHISPER::InternalUDPListener>("239.0.0.1",10000); // BroadcastListener_ = std::make_shared<WHISPER::InternalUDPListener>("239.0.0.1",10000);
BroadcastListener_ = std::make_shared<WHISPER::InternalUDPListener>(GroundTruthAddr_,GroundTruthPort_); BroadcastListener_ = std::make_shared<WHISPER::InternalUDPListener>(GroundTruthAddr_,GroundTruthPort_);
@@ -467,9 +473,28 @@ namespace SimControl {
// LOG_S(INFO)<<"REQUEST: "<<request; // LOG_S(INFO)<<"REQUEST: "<<request;
std::string response; std::string response;
auto info = PodController_->getInfoForPod(id); auto info = PodController_->getInfoForPod(id);
std::unique_ptr<kubecontrol::PodChild> cmsPod = nullptr;
LOG_S(INFO)<<"PODS Info: " <<info.Component; bool hasCMS = false;
DirectCommunication::DirectCommunicationClient client(std::stoi(CommandPort_),info.IP,ID_.getUUID()); std::string IP = info.IP;
for (auto child: info.Childs) {
if (child.Component == "cms")
{
cmsPod = std::make_unique<kubecontrol::PodChild>(child);
hasCMS = true;
}
}
if (cmsPod == nullptr && hasCMS == true)
{
return;
}
IP = cmsPod->IP;
LOG_S(INFO)<<"PODS Info: " <<cmsPod->IP;
DirectCommunication::DirectCommunicationClient client(std::stoi(CommandPort_),IP,ID_.getUUID());
Orders::TracklistRequest TrackListRequest(ID_,SimCore::Identifier(id),true); Orders::TracklistRequest TrackListRequest(ID_,SimCore::Identifier(id),true);
// SimCore::Control control(this->ID_,SimCore::ControlType::GET_TRACKLIST,"Tracklist"); // SimCore::Control control(this->ID_,SimCore::ControlType::GET_TRACKLIST,"Tracklist");
client.sendMessage(TrackListRequest.buildMessage()); client.sendMessage(TrackListRequest.buildMessage());

View File

@@ -42,11 +42,11 @@ int main()
} }
const char* GroundTruthAddr = "239.0.0.1"; const char* GroundTruthAddr = "239.0.0.1";
if (std::getenv("GROUNDTRUTH_ADDR") != nullptr) { if (std::getenv("GROUNDTRUTH_ADDR") != nullptr) {
CommandPortChar = std::getenv("GROUNDTRUTH_ADDR"); GroundTruthAddr = std::getenv("GROUNDTRUTH_ADDR");
} }
const char* GroundTruthPort = "10000"; const char* GroundTruthPort = "10000";
if (std::getenv("GROUNDTRUTH_PORT") != nullptr) { if (std::getenv("GROUNDTRUTH_PORT") != nullptr) {
CommandPortChar = std::getenv("GROUNDTRUTH_PORT"); GroundTruthPort = std::getenv("GROUNDTRUTH_PORT");
} }
const char* Namespace = "simulator"; const char* Namespace = "simulator";
@@ -67,6 +67,8 @@ int main()
LOG_S(INFO)<<"online:" << online; LOG_S(INFO)<<"online:" << online;
LOG_S(INFO)<< "command port"<< CommandPortChar;
SimControl::SimControl sc(online,CommandPortChar,GroundTruthAddr,SimCore::UtilFunctions::StringToUShort(GroundTruthPort),Namespace); SimControl::SimControl sc(online,CommandPortChar,GroundTruthAddr,SimCore::UtilFunctions::StringToUShort(GroundTruthPort),Namespace);