コード例 #1
0
 def partial(min_value, max_value):
     stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="port_{}".format(field),
                                                    min_value=min_value,
                                                    max_value=max_value,
                                                    size=2,
                                                    limit=int(count),
                                                    seed=0x1235)
     self.vm_flow_vars.append(stl_vm_flow_var)
     stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_{}'.format(field),
                                         pkt_offset=self.udp[field])
     self.vm_flow_vars.append(stl_vm_wr_flow_var)
コード例 #2
0
 def partial(min_value, max_value):
     stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="ip4_{}".format(direction),
                                                    min_value=min_value,
                                                    max_value=max_value,
                                                    size=4,
                                                    limit=int(count),
                                                    seed=0x1235)
     self.vm_flow_vars.append(stl_vm_flow_var)
     stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='ip4_{}'.format(direction),
                                         pkt_offset='IP.{}'.format(direction))
     self.vm_flow_vars.append(stl_vm_wr_flow_var)
     stl_vm_fix_ipv4 = STLVmFixIpv4(offset="IP")
     self.vm_flow_vars.append(stl_vm_fix_ipv4)
コード例 #3
0
 def set_src_port(self, src_port, count=1):
     """ set packet source port """
     src_ports = str(src_port).split('-')
     min_value = int(src_ports[0])
     if len(src_ports) == 1:
         max_value = int(src_ports[0])
         src_port = min_value
         self._set_udp_fields(sport=src_port)
     else:
         max_value = int(src_ports[1])
         stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="port_src",
                                                        min_value=min_value,
                                                        max_value=max_value,
                                                        size=2,
                                                        limit=int(count),
                                                        seed=0x1235)
         self.vm_flow_vars.append(stl_vm_flow_var)
         stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_src',
                                             pkt_offset=self.udp_sport)
         self.vm_flow_vars.append(stl_vm_wr_flow_var)
コード例 #4
0
 def set_dst_port(self, dst_port, count=1):
     """ set packet destnation port """
     dst_ports = str(dst_port).split('-')
     min_value = int(dst_ports[0])
     if len(dst_ports) == 1:
         max_value = int(dst_ports[0])
         dst_port = min_value
         self._set_udp_fields(dport=dst_port)
     else:
         max_value = int(dst_ports[1])
         stl_vm_flow_var = \
             STLVmFlowVarRepeatableRandom(name="port_dst",
                                          min_value=min_value,
                                          max_value=max_value,
                                          size=2,
                                          limit=int(count),
                                          seed=0x1235)
         self.vm_flow_vars.append(stl_vm_flow_var)
         stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_dst',
                                             pkt_offset=self.udp_dport)
         self.vm_flow_vars.append(stl_vm_wr_flow_var)
コード例 #5
0
 def set_dst_ip4(self, dst_ip4, count=1):
     """ set destination ipv4 address fields """
     dst_ips = dst_ip4.split('-')
     min_value = dst_ips[0]
     max_value = dst_ips[1] if len(dst_ips) == 2 else dst_ips[0]
     if len(dst_ips) == 1:
         dst_ip4 = min_value
         self._set_ip_fields(dst=dst_ip4)
     else:
         stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="dst_ip4",
                                                        min_value=min_value,
                                                        max_value=max_value,
                                                        size=4,
                                                        limit=int(count),
                                                        seed=0x1235)
         self.vm_flow_vars.append(stl_vm_flow_var)
         stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='dst_ip4',
                                             pkt_offset='IP.dst')
         self.vm_flow_vars.append(stl_vm_wr_flow_var)
         stl_vm_fix_ipv4 = STLVmFixIpv4(offset="IP")
         self.vm_flow_vars.append(stl_vm_fix_ipv4)
コード例 #6
0
 def set_src_ip4(self, src_ip4, count=1):
     """ set source ipv4 address fields """
     src_ips = src_ip4.split('-')
     min_value = src_ips[0]
     max_value = src_ips[1] if len(src_ips) == 2 else src_ips[0]
     if len(src_ips) == 1:
         src_ip4 = min_value
         self._set_ip_fields(src=src_ip4)
     else:
         stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="ip4_src",
                                                        min_value=min_value,
                                                        max_value=max_value,
                                                        size=4,
                                                        limit=int(count),
                                                        seed=0x1235)
         self.vm_flow_vars.append(stl_vm_flow_var)
         stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='ip4_src',
                                             pkt_offset='IP.src')
         self.vm_flow_vars.append(stl_vm_wr_flow_var)
         stl_vm_fix_ipv4 = STLVmFixIpv4(offset="IP")
         self.vm_flow_vars.append(stl_vm_fix_ipv4)
コード例 #7
0
ファイル: traffic_profile.py プロジェクト: rossella/yardstick
        def partial(min_value, max_value, count):
            ip1 = int(ipaddress.IPv4Address(min_value))
            ip2 = int(ipaddress.IPv4Address(max_value))
            actual_count = (ip2 - ip1)
            if not actual_count:
                count = 1
            elif actual_count < int(count):
                count = actual_count

            stl_vm_flow_var = STLVmFlowVarRepeatableRandom(
                name="ip4_{}".format(direction),
                min_value=min_value,
                max_value=max_value,
                size=4,
                limit=int(count),
                seed=0x1235)
            self.vm_flow_vars.append(stl_vm_flow_var)
            stl_vm_wr_flow_var = STLVmWrFlowVar(
                fv_name='ip4_{}'.format(direction),
                pkt_offset='IP.{}'.format(direction))
            self.vm_flow_vars.append(stl_vm_wr_flow_var)
            stl_vm_fix_ipv4 = STLVmFixIpv4(offset="IP")
            self.vm_flow_vars.append(stl_vm_fix_ipv4)