Skip to content

Commit 4b34813

Browse files
committed
adding commandline
1 parent 0050f1a commit 4b34813

7 files changed

Lines changed: 114 additions & 34 deletions

File tree

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/Latte/LatteClientExecutor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public LatteClientExecutor(VirtualClientComponent component)
3838
public LatteClientExecutor(IServiceCollection dependencies, IDictionary<string, IConvertible> parameters)
3939
: base(dependencies, parameters)
4040
{
41+
this.InitializeWindowsClientCommandline();
4142
}
4243

4344
/// <inheritdoc/>

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/Latte/LatteServerExecutor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class LatteServerExecutor : LatteExecutor
2727
public LatteServerExecutor(VirtualClientComponent component)
2828
: base(component)
2929
{
30+
this.InitializeWindowsServerCommandline();
3031
}
3132

3233
/// <summary>

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/NTttcp/NTttcpClientExecutor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public NTttcpClientExecutor(VirtualClientComponent component)
3030
public NTttcpClientExecutor(IServiceCollection dependencies, IDictionary<string, IConvertible> parameters)
3131
: base(dependencies, parameters)
3232
{
33+
this.IntializeLinuxClientCommandline();
34+
this.IntializeWindowsClientCommandline();
3335
}
3436

3537
private void IntializeWindowsClientCommandline()

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/NTttcp/NTttcpExecutor.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -250,24 +250,6 @@ protected override Task InitializeAsync(EventContext telemetryContext, Cancellat
250250
return this.SystemManagement.MakeFileExecutableAsync(this.ExecutablePath, this.Platform, cancellationToken);
251251
}
252252

253-
/// <summary>
254-
/// Returns the NTttcp command line arguments.
255-
/// </summary>
256-
protected override string GetCommandLineArguments()
257-
{
258-
string command = null;
259-
if (this.Platform == PlatformID.Win32NT && this.IsInClientRole)
260-
{
261-
command = this.CommandLineWindowsClient;
262-
}
263-
else if (this.Platform == PlatformID.Unix)
264-
{
265-
command = this.GetLinuxSpecificCommandLine();
266-
}
267-
268-
return command;
269-
}
270-
271253
/// <summary>
272254
/// Gets the Sysctl command output.
273255
/// </summary>

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/NTttcp/NTttcpServerExecutor.cs

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace VirtualClient.Actions.NetworkPerformance
55
{
66
using System;
77
using System.Collections.Generic;
8+
using System.Linq;
89
using Microsoft.Extensions.DependencyInjection;
910
using VirtualClient.Contracts;
1011

@@ -30,6 +31,113 @@ public NTttcpServerExecutor(VirtualClientComponent component)
3031
public NTttcpServerExecutor(IServiceCollection dependencies, IDictionary<string, IConvertible> parameters)
3132
: base(dependencies, parameters)
3233
{
34+
this.IntializeLinuxServerCommandline();
35+
this.IntializeWindowsServerCommandline();
36+
}
37+
38+
private void IntializeWindowsServerCommandline()
39+
{
40+
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
41+
if (!this.CommandLineWindowsServer.Contains("-r") && !this.CommandLineWindowsServer.Contains("-s"))
42+
{
43+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + " -r";
44+
}
45+
46+
if (!this.CommandLineWindowsServer.Contains("-t") && this.TestDuration != null)
47+
{
48+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $" -t {this.TestDuration.TotalSeconds}";
49+
}
50+
51+
if (!this.CommandLineWindowsServer.Contains("-l") && this.BufferSizeServer != null)
52+
{
53+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $" -l {this.BufferSizeServer}";
54+
}
55+
56+
if (!this.CommandLineWindowsServer.Contains("-p"))
57+
{
58+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $" -p {this.Port}";
59+
}
60+
61+
if (!this.CommandLineWindowsServer.Contains("-xml") && this.ResultsPath != null)
62+
{
63+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $" -xml {this.ResultsPath}";
64+
}
65+
66+
if (!this.CommandLineWindowsServer.Contains("-u") && this.Protocol != null)
67+
{
68+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $"{(this.Protocol.ToLowerInvariant() == "udp" ? " -u" : string.Empty)} ";
69+
}
70+
71+
if (!this.CommandLineWindowsServer.Contains("-ns") && this.NoSyncEnabled != null)
72+
{
73+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $"{(this.NoSyncEnabled == true ? " -ns" : string.Empty)} ";
74+
}
75+
76+
if (!this.CommandLineWindowsServer.Contains("-m"))
77+
{
78+
this.CommandLineWindowsServer = this.CommandLineWindowsServer + $" -m {this.ThreadCount},*,{serverIPAddress} ";
79+
}
80+
}
81+
82+
private void IntializeLinuxServerCommandline()
83+
{
84+
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
85+
string clientIPAddress = this.GetLayoutClientInstances(ClientRole.Client).First().IPAddress;
86+
87+
if (!this.CommandLineLinuxClient.Contains("-r") && !this.CommandLineLinuxServer.Contains("-s"))
88+
{
89+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + " -r";
90+
}
91+
92+
if (!this.CommandLineLinuxServer.Contains("-t") && this.TestDuration != null)
93+
{
94+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $" -t {this.TestDuration.TotalSeconds}";
95+
}
96+
97+
if (!this.CommandLineLinuxServer.Contains("-l") && this.BufferSizeClient != null)
98+
{
99+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $" -l {this.BufferSizeServer}";
100+
}
101+
102+
if (!this.CommandLineWindowsServer.Contains("-p"))
103+
{
104+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $" -p {this.Port}";
105+
}
106+
107+
if (!this.CommandLineLinuxServer.Contains("-xml") && this.ResultsPath != null)
108+
{
109+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $" -xml {this.ResultsPath}";
110+
}
111+
112+
if (!this.CommandLineLinuxServer.Contains("-u") && this.Protocol != null)
113+
{
114+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $"{(this.Protocol.ToLowerInvariant() == "udp" ? " -u" : string.Empty)} ";
115+
}
116+
117+
if (!this.CommandLineLinuxServer.Contains("-ns") && this.NoSyncEnabled != null)
118+
{
119+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $"{(this.NoSyncEnabled == true ? " -ns" : string.Empty)} ";
120+
}
121+
122+
if (!this.CommandLineLinuxServer.Contains("-m"))
123+
{
124+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $" -m {this.ThreadCount},*,{serverIPAddress} ";
125+
}
126+
127+
if (!this.CommandLineLinuxServer.Contains("-M"))
128+
{
129+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $"{((this.ReceiverMultiClientMode == true) ? " -M" : string.Empty)} ";
130+
}
131+
132+
if (!this.CommandLineLinuxServer.Contains("-N") && this.NoSyncEnabled != null)
133+
{
134+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $"{(this.NoSyncEnabled == true ? " -N" : string.Empty)} ";
135+
}
136+
137+
if (!this.CommandLineLinuxServer.Contains("--show-dev-interrupts") && this.DevInterruptsDifferentiator != null)
138+
{
139+
this.CommandLineLinuxServer = this.CommandLineLinuxServer + $"{((this.DevInterruptsDifferentiator != null) ? $" --show-dev-interrupts {this.DevInterruptsDifferentiator}" : string.Empty)}".Trim();
140+
}
33141
}
34142
}
35143
}

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/SockPerf/SockPerfClientExecutor.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
namespace VirtualClient.Actions.NetworkPerformance
55
{
6-
using Microsoft.Extensions.DependencyInjection;
7-
using Microsoft.Extensions.Logging;
8-
using Org.BouncyCastle.Pqc.Crypto.Lms;
96
using System;
107
using System.Collections.Generic;
118
using System.Linq;
129
using System.Threading;
1310
using System.Threading.Tasks;
11+
using Microsoft.Extensions.DependencyInjection;
12+
using Microsoft.Extensions.Logging;
1413
using VirtualClient.Common;
15-
using VirtualClient.Common.Extensions;
1614
using VirtualClient.Common.Telemetry;
1715
using VirtualClient.Contracts;
1816
using VirtualClient.Contracts.Metadata;

src/VirtualClient/VirtualClient.Actions/Network/NetworkingWorkload/SockPerf/SockPerfServerExecutor.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,5 @@ private void InitializeLinuxServerCommandline()
142142

143143
this.CommandLineLinuxServer = this.CommandLineLinuxServer.Trim();
144144
}
145-
146-
/// <summary>
147-
/// Returns the Sockperf server-side command line arguments.
148-
/// </summary>
149-
protected override string GetCommandLineArguments()
150-
{
151-
// sockperf server -i 10.0.1.1 -p 8201 --tcp
152-
string serverIPAddress = this.GetLayoutClientInstances(ClientRole.Server).First().IPAddress;
153-
string protocolParam = this.Protocol.ToLowerInvariant() == "tcp" ? "--tcp" : string.Empty;
154-
155-
return $"server -i {serverIPAddress} -p {this.Port} {protocolParam}".Trim();
156-
}
157145
}
158146
}

0 commit comments

Comments
 (0)