com.cisco.trex.stateful.model.stats.AstfStatistics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trex-java-sdk Show documentation
Show all versions of trex-java-sdk Show documentation
Java client SDK provides an implementation for TRex RPC APIs
package com.cisco.trex.stateful.model.stats;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;
/** ASTF statistics */
public class AstfStatistics {
/** Json Property */
@JsonProperty("client")
private Map clientCounters = new HashMap<>();
@JsonProperty("server")
private Map serverCounters = new HashMap<>();
@JsonProperty("epoch")
private int epoch;
@JsonProperty("name")
private String name;
private Map matchedNameAndValuesForClient = new HashMap<>();
private Map matchedNameAndValuesForServer = new HashMap<>();
@JsonProperty("client")
public Map getClientCounters() {
return clientCounters;
}
@JsonProperty("client")
public void setClientCounters(Map clientCounters) {
this.clientCounters = clientCounters;
}
@JsonProperty("server")
public Map getServerCounters() {
return serverCounters;
}
@JsonProperty("server")
public void setServerCounters(Map serverCounters) {
this.serverCounters = serverCounters;
}
@JsonProperty("epoch")
public int getEpoch() {
return epoch;
}
@JsonProperty("epoch")
public void setEpoch(int epoch) {
this.epoch = epoch;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
/**
* @param metaData
* @return this
*/
public AstfStatistics setCounterNames(MetaData metaData) {
for (Map.Entry counter : clientCounters.entrySet()) {
matchedNameAndValuesForClient.put(
getCounterName(counter.getKey(), metaData), counter.getValue());
}
for (Map.Entry counter : serverCounters.entrySet()) {
matchedNameAndValuesForServer.put(
getCounterName(counter.getKey(), metaData), counter.getValue());
}
return this;
}
private static String getCounterName(int id, MetaData metaData) {
for (CounterMeta meta : metaData.getData()) {
if (meta.getId() == id) {
return meta.getName();
}
}
return null;
}
public Map getClientStatistics() {
return matchedNameAndValuesForClient;
}
public Map getServerStatistics() {
return matchedNameAndValuesForServer;
}
}