Skip to content

Commit 2aca01b

Browse files
committed
add global_config RPC support
Signed-off-by: Leo Ma <[email protected]>
1 parent 4be8278 commit 2aca01b

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/main/java/com/cisco/trex/ClientBase.java

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

3+
import com.cisco.trex.model.GlobalConfig;
34
import com.cisco.trex.stateless.TRexCommand;
45
import com.cisco.trex.stateless.TRexTransport;
56
import com.cisco.trex.stateless.exception.TRexConnectionException;
@@ -548,6 +549,29 @@ public SystemInfo getSystemInfo() {
548549
return GSON.fromJson(getResultFromResponse(json), SystemInfo.class);
549550
}
550551

552+
/**
553+
* Get global configuration parameters
554+
*
555+
* @return GlobalConfig
556+
*/
557+
public TRexClientResult<GlobalConfig> getGlobalConfig(int portIdx) {
558+
Map<String, Object> payload = new HashMap<>();
559+
return callMethod("get_global_cfg", null, GlobalConfig.class);
560+
}
561+
562+
/**
563+
* Change global configuration parameter
564+
*
565+
* @param name parameter name
566+
* @param value parameter value in data types of dboule, boolean depending on the parameter type
567+
* @return StubResult
568+
*/
569+
public TRexClientResult<StubResult> setGlobalConfig(String name, Object value) {
570+
Map<String, Object> payload = new HashMap<>();
571+
payload.put(name, value);
572+
return callMethod("set_global_cfg", payload, StubResult.class);
573+
}
574+
551575
protected Map<String, Object> createPayload(int portIndex) {
552576
Map<String, Object> payload = new HashMap<>();
553577
payload.put(PORT_ID, portIndex);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.cisco.trex.model;
2+
3+
import java.util.HashMap;
4+
5+
/** Global configuration parameters */
6+
public class GlobalConfig extends HashMap<String, Object> {
7+
8+
public boolean getProcessAtCp() {
9+
return (boolean) get("process_at_cp");
10+
}
11+
12+
public double getSchedMaxStretch() {
13+
return (double) get("sched_max_stretch");
14+
}
15+
}

0 commit comments

Comments
 (0)