<commit_before>#! /usr/bin/env python
import sys
import os

# Usage: flowid src_dpid dst_dpid params
def usage():
  print "%s flowid src_dpid dst_dpid svr|client <proto>/<duration>/<interval>/<samples>" % sys.argv[0]
  sys.exit()

def main():
  flowid = sys.argv[1]
  src_dpid = sys.argv[2]
  dst_dpid = sys.argv[3]
  server = sys.argv[4].upper()[0]
  params = sys.argv[5].split('/')
  proto = params[0]
  duration = params[1]
  interval = params[2]
  samples = params[3]

  src_nwid=int(src_dpid.split(':')[-2], 16)
  dst_nwid=int(dst_dpid.split(':')[-2], 16)
  src_hostid=int(src_dpid.split(':')[-1], 16)
  dst_hostid=int(dst_dpid.split(':')[-1], 16)

  if (proto == "tcp"):
    cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperf_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
    killcmd='pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
    print killcmd
    print cmd
    os.popen(killcmd)
    os.popen(cmd)
  else:
    if (server == 'S'):
      cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -us -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfsvr_%s.out 2>&1 &' &" % (dst_hostid, interval, samples, flowid)
      killcmd='pkill -KILL -f \"iperf .* -o .*/iperfsvr_%s.out\"' % (flowid)
      print killcmd
      print cmd
    else:
      cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -u -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
      killcmd='pkill -KILL -f \"iperf .* -o .*/iperfclient_%s.out\"' % (flowid)
      print killcmd
      print cmd
    os.popen(killcmd)
    os.popen(cmd)

if __name__ == "__main__":
  if len(sys.argv) != 6:
    print len(sys.argv)
    usage()

  main()
<commit_msg>limit udp pkt length to 1000K (not to overwhelming capsulator)<commit_after>#! /usr/bin/env python
import sys
import os

# Usage: flowid src_dpid dst_dpid params
def usage():
  print "%s flowid src_dpid dst_dpid svr|client <proto>/<duration>/<interval>/<samples>" % sys.argv[0]
  sys.exit()

def main():
  flowid = sys.argv[1]
  src_dpid = sys.argv[2]
  dst_dpid = sys.argv[3]
  server = sys.argv[4].upper()[0]
  params = sys.argv[5].split('/')
  proto = params[0]
  duration = params[1]
  interval = params[2]
  samples = params[3]

  src_nwid=int(src_dpid.split(':')[-2], 16)
  dst_nwid=int(dst_dpid.split(':')[-2], 16)
  src_hostid=int(src_dpid.split(':')[-1], 16)
  dst_hostid=int(dst_dpid.split(':')[-1], 16)

  if (proto == "tcp"):
    cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperf_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
    killcmd='pkill -KILL -f \"iperf .* -o .*/iperf_%s.out\"' % (flowid)
    print killcmd
    print cmd
    os.popen(killcmd)
    os.popen(cmd)
  else:
    if (server == 'S'):
      cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -us -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfsvr_%s.out 2>&1 &' &" % (dst_hostid, interval, samples, flowid)
      killcmd='pkill -KILL -f \"iperf .* -o .*/iperfsvr_%s.out\"' % (flowid)
      print killcmd
      print cmd
    else:
      cmd="ssh -o StrictHostKeyChecking=no 1.1.%d.1 '/home/ubuntu/ONOS/scripts/iperf -l 1000 -u -t%s -i%s -k%s -yJ -o /home/ubuntu/ONOS/web/log/iperfclient_%s.out -c 192.168.%d.%d 2>&1 &' &" % (src_hostid, duration, interval, samples, flowid, dst_nwid, dst_hostid)
      killcmd='pkill -KILL -f \"iperf .* -o .*/iperfclient_%s.out\"' % (flowid)
      print killcmd
      print cmd
    os.popen(killcmd)
    os.popen(cmd)

if __name__ == "__main__":
  if len(sys.argv) != 6:
    print len(sys.argv)
    usage()

  main()

{'fraction_non_alphanumeric': 0.19463426980511264, 'fraction_numerical': 0.027841052898000505, 'mean_word_length': 3.199787460148778, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3350887', 'n_tokens_mistral': 1800, 'n_tokens_neox': 1693, 'n_words': 341}