Skip to content

Commit e7b0d50

Browse files
committed
Add sync api for astf client
Signed-off-by: Leo Ma <[email protected]>
1 parent 9690827 commit e7b0d50

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

src/main/java/com/cisco/trex/stateful/TRexAstfClient.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.cisco.trex.stateful;
22

33
import com.cisco.trex.ClientBase;
4+
import com.cisco.trex.stateful.model.ServerStatus;
45
import com.cisco.trex.stateful.model.stats.AstfStatistics;
56
import com.cisco.trex.stateful.model.stats.LatencyPortData;
67
import com.cisco.trex.stateful.model.stats.LatencyStats;
@@ -457,6 +458,16 @@ public Map<String, AstfStatistics> getTemplateGroupStatistics(
457458

458459
return stats;
459460
}
461+
462+
/**
463+
* get template group statistics
464+
*
465+
* @return Map key:tgName, value:AstfStatistics
466+
*/
467+
public ServerStatus syncWithServer() {
468+
Map<String, Object> payload = createPayload("*");
469+
return callMethod("sync", payload, ServerStatus.class).get();
470+
}
460471

461472
/**
462473
* translate template group names to ids getTemplateGroupNames with return all template group
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.cisco.trex.stateful.model;
2+
3+
import java.util.Map;
4+
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
7+
public class ServerStatus {
8+
9+
public enum State {
10+
@JsonProperty("0")
11+
IDLE,
12+
13+
@JsonProperty("1")
14+
LOADED,
15+
16+
@JsonProperty("2")
17+
PARSING,
18+
19+
@JsonProperty("3")
20+
BUILDING,
21+
22+
@JsonProperty("4")
23+
TRANSMITTING,
24+
25+
@JsonProperty("5")
26+
CLEANUP;
27+
}
28+
29+
@JsonProperty("epoch")
30+
private int epoch;
31+
32+
@JsonProperty("state")
33+
private int state;
34+
35+
@JsonProperty("state_profile")
36+
private Map<String, State> stateProfile;
37+
38+
@JsonProperty("epoch")
39+
public int getEpoch() {
40+
return epoch;
41+
}
42+
43+
@JsonProperty("epoch")
44+
public void setEpoch(int epoch) {
45+
this.epoch = epoch;
46+
}
47+
48+
@JsonProperty("state")
49+
public int getState() {
50+
return state;
51+
}
52+
53+
@JsonProperty("state")
54+
public void setState(int state) {
55+
this.state = state;
56+
}
57+
58+
@JsonProperty("state_profile")
59+
public Map<String, State> getStateProfile() {
60+
return stateProfile;
61+
}
62+
63+
@JsonProperty("state_profile")
64+
public void setStateProfile(Map<String, State> stateProfile) {
65+
this.stateProfile = stateProfile;
66+
}
67+
}

0 commit comments

Comments
 (0)