Skip to content

Commit c7509a8

Browse files
HongJiangEricleomaatEric
authored andcommitted
Fix comments with delete class and rename contants
1 parent f669c69 commit c7509a8

File tree

6 files changed

+11
-46
lines changed

6 files changed

+11
-46
lines changed

src/e2e-test/java/com/cisco/trex/stateless/TrexClientUtilTest.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import com.cisco.trex.stateless.model.ApiVersionHandler;
2222
import com.cisco.trex.stateless.model.PortStatus;
2323
import com.cisco.trex.stateless.model.TRexClientResult;
24-
import com.cisco.trex.stateless.model.stats.ExtendedPortStatistics;
25-
import com.cisco.trex.stateless.model.stats.XstatsNames;
2624
import com.google.gson.JsonArray;
2725
import com.google.gson.JsonElement;
2826
import com.google.gson.JsonParser;
@@ -51,13 +49,13 @@ public TRexAstfClient(String host, String port, String userName) {
5149
protected void serverAPISync() throws TRexConnectionException {
5250
LOGGER.info("Sync API with the TRex");
5351
Map<String, Object> apiVers = new HashMap<>();
54-
apiVers.put("major", Constants.API_VERSION_MAJOR);
52+
apiVers.put("major", Constants.ASTF_API_VERSION_MAJOR);
5553
apiVers.put("minor", Constants.ASTF_API_VERSION_MINOR);
5654
apiVers.put("name", ASTF);
5755
TRexClientResult<ApiVersionHandler> result = callMethod("api_sync_v2", apiVers, ApiVersionHandler.class);
5856
if (result.get() == null) {
5957
TRexConnectionException e = new TRexConnectionException(
60-
"Unable to connect to TRex server. Required API version is " + Constants.API_VERSION_MAJOR + "."
58+
"Unable to connect to TRex server. Required API version is " + Constants.ASTF_API_VERSION_MAJOR + "."
6159
+ Constants.ASTF_API_VERSION_MINOR);
6260
LOGGER.error("Unable to sync client with TRex server due to: API_H is null.", e.getMessage());
6361
throw e;

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.stream.Collectors;
1818
import java.util.stream.StreamSupport;
1919

20+
import com.cisco.trex.util.Constants;
2021
import org.pcap4j.packet.ArpPacket;
2122
import org.pcap4j.packet.Dot1qVlanTagPacket;
2223
import org.pcap4j.packet.EthernetPacket;
@@ -64,8 +65,6 @@
6465
public class TRexClient extends ClientBase {
6566

6667
private static final EtherType QInQ = new EtherType((short) 0x88a8, "802.1Q Provider Bridge (Q-in-Q)");
67-
private static Integer API_VERSION_MAJOR = 4;
68-
private static Integer API_VERSION_MINOR = 6;
6968
private Integer session_id = 123456789;
7069

7170
public TRexClient(String host, String port, String userName) {
@@ -83,17 +82,17 @@ protected void serverAPISync() throws TRexConnectionException {
8382

8483
Map<String, Object> parameters = new HashMap<>();
8584
parameters.put("name", "STL");
86-
parameters.put("major", API_VERSION_MAJOR);
87-
parameters.put("minor", API_VERSION_MINOR);
85+
parameters.put("major", Constants.STL_API_VERSION_MAJOR);
86+
parameters.put("minor", Constants.STL_API_VERSION_MINOR);
8887

8988
TRexClientResult<ApiVersionHandler> result = callMethod("api_sync_v2", parameters, ApiVersionHandler.class);
9089

9190
if (result.get() == null) {
9291
TRexConnectionException e = new TRexConnectionException(
9392
MessageFormat.format(
9493
"Unable to connect to TRex server. Required API version is {0}.{1}. Error: {2}",
95-
API_VERSION_MAJOR,
96-
API_VERSION_MINOR,
94+
Constants.STL_API_VERSION_MAJOR,
95+
Constants.STL_API_VERSION_MINOR,
9796
result.getError()));
9897
LOGGER.error("Unable to sync client with TRex server due to: API_H is null.", e.getMessage());
9998
throw e;

src/main/java/com/cisco/trex/util/Constants.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
public final class Constants {
77
public static final String JSON_RPC_VERSION = "2.0";
8-
public static Integer API_VERSION_MAJOR = 1;
8+
public static Integer ASTF_API_VERSION_MAJOR = 1;
99
public static Integer ASTF_API_VERSION_MINOR = 7;
10+
public static Integer STL_API_VERSION_MAJOR = 4;
11+
public static Integer STL_API_VERSION_MINOR = 6;
1012
}

src/main/java/com/cisco/trex/util/TRexClientUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static TRexServerMode getMode(String host, String port) {
3030
transport = new TRexTransport(host, port, 3000);
3131
Map<String, Object> parameters = new HashMap<>();
3232
parameters.put("name", "ASTF");
33-
parameters.put("major", Constants.API_VERSION_MAJOR);
33+
parameters.put("major", Constants.ASTF_API_VERSION_MAJOR);
3434
parameters.put("minor", Constants.ASTF_API_VERSION_MINOR);
3535
RPCResponse response = null;
3636
try {

src/main/java/com/cisco/trex/util/TrexServerMode.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)