Added threshold checks and commsCost calculation (RTT)

parent 776fe9a4
......@@ -22,13 +22,6 @@ public class NetMonitor extends ResourceManager {
}
public Node getNodeByIP(String ip) {
return elasticSystem.getNodes().stream().
filter(node -> node.getIpEth().equals(ip)).findFirst().orElse(null);
}
public void setLinksRTT() {
List<CommunicationLink> commsList = this.node.getCommunicationLinks().stream().
......
......@@ -7,6 +7,8 @@ import java.util.TimerTask;
import org.json.JSONObject;
import es.bsc.compss.nfr.model.Node;
import netMonitor.NetMonitor;
import resourceManager.ResourceManagerComms;
import utils.Constants;
import utils.FileUtils;
......@@ -19,6 +21,7 @@ public class CommsMonitoringTask extends TimerTask {
ResourceManagerComms resourceManager;
FileUtils fileUtils;
HardwareInfo hardWareInfo;
Node node;
public CommsMonitoringTask(ResourceManagerComms resourceManager) {
......@@ -26,13 +29,14 @@ public class CommsMonitoringTask extends TimerTask {
this.resourceManager = resourceManager;
this.fileUtils = new FileUtils();
this.hardWareInfo = new HardwareInfo();
this.node = resourceManager.getNodeByIP("10.0.2.15"); //TODO: get IP as I should
}
@Override
public void run() {
this.resourceManager.getConfig(Constants.CONFIG_FILE_PATH);
Map<String, Integer> intResultsMap = this.resourceManager
this.resourceManager.getConfig(Constants.CONFIG_FILE_PATH);
this.resourceManager.getCosts(this.node);
/*Map<String, Integer> intResultsMap = this.resourceManager
.checkThresholds(hardWareInfo.getTelemetry(), Arrays.asList("devLevel", "rttmax"), Arrays.asList("devLevel", "pllmax"));
intResultsMap.forEach((k,v) -> {
......@@ -52,7 +56,7 @@ public class CommsMonitoringTask extends TimerTask {
System.out.println("[+] Interface " + k + " up and Running");
break;
}
});
});*/
}
......
......@@ -8,25 +8,25 @@ import es.bsc.compss.nfr.model.Node;
import es.bsc.compss.nfr.model.Worker;
public abstract class ResourceManager {
protected ElasticSystem elasticSystem;
protected ArrayList<COMPSsApplication> apps;
protected ArrayList<Node> nodes;
protected ArrayList<Worker> workers;
/*
* Public Getters & Setters
*/
public ResourceManager(ElasticSystem elasticSystem) {
this.elasticSystem = elasticSystem;
this.apps = this.elasticSystem.getApplications();
this.nodes = elasticSystem.getNodes();
}
public ResourceManager() {}
public ResourceManager() {
}
public ElasticSystem getElasticSystem() {
return elasticSystem;
......@@ -48,7 +48,13 @@ public abstract class ResourceManager {
return nodes;
}
public Node getNodeByIP(String ip) {
return elasticSystem.getNodes().stream().filter(node -> node.getIpEth().equals(ip)).findFirst().orElse(null);
}
public void setNodes(ArrayList<Node> nodes) {
this.nodes = nodes;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment