def test_046_dstPortRuleUDP(self): global app, appWF, wanLimitMbit # only use 30% because QoS will limit to 10% and we want to make sure it takes effect # really high levels will actually be limited by the untangle-vm throughput instead of QoS # which can interfere with the test targetSpeedMbit = str(wanLimitMbit*.3)+"M" if remote_control.quickTestsOnly: raise unittest2.SkipTest('Skipping a time consuming test') # We will use iperf server and iperf for this test. wan_IP = uvmContext.networkManager().getFirstWanAddress() iperfAvailable = global_functions.verify_iperf_configuration(wan_IP) if (not iperfAvailable): raise unittest2.SkipTest("Iperf server and/or iperf not available, skipping alternate port forwarding test") # Enabled QoS netsettings = uvmContext.networkManager().getNetworkSettings() nukeRules() appendRule(createBandwidthSingleConditionRule("DST_PORT","5000","SET_PRIORITY",1)) pre_UDP_speed = global_functions.get_udp_download_speed( receiverIP=global_functions.iperfServer, senderIP=remote_control.clientIP, targetRate=targetSpeedMbit ) # Create DST_PORT based rule to limit bandwidth nukeRules() appendRule(createBandwidthSingleConditionRule("DST_PORT","5000","SET_PRIORITY",7)) post_UDP_speed = global_functions.get_udp_download_speed( receiverIP=global_functions.iperfServer, senderIP=remote_control.clientIP, targetRate=targetSpeedMbit ) printResults( pre_UDP_speed, post_UDP_speed, (wanLimitKbit/8)*0.1, pre_UDP_speed*.9 ) assert (post_UDP_speed < pre_UDP_speed*.9)
def test_014_qosBypassCustomRulesUDP(self): global wanLimitMbit targetSpeedMbit = str(wanLimitMbit)+"M" if remote_control.quickTestsOnly: raise unittest2.SkipTest('Skipping a time consuming test') # We will use iperf server and iperf for this test. wan_IP = uvmContext.networkManager().getFirstWanAddress() iperfAvailable = global_functions.verify_iperf_configuration(wan_IP) if (not iperfAvailable): raise unittest2.SkipTest("Iperf server and/or iperf not available") netsettings = uvmContext.networkManager().getNetworkSettings() netsettings['bypassRules']['list'].append( createBypassConditionRule("DST_PORT","5000") ) netsettings['qosSettings']['qosRules']["list"].append( createQoSCustomRule("DST_PORT","5000", 1) ) uvmContext.networkManager().setNetworkSettings( netsettings ) pre_UDP_speed = global_functions.get_udp_download_speed( receiverIP=global_functions.iperfServer, senderIP=remote_control.clientIP, targetRate=targetSpeedMbit ) netsettings['qosSettings']['qosRules']['list'] = [] netsettings['qosSettings']['qosRules']["list"].append( createQoSCustomRule("DST_PORT","5000", 7) ) uvmContext.networkManager().setNetworkSettings( netsettings ) post_UDP_speed = global_functions.get_udp_download_speed( receiverIP=global_functions.iperfServer, senderIP=remote_control.clientIP, targetRate=targetSpeedMbit ) # Restore original network settings uvmContext.networkManager().setNetworkSettings( origNetworkSettingsWithQoS ) printResults( pre_UDP_speed, post_UDP_speed, (wanLimitKbit/8)*0.1, pre_UDP_speed*.9 ) assert (post_UDP_speed < pre_UDP_speed*.9)