aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/mrr-daily-skx.txt
blob: 95697a7ed6a0f39a8d85b42cdd7ca4e8fb491933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
!nf_density

# container_memif
mrrAND${default_nic}ANDmemifANDbaseAND64b

# crypto
# mrrAND${default_nic}ANDscaleANDipsecswAND64bNOTipsectunNOThmac_sha_256NOTaes_128_gcmNOTtnl_40NOTtnl_400NOTtnl_5000NOTtnl_20000NOTtnl_40000NOTtnl_60000
mrrAND${default_nic}ANDscaleANDipsecswANDimixNOTipsectunNOThmac_sha_256NOTaes_128_gcmNOTtnl_40NOTtnl_400NOTtnl_5000NOTtnl_20000NOTtnl_40000NOTtnl_60000

# ip4
mrrAND${default_nic}ANDip4fwdANDbaseAND64bNOTipsecNOTmemifNOTvhostNOTvxlanNOTsrc_user_1NOTdot1qNOTsrc_user_1
mrrAND${default_nic}ANDip4fwdANDbaseAND64bANDdot1qAND2_node_*_link_topoNOTipsecNOTmemifNOTvhostNOTvxlanNOTsrc_user_1
mrrAND${default_nic}ANDip4fwdANDbaseAND64bANDdot1qAND3_node_*_link_topoNOTipsecNOTmemifNOTvhostNOTvxlanNOTsrc_user_1NOTdrv_avf
mrrAND${default_nic}ANDip4fwdANDscaleAND64bNOTnat44NOTipsec
mrrAND${default_nic}ANDip4fwdANDacl50AND10k_flowsAND64b
mrrANDip4baseAND64bNOTdot1q
mrrANDip4baseAND64bANDdot1qNOTdrv_avf
mrrANDip4fwdANDscaleANDfib_2mAND64b

# ip4_tunnels
mrrAND${default_nic}ANDvxlanAND64bNOTvxlan_10NOTvxlan_1kNOTvtsNOTvhost

# ip6
mrrAND${default_nic}ANDip6fwdANDbaseAND78b
mrrAND${default_nic}ANDip6fwdANDscaleAND78b
mrrANDip6baseAND78b
mrrANDip6fwdANDscaleANDfib_2mAND78b

# ip6_tunnels

# l2
mrrAND${default_nic}ANDl2bdmaclrnANDbaseAND64bNOTmemifNOTvhostNOTvxlanNOTdot1q
mrrAND${default_nic}ANDl2bdmaclrnANDbaseAND64bANDdot1qAND2_node_*_link_topoNOTmemifNOTvhostNOTvxlan
mrrAND${default_nic}ANDl2bdmaclrnANDbaseAND64bANDdot1qAND3_node_*_link_topoNOTmemifNOTvhostNOTvxlanNOTdrv_avf
mrrAND${default_nic}ANDl2xcfwdANDbaseAND64bNOTdot1adNOTmemifNOTvhostNOTvxlan
mrrAND${default_nic}ANDl2patchANDbaseAND64bNOTmemifNOTvhostNOTvxlan
mrrAND${default_nic}ANDl2bdmaclrnANDscaleAND64bNOTmemifNOTvhostNOTvxlan
mrrAND${default_nic}ANDl2bdmaclrnANDfeatureANDacl50AND10k_flowsAND64b
mrrANDl2bdmaclrnANDbaseAND64bNOTmemifNOTvhostNOTvxlanNOTgbp
mrrANDl2xcfwdANDbaseANDdrv_avfAND64bNOTdot1qNOTdot1adNOTmemifNOTvhost
mrrANDl2patchANDbaseANDdrv_avfAND64bNOTdot1qNOTdot1adNOTmemifNOTvhost
mrrANDl2bdmaclrnANDscaleANDfib_1mAND64bNOTmemifNOTvhostNOTvxlan

# srv6
mrrAND${default_nic}ANDfeatureANDsrv6AND78b

# vm_vhost
mrrAND${default_nic}ANDvhostAND64b
mrrANDvhostAND64bANDlbond

# vts
mrrAND${default_nic}ANDvtsAND114b

!ipsectun
!hmac_sha_256
!aes_128_gcm
!tnl_40
!tnl_400
!tnl_5000
!tnl_20000
!tnl_40000
!tnl_60000
!scaleANDnat44
.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import Ether from scapy.layers.inet import IP, TCP from scapy.layers.inet6 import IPv6, ICMPv6ND_NS from ipaddress import ip_address from resources.libraries.python.TrafficScriptArg import TrafficScriptArg from resources.libraries.python.PacketVerifier import RxQueue, TxQueue def check_ipv4(pkt_recv, dscp): """Check received IPv4 IPsec packet. :param pkt_recv: Received packet to verify. :param dscp: DSCP value to check. :type pkt_recv: scapy.Ether :type dscp: int :raises RuntimeError: If received packet is invalid. """ if not pkt_recv.haslayer(IP): raise RuntimeError('Not an IPv4 packet received: {0}'. format(pkt_recv.__repr__())) rx_dscp = pkt_recv[IP].tos >> 2 if rx_dscp != dscp: raise RuntimeError('Invalid DSCP {0} should be {1}'. format(rx_dscp, dscp)) if not pkt_recv.haslayer(TCP): raise RuntimeError('Not a TCP packet received: {0}'. format(pkt_recv.__repr__())) def check_ipv6(pkt_recv, dscp): """Check received IPv6 IPsec packet. :param pkt_recv: Received packet to verify. :param dscp: DSCP value to check. :type pkt_recv: scapy.Ether :type dscp: int :raises RuntimeError: If received packet is invalid. """ if not pkt_recv.haslayer(IPv6): raise RuntimeError('Not an IPv6 packet received: {0}'. format(pkt_recv.__repr__())) rx_dscp = pkt_recv[IPv6].tc >> 2 if rx_dscp != dscp: raise RuntimeError('Invalid DSCP {0} should be {1}'. format(rx_dscp, dscp)) if not pkt_recv.haslayer(TCP): raise RuntimeError('Not a TCP packet received: {0}'. format(pkt_recv.__repr__())) # pylint: disable=too-many-locals # pylint: disable=too-many-statements def main(): """Send and receive TCP packet.""" args = TrafficScriptArg(['src_mac', 'dst_mac', 'src_ip', 'dst_ip', 'dscp']) rxq = RxQueue(args.get_arg('rx_if')) txq = TxQueue(args.get_arg('tx_if')) src_mac = args.get_arg('src_mac') dst_mac = args.get_arg('dst_mac') src_ip = args.get_arg('src_ip') dst_ip = args.get_arg('dst_ip') dscp = int(args.get_arg('dscp')) if 6 == ip_address(unicode(src_ip)).version: is_ipv4 = False else: is_ipv4 = True sent_packets = [] if is_ipv4: ip_pkt = (IP(src=src_ip, dst=dst_ip) / TCP()) else: ip_pkt = (IPv6(src=src_ip, dst=dst_ip) / TCP()) pkt_send = (Ether(src=src_mac, dst=dst_mac) / ip_pkt) sent_packets.append(pkt_send) txq.send(pkt_send) while True: pkt_recv = rxq.recv(2, sent_packets) if pkt_recv is None: raise RuntimeError('ICMPv6 echo reply Rx timeout') if pkt_recv.haslayer(ICMPv6ND_NS): # read another packet in the queue if the current one is ICMPv6ND_NS continue else: # otherwise process the current packet break if pkt_recv is None: raise RuntimeError('Rx timeout') if is_ipv4: check_ipv4(pkt_recv, dscp) else: check_ipv6(pkt_recv, dscp) sys.exit(0) if __name__ == "__main__": main()