ADD: added central kubernetes api class

This commit is contained in:
Henry Winkel
2023-12-21 17:15:28 +01:00
parent d1024de907
commit 351cf9ec69
12 changed files with 514 additions and 128 deletions

View File

@@ -3,6 +3,7 @@
#include "kubecontrol/PodController.hpp"
#include "nlohmann/json_fwd.hpp"
#include <thread>
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <kubecontrol/PodInfo.hpp>
@@ -10,11 +11,52 @@
SCENARIO("Testing the SimCore Sensor")
{
kubecontrol::PodController podc("docs/config");
podc.checkPodsHierarchy();
auto tmp = podc.getInfoForPod("hamburg");
LOG_S(INFO)<<tmp;
kubecontrol::PodInfo info(tmp);
kubecontrol::PodController podc("docs/config");
std::string name = "hamburg";
std::string uuid = name;
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
nlohmann::json vars;
vars["ENTITY_ID"] = uuid;
vars["ENTITY_NAME"] = "FGS Hamburg";
vars["ENTITY_SIDE"] = "Neutral";
vars["POSITION"]["LAT"] = "55";
vars["POSITION"]["LON"] = "8";
vars["POSITION"]["Height"] = "0";
vars["COURSE"] = "0";
vars["SPEED"] = "0";
vars["GROUNDTRUTH_PORT"] = std::to_string(10000);
vars["GROUNDTRUTH_ADDR"] = "239.0.0.1";
vars["COMMAND_PORT"] = "5555";
vars["ENTITY_RCS"] = std::to_string(850);
vars["ENTITY_SENSORS"].push_back("radar:latest");
ShipPod1.setEnvironmentVar("CONFIG", vars.dump());
LOG_S(INFO)<<"Starting";
podc.startPod(ShipPod1);
LOG_S(INFO)<<"started";
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
podc.checkPodsHierarchy();
auto tmp = podc.getInfoForPod(name);
// LOG_S(INFO)<<tmp;
kubecontrol::PodInfo info(tmp);
LOG_S(INFO)<<info.ToString();
LOG_S(INFO)<<info.ToJson();
podc.stopAllPods();
GIVEN("different Attributes for a Track in different forms")
{