diff options
author | 2016-06-29 16:12:19 +0000 | |
---|---|---|
committer | 2016-06-29 16:12:19 +0000 | |
commit | 10121775eb7ee5eb6675d472b2c2e5e1662aac03 (patch) | |
tree | ebdd6d431711e00783a694b28fd7fd382190d7a8 /tools/pkt_gen/xena/xena_json.py | |
parent | e04b1b9a22f93bb1783ff9e82486aec38dcb0efb (diff) | |
parent | e79f969b7f40792d0071bb484026097adda7c2b5 (diff) |
Merge "Xena: Modify xena_json for back2back options"
Diffstat (limited to 'tools/pkt_gen/xena/xena_json.py')
-rw-r--r-- | tools/pkt_gen/xena/xena_json.py | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/tools/pkt_gen/xena/xena_json.py b/tools/pkt_gen/xena/xena_json.py index 23b56084..2a15a932 100644 --- a/tools/pkt_gen/xena/xena_json.py +++ b/tools/pkt_gen/xena/xena_json.py @@ -354,10 +354,10 @@ class XenaJSON(object): self.json_data['PortHandler']['EntityList'][ port]["IpV6RoutingPrefix"] = int(netmask) - def set_test_options(self, packet_sizes, duration, iterations, loss_rate, - micro_tpld=False): + def set_test_options_tput(self, packet_sizes, duration, iterations, + loss_rate, micro_tpld=False): """ - Set the test options + Set the tput test options :param packet_sizes: List of packet sizes to test, single int entry is acceptable for one packet size testing :param duration: time for each test in seconds as int @@ -379,6 +379,35 @@ class XenaJSON(object): self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][ 'Iterations'] = iterations + def set_test_options_back2back(self, packet_sizes, duration, + iterations, startvalue, endvalue, + micro_tpld=False): + """ + Set the back2back test options + :param packet_sizes: List of packet sizes to test, single int entry is + acceptable for one packet size testing + :param duration: time for each test in seconds as int + :param iterations: number of iterations of testing as int + :param micro_tpld: boolean if micro_tpld should be enabled or disabled + :param StartValue: start value + :param EndValue: end value + :return: None + """ + if isinstance(packet_sizes, int): + packet_sizes = [packet_sizes] + self.json_data['TestOptions']['PacketSizes'][ + 'CustomPacketSizes'] = packet_sizes + self.json_data['TestOptions']['TestTypeOptionMap']['Back2Back'][ + 'Duration'] = duration + self.json_data['TestOptions']['FlowCreationOptions'][ + 'UseMicroTpldOnDemand'] = 'true' if micro_tpld else 'false' + self.json_data['TestOptions']['TestTypeOptionMap']['Back2Back'][ + 'Iterations'] = iterations + self.json_data['TestOptions']['TestTypeOptionMap']['Back2Back'][ + 'RateSweepOptions']['StartValue'] = startvalue + self.json_data['TestOptions']['TestTypeOptionMap']['Back2Back'][ + 'RateSweepOptions']['EndValue'] = endvalue + def set_topology_blocks(self): """ Set the test topology to a West to East config for half duplex flow with @@ -586,8 +615,8 @@ if __name__ == "__main__": JSON.set_header_layer3(src_ip='192.168.100.2', dst_ip='192.168.100.3', protocol='udp') JSON.set_header_layer4_udp(source_port=3000, destination_port=3001) - JSON.set_test_options(packet_sizes=[64], duration=10, iterations=1, - loss_rate=0.0, micro_tpld=True) + JSON.set_test_options_tput(packet_sizes=[64], duration=10, iterations=1, + loss_rate=0.0, micro_tpld=True) JSON.add_header_segments(flows=4000, multistream_layer='L4') JSON.set_topology_blocks() write_json_file(JSON.json_data, './testthis.x2544') |