Skip to content

Commit b5ebe60

Browse files
committed
format file
Signed-off-by: Leo Ma <[email protected]>
1 parent 5bf1f82 commit b5ebe60

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

src/main/java/com/cisco/trex/stateful/api/lowlevel/ASTFProfile.java

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public class ASTFProfile {
2424
private List<ASTFTemplate> astfTemplateList;
2525
private List<ASTFCapInfo> astfCapInfoList;
2626

27-
private Map<String, Integer> tgName2TgId =
28-
new LinkedHashMap<>(); // template group name -> template group id
27+
private Map<String, Integer> tgName2TgId = new LinkedHashMap<>(); // template group name ->
28+
// template group id
2929

3030
/**
3131
* construct
@@ -46,19 +46,15 @@ public ASTFProfile(ASTFIpGen defaultIpGen, List<ASTFTemplate> astfTemplateList)
4646
* @param astfTemplateList
4747
* @param astfCapInfoList
4848
*/
49-
public ASTFProfile(
50-
ASTFIpGen defaultIpGen,
51-
ASTFGlobalInfo astfClientGlobalInfo,
52-
ASTFGlobalInfo astfServerGlobalInfo,
53-
List<ASTFTemplate> astfTemplateList,
49+
public ASTFProfile(ASTFIpGen defaultIpGen, ASTFGlobalInfo astfClientGlobalInfo,
50+
ASTFGlobalInfo astfServerGlobalInfo, List<ASTFTemplate> astfTemplateList,
5451
List<ASTFCapInfo> astfCapInfoList) {
5552
this.astfClientGlobalInfo = astfClientGlobalInfo;
5653
this.astfServerGlobalInfo = astfServerGlobalInfo;
5754

5855
if (astfTemplateList == null && astfCapInfoList == null) {
59-
throw new IllegalStateException(
60-
String.format(
61-
"bad param combination,AstfTemplate and AstfCapInfo should not be null at the same time "));
56+
throw new IllegalStateException(String.format(
57+
"bad param combination,AstfTemplate and AstfCapInfo should not be null at the same time "));
6258
}
6359
this.astfTemplateList = astfTemplateList;
6460
this.astfCapInfoList = astfCapInfoList;
@@ -121,9 +117,8 @@ public ASTFProfile(
121117
} else {
122118
dPort = capInfo.getAssoc().getPort();
123119
myAssoc = capInfo.getAssoc();
124-
throw new IllegalStateException(
125-
String.format(
126-
"More than one cap use dest port %s. This is currently not supported.", dPort));
120+
throw new IllegalStateException(String.format(
121+
"More than one cap use dest port %s. This is currently not supported.", dPort));
127122
}
128123
dPorts.add(dPort);
129124

@@ -155,20 +150,11 @@ public ASTFProfile(
155150
}
156151

157152
for (Map<String, Object> map : allCapInfo) {
158-
ASTFTCPClientTemplate tempC =
159-
new ASTFTCPClientTemplate(
160-
(ASTFProgram) map.get("prog_c"),
161-
(ASTFIpGen) map.get("ip_gen"),
162-
null,
163-
(int) map.get("d_port"),
164-
(float) map.get("cps"),
165-
(ASTFGlobalInfoPerTemplate) map.get("glob_c"),
166-
(int) map.get("limit"));
167-
ASTFTCPServerTemplate tempS =
168-
new ASTFTCPServerTemplate(
169-
(ASTFProgram) map.get("prog_s"),
170-
(ASTFAssociation) map.get("my_assoc"),
171-
(ASTFGlobalInfoPerTemplate) map.get("glob_s"));
153+
ASTFTCPClientTemplate tempC = new ASTFTCPClientTemplate((ASTFProgram) map.get("prog_c"),
154+
(ASTFIpGen) map.get("ip_gen"), null, (int) map.get("d_port"), (float) map.get("cps"),
155+
(ASTFGlobalInfoPerTemplate) map.get("glob_c"), (int) map.get("limit"));
156+
ASTFTCPServerTemplate tempS = new ASTFTCPServerTemplate((ASTFProgram) map.get("prog_s"),
157+
(ASTFAssociation) map.get("my_assoc"), (ASTFGlobalInfoPerTemplate) map.get("glob_s"));
172158
ASTFTemplate template = new ASTFTemplate(tempC, tempS);
173159
astfTemplateList.add(template);
174160
}
@@ -225,9 +211,8 @@ public void printStats() {
225211
tempJson.getAsJsonObject("client_template").get("program_index").getAsInt();
226212
int serverProgInd =
227213
tempJson.getAsJsonObject("server_template").get("program_index").getAsInt();
228-
int totalBytes =
229-
ASTFTemplateBase.getTotalSendBytes(clientProgInd)
230-
+ ASTFTemplateBase.getTotalSendBytes(serverProgInd);
214+
int totalBytes = ASTFTemplateBase.getTotalSendBytes(clientProgInd)
215+
+ ASTFTemplateBase.getTotalSendBytes(serverProgInd);
231216

232217
float tempCps = tempJson.getAsJsonObject("client_template").get("cps").getAsFloat();
233218
float tempBps = totalBytes * tempCps * 8;
@@ -237,7 +222,7 @@ public void printStats() {
237222
}
238223
LOGGER.info("total for all templates - cps:{} bps:{}", totalCps, totalBps);
239224
}
240-
225+
241226
public List<ASTFTemplate> getAstfTemplateList() {
242227
return this.astfTemplateList;
243228
}

0 commit comments

Comments
 (0)