コード例 #1
0
ファイル: vpp_rfc2544.py プロジェクト: yc18/yardstick
    def _create_single_stream(self,
                              current_port,
                              imix_data,
                              imix_sum,
                              isg=0.0):
        streams = []
        for size, weight in ((int(size), float(weight))
                             for (size, weight) in imix_data.items()
                             if float(weight) > 0):
            if current_port == 1:
                isg += 10.0
            if self.max_rate > 100:
                mode = trex_stl_streams.STLTXCont(pps=int(weight * imix_sum /
                                                          100))
                mode_lat = mode
            else:
                mode = trex_stl_streams.STLTXCont(percentage=weight *
                                                  self.max_rate / 100)
                mode_lat = trex_stl_streams.STLTXCont(pps=9000)

            packet, packet_lat = self._create_single_packet(size)
            streams.append(
                trex_stl_client.STLStream(isg=isg, packet=packet, mode=mode))
            if self.enable_latency:
                pg_id = self.port_pg_id.increase_pg_id(current_port)
                stl_flow = trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id)
                stream_lat = trex_stl_client.STLStream(isg=isg,
                                                       packet=packet_lat,
                                                       mode=mode_lat,
                                                       flow_stats=stl_flow)
                streams.append(stream_lat)
        return streams
コード例 #2
0
ファイル: rfc2544.py プロジェクト: rexlee8776/yardstick
    def _create_streams(self, imix_data, rate, port_pg_id, enable_latency):
        """Create a list of streams per packet size

        The STL TX mode speed of the generated streams will depend on the frame
        weight and the frame rate. Both the frame weight and the total frame
        rate are normalized to 100. The STL TX mode speed, defined in
        percentage, is the combitation of both percentages. E.g.:
          frame weight = 100
          rate = 90
            --> STLTXmode percentage = 10 (%)

          frame weight = 80
          rate = 50
            --> STLTXmode percentage = 40 (%)

        :param imix_data: (dict) IMIX size and weight
        :param rate: (float) normalized [0..100] total weight
        :param pg_id: (PortPgIDMap) port / pg_id (list) map
        """
        streams = []
        for size, weight in ((int(size), float(weight))
                             for (size, weight) in imix_data.items()
                             if float(weight) > 0):
            packet = self._create_single_packet(size)
            pg_id = port_pg_id.increase_pg_id()
            stl_flow = (trex_stl_streams.STLFlowLatencyStats(
                pg_id=pg_id) if enable_latency else None)
            mode = trex_stl_streams.STLTXCont(percentage=weight * rate / 100)
            streams.append(
                trex_stl_client.STLStream(packet=packet,
                                          flow_stats=stl_flow,
                                          mode=mode))
        return streams