Merge pull request #8 from marosg42/proper_iperf_ip

iperf server needs to listen on a correct IP from magpie interface
This commit is contained in:
Andrew McLeod 2019-09-19 11:37:16 +02:00 committed by GitHub
commit 9388f28568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -12,13 +12,15 @@ class Iperf():
"""
Install and start a server automatically
"""
iperf_out = '/home/ubuntu/iperf_output.txt'
def __init__(self):
self.iperf_out = '/home/ubuntu/iperf_output.' + hookenv.application_name() + '.txt'
def install_iperf(self):
apt_install("iperf")
def listen(self):
cmd = "iperf -s -m -fm | tee " + self.iperf_out + " &"
ip = hookenv.network_get('magpie')['bind-addresses'][0]['addresses'][0]['address']
cmd = "iperf -s -m -fm -B " + ip + " | tee " + self.iperf_out + " &"
os.system(cmd)
def mtu(self):