This commit is contained in:
Jake Hillion 2020-11-10 21:43:49 +00:00
parent 5e2009610f
commit e594f6f06e
2 changed files with 59 additions and 20 deletions

View File

@ -111,15 +111,15 @@
"\n",
" st2.get_interfaces()[0].set_rate(1)\n",
" st2.server()\n",
" directionInbound['One1MBNotProxied'] = st1.client(st2.get_interfaces()[0].get_address())\n",
" directionInbound['One1MBNotProxied'] = st1.client(st2)\n",
" st1.server()\n",
" directionOutbound['One1MBNotProxied'] = st2.client(st1.get_interfaces()[0].get_address())\n",
" directionOutbound['One1MBNotProxied'] = st2.client(st1)\n",
"\n",
" st2.get_interfaces()[0].set_rate(1)\n",
" st2.get_interfaces()[0].set_rate(2)\n",
" st2.server()\n",
" directionInbound['One2MBNotProxied'] = st1.client(st2.get_interfaces()[0].get_address())\n",
" directionInbound['One2MBNotProxied'] = st1.client(st2)\n",
" st1.server()\n",
" directionOutbound['One2MBNotProxied'] = st2.client(st1.get_interfaces()[0].get_address())\n",
" directionOutbound['One2MBNotProxied'] = st2.client(st1)\n",
"finally:\n",
" runner.teardown()"
]
@ -160,25 +160,25 @@
" lp.get_interfaces()[1].set_rate(1)\n",
"\n",
" cl.server()\n",
" directionInbound['Two1MBProxied'] = st.client(cl.get_interfaces()[0].get_address())\n",
" directionInbound['Two1MBProxied'] = st.client(cl)\n",
" st.server()\n",
" directionOutbound['Two1MBProxied'] = cl.client(st.get_interfaces()[0].get_address())\n",
" directionOutbound['Two1MBProxied'] = cl.client(st)\n",
"\n",
" lp.get_interfaces()[0].set_rate(2)\n",
" lp.get_interfaces()[1].set_rate(2)\n",
"\n",
" cl.server()\n",
" directionInbound['Two2MBProxied'] = st.client(cl.get_interfaces()[0].get_address())\n",
" directionInbound['Two2MBProxied'] = st.client(cl)\n",
" st.server()\n",
" directionOutbound['Two2MBProxied'] = cl.client(st.get_interfaces()[0].get_address())\n",
" directionOutbound['Two2MBProxied'] = cl.client(st)\n",
"\n",
" lp.get_interfaces()[0].set_rate(1)\n",
" lp.get_interfaces()[1].set_rate(2)\n",
"\n",
" cl.server()\n",
" directionInbound['One1MBOne2MBProxied'] = st.client(cl.get_interfaces()[0].get_address())\n",
" directionInbound['One1MBOne2MBProxied'] = st.client(cl)\n",
" st.server()\n",
" directionOutbound['One1MBOne2MBProxied'] = cl.client(st.get_interfaces()[0].get_address())\n",
" directionOutbound['One1MBOne2MBProxied'] = cl.client(st)\n",
"\n",
" lp.get_interfaces()[0].set_rate(2)\n",
" lp.get_interfaces()[1].set_rate(2)\n",
@ -186,14 +186,12 @@
" cl.server()\n",
" threading.Timer(5+15, lambda: lp.get_interfaces()[1].set_rate(1)).start()\n",
" threading.Timer(5+30, lambda: lp.get_interfaces()[1].set_rate(2)).start()\n",
" directionInbound['One2MBOneYMBProxiedSlow15Return30']\\\n",
" = st.client(cl.get_interfaces()[0].get_address(), time=60)\n",
" directionInbound['One2MBOneYMBProxiedSlow15Return30'] = st.client(cl, time=60)\n",
"\n",
" st.server()\n",
" threading.Timer(5+15, lambda: lp.get_interfaces()[1].set_rate(1)).start()\n",
" threading.Timer(5+30, lambda: lp.get_interfaces()[1].set_rate(2)).start()\n",
" directionOutbound['One2MBOneYMBProxiedSlow15Return30'] =\\\n",
" cl.client(st.get_interfaces()[0].get_address(), time=60)\n",
" directionOutbound['One2MBOneYMBProxiedSlow15Return30'] = cl.client(st, time=60)\n",
"finally:\n",
" runner.teardown()"
]
@ -236,9 +234,9 @@
" lp.get_interfaces()[2].set_rate(1)\n",
"\n",
" cl.server()\n",
" directionInbound['Three1MBProxied'] = st.client(cl.get_interfaces()[0].get_address())\n",
" directionInbound['Three1MBProxied'] = st.client(cl)\n",
" st.server()\n",
" directionOutbound['Three1MBProxied'] = cl.client(st.get_interfaces()[0].get_address())\n",
" directionOutbound['Three1MBProxied'] = cl.client(st)\n",
"finally:\n",
" runner.teardown()"
]
@ -283,9 +281,9 @@
" lp.get_interfaces()[3].set_rate(1)\n",
"\n",
" cl.server()\n",
" directionInbound['Four1MBProxied'] = st.client(cl.get_interfaces()[0].get_address())\n",
" directionInbound['Four1MBProxied'] = st.client(cl)\n",
" st.server()\n",
" directionOutbound['Four1MBProxied'] = cl.client(st.get_interfaces()[0].get_address())\n",
" directionOutbound['Four1MBProxied'] = cl.client(st)\n",
"finally:\n",
" runner.teardown()\n"
]
@ -346,7 +344,6 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
@ -356,6 +353,45 @@
"This section shows equal connections scaling at various speeds and number of connections."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"plot_iperf_results(\n",
" {\n",
" '1x2MB Connection (not proxied)': directionInbound['One2MBNotProxied'],\n",
" '2x1MB Connections (proxied)': directionInbound['Two1MBProxied'],\n",
" '1x1MB Connection (not proxied)': directionInbound['One1MBNotProxied'],\n",
" },\n",
" 'Two Equal 1MB Connections',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"plot_iperf_results(\n",
" {\n",
" '2x2MB Connections (proxied)': directionInbound['Two2MBProxied'],\n",
" '1x2MB Connection (not proxied)': directionInbound['One2MBNotProxied'],\n",
" },\n",
" 'Two Equal 2MB Connections',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,

View File

@ -156,6 +156,9 @@ class SpeedTestServer(Node):
self.ssh('iperf3 -s -1 -D', error_stdout=True, error_stderr=True)
def client(self, target, time=30):
if isinstance(target, SpeedTestServer):
target = target.get_interfaces()[0].get_address()
command = 'iperf3 -c {target} -t {time} -O 5 -J'.format(target=target, time=time)
out = self.ssh(command, error_stdout=True, error_stderr=True, return_stdout=True)
return json.loads(out)