def _set_outer_l3v4_fields(self, outer_l3v4): """ setup outer l3v4 fields from traffic profile """ ip_params = {} if 'proto' in outer_l3v4: ip_params['proto'] = socket.getprotobyname(outer_l3v4['proto']) if outer_l3v4['proto'] == 'tcp': self.udp_packet = Pkt.TCP() self.udp[DST_PORT] = 'TCP.dport' self.udp[SRC_PORT] = 'TCP.sport' tcp_params = {'flags': '', 'window': 0} self._set_proto_fields(UDP, **tcp_params) if 'ttl' in outer_l3v4: ip_params['ttl'] = outer_l3v4['ttl'] self._set_proto_fields(IP, **ip_params) if 'dscp' in outer_l3v4: self._set_proto_addr(DSCP, TYPE_OF_SERVICE, outer_l3v4['dscp']) if 'srcip4' in outer_l3v4: self._set_proto_addr(IP, SRC, outer_l3v4['srcip4'], outer_l3v4['count']) if 'dstip4' in outer_l3v4: self._set_proto_addr(IP, DST, outer_l3v4['dstip4'], outer_l3v4['count'])
def set_outer_l3v4_fields(self, outer_l3v4): """ setup outer l3v4 fields from traffic profile """ ip_params = {} if 'proto' in outer_l3v4: ip_params['proto'] = outer_l3v4['proto'] if outer_l3v4['proto'] == 'tcp': self.udp_packet = Pkt.TCP() self.udp_dport = 'TCP.dport' self.udp_sport = 'TCP.sport' tcp_params = {'flags': '', 'window': 0} self._set_udp_fields(**tcp_params) if 'ttl' in outer_l3v4: ip_params['ttl'] = outer_l3v4['ttl'] self._set_ip_fields(**ip_params) if 'dscp' in outer_l3v4: self.set_dscp(outer_l3v4['dscp']) if 'srcip4' in outer_l3v4: self.set_src_ip4(outer_l3v4['srcip4'], outer_l3v4['count']) if 'dstip4' in outer_l3v4: self.set_dst_ip4(outer_l3v4['dstip4'], outer_l3v4['count'])
def _set_outer_l3v6_fields(self, outer_l3v6): """ setup outer l3v6 fields from traffic profile """ ether_params = {'type': 0x86dd} self._set_proto_fields(ETHERNET, **ether_params) ip6_params = {} if 'proto' in outer_l3v6: ip6_params['proto'] = outer_l3v6['proto'] if outer_l3v6['proto'] == 'tcp': self.udp_packet = Pkt.TCP() self.udp[DST_PORT] = 'TCP.dport' self.udp[SRC_PORT] = 'TCP.sport' tcp_params = {'flags': '', 'window': 0} self._set_proto_fields(UDP, **tcp_params) if 'ttl' in outer_l3v6: ip6_params['ttl'] = outer_l3v6['ttl'] if 'tc' in outer_l3v6: ip6_params['tc'] = outer_l3v6['tc'] if 'hlim' in outer_l3v6: ip6_params['hlim'] = outer_l3v6['hlim'] self._set_proto_fields(IPv6, **ip6_params) if 'srcip6' in outer_l3v6: self._set_proto_addr(IPv6, SRC, outer_l3v6['srcip6']) if 'dstip6' in outer_l3v6: self._set_proto_addr(IPv6, DST, outer_l3v6['dstip6'])
def set_outer_l3v6_fields(self, outer_l3v6): """ setup outer l3v6 fields from traffic profile """ ether_params = {'type': 0x86dd} self._set_ether_fields(**ether_params) ip6_params = {} if 'proto' in outer_l3v6: ip6_params['proto'] = outer_l3v6['proto'] if outer_l3v6['proto'] == 'tcp': self.udp_packet = Pkt.TCP() self.udp_dport = 'TCP.dport' self.udp_sport = 'TCP.sport' tcp_params = {'flags': '', 'window': 0} self._set_udp_fields(**tcp_params) if 'ttl' in outer_l3v6: ip6_params['ttl'] = outer_l3v6['ttl'] if 'tc' in outer_l3v6: ip6_params['tc'] = outer_l3v6['tc'] if 'hlim' in outer_l3v6: ip6_params['hlim'] = outer_l3v6['hlim'] self._set_ip6_fields(**ip6_params) if 'srcip6' in outer_l3v6: self.set_src_ip6(outer_l3v6['srcip6']) if 'dstip6' in outer_l3v6: self.set_dst_ip6(outer_l3v6['dstip6'])