Skip to content

Commit 6ccb25c

Browse files
committed
move all low level api classes to separate package
rename all low level api classes to align with python class names
1 parent 3cc3b1f commit 6ccb25c

35 files changed

+285
-275
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build/
55
.classpath
66
.project
77
.settings/
8+
/bin/

src/main/java/com/cisco/trex/stateful/AstfAssociation.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFAssociation.java

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

33
import com.google.gson.JsonArray;
44

55
import java.util.ArrayList;
66
import java.util.List;
77

88
/**
9-
* Astf Association
9+
* Java implementation for TRex python sdk ASTFAssociation class
1010
*/
11-
public class AstfAssociation {
11+
public class ASTFAssociation {
1212

13-
private List<AstfAssociationRule> astfAssociationRuleList;
13+
private List<ASTFAssociationRule> astfAssociationRuleList;
1414

1515
/**
1616
* construct
1717
*
1818
* @param astfAssociationRuleList
1919
*/
20-
public AstfAssociation(List<AstfAssociationRule> astfAssociationRuleList) {
20+
public ASTFAssociation(List<ASTFAssociationRule> astfAssociationRuleList) {
2121
this.astfAssociationRuleList = astfAssociationRuleList;
2222
}
2323

@@ -26,7 +26,7 @@ public AstfAssociation(List<AstfAssociationRule> astfAssociationRuleList) {
2626
*
2727
* @param astfAssociationRule
2828
*/
29-
public AstfAssociation(AstfAssociationRule astfAssociationRule) {
29+
public ASTFAssociation(ASTFAssociationRule astfAssociationRule) {
3030
astfAssociationRuleList = new ArrayList();
3131
astfAssociationRuleList.add(astfAssociationRule);
3232
}
@@ -38,7 +38,7 @@ public AstfAssociation(AstfAssociationRule astfAssociationRule) {
3838
*/
3939
public JsonArray toJson() {
4040
JsonArray jsonArray = new JsonArray();
41-
for (AstfAssociationRule rule : astfAssociationRuleList) {
41+
for (ASTFAssociationRule rule : astfAssociationRuleList) {
4242
jsonArray.add(rule.toJson());
4343
}
4444
return jsonArray;

src/main/java/com/cisco/trex/stateful/AstfAssociationRule.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFAssociationRule.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
import com.google.gson.JsonObject;
44
import org.apache.commons.lang3.StringUtils;
55

66
/**
7-
* Astf Association Rule
7+
* Java implementation for TRex python sdk ASTFAssociationRule class
88
*/
9-
public class AstfAssociationRule {
9+
public class ASTFAssociationRule {
1010
private JsonObject fields = new JsonObject();
1111
private int port;
1212

@@ -17,7 +17,7 @@ public class AstfAssociationRule {
1717
* @param ipEnd
1818
* @param port
1919
*/
20-
public AstfAssociationRule(String ipStart, String ipEnd, int port) {
20+
public ASTFAssociationRule(String ipStart, String ipEnd, int port) {
2121
this.port = port;
2222
fields.addProperty("port", port);
2323
if (!StringUtils.isEmpty(ipStart)) {
@@ -33,7 +33,7 @@ public AstfAssociationRule(String ipStart, String ipEnd, int port) {
3333
*
3434
* @param port
3535
*/
36-
public AstfAssociationRule(int port) {
36+
public ASTFAssociationRule(int port) {
3737
this(null, null, port);
3838
}
3939

src/main/java/com/cisco/trex/stateful/AstfCapInfo.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCapInfo.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
/**
4-
* Astf Cap Info,for pcap file usage
4+
* Java implementation for TRex python sdk ASTFCapInfo class
55
*/
6-
public class AstfCapInfo {
6+
public class ASTFCapInfo {
77
private String filePath;//pcap file name. Filesystem directory location is relative to the profile file in case it is not start with
88
private float cps;//new connection per second rate
9-
private AstfAssociation assoc;//rule for server association in default take the destination port from pcap file
10-
private AstfIpGen astfIpGen;//tuple generator for this template
9+
private ASTFAssociation assoc;//rule for server association in default take the destination port from pcap file
10+
private ASTFIpGen astfIpGen;//tuple generator for this template
1111
private int port;//Override destination port, by default is taken from pcap
1212
private float l7Percent;//L7 stream bandwidth percent
13-
private AstfGlobalInfoPerTemplate serverGlobInfo;//server global param
14-
private AstfGlobalInfoPerTemplate clientGlobInfo;//client global param
13+
private ASTFGlobalInfoPerTemplate serverGlobInfo;//server global param
14+
private ASTFGlobalInfoPerTemplate clientGlobInfo;//client global param
1515
private int limit;//Limit the number of flows
1616

17-
private AstfCapInfo(AstfCapInfoBuilder builder) {
17+
private ASTFCapInfo(AstfCapInfoBuilder builder) {
1818
filePath = builder.filePath;
1919
cps = builder.cps;
2020
assoc = builder.assoc;
@@ -52,7 +52,7 @@ private void paramCheck() {
5252
}
5353
if (assoc == null) {
5454
if (port > 0) {
55-
assoc = new AstfAssociation(new AstfAssociationRule(port));
55+
assoc = new ASTFAssociation(new ASTFAssociationRule(port));
5656
} else {
5757
assoc = null;
5858
}
@@ -82,7 +82,7 @@ public float getCps() {
8282
*
8383
* @return assoc
8484
*/
85-
public AstfAssociation getAssoc() {
85+
public ASTFAssociation getAssoc() {
8686
return assoc;
8787
}
8888

@@ -91,7 +91,7 @@ public AstfAssociation getAssoc() {
9191
*
9292
* @return astfIpGen
9393
*/
94-
public AstfIpGen getAstfIpGen() {
94+
public ASTFIpGen getAstfIpGen() {
9595
return astfIpGen;
9696
}
9797

@@ -118,7 +118,7 @@ public float getL7Percent() {
118118
*
119119
* @return serverGlobInfo
120120
*/
121-
public AstfGlobalInfoPerTemplate getServerGlobInfo() {
121+
public ASTFGlobalInfoPerTemplate getServerGlobInfo() {
122122
return serverGlobInfo;
123123
}
124124

@@ -127,7 +127,7 @@ public AstfGlobalInfoPerTemplate getServerGlobInfo() {
127127
*
128128
* @return clientGlobInfo
129129
*/
130-
public AstfGlobalInfoPerTemplate getClientGlobInfo() {
130+
public ASTFGlobalInfoPerTemplate getClientGlobInfo() {
131131
return clientGlobInfo;
132132
}
133133

@@ -146,12 +146,12 @@ public int getLimit() {
146146
public static final class AstfCapInfoBuilder {
147147
private String filePath;
148148
private float cps;
149-
private AstfAssociation assoc;
150-
private AstfIpGen astfIpGen;
149+
private ASTFAssociation assoc;
150+
private ASTFIpGen astfIpGen;
151151
private int port;
152152
private float l7Percent;
153-
private AstfGlobalInfoPerTemplate serverGlobInfo;
154-
private AstfGlobalInfoPerTemplate clientGlobInfo;
153+
private ASTFGlobalInfoPerTemplate serverGlobInfo;
154+
private ASTFGlobalInfoPerTemplate clientGlobInfo;
155155
private int limit;
156156

157157
public AstfCapInfoBuilder filePath(String val) {
@@ -164,12 +164,12 @@ public AstfCapInfoBuilder cps(float val) {
164164
return this;
165165
}
166166

167-
public AstfCapInfoBuilder assoc(AstfAssociation val) {
167+
public AstfCapInfoBuilder assoc(ASTFAssociation val) {
168168
assoc = val;
169169
return this;
170170
}
171171

172-
public AstfCapInfoBuilder astfIpGen(AstfIpGen val) {
172+
public AstfCapInfoBuilder astfIpGen(ASTFIpGen val) {
173173
astfIpGen = val;
174174
return this;
175175
}
@@ -184,12 +184,12 @@ public AstfCapInfoBuilder l7Percent(float val) {
184184
return this;
185185
}
186186

187-
public AstfCapInfoBuilder serverGlobInfo(AstfGlobalInfoPerTemplate val) {
187+
public AstfCapInfoBuilder serverGlobInfo(ASTFGlobalInfoPerTemplate val) {
188188
serverGlobInfo = val;
189189
return this;
190190
}
191191

192-
public AstfCapInfoBuilder clientGlobInfo(AstfGlobalInfoPerTemplate val) {
192+
public AstfCapInfoBuilder clientGlobInfo(ASTFGlobalInfoPerTemplate val) {
193193
clientGlobInfo = val;
194194
return this;
195195
}
@@ -199,8 +199,8 @@ public AstfCapInfoBuilder limit(int val) {
199199
return this;
200200
}
201201

202-
public AstfCapInfo build() {
203-
return new AstfCapInfo(this);
202+
public ASTFCapInfo build() {
203+
return new ASTFCapInfo(this);
204204
}
205205
}
206206
}

src/main/java/com/cisco/trex/stateful/AstfClientTemplate.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFClientTemplate.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
import com.google.gson.JsonObject;
44

55
/**
6-
* abstract Astf Client Template class
6+
* Java implementation for TRex python sdk _ASTFClientTemplate class, the abstract Astf Client Template class
77
*/
8-
abstract class AstfClientTemplate extends AstfTemplateBase {
9-
private AstfCluster astfCluster;
10-
private AstfIpGen iPGen;
11-
private AstfProgram astfProgram;
8+
abstract class ASTFClientTemplate extends ASTFTemplateBase {
9+
private ASTFCluster astfCluster;
10+
private ASTFIpGen iPGen;
11+
private ASTFProgram astfProgram;
1212

1313
/**
1414
* construct
@@ -17,10 +17,10 @@ abstract class AstfClientTemplate extends AstfTemplateBase {
1717
* @param astfCluster
1818
* @param astfProgram
1919
*/
20-
public AstfClientTemplate(AstfIpGen iPGen, AstfCluster astfCluster, AstfProgram astfProgram) {
20+
public ASTFClientTemplate(ASTFIpGen iPGen, ASTFCluster astfCluster, ASTFProgram astfProgram) {
2121
super(astfProgram);
2222
this.iPGen = iPGen;
23-
this.astfCluster = astfCluster == null ? new AstfCluster() : astfCluster;
23+
this.astfCluster = astfCluster == null ? new ASTFCluster() : astfCluster;
2424
this.astfProgram = astfProgram;
2525
}
2626

src/main/java/com/cisco/trex/stateful/AstfCluster.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCluster.java

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

33
import com.google.gson.JsonObject;
44

55
/**
6-
* for future use
6+
* Java implementation for TRex python sdk ASTFCluster class
77
*/
8-
public class AstfCluster {
8+
public class ASTFCluster {
99

1010
/**
1111
* to json format

src/main/java/com/cisco/trex/stateful/AstfCmd.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCmd.java

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

33
import com.google.gson.JsonObject;
44

55
/**
6-
* Abstract Astf Cmd class
6+
* Java implementation for TRex python sdk ASTFCmd class, the abstract Astf Cmd class,
77
*/
8-
public abstract class AstfCmd {
8+
public abstract class ASTFCmd {
99

1010
protected JsonObject fields;
1111
protected Boolean stream = null;
@@ -14,7 +14,7 @@ public abstract class AstfCmd {
1414
/**
1515
* construct
1616
*/
17-
public AstfCmd() {
17+
public ASTFCmd() {
1818
fields = new JsonObject();
1919
}
2020

src/main/java/com/cisco/trex/stateful/AstfCmdCloseMsg.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCmdCloseMsg.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
/**
4-
* Astf Cmd Close Msg
4+
* Java implementation for TRex python sdk ASTFCmdCloseMsg class
55
*/
6-
public class AstfCmdCloseMsg extends AstfCmd {
6+
public class ASTFCmdCloseMsg extends ASTFCmd {
77
private static final String NAME = "close_msg";
88

99
/**
1010
* construct
1111
*/
12-
public AstfCmdCloseMsg() {
12+
public ASTFCmdCloseMsg() {
1313
super();
1414
fields.addProperty("name", NAME);
1515
stream = false;

src/main/java/com/cisco/trex/stateful/AstfCmdConnect.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCmdConnect.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
/**
4-
* Astf Cmd Connect
4+
* Java implementation for TRex python sdk ASTFCmdConnect class
55
*/
6-
public class AstfCmdConnect extends AstfCmd {
6+
public class ASTFCmdConnect extends ASTFCmd {
77
private static final String NAME = "connect";
88

99
/**
1010
* construct
1111
*/
12-
public AstfCmdConnect() {
12+
public ASTFCmdConnect() {
1313
fields.addProperty("name", NAME);
1414
stream = true;
1515
}

src/main/java/com/cisco/trex/stateful/AstfCmdDelay.java renamed to src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFCmdDelay.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
package com.cisco.trex.stateful;
1+
package com.cisco.trex.stateful.api.lowlevel;
22

33
/**
4-
* Astf Cmd Delay
4+
* Java implementation for TRex python sdk ASTFCmdDelay class
55
*/
6-
public class AstfCmdDelay extends AstfCmd {
6+
public class ASTFCmdDelay extends ASTFCmd {
77
private static final String NAME = "delay";
88

99
/**
1010
* construct
1111
*
1212
* @param usec
1313
*/
14-
public AstfCmdDelay(int usec) {
14+
public ASTFCmdDelay(int usec) {
1515
super();
1616
fields.addProperty("name", NAME);
1717
fields.addProperty("usec", usec);

0 commit comments

Comments
 (0)