예제 #1
0
    def test_acl_qos_a1(self):

        #初始化
        fun.iperf_kill()

        #下发配置并检查结果
        for key in self.case1_step:
            fun.cmd(self.case1_step[key][0], 'gw')
            re = fun.cmd(self.case1_step[key][1], 'gw')
            assert self.case1_step[key][2] in re

        # 服务端占用端口
        fun.cmd(f'iperf3 -s -p {qos_port} --logfile s.txt', 's', thread=1)
        time.sleep(5)

        # 发送报文
        c_cmd = fun.cmd(
            f'iperf3 -c {pcap_dip} -p {qos_port} -i 1 -u -t 5 -b 30M -P 5',
            'c')
        print(c_cmd)

        # 检查速率是否正确
        s_txt = fun.cmd('cat s.txt', 's')
        speed_list = fun.qos_speed('s.txt', s_txt)
        for i in speed_list:
            print(i)
            assert 9.0 <= float(i) <= 10.0
예제 #2
0
    def test_qos_qbucket_a2(self):

        # 初始化
        fun.iperf_kill()

        # 下发配置并检查结果
        for key in self.case2_step:
            fun.cmd(self.case2_step[key][0], 'gw')
            re = fun.cmd(self.case2_step[key][1], 'gw')
            assert self.case2_step[key][2] in re

        # 服务端占用端口
        print('服务端占用端口:', f'iperf3 -s -p {qos_port} --logfile s.txt')
        fun.cmd(f'iperf3 -s -p {qos_port} --logfile s.txt', 's', thread=1)
        time.sleep(5)

        # 发送报文
        print('客户端发送报文:',
              f'iperf3 -c {pcap_dip} -p {qos_port} -i 1 -u -t 5 -b 30M -P 5')
        c_cmd = fun.cmd(
            f'iperf3 -c {pcap_dip} -p {qos_port} -i 1 -u -t 5 -b 30M -P 5',
            'c')
        print('c_cmd: ', c_cmd)

        # 检查速率是否正确
        s_txt = fun.cmd('cat s.txt', 's')
        print('s_txt: ', s_txt)
        s_speed = fun.qos_speed('s.txt', s_txt, qbucket='s')
        print('s_speed: ', s_speed)
        assert 9.0 <= float(s_speed) <= 10.0
예제 #3
0
	def teardown_method(self):
		self.clr_met = clr_env.clear_met

		for i in self.clr_met:
			fun.cmd(i, 'gw')

		fun.iperf_kill()
예제 #4
0
 def teardown_method(self):
     clr_env.clear_met_acl()
     fun.iperf_kill()