def set_rule(self,startIP,endIP,dlSpeed,upSpeed,i): driver = self.driver driver.implicitly_wait(10) qosIP_control.add(self) qosIP_control.set_ip(self,startIP,endIP,i) qosIP_control.set_speed(self,dlSpeed,upSpeed,i) qosIP_control.submit(self)
def test_qos_endtipCheck(self): u'''验证qos-ip规则只设置起始地址容错性''' #添加IP qosIP_control.set_qos_ip_enable(self) qosIP_control.add(self) qosIP_control.set_ip(self,'192.168.1.101','',1) qosIP_control.add(self) time.sleep(1) test = qosIP_business.get_alert_text(self) assert test == u'结束IP地址必须大于起始IP地址,且结束IP地址与起始IP地址的前3段必须相同。\n是否修改结束IP地址?',u'弹窗信息表达错误' print u'验证qos-ip规则只设置起始地址容错性--用例编号100msh0261--测试成功'
def test_qos_startipCheck(self): u'''验证qos-ip规则只设置结束地址容错性''' driver = self.driver #添加IP qosIP_control.set_qos_ip_enable(self) qosIP_control.add(self) qosIP_control.set_ip(self,'','192.168.1.101',1) time.sleep(1) qosIP_control.submit(self) element = driver.find_element_by_xpath(".//*[@id='cbi-qos-ip-classify']/div[2]/div[1]/ul/li") assert element ,u'qos-ip规则只设置结束地址时,没有弹窗提示信息' test = element.text assert test == u'无效的起始IP地址或者结束IP地址,结束IP地址必须大于起始IP地址。',u'提示信息错误' print u'验证qos-ip规则只设置结束地址容错性--用例编号100msh0263--测试成功'
def add_multi(self,numMax): driver = self.driver ip = ['192','168','11','100'] dlSpeed = 1024 upSpeed = 128 for i in range(1,numMax): ip[3] = str(int(ip[3])+1) startIp = '.'.join(ip) endIp = '.'.join(ip) dl = dlSpeed+i*128 up = upSpeed+i*128 qosIP_control.add(self) qosIP_control.set_ip(self,startIp,endIp,i) qosIP_control.set_speed(self,dl,up,i) qosIP_control.submit(self)
def test_qosIP_multi2(self,numMax): u'''验证qos-ip设置多条IP相同速率不同的规则''' driver = self.driver dlSpeed = 1024 upSpeed = 128 for i in range(1,numMax): dl = dlSpeed+i*128 up = upSpeed+i*128 qosIP_control.add(self) qosIP_control.set_ip(self,startIP,endIP,i) qosIP_control.set_speed(self,dl,up,i) qosIP_control.submit(self) dl = qosIP_business.dlSpeedCheck(self,dlSpeed,err) assert dl, u"在线测试下载速度与设置的下载速度误差超过" print u"验证qos-ip设置多条IP相同速率不同的规则--用例编号100msh0267--测试成功"
def test_qosIP_multi(self,numMax): u'''验证qos-ip添加多个IP规则有效性''' driver = self.driver ip = ['192','168','11','100'] dlSpeed = 1024 upSpeed = 128 for i in range(1,numMax): ip[3] +=1 startIp = '.'.join(ip) endIp = '.'.join(ip) dl = dlSpeed+i*128 up = upSpeed+i*128 qosIP_control.add(self) qosIP_control.set_ip(self,startIp,endIp,i) qosIP_control.set_speed(self,dl,up,i) qosIP_control.submit(self)