1 -----------------------------------------------------------------------------
2 -- Copyright (c) 2015 Intel Research and Development Ireland Ltd.
4 -- Licensed under the Apache License, Version 2.0 (the "License");
5 -- you may not use this file except in compliance with the License.
6 -- You may obtain a copy of the License at
8 -- http://www.apache.org/licenses/LICENSE-2.0
10 -- Unless required by applicable law or agreed to in writing, software
11 -- distributed under the License is distributed on an "AS IS" BASIS,
12 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 -- See the License for the specific language governing permissions and
14 -- limitations under the License.
15 -----------------------------------------------------------------------------
17 -----------------------------------
18 ----- Constant traffic sender -----
19 -----------------------------------
21 package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
24 ----- Packet Gen Configuration
26 pktgen.vlan(sendport, "on");
28 pktgen.icmp_echo("all", "on");
29 pktgen.process("all", "on");
32 ----- Script Configuration
33 local traffic_delay = 0;
34 local traffic_rate = 0;
38 function start_traffic(rate)
39 local endStats, diff, prev, iteration, flag, found;
43 -- Send traffic at the specified rate
44 print("Start Generation");
45 pktgen.set(sendport, "rate", rate);
47 pktgen.start(sendport);
49 pktgen.stop(sendport);
50 print("Stop Generation");
52 -- Collect statistics about the experiment
53 endStats = pktgen.portStats("all", "port");
54 sent_packets = endStats[0].opackets
60 print("INSTANTIATION VALIDATION TEST")
62 -- Write output on log file
63 file = io.open(out_file, "w");
66 packets = start_traffic(traffic_rate);
67 print("SENT PACKETS: " .. packets);
73 -- Quit the environment