ADD: adden more functionality includeing a tcp server for external comms
This commit is contained in:
267
tests/info.json
Normal file
267
tests/info.json
Normal file
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Pod",
|
||||
"metadata": {
|
||||
"creationTimestamp": "2023-08-14T14:05:26Z",
|
||||
"labels": {
|
||||
"app.kubernetes.io/name": "hamburg"
|
||||
},
|
||||
"managedFields": [{
|
||||
"apiVersion": "v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:app.kubernetes.io/name": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:containers": {
|
||||
"k:{\"name\":\"hamburg-container\"}": {
|
||||
".": {},
|
||||
"f:env": {
|
||||
".": {},
|
||||
"k:{\"name\":\"COMMAND_PORT\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"ENTITY_ID\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"ENTITY_NAME\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"GROUNDTRUTH_PORT\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"POS_HEIGHT\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"POS_LAT\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
},
|
||||
"k:{\"name\":\"POS_LONG\"}": {
|
||||
".": {},
|
||||
"f:name": {},
|
||||
"f:value": {}
|
||||
}
|
||||
},
|
||||
"f:image": {},
|
||||
"f:imagePullPolicy": {},
|
||||
"f:name": {},
|
||||
"f:resources": {},
|
||||
"f:terminationMessagePath": {},
|
||||
"f:terminationMessagePolicy": {}
|
||||
}
|
||||
},
|
||||
"f:dnsPolicy": {},
|
||||
"f:enableServiceLinks": {},
|
||||
"f:restartPolicy": {},
|
||||
"f:schedulerName": {},
|
||||
"f:securityContext": {},
|
||||
"f:terminationGracePeriodSeconds": {}
|
||||
}
|
||||
},
|
||||
"manager": "unknown",
|
||||
"operation": "Update",
|
||||
"time": "2023-08-14T14:05:26Z"
|
||||
}, {
|
||||
"apiVersion": "v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:status": {
|
||||
"f:conditions": {
|
||||
"k:{\"type\":\"ContainersReady\"}": {
|
||||
".": {},
|
||||
"f:lastProbeTime": {},
|
||||
"f:lastTransitionTime": {},
|
||||
"f:status": {},
|
||||
"f:type": {}
|
||||
},
|
||||
"k:{\"type\":\"Initialized\"}": {
|
||||
".": {},
|
||||
"f:lastProbeTime": {},
|
||||
"f:lastTransitionTime": {},
|
||||
"f:status": {},
|
||||
"f:type": {}
|
||||
},
|
||||
"k:{\"type\":\"Ready\"}": {
|
||||
".": {},
|
||||
"f:lastProbeTime": {},
|
||||
"f:lastTransitionTime": {},
|
||||
"f:status": {},
|
||||
"f:type": {}
|
||||
}
|
||||
},
|
||||
"f:containerStatuses": {},
|
||||
"f:hostIP": {},
|
||||
"f:phase": {},
|
||||
"f:podIP": {},
|
||||
"f:podIPs": {
|
||||
".": {},
|
||||
"k:{\"ip\":\"10.0.3.47\"}": {
|
||||
".": {},
|
||||
"f:ip": {}
|
||||
}
|
||||
},
|
||||
"f:startTime": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubelet",
|
||||
"operation": "Update",
|
||||
"subresource": "status",
|
||||
"time": "2023-08-14T14:05:28Z"
|
||||
}],
|
||||
"name": "ship1",
|
||||
"namespace": "hwinkel",
|
||||
"resourceVersion": "172370869",
|
||||
"uid": "d66ba1fc-f664-4d88-acd0-f33bbc936d7c"
|
||||
},
|
||||
"spec": {
|
||||
"containers": [{
|
||||
"env": [{
|
||||
"name": "COMMAND_PORT",
|
||||
"value": "\"5555\""
|
||||
}, {
|
||||
"name": "ENTITY_ID",
|
||||
"value": "ship1"
|
||||
}, {
|
||||
"name": "ENTITY_NAME",
|
||||
"value": "hamburg"
|
||||
}, {
|
||||
"name": "GROUNDTRUTH_PORT",
|
||||
"value": "\"8000\""
|
||||
}, {
|
||||
"name": "POS_HEIGHT",
|
||||
"value": "\"0\""
|
||||
}, {
|
||||
"name": "POS_LAT",
|
||||
"value": "\"55\""
|
||||
}, {
|
||||
"name": "POS_LONG",
|
||||
"value": "\"8\""
|
||||
}],
|
||||
"image": "kmaster.ti.unibw-hamburg.de:30808/ship:latest",
|
||||
"imagePullPolicy": "Always",
|
||||
"name": "hamburg-container",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File",
|
||||
"volumeMounts": [{
|
||||
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount",
|
||||
"name": "kube-api-access-tpw7t",
|
||||
"readOnly": true
|
||||
}]
|
||||
}],
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"enableServiceLinks": true,
|
||||
"nodeName": "kslave02.ti.unibw-hamburg.de",
|
||||
"preemptionPolicy": "PreemptLowerPriority",
|
||||
"priority": 0,
|
||||
"restartPolicy": "Never",
|
||||
"schedulerName": "default-scheduler",
|
||||
"securityContext": {},
|
||||
"serviceAccount": "default",
|
||||
"serviceAccountName": "default",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"tolerations": [{
|
||||
"effect": "NoExecute",
|
||||
"key": "node.kubernetes.io/not-ready",
|
||||
"operator": "Exists",
|
||||
"tolerationSeconds": 300
|
||||
}, {
|
||||
"effect": "NoExecute",
|
||||
"key": "node.kubernetes.io/unreachable",
|
||||
"operator": "Exists",
|
||||
"tolerationSeconds": 300
|
||||
}],
|
||||
"volumes": [{
|
||||
"name": "kube-api-access-tpw7t",
|
||||
"projected": {
|
||||
"defaultMode": 420,
|
||||
"sources": [{
|
||||
"serviceAccountToken": {
|
||||
"expirationSeconds": 3607,
|
||||
"path": "token"
|
||||
}
|
||||
}, {
|
||||
"configMap": {
|
||||
"items": [{
|
||||
"key": "ca.crt",
|
||||
"path": "ca.crt"
|
||||
}],
|
||||
"name": "kube-root-ca.crt"
|
||||
}
|
||||
}, {
|
||||
"downwardAPI": {
|
||||
"items": [{
|
||||
"fieldRef": {
|
||||
"apiVersion": "v1",
|
||||
"fieldPath": "metadata.namespace"
|
||||
},
|
||||
"path": "namespace"
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
||||
}]
|
||||
},
|
||||
"status": {
|
||||
"conditions": [{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2023-08-14T14:05:26Z",
|
||||
"status": "True",
|
||||
"type": "Initialized"
|
||||
}, {
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2023-08-14T14:05:28Z",
|
||||
"status": "True",
|
||||
"type": "Ready"
|
||||
}, {
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2023-08-14T14:05:28Z",
|
||||
"status": "True",
|
||||
"type": "ContainersReady"
|
||||
}, {
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2023-08-14T14:05:26Z",
|
||||
"status": "True",
|
||||
"type": "PodScheduled"
|
||||
}],
|
||||
"containerStatuses": [{
|
||||
"containerID": "cri-o://8da2c28ef57a276017f9ca1e840d8387006343cdb1f90f393a7eb3dbff43cdca",
|
||||
"image": "kmaster.ti.unibw-hamburg.de:30808/ship:latest",
|
||||
"imageID": "kmaster.ti.unibw-hamburg.de:30808/ship@sha256:842cf35f29e1e8139a990b02ec7d64195307f789e03e52e7fb3b8c9cfb13ded5",
|
||||
"lastState": {},
|
||||
"name": "hamburg-container",
|
||||
"ready": true,
|
||||
"restartCount": 0,
|
||||
"started": true,
|
||||
"state": {
|
||||
"running": {
|
||||
"startedAt": "2023-08-14T14:05:27Z"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"hostIP": "192.168.252.8",
|
||||
"phase": "Running",
|
||||
"podIP": "10.0.3.47",
|
||||
"podIPs": [{
|
||||
"ip": "10.0.3.47"
|
||||
}],
|
||||
"qosClass": "BestEffort",
|
||||
"startTime": "2023-08-14T14:05:26Z"
|
||||
}
|
||||
}
|
||||
1148
tests/string.cpp
Normal file
1148
tests/string.cpp
Normal file
File diff suppressed because it is too large
Load Diff
77
tests/test_podlist.cpp
Normal file
77
tests/test_podlist.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
|
||||
#include "kubecontrol/PodController.hpp"
|
||||
#include "nlohmann/json_fwd.hpp"
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "SimControl/PodList.hpp"
|
||||
#include <catch2/catch.hpp>
|
||||
#include <loguru.hpp>
|
||||
|
||||
#include "string.cpp"
|
||||
|
||||
// SimCore::Identifier OwnID, SimCore::Identifier ParentID, SimCore::SensorKinds SensorKind,std::uint32_t GroundTruthPort, std::uint32_t ParentPort,std::string ParentIPAddress
|
||||
|
||||
SCENARIO("Testing the the podlist")
|
||||
{
|
||||
|
||||
auto control = kubecontrol::PodController("docs/config");
|
||||
|
||||
|
||||
|
||||
|
||||
// std::ifstream ifs("info.json");
|
||||
nlohmann::json j = nlohmann::json::parse(control.getPodsInfo());
|
||||
|
||||
LOG_S(INFO)<<control.getInfoForPod("hamburg");
|
||||
// LOG_S(INFO)<< j;
|
||||
|
||||
LOG_S(INFO)<<control.getPodsInfoForAll();
|
||||
|
||||
|
||||
// SimControl::PodList podlist(j.dump());
|
||||
|
||||
|
||||
// auto info = control.getInfoForPod("20939877-4c5e-4dbc-9f62-07533195334e");
|
||||
// LOG_S(INFO)<<info;
|
||||
// podlist.addPodToList(info);
|
||||
// LOG_S(INFO)<<podlist.getPodTree("hamburg").dump();
|
||||
|
||||
|
||||
// auto item1 = std::make_shared<SimControl::PodListItem>();
|
||||
|
||||
// auto item2 = std::make_shared<SimControl::PodListItem>();
|
||||
// item2->Uuid= "movement";
|
||||
|
||||
|
||||
// item1->Uuid= "test";
|
||||
// item1->relatedPods.emplace_back(item2);
|
||||
|
||||
|
||||
// podlist.addPodToList(item1);
|
||||
// podlist.addPodToList(item2);
|
||||
|
||||
|
||||
|
||||
// LOG_S(INFO)<<podlist.getPodTree("test");
|
||||
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
// REQUIRE(podlist.size() == 2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
Reference in New Issue
Block a user