예제 #1
0
    def __init__(self, K, config):
        self.K = K / 2 * 2
        self.config = config
        self.json = json.load(config.json)
        self.min_delay = 60

        Case.__init__(self)
예제 #2
0
    def __init__(self, K, config, json):
        self.K = K / 2 * 2
        self.config = config
        self.json = json
        self.min_delay = 60

        Case.__init__(self)
예제 #3
0
    def config_nodes(self):
        create_bottleneck_link(self.net, self.core[0], self.core[1], self.config)
        for host in self.sources:
            create_access_link(self.net, self.core[0], host, self.config)
        for host in self.sinks:
            create_access_link(self.net, self.core[1], host, self.config)

        Case.config_nodes(self)
예제 #4
0
    def config_nodes(self):
        for i in range(self.N - 1):
            create_bottleneck_link(self.net, self.switch[i], self.switch[i + 1],
                                   self.config)
        for i in range(self.N):
            create_access_link(self.net, self.switch[i], self.host[i],
                               self.config)
        for i in range(2):
            create_access_link(self.net, self.switch[i * (self.N-1)],
                               self.extra_host[i], self.config)

        Case.config_nodes(self)
예제 #5
0
    def config_nodes(self):
        for i in range(self.N - 1):
            create_bottleneck_link(self.net, self.core[i], self.core[i + 1],
                                   self.config, bw=self.capacity[i])

        for i in range(self.F):
            create_access_link(self.net, self.core[self.flow[i]['from']],
                               self.host[i]['src'], self.config)
            create_access_link(self.net, self.core[self.flow[i]['to']],
                               self.host[i]['dst'], self.config)

        Case.config_nodes(self)
예제 #6
0
    def test(self):
        for sink in self.sinks:
            sink.cmd('iperf3 -s -D')

        info('Collecting data...\n')
        self.waiting_time = self.config.duration + 2

        for i in range(self.N):
            send_cmd = SND_CMD % ('10.0.2.%d' % (i+1), self.config.duration,
                                  self.config.tcp, self.config.mss, i)
            self.sources[i].cmd('sleep %d && %s &' % (i * self.config.gap + 1, send_cmd))

        Case.test(self)
예제 #7
0
    def test(self):
        for i in range(self.F):
            self.host[i]['dst'].cmd('iperf3 -s -D')

        info('Collecting data...\n')
        self.waiting_time = self.config.duration + 2

        for i in range(self.F):
            send_cmd = SND_CMD % ('10.0.2.%d' % (i+1), self.config.duration,
                                  self.config.tcp, self.config.mss, i)
            self.host[i]['src'].cmd('sleep %d && %s &' % (2, send_cmd))

        Case.test(self)
        self.report()
예제 #8
0
 def __init__(self, config):
     self.config = config
     self.json = json.load(config.json)
     if type(self.json) == list:
         self.flow = self.json
         self.capacity = []
     else:
         self.flow = self.json['flow']
         self.capacity = self.json['capacity']
     self.N = max([max(x['from'], x['to']) for x in self.flow]) + 1
     self.F = len(self.flow)
     if not self.capacity:
         self.capacity = [self.config.bw] * self.N
     Case.__init__(self)
예제 #9
0
    def test(self):
        info('Collecting data...\n')
        self.waiting_time = self.config.duration + self.delay + 2

        cnt = 0
        for sender, receiver, sip, dip, tcp, delay in self.flows:
            recv_cmd = 'iperf3 -s -D'
            send_cmd = SND_CMD % (dip, self.config.duration,
                                  tcp, self.config.mss, cnt)
            cnt += 1

            receiver.cmd(recv_cmd)
            sender.cmd('sleep %d && %s &' % (delay, send_cmd))

        Case.test(self)
        self.report()
예제 #10
0
    def test(self):
        for tsink in self.sinks:
            for sink in tsink['hosts']:
                sink.cmd('iperf3 -s -D')

        info('Collecting data...\n')
        self.waiting_time = self.config.duration + 2

        cnt = 0
        for t in range(len(self.sources)):
            for i in range(len(self.sources[t]['hosts'])):
                send_cmd = SND_CMD % ('10.0.%d.%d' % (2*t+2, i+1), self.config.duration,
                                      self.sources[t]['tcp'], self.config.mss, cnt)
                self.sources[t]['hosts'][i].cmd('sleep %d && %s &'
                                                % (i * self.config.gap + 1, send_cmd))
                cnt += 1

        Case.test(self)
        self.report()
예제 #11
0
    def test(self):
        info('Collecting data...\n')
        self.waiting_time = self.config.duration + 2

        for i in range(self.N-1):
            mon_cmd = MON_CMD % ('h%s-eth0' % i, 'h%s' % i, '')
            self.host[i].cmd('sleep %d && %s &' % (1, mon_cmd))
            self.host[i+1].cmd('iperf3 -s -D')
            send_cmd = SND_CMD % ('10.0.1.%d' % (i+2), self.config.duration,
                                  self.config.tcp, self.config.mss, i)
            self.host[i].cmd('sleep %d && %s &' % (2, send_cmd))

        for i in range(1):
            mon_cmd = MON_CMD % ('extra%s-eth0' % i, 'e%s' % (i), '')
            self.extra_host[i].cmd('sleep %d && %s &' % (1, mon_cmd))
            self.extra_host[i+1].cmd('iperf3 -s -D')
            send_cmd = SND_CMD % ('10.0.2.%d' % (i+2), self.config.duration,
                                  self.config.tcp, self.config.mss, i + self.N -1)
            self.extra_host[i].cmd('sleep %d && %s &' % (2, send_cmd))

        Case.test(self)
예제 #12
0
 def __init__(self, N, config):
     self.N = N
     self.config = config
     Case.__init__(self)
예제 #13
0
 def config_nodes(self):
     Case.config_nodes(self)
예제 #14
0
 def __init__(self, config):
     self.config = config
     self.json = json.load(config.json)
     Case.__init__(self)
예제 #15
0
import sys
import random
import pytest

sys.path.append("../..")
from util.case import Case

case = Case()


def setup_module(module):
    case.http.set_env('dev')
    case.load_data('test_user_data.xlsx')


def test_user_login_normal():
    case.run()


def test_user_login_not_exists():
    case.run()


def test_user_login_passwd_wrong():
    case.run()


def test_user_reg_random_name():
    random_name = random.choice(['E', 'V', 'O', 'Y', 'C', 'Z', 'D', 'M', 'L'
                                 ]) + chr(random.randint(0x4e00, 0x9fbf))
    case.run({"random_name": random_name})