@@ -45,65 +45,63 @@ async def network_up(unet):
45
45
# +----+ .1 .2 +----+ .2 .3 +----+ .3 .4 +----+
46
46
# 10.0.0.0/24 10.0.1.0/24 10.0.2.0/24
47
47
48
+ PING_COUNT = 5
49
+ INIT_DELAY = 100000
50
+
48
51
49
52
async def test_net_up (unet , astepf ):
50
53
await astepf ("Before test network up" )
51
54
await _test_net_up (unet , ipv6 = True )
52
55
53
56
54
- async def do_ping (h1 , astepf ):
55
- count = 3000
56
-
57
- await astepf ("first IPv6 ping" )
58
- logging .debug (h1 .cmd_raises ("ping -c1 fc00:0:0:2::4" ))
59
- await astepf (f"flood { count } IPv6 ping" )
60
- logging .debug (h1 .cmd_raises (f"ping -f -c{ count } fc00:0:0:2::4" ))
57
+ async def do_ping (host , dest4 , dest6 , astepf ):
58
+ count = PING_COUNT
61
59
62
- await astepf ("first IPv4 ping" )
63
- logging .debug (h1 .cmd_raises ("ping -c1 10.0.2.4" ))
64
60
await astepf (f"flood { count } IPv4 ping" )
65
- logging .debug (h1 .cmd_raises (f"ping -f -c{ count } 10.0.2.4 " ))
61
+ logging .debug (host .cmd_raises (f"ping -q -n -s 8 -f -c{ count } { dest4 } " ))
66
62
63
+ await astepf (f"flood { count } IPv6 ping" )
64
+ logging .debug (host .cmd_raises (f"ping -q -n -s 8 -f -c{ count } { dest6 } " ))
67
65
68
- async def test_policy_tun4_up (unet , astepf , pytestconfig ):
69
- h1 = unet .hosts ["h1" ]
70
66
71
- opts = pytestconfig .getoption ("--iptfs-opts" , "dont-frag" )
67
+ @pytest .mark .parametrize ("tun_ipv6" , [False , True ])
68
+ async def test_policy_tun_agg (unet , astepf , tun_ipv6 ):
72
69
await setup_policy_tun (
73
- unet , mode = "iptfs" , iptfs_opts = opts , ipv6 = True , tun_ipv6 = False
70
+ unet ,
71
+ mode = "iptfs" ,
72
+ iptfs_opts = f"init-delay { INIT_DELAY } " ,
73
+ ipv6 = True ,
74
+ tun_ipv6 = tun_ipv6 ,
74
75
)
75
76
76
- await do_ping (h1 , astepf )
77
+ await do_ping (unet .hosts ["r1" ], "10.0.1.3" , "fc00:0:0:1::3" , astepf )
78
+ await do_ping (unet .hosts ["h1" ], "10.0.2.4" , "fc00:0:0:2::4" , astepf )
77
79
80
+ # Now validate that we have sent and received exactly 8 ESP packets
81
+ base = "fc00:0:0:1::" if tun_ipv6 else "10.0.1."
82
+ o = unet .hosts ["r1" ].cmd_raises (f"ip x s l src { base } 2" )
83
+ assert " oseq 0x4" in o
84
+ o = unet .hosts ["r1" ].cmd_raises (f"ip x s l src { base } 3" )
85
+ assert " seq 0x4" in o
78
86
79
- async def test_routed_tun4_up (unet , astepf , pytestconfig ):
80
- h1 = unet .hosts ["h1" ]
81
87
82
- opts = pytestconfig .getoption ("--iptfs-opts" , "" )
88
+ @pytest .mark .parametrize ("tun_ipv6" , [False , True ])
89
+ async def test_routed_tun_agg (unet , astepf , tun_ipv6 ):
83
90
await setup_routed_tun (
84
- unet , mode = "iptfs" , iptfs_opts = opts , ipv6 = True , tun_ipv6 = False
91
+ unet ,
92
+ mode = "iptfs" ,
93
+ esp_flags = "esn" ,
94
+ iptfs_opts = f"init-delay { INIT_DELAY } " ,
95
+ ipv6 = True ,
96
+ tun_ipv6 = tun_ipv6 ,
85
97
)
86
98
87
- await do_ping (h1 , astepf )
88
-
89
-
90
- async def test_policy_tun6_up (unet , astepf , pytestconfig ):
91
- h1 = unet .hosts ["h1" ]
92
-
93
- opts = pytestconfig .getoption ("--iptfs-opts" , "dont-frag" )
94
- await setup_policy_tun (
95
- unet , mode = "iptfs" , iptfs_opts = opts , ipv6 = True , tun_ipv6 = True
96
- )
97
-
98
- await do_ping (h1 , astepf )
99
-
100
-
101
- async def test_routed_tun6_up (unet , astepf , pytestconfig ):
102
- h1 = unet .hosts ["h1" ]
103
-
104
- opts = pytestconfig .getoption ("--iptfs-opts" , "" )
105
- await setup_routed_tun (
106
- unet , mode = "iptfs" , iptfs_opts = opts , ipv6 = True , tun_ipv6 = True
107
- )
99
+ # We don't have routes setup for local originated pings
100
+ await do_ping (unet .hosts ["h1" ], "10.0.2.4" , "fc00:0:0:2::4" , astepf )
108
101
109
- await do_ping (h1 , astepf )
102
+ # Now validate that we have sent and received exactly 8 ESP packets
103
+ base = "fc00:0:0:1::" if tun_ipv6 else "10.0.1."
104
+ o = unet .hosts ["r1" ].cmd_raises (f"ip x s l src { base } 2" )
105
+ assert " oseq 0x2" in o
106
+ o = unet .hosts ["r1" ].cmd_raises (f"ip x s l src { base } 3" )
107
+ assert " seq 0x2" in o
0 commit comments