Skip to content

Commit 9d3aa7b

Browse files
Merge pull request #89 from cisco-system-traffic-generator/Emil-Gustafsson-patch-1
support Promiscuous and FlowControl on port
2 parents 08c20b0 + 002dab2 commit 9d3aa7b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/java/com/cisco/trex/stateless/TRexClient.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,28 @@ public void removeRxQueue(int portIndex) {
347347
callMethod("set_rx_feature", payload);
348348
}
349349

350+
/** Set promiscuous mode, Enable interface to receive packets from all mac addresses */
351+
public void setPromiscuousMode(int portIndex, boolean enabled) {
352+
Map<String, Object> payload = createPayload(portIndex);
353+
Map<String, Object> attributes = new HashMap<>();
354+
Map<String, Object> promiscuousValue = new HashMap<>();
355+
promiscuousValue.put("enabled", enabled);
356+
attributes.put("promiscuous", promiscuousValue);
357+
payload.put("attr", attributes);
358+
callMethod("set_port_attr", payload);
359+
}
360+
361+
/** Set flow control mode, Flow control: 0 = none, 1 = tx, 2 = rx, 3 = full */
362+
public void setFlowControlMode(int portIndex, int mode) {
363+
Map<String, Object> payload = createPayload(portIndex);
364+
Map<String, Object> attributes = new HashMap<>();
365+
Map<String, Object> flowCtrlValue = new HashMap<>();
366+
flowCtrlValue.put("enabled", mode);
367+
attributes.put("flow_ctrl_mode", flowCtrlValue);
368+
payload.put("attr", attributes);
369+
callMethod("set_port_attr", payload);
370+
}
371+
350372
public synchronized void sendPacket(int portIndex, Packet pkt) {
351373
Stream stream = build1PktSingleBurstStream(pkt);
352374

0 commit comments

Comments
 (0)