Skip to content

Commit 6a9d579

Browse files
support Promiscuous and FlowControl on port
1 parent 08c20b0 commit 6a9d579

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,34 @@ public void removeRxQueue(int portIndex) {
346346
payload.put("enabled", false);
347347
callMethod("set_rx_feature", payload);
348348
}
349+
350+
/**
351+
* Set promiscuous mode
352+
* Enable interface to receive packets from all mac addresses
353+
*/
354+
public void setPromiscuousMode(int portIndex, boolean enabled) {
355+
Map<String, Object> payload = createPayload(portIndex);
356+
Map<String, Object> attributes = new HashMap<>();
357+
Map<String, Object> promiscuousValue = new HashMap<>();
358+
promiscuousValue.put("enabled", enabled);
359+
attributes.put("promiscuous", promiscuousValue);
360+
payload.put("attr", attributes);
361+
callMethod("set_port_attr", payload);
362+
}
363+
364+
/**
365+
* Set flow control mode
366+
* Flow control: 0 = none, 1 = tx, 2 = rx, 3 = full
367+
*/
368+
public void setFlowControlMode(int portIndex, int mode) {
369+
Map<String, Object> payload = createPayload(portIndex);
370+
Map<String, Object> attributes = new HashMap<>();
371+
Map<String, Object> flowCtrlValue = new HashMap<>();
372+
flowCtrlValue.put("enabled", mode);
373+
attributes.put("flow_ctrl_mode", flowCtrlValue);
374+
payload.put("attr", attributes);
375+
callMethod("set_port_attr", payload);
376+
}
349377

350378
public synchronized void sendPacket(int portIndex, Packet pkt) {
351379
Stream stream = build1PktSingleBurstStream(pkt);

0 commit comments

Comments
 (0)