1 #!/bin/bash 1 #!/bin/bash 2 # SPDX-License-Identifier: GPL-2.0+ 2 # SPDX-License-Identifier: GPL-2.0+ 3 # 3 # 4 # Author: Justin Iurman <justin.iurman@uliege.b 4 # Author: Justin Iurman <justin.iurman@uliege.be> 5 # 5 # 6 # This script evaluates the IOAM insertion for 6 # This script evaluates the IOAM insertion for IPv6 by checking the IOAM data 7 # consistency directly inside packets on the r 7 # consistency directly inside packets on the receiver side. Tests are divided 8 # into three categories: OUTPUT (evaluates the 8 # into three categories: OUTPUT (evaluates the IOAM processing by the sender), 9 # INPUT (evaluates the IOAM processing by a re 9 # INPUT (evaluates the IOAM processing by a receiver) and GLOBAL (evaluates 10 # wider use cases that do not fall into the ot 10 # wider use cases that do not fall into the other two categories). Both OUTPUT 11 # and INPUT tests only use a two-node topology 11 # and INPUT tests only use a two-node topology (alpha and beta), while GLOBAL 12 # tests use the entire three-node topology (al 12 # tests use the entire three-node topology (alpha, beta, gamma). Each test is 13 # documented inside its own handler in the cod 13 # documented inside its own handler in the code below. 14 # 14 # 15 # An IOAM domain is configured from Alpha to G 15 # An IOAM domain is configured from Alpha to Gamma but not on the reverse path. 16 # When either Beta or Gamma is the destination 16 # When either Beta or Gamma is the destination (depending on the test category), 17 # Alpha adds an IOAM option (Pre-allocated Tra 17 # Alpha adds an IOAM option (Pre-allocated Trace) inside a Hop-by-hop. 18 # 18 # 19 # 19 # 20 # +-------------------+ 20 # +-------------------+ +-------------------+ 21 # | | 21 # | | | | 22 # | Alpha netns | 22 # | Alpha netns | | Gamma netns | 23 # | | 23 # | | | | 24 # | +-------------+ | 24 # | +-------------+ | | +-------------+ | 25 # | | veth0 | | 25 # | | veth0 | | | | veth0 | | 26 # | | db01::2/64 | | 26 # | | db01::2/64 | | | | db02::2/64 | | 27 # | +-------------+ | 27 # | +-------------+ | | +-------------+ | 28 # | . | 28 # | . | | . | 29 # +-------------------+ 29 # +-------------------+ +-------------------+ 30 # . 30 # . . 31 # . 31 # . . 32 # . 32 # . . 33 # +-------------------------------- 33 # +----------------------------------------------------+ 34 # | . 34 # | . . | 35 # | +-------------+ 35 # | +-------------+ +-------------+ | 36 # | | veth0 | 36 # | | veth0 | | veth1 | | 37 # | | db01::1/64 | .............. 37 # | | db01::1/64 | ................ | db02::1/64 | | 38 # | +-------------+ 38 # | +-------------+ +-------------+ | 39 # | 39 # | | 40 # | Beta netns 40 # | Beta netns | 41 # | 41 # | | 42 # +-------------------------------- 42 # +----------------------------------------------------+ 43 # 43 # 44 # 44 # 45 # 45 # 46 # ===================================== 46 # ============================================================= 47 # | Alpha - IOAM configu 47 # | Alpha - IOAM configuration | 48 # +==================================== 48 # +===========================================================+ 49 # | Node ID | 1 49 # | Node ID | 1 | 50 # +------------------------------------ 50 # +-----------------------------------------------------------+ 51 # | Node Wide ID | 11111111 51 # | Node Wide ID | 11111111 | 52 # +------------------------------------ 52 # +-----------------------------------------------------------+ 53 # | Ingress ID | 0xffff (defau 53 # | Ingress ID | 0xffff (default value) | 54 # +------------------------------------ 54 # +-----------------------------------------------------------+ 55 # | Ingress Wide ID | 0xffffffff (d 55 # | Ingress Wide ID | 0xffffffff (default value) | 56 # +------------------------------------ 56 # +-----------------------------------------------------------+ 57 # | Egress ID | 101 57 # | Egress ID | 101 | 58 # +------------------------------------ 58 # +-----------------------------------------------------------+ 59 # | Egress Wide ID | 101101 59 # | Egress Wide ID | 101101 | 60 # +------------------------------------ 60 # +-----------------------------------------------------------+ 61 # | Namespace Data | 0xdeadbee0 61 # | Namespace Data | 0xdeadbee0 | 62 # +------------------------------------ 62 # +-----------------------------------------------------------+ 63 # | Namespace Wide Data | 0xcafec0caf00 63 # | Namespace Wide Data | 0xcafec0caf00dc0de | 64 # +------------------------------------ 64 # +-----------------------------------------------------------+ 65 # | Schema ID | 777 65 # | Schema ID | 777 | 66 # +------------------------------------ 66 # +-----------------------------------------------------------+ 67 # | Schema Data | something tha 67 # | Schema Data | something that will be 4n-aligned | 68 # +------------------------------------ 68 # +-----------------------------------------------------------+ 69 # 69 # 70 # 70 # 71 # ===================================== 71 # ============================================================= 72 # | Beta - IOAM configu 72 # | Beta - IOAM configuration | 73 # +==================================== 73 # +===========================================================+ 74 # | Node ID | 2 74 # | Node ID | 2 | 75 # +------------------------------------ 75 # +-----------------------------------------------------------+ 76 # | Node Wide ID | 22222222 76 # | Node Wide ID | 22222222 | 77 # +------------------------------------ 77 # +-----------------------------------------------------------+ 78 # | Ingress ID | 201 78 # | Ingress ID | 201 | 79 # +------------------------------------ 79 # +-----------------------------------------------------------+ 80 # | Ingress Wide ID | 201201 80 # | Ingress Wide ID | 201201 | 81 # +------------------------------------ 81 # +-----------------------------------------------------------+ 82 # | Egress ID | 202 82 # | Egress ID | 202 | 83 # +------------------------------------ 83 # +-----------------------------------------------------------+ 84 # | Egress Wide ID | 202202 84 # | Egress Wide ID | 202202 | 85 # +------------------------------------ 85 # +-----------------------------------------------------------+ 86 # | Namespace Data | 0xdeadbee1 86 # | Namespace Data | 0xdeadbee1 | 87 # +------------------------------------ 87 # +-----------------------------------------------------------+ 88 # | Namespace Wide Data | 0xcafec0caf11 88 # | Namespace Wide Data | 0xcafec0caf11dc0de | 89 # +------------------------------------ 89 # +-----------------------------------------------------------+ 90 # | Schema ID | 666 90 # | Schema ID | 666 | 91 # +------------------------------------ 91 # +-----------------------------------------------------------+ 92 # | Schema Data | Hello there - 92 # | Schema Data | Hello there -Obi | 93 # +------------------------------------ 93 # +-----------------------------------------------------------+ 94 # 94 # 95 # 95 # 96 # ===================================== 96 # ============================================================= 97 # | Gamma - IOAM configu 97 # | Gamma - IOAM configuration | 98 # +==================================== 98 # +===========================================================+ 99 # | Node ID | 3 99 # | Node ID | 3 | 100 # +------------------------------------ 100 # +-----------------------------------------------------------+ 101 # | Node Wide ID | 33333333 101 # | Node Wide ID | 33333333 | 102 # +------------------------------------ 102 # +-----------------------------------------------------------+ 103 # | Ingress ID | 301 103 # | Ingress ID | 301 | 104 # +------------------------------------ 104 # +-----------------------------------------------------------+ 105 # | Ingress Wide ID | 301301 105 # | Ingress Wide ID | 301301 | 106 # +------------------------------------ 106 # +-----------------------------------------------------------+ 107 # | Egress ID | 0xffff (defau 107 # | Egress ID | 0xffff (default value) | 108 # +------------------------------------ 108 # +-----------------------------------------------------------+ 109 # | Egress Wide ID | 0xffffffff (d 109 # | Egress Wide ID | 0xffffffff (default value) | 110 # +------------------------------------ 110 # +-----------------------------------------------------------+ 111 # | Namespace Data | 0xdeadbee2 111 # | Namespace Data | 0xdeadbee2 | 112 # +------------------------------------ 112 # +-----------------------------------------------------------+ 113 # | Namespace Wide Data | 0xcafec0caf22 113 # | Namespace Wide Data | 0xcafec0caf22dc0de | 114 # +------------------------------------ 114 # +-----------------------------------------------------------+ 115 # | Schema ID | 0xffffff (= N 115 # | Schema ID | 0xffffff (= None) | 116 # +------------------------------------ 116 # +-----------------------------------------------------------+ 117 # | Schema Data | 117 # | Schema Data | | 118 # +------------------------------------ 118 # +-----------------------------------------------------------+ 119 119 120 source lib.sh !! 120 # Kselftest framework requirement - SKIP code is 4. >> 121 ksft_skip=4 121 122 122 ############################################## 123 ################################################################################ 123 # 124 # # 124 # WARNING: Be careful if you modify the block 125 # WARNING: Be careful if you modify the block below - it MUST be kept # 125 # synchronized with configurations in 126 # synchronized with configurations inside ioam6_parser.c and always # 126 # reflect the same. 127 # reflect the same. # 127 # 128 # # 128 ############################################## 129 ################################################################################ 129 130 130 ALPHA=( 131 ALPHA=( 131 1 132 1 # ID 132 11111111 133 11111111 # Wide ID 133 0xffff 134 0xffff # Ingress ID 134 0xffffffff 135 0xffffffff # Ingress Wide ID 135 101 136 101 # Egress ID 136 101101 137 101101 # Egress Wide ID 137 0xdeadbee0 138 0xdeadbee0 # Namespace Data 138 0xcafec0caf00dc0de 139 0xcafec0caf00dc0de # Namespace Wide Data 139 777 140 777 # Schema ID (0xffffff = None) 140 "something that will be 4n-aligned" 141 "something that will be 4n-aligned" # Schema Data 141 ) 142 ) 142 143 143 BETA=( 144 BETA=( 144 2 145 2 145 22222222 146 22222222 146 201 147 201 147 201201 148 201201 148 202 149 202 149 202202 150 202202 150 0xdeadbee1 151 0xdeadbee1 151 0xcafec0caf11dc0de 152 0xcafec0caf11dc0de 152 666 153 666 153 "Hello there -Obi" 154 "Hello there -Obi" 154 ) 155 ) 155 156 156 GAMMA=( 157 GAMMA=( 157 3 158 3 158 33333333 159 33333333 159 301 160 301 160 301301 161 301301 161 0xffff 162 0xffff 162 0xffffffff 163 0xffffffff 163 0xdeadbee2 164 0xdeadbee2 164 0xcafec0caf22dc0de 165 0xcafec0caf22dc0de 165 0xffffff 166 0xffffff 166 "" 167 "" 167 ) 168 ) 168 169 169 TESTS_OUTPUT=" 170 TESTS_OUTPUT=" 170 out_undef_ns 171 out_undef_ns 171 out_no_room 172 out_no_room 172 out_bits 173 out_bits 173 out_full_supp_trace 174 out_full_supp_trace 174 " 175 " 175 176 176 TESTS_INPUT=" 177 TESTS_INPUT=" 177 in_undef_ns 178 in_undef_ns 178 in_no_room 179 in_no_room 179 in_oflag 180 in_oflag 180 in_bits 181 in_bits 181 in_full_supp_trace 182 in_full_supp_trace 182 " 183 " 183 184 184 TESTS_GLOBAL=" 185 TESTS_GLOBAL=" 185 fwd_full_supp_trace 186 fwd_full_supp_trace 186 " 187 " 187 188 188 189 189 ############################################## 190 ################################################################################ 190 # 191 # # 191 # LIBRARY 192 # LIBRARY # 192 # 193 # # 193 ############################################## 194 ################################################################################ 194 195 195 check_kernel_compatibility() 196 check_kernel_compatibility() 196 { 197 { 197 setup_ns ioam_tmp_node !! 198 ip netns add ioam-tmp-node 198 ip link add name veth0 netns $ioam_tmp_node !! 199 ip link add name veth0 netns ioam-tmp-node type veth \ 199 peer name veth1 netns $ioam_tmp_node !! 200 peer name veth1 netns ioam-tmp-node 200 201 201 ip -netns $ioam_tmp_node link set veth0 up !! 202 ip -netns ioam-tmp-node link set veth0 up 202 ip -netns $ioam_tmp_node link set veth1 up !! 203 ip -netns ioam-tmp-node link set veth1 up 203 204 204 ip -netns $ioam_tmp_node ioam namespace add !! 205 ip -netns ioam-tmp-node ioam namespace add 0 205 ns_ad=$? 206 ns_ad=$? 206 207 207 ip -netns $ioam_tmp_node ioam namespace show !! 208 ip -netns ioam-tmp-node ioam namespace show | grep -q "namespace 0" 208 ns_sh=$? 209 ns_sh=$? 209 210 210 if [[ $ns_ad != 0 || $ns_sh != 0 ]] 211 if [[ $ns_ad != 0 || $ns_sh != 0 ]] 211 then 212 then 212 echo "SKIP: kernel version probably too ol 213 echo "SKIP: kernel version probably too old, missing ioam support" 213 ip link del veth0 2>/dev/null || true 214 ip link del veth0 2>/dev/null || true 214 cleanup_ns $ioam_tmp_node || true !! 215 ip netns del ioam-tmp-node || true 215 exit $ksft_skip 216 exit $ksft_skip 216 fi 217 fi 217 218 218 ip -netns $ioam_tmp_node route add db02::/64 !! 219 ip -netns ioam-tmp-node route add db02::/64 encap ioam6 mode inline \ 219 trace prealloc type 0x800000 ns 0 siz 220 trace prealloc type 0x800000 ns 0 size 4 dev veth0 220 tr_ad=$? 221 tr_ad=$? 221 222 222 ip -netns $ioam_tmp_node -6 route | grep -q !! 223 ip -netns ioam-tmp-node -6 route | grep -q "encap ioam6" 223 tr_sh=$? 224 tr_sh=$? 224 225 225 if [[ $tr_ad != 0 || $tr_sh != 0 ]] 226 if [[ $tr_ad != 0 || $tr_sh != 0 ]] 226 then 227 then 227 echo "SKIP: cannot attach an ioam trace to 228 echo "SKIP: cannot attach an ioam trace to a route, did you compile" \ 228 "without CONFIG_IPV6_IOAM6_LWTUNNEL?" 229 "without CONFIG_IPV6_IOAM6_LWTUNNEL?" 229 ip link del veth0 2>/dev/null || true 230 ip link del veth0 2>/dev/null || true 230 cleanup_ns $ioam_tmp_node || true !! 231 ip netns del ioam-tmp-node || true 231 exit $ksft_skip 232 exit $ksft_skip 232 fi 233 fi 233 234 234 ip link del veth0 2>/dev/null || true 235 ip link del veth0 2>/dev/null || true 235 cleanup_ns $ioam_tmp_node || true !! 236 ip netns del ioam-tmp-node || true 236 237 237 lsmod | grep -q "ip6_tunnel" 238 lsmod | grep -q "ip6_tunnel" 238 ip6tnl_loaded=$? 239 ip6tnl_loaded=$? 239 240 240 if [ $ip6tnl_loaded = 0 ] 241 if [ $ip6tnl_loaded = 0 ] 241 then 242 then 242 encap_tests=0 243 encap_tests=0 243 else 244 else 244 modprobe ip6_tunnel &>/dev/null 245 modprobe ip6_tunnel &>/dev/null 245 lsmod | grep -q "ip6_tunnel" 246 lsmod | grep -q "ip6_tunnel" 246 encap_tests=$? 247 encap_tests=$? 247 248 248 if [ $encap_tests != 0 ] 249 if [ $encap_tests != 0 ] 249 then 250 then 250 ip a | grep -q "ip6tnl0" 251 ip a | grep -q "ip6tnl0" 251 encap_tests=$? 252 encap_tests=$? 252 253 253 if [ $encap_tests != 0 ] 254 if [ $encap_tests != 0 ] 254 then 255 then 255 echo "Note: ip6_tunnel not found neith 256 echo "Note: ip6_tunnel not found neither as a module nor inside the" \ 256 "kernel, tests that require it (e 257 "kernel, tests that require it (encap mode) will be omitted" 257 fi 258 fi 258 fi 259 fi 259 fi 260 fi 260 } 261 } 261 262 262 cleanup() 263 cleanup() 263 { 264 { 264 ip link del ioam-veth-alpha 2>/dev/null || t 265 ip link del ioam-veth-alpha 2>/dev/null || true 265 ip link del ioam-veth-gamma 2>/dev/null || t 266 ip link del ioam-veth-gamma 2>/dev/null || true 266 267 267 cleanup_ns $ioam_node_alpha $ioam_node_beta !! 268 ip netns del ioam-node-alpha || true >> 269 ip netns del ioam-node-beta || true >> 270 ip netns del ioam-node-gamma || true 268 271 269 if [ $ip6tnl_loaded != 0 ] 272 if [ $ip6tnl_loaded != 0 ] 270 then 273 then 271 modprobe -r ip6_tunnel 2>/dev/null || true 274 modprobe -r ip6_tunnel 2>/dev/null || true 272 fi 275 fi 273 } 276 } 274 277 275 setup() 278 setup() 276 { 279 { 277 setup_ns ioam_node_alpha ioam_node_beta ioam !! 280 ip netns add ioam-node-alpha 278 !! 281 ip netns add ioam-node-beta 279 ip link add name ioam-veth-alpha netns $ioam !! 282 ip netns add ioam-node-gamma 280 peer name ioam-veth-betaL netns $ioam !! 283 281 ip link add name ioam-veth-betaR netns $ioam !! 284 ip link add name ioam-veth-alpha netns ioam-node-alpha type veth \ 282 peer name ioam-veth-gamma netns $ioam !! 285 peer name ioam-veth-betaL netns ioam-node-beta 283 !! 286 ip link add name ioam-veth-betaR netns ioam-node-beta type veth \ 284 ip -netns $ioam_node_alpha link set ioam-vet !! 287 peer name ioam-veth-gamma netns ioam-node-gamma 285 ip -netns $ioam_node_beta link set ioam-veth !! 288 286 ip -netns $ioam_node_beta link set ioam-veth !! 289 ip -netns ioam-node-alpha link set ioam-veth-alpha name veth0 287 ip -netns $ioam_node_gamma link set ioam-vet !! 290 ip -netns ioam-node-beta link set ioam-veth-betaL name veth0 288 !! 291 ip -netns ioam-node-beta link set ioam-veth-betaR name veth1 289 ip -netns $ioam_node_alpha addr add db01::2/ !! 292 ip -netns ioam-node-gamma link set ioam-veth-gamma name veth0 290 ip -netns $ioam_node_alpha link set veth0 up !! 293 291 ip -netns $ioam_node_alpha link set lo up !! 294 ip -netns ioam-node-alpha addr add db01::2/64 dev veth0 292 ip -netns $ioam_node_alpha route add db02::/ !! 295 ip -netns ioam-node-alpha link set veth0 up 293 ip -netns $ioam_node_alpha route del db01::/ !! 296 ip -netns ioam-node-alpha link set lo up 294 ip -netns $ioam_node_alpha route add db01::/ !! 297 ip -netns ioam-node-alpha route add db02::/64 via db01::1 dev veth0 295 !! 298 ip -netns ioam-node-alpha route del db01::/64 296 ip -netns $ioam_node_beta addr add db01::1/6 !! 299 ip -netns ioam-node-alpha route add db01::/64 dev veth0 297 ip -netns $ioam_node_beta addr add db02::1/6 !! 300 298 ip -netns $ioam_node_beta link set veth0 up !! 301 ip -netns ioam-node-beta addr add db01::1/64 dev veth0 299 ip -netns $ioam_node_beta link set veth1 up !! 302 ip -netns ioam-node-beta addr add db02::1/64 dev veth1 300 ip -netns $ioam_node_beta link set lo up !! 303 ip -netns ioam-node-beta link set veth0 up 301 !! 304 ip -netns ioam-node-beta link set veth1 up 302 ip -netns $ioam_node_gamma addr add db02::2/ !! 305 ip -netns ioam-node-beta link set lo up 303 ip -netns $ioam_node_gamma link set veth0 up !! 306 304 ip -netns $ioam_node_gamma link set lo up !! 307 ip -netns ioam-node-gamma addr add db02::2/64 dev veth0 305 ip -netns $ioam_node_gamma route add db01::/ !! 308 ip -netns ioam-node-gamma link set veth0 up >> 309 ip -netns ioam-node-gamma link set lo up >> 310 ip -netns ioam-node-gamma route add db01::/64 via db02::1 dev veth0 306 311 307 # - IOAM config - 312 # - IOAM config - 308 ip netns exec $ioam_node_alpha sysctl -wq ne !! 313 ip netns exec ioam-node-alpha sysctl -wq net.ipv6.ioam6_id=${ALPHA[0]} 309 ip netns exec $ioam_node_alpha sysctl -wq ne !! 314 ip netns exec ioam-node-alpha sysctl -wq net.ipv6.ioam6_id_wide=${ALPHA[1]} 310 ip netns exec $ioam_node_alpha sysctl -wq ne !! 315 ip netns exec ioam-node-alpha sysctl -wq net.ipv6.conf.veth0.ioam6_id=${ALPHA[4]} 311 ip netns exec $ioam_node_alpha sysctl -wq ne !! 316 ip netns exec ioam-node-alpha sysctl -wq net.ipv6.conf.veth0.ioam6_id_wide=${ALPHA[5]} 312 ip -netns $ioam_node_alpha ioam namespace ad !! 317 ip -netns ioam-node-alpha ioam namespace add 123 data ${ALPHA[6]} wide ${ALPHA[7]} 313 ip -netns $ioam_node_alpha ioam schema add $ !! 318 ip -netns ioam-node-alpha ioam schema add ${ALPHA[8]} "${ALPHA[9]}" 314 ip -netns $ioam_node_alpha ioam namespace se !! 319 ip -netns ioam-node-alpha ioam namespace set 123 schema ${ALPHA[8]} 315 !! 320 316 ip netns exec $ioam_node_beta sysctl -wq net !! 321 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.all.forwarding=1 317 ip netns exec $ioam_node_beta sysctl -wq net !! 322 ip netns exec ioam-node-beta sysctl -wq net.ipv6.ioam6_id=${BETA[0]} 318 ip netns exec $ioam_node_beta sysctl -wq net !! 323 ip netns exec ioam-node-beta sysctl -wq net.ipv6.ioam6_id_wide=${BETA[1]} 319 ip netns exec $ioam_node_beta sysctl -wq net !! 324 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth0.ioam6_enabled=1 320 ip netns exec $ioam_node_beta sysctl -wq net !! 325 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth0.ioam6_id=${BETA[2]} 321 ip netns exec $ioam_node_beta sysctl -wq net !! 326 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth0.ioam6_id_wide=${BETA[3]} 322 ip netns exec $ioam_node_beta sysctl -wq net !! 327 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth1.ioam6_id=${BETA[4]} 323 ip netns exec $ioam_node_beta sysctl -wq net !! 328 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth1.ioam6_id_wide=${BETA[5]} 324 ip -netns $ioam_node_beta ioam namespace add !! 329 ip -netns ioam-node-beta ioam namespace add 123 data ${BETA[6]} wide ${BETA[7]} 325 ip -netns $ioam_node_beta ioam schema add ${ !! 330 ip -netns ioam-node-beta ioam schema add ${BETA[8]} "${BETA[9]}" 326 ip -netns $ioam_node_beta ioam namespace set !! 331 ip -netns ioam-node-beta ioam namespace set 123 schema ${BETA[8]} 327 !! 332 328 ip netns exec $ioam_node_gamma sysctl -wq ne !! 333 ip netns exec ioam-node-gamma sysctl -wq net.ipv6.ioam6_id=${GAMMA[0]} 329 ip netns exec $ioam_node_gamma sysctl -wq ne !! 334 ip netns exec ioam-node-gamma sysctl -wq net.ipv6.ioam6_id_wide=${GAMMA[1]} 330 ip netns exec $ioam_node_gamma sysctl -wq ne !! 335 ip netns exec ioam-node-gamma sysctl -wq net.ipv6.conf.veth0.ioam6_enabled=1 331 ip netns exec $ioam_node_gamma sysctl -wq ne !! 336 ip netns exec ioam-node-gamma sysctl -wq net.ipv6.conf.veth0.ioam6_id=${GAMMA[2]} 332 ip netns exec $ioam_node_gamma sysctl -wq ne !! 337 ip netns exec ioam-node-gamma sysctl -wq net.ipv6.conf.veth0.ioam6_id_wide=${GAMMA[3]} 333 ip -netns $ioam_node_gamma ioam namespace ad !! 338 ip -netns ioam-node-gamma ioam namespace add 123 data ${GAMMA[6]} wide ${GAMMA[7]} 334 339 335 sleep 1 340 sleep 1 336 341 337 ip netns exec $ioam_node_alpha ping6 -c 5 -W !! 342 ip netns exec ioam-node-alpha ping6 -c 5 -W 1 db02::2 &>/dev/null 338 if [ $? != 0 ] 343 if [ $? != 0 ] 339 then 344 then 340 echo "Setup FAILED" 345 echo "Setup FAILED" 341 cleanup &>/dev/null 346 cleanup &>/dev/null 342 exit 0 347 exit 0 343 fi 348 fi 344 } 349 } 345 350 346 log_test_passed() 351 log_test_passed() 347 { 352 { 348 local desc=$1 353 local desc=$1 349 printf "TEST: %-60s [ OK ]\n" "${desc}" 354 printf "TEST: %-60s [ OK ]\n" "${desc}" 350 } 355 } 351 356 352 log_test_failed() 357 log_test_failed() 353 { 358 { 354 local desc=$1 359 local desc=$1 355 printf "TEST: %-60s [FAIL]\n" "${desc}" 360 printf "TEST: %-60s [FAIL]\n" "${desc}" 356 } 361 } 357 362 358 log_results() 363 log_results() 359 { 364 { 360 echo "- Tests passed: ${npassed}" 365 echo "- Tests passed: ${npassed}" 361 echo "- Tests failed: ${nfailed}" 366 echo "- Tests failed: ${nfailed}" 362 } 367 } 363 368 364 run_test() 369 run_test() 365 { 370 { 366 local name=$1 371 local name=$1 367 local desc=$2 372 local desc=$2 368 local node_src=$3 373 local node_src=$3 369 local node_dst=$4 374 local node_dst=$4 370 local ip6_dst=$5 !! 375 local ip6_src=$5 371 local trace_type=$6 !! 376 local ip6_dst=$6 372 local ioam_ns=$7 !! 377 local if_dst=$7 373 local type=$8 !! 378 local trace_type=$8 >> 379 local ioam_ns=$9 374 380 375 ip netns exec $node_dst ./ioam6_parser $name !! 381 ip netns exec $node_dst ./ioam6_parser $if_dst $name $ip6_src $ip6_dst \ >> 382 $trace_type $ioam_ns & 376 local spid=$! 383 local spid=$! 377 sleep 0.1 384 sleep 0.1 378 385 379 ip netns exec $node_src ping6 -t 64 -c 1 -W 386 ip netns exec $node_src ping6 -t 64 -c 1 -W 1 $ip6_dst &>/dev/null 380 if [ $? != 0 ] 387 if [ $? != 0 ] 381 then 388 then 382 nfailed=$((nfailed+1)) 389 nfailed=$((nfailed+1)) 383 log_test_failed "${desc}" 390 log_test_failed "${desc}" 384 kill -2 $spid &>/dev/null 391 kill -2 $spid &>/dev/null 385 else 392 else 386 wait $spid 393 wait $spid 387 if [ $? = 0 ] 394 if [ $? = 0 ] 388 then 395 then 389 npassed=$((npassed+1)) 396 npassed=$((npassed+1)) 390 log_test_passed "${desc}" 397 log_test_passed "${desc}" 391 else 398 else 392 nfailed=$((nfailed+1)) 399 nfailed=$((nfailed+1)) 393 log_test_failed "${desc}" 400 log_test_failed "${desc}" 394 fi 401 fi 395 fi 402 fi 396 } 403 } 397 404 398 run() 405 run() 399 { 406 { 400 echo 407 echo 401 printf "%0.s-" {1..74} 408 printf "%0.s-" {1..74} 402 echo 409 echo 403 echo "OUTPUT tests" 410 echo "OUTPUT tests" 404 printf "%0.s-" {1..74} 411 printf "%0.s-" {1..74} 405 echo 412 echo 406 413 407 # set OUTPUT settings 414 # set OUTPUT settings 408 ip netns exec $ioam_node_beta sysctl -wq net !! 415 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth0.ioam6_enabled=0 409 416 410 for t in $TESTS_OUTPUT 417 for t in $TESTS_OUTPUT 411 do 418 do 412 $t "inline" 419 $t "inline" 413 [ $encap_tests = 0 ] && $t "encap" 420 [ $encap_tests = 0 ] && $t "encap" 414 done 421 done 415 422 416 # clean OUTPUT settings 423 # clean OUTPUT settings 417 ip netns exec $ioam_node_beta sysctl -wq net !! 424 ip netns exec ioam-node-beta sysctl -wq net.ipv6.conf.veth0.ioam6_enabled=1 418 ip -netns $ioam_node_alpha route change db01 !! 425 ip -netns ioam-node-alpha route change db01::/64 dev veth0 419 426 420 427 421 echo 428 echo 422 printf "%0.s-" {1..74} 429 printf "%0.s-" {1..74} 423 echo 430 echo 424 echo "INPUT tests" 431 echo "INPUT tests" 425 printf "%0.s-" {1..74} 432 printf "%0.s-" {1..74} 426 echo 433 echo 427 434 428 # set INPUT settings 435 # set INPUT settings 429 ip -netns $ioam_node_alpha ioam namespace de !! 436 ip -netns ioam-node-alpha ioam namespace del 123 430 437 431 for t in $TESTS_INPUT 438 for t in $TESTS_INPUT 432 do 439 do 433 $t "inline" 440 $t "inline" 434 [ $encap_tests = 0 ] && $t "encap" 441 [ $encap_tests = 0 ] && $t "encap" 435 done 442 done 436 443 437 # clean INPUT settings 444 # clean INPUT settings 438 ip -netns $ioam_node_alpha ioam namespace ad !! 445 ip -netns ioam-node-alpha ioam namespace add 123 \ 439 data ${ALPHA[6]} wide ${ALPHA[7]} 446 data ${ALPHA[6]} wide ${ALPHA[7]} 440 ip -netns $ioam_node_alpha ioam namespace se !! 447 ip -netns ioam-node-alpha ioam namespace set 123 schema ${ALPHA[8]} 441 ip -netns $ioam_node_alpha route change db01 !! 448 ip -netns ioam-node-alpha route change db01::/64 dev veth0 442 449 443 echo 450 echo 444 printf "%0.s-" {1..74} 451 printf "%0.s-" {1..74} 445 echo 452 echo 446 echo "GLOBAL tests" 453 echo "GLOBAL tests" 447 printf "%0.s-" {1..74} 454 printf "%0.s-" {1..74} 448 echo 455 echo 449 456 450 for t in $TESTS_GLOBAL 457 for t in $TESTS_GLOBAL 451 do 458 do 452 $t "inline" 459 $t "inline" 453 [ $encap_tests = 0 ] && $t "encap" 460 [ $encap_tests = 0 ] && $t "encap" 454 done 461 done 455 462 456 echo 463 echo 457 log_results 464 log_results 458 } 465 } 459 466 460 bit2type=( 467 bit2type=( 461 0x800000 0x400000 0x200000 0x100000 0x080000 468 0x800000 0x400000 0x200000 0x100000 0x080000 0x040000 0x020000 0x010000 462 0x008000 0x004000 0x002000 0x001000 0x000800 469 0x008000 0x004000 0x002000 0x001000 0x000800 0x000400 0x000200 0x000100 463 0x000080 0x000040 0x000020 0x000010 0x000008 470 0x000080 0x000040 0x000020 0x000010 0x000008 0x000004 0x000002 464 ) 471 ) 465 bit2size=( 4 4 4 4 4 4 4 4 8 8 8 4 4 4 4 4 4 4 472 bit2size=( 4 4 4 4 4 4 4 4 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 ) 466 473 467 474 468 ############################################## 475 ################################################################################ 469 # 476 # # 470 # OUTPUT tests 477 # OUTPUT tests # 471 # 478 # # 472 # Two nodes (sender/receiver), IOAM disabled 479 # Two nodes (sender/receiver), IOAM disabled on ingress for the receiver. # 473 ############################################## 480 ################################################################################ 474 481 475 out_undef_ns() 482 out_undef_ns() 476 { 483 { 477 ############################################ 484 ############################################################################## 478 # Make sure that the encap node won't fill t 485 # Make sure that the encap node won't fill the trace if the chosen IOAM # 479 # namespace is not configured locally. 486 # namespace is not configured locally. # 480 ############################################ 487 ############################################################################## 481 local desc="Unknown IOAM namespace" 488 local desc="Unknown IOAM namespace" 482 489 483 [ "$1" = "encap" ] && mode="$1 tundst db01:: 490 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 484 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 491 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 485 492 486 ip -netns $ioam_node_alpha route change db01 !! 493 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 487 trace prealloc type 0x800000 ns 0 siz 494 trace prealloc type 0x800000 ns 0 size 4 dev veth0 488 495 489 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 496 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 490 db01::1 0x800000 0 $1 !! 497 db01::2 db01::1 veth0 0x800000 0 491 498 492 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 499 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 493 } 500 } 494 501 495 out_no_room() 502 out_no_room() 496 { 503 { 497 ############################################ 504 ############################################################################## 498 # Make sure that the encap node won't fill t 505 # Make sure that the encap node won't fill the trace and will set the # 499 # Overflow flag since there is no room enoug 506 # Overflow flag since there is no room enough for its data. # 500 ############################################ 507 ############################################################################## 501 local desc="Missing trace room" 508 local desc="Missing trace room" 502 509 503 [ "$1" = "encap" ] && mode="$1 tundst db01:: 510 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 504 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 511 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 505 512 506 ip -netns $ioam_node_alpha route change db01 !! 513 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 507 trace prealloc type 0xc00000 ns 123 s 514 trace prealloc type 0xc00000 ns 123 size 4 dev veth0 508 515 509 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 516 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 510 db01::1 0xc00000 123 $1 !! 517 db01::2 db01::1 veth0 0xc00000 123 511 518 512 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 519 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 513 } 520 } 514 521 515 out_bits() 522 out_bits() 516 { 523 { 517 ############################################ 524 ############################################################################## 518 # Make sure that, for each trace type bit, t 525 # Make sure that, for each trace type bit, the encap node will either: # 519 # (i) fill the trace with its data when it 526 # (i) fill the trace with its data when it is a supported bit # 520 # (ii) not fill the trace with its data whe 527 # (ii) not fill the trace with its data when it is an unsupported bit # 521 ############################################ 528 ############################################################################## 522 local desc="Trace type with bit <n> only" 529 local desc="Trace type with bit <n> only" 523 530 524 local tmp=${bit2size[22]} 531 local tmp=${bit2size[22]} 525 bit2size[22]=$(( $tmp + ${#ALPHA[9]} + ((4 - 532 bit2size[22]=$(( $tmp + ${#ALPHA[9]} + ((4 - (${#ALPHA[9]} % 4)) % 4) )) 526 533 527 [ "$1" = "encap" ] && mode="$1 tundst db01:: 534 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 528 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 535 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 529 536 530 for i in {0..22} 537 for i in {0..22} 531 do 538 do 532 ip -netns $ioam_node_alpha route change db !! 539 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 533 trace prealloc type ${bit2type[$i]} 540 trace prealloc type ${bit2type[$i]} ns 123 size ${bit2size[$i]} \ 534 dev veth0 &>/dev/null 541 dev veth0 &>/dev/null 535 542 536 local cmd_res=$? 543 local cmd_res=$? 537 local descr="${desc/<n>/$i}" 544 local descr="${desc/<n>/$i}" 538 545 539 if [[ $i -ge 12 && $i -le 21 ]] 546 if [[ $i -ge 12 && $i -le 21 ]] 540 then 547 then 541 if [ $cmd_res != 0 ] 548 if [ $cmd_res != 0 ] 542 then 549 then 543 npassed=$((npassed+1)) 550 npassed=$((npassed+1)) 544 log_test_passed "$descr ($1 mode)" !! 551 log_test_passed "$descr" 545 else 552 else 546 nfailed=$((nfailed+1)) 553 nfailed=$((nfailed+1)) 547 log_test_failed "$descr ($1 mode)" !! 554 log_test_failed "$descr" 548 fi 555 fi 549 else 556 else 550 run_test "out_bit$i" "$descr ($1 mode) !! 557 run_test "out_bit$i" "$descr ($1 mode)" ioam-node-alpha \ 551 $ioam_node_beta db01::1 ${bit2type[ !! 558 ioam-node-beta db01::2 db01::1 veth0 ${bit2type[$i]} 123 552 fi 559 fi 553 done 560 done 554 561 555 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 562 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 556 563 557 bit2size[22]=$tmp 564 bit2size[22]=$tmp 558 } 565 } 559 566 560 out_full_supp_trace() 567 out_full_supp_trace() 561 { 568 { 562 ############################################ 569 ############################################################################## 563 # Make sure that the encap node will correct 570 # Make sure that the encap node will correctly fill a full trace. Be careful,# 564 # "full trace" here does NOT mean all bits ( 571 # "full trace" here does NOT mean all bits (only supported ones). # 565 ############################################ 572 ############################################################################## 566 local desc="Full supported trace" 573 local desc="Full supported trace" 567 574 568 [ "$1" = "encap" ] && mode="$1 tundst db01:: 575 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 569 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 576 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 570 577 571 ip -netns $ioam_node_alpha route change db01 !! 578 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 572 trace prealloc type 0xfff002 ns 123 s 579 trace prealloc type 0xfff002 ns 123 size 100 dev veth0 573 580 574 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 581 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 575 db01::1 0xfff002 123 $1 !! 582 db01::2 db01::1 veth0 0xfff002 123 576 583 577 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 584 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 578 } 585 } 579 586 580 587 581 ############################################## 588 ################################################################################ 582 # 589 # # 583 # INPUT tests 590 # INPUT tests # 584 # 591 # # 585 # Two nodes (sender/receiver), the sender 592 # Two nodes (sender/receiver), the sender MUST NOT fill the trace upon # 586 # insertion -> the IOAM namespace configur 593 # insertion -> the IOAM namespace configured on the sender is removed # 587 # and is used in the inserted trace to for 594 # and is used in the inserted trace to force the sender not to fill it. # 588 ############################################## 595 ################################################################################ 589 596 590 in_undef_ns() 597 in_undef_ns() 591 { 598 { 592 ############################################ 599 ############################################################################## 593 # Make sure that the receiving node won't fi 600 # Make sure that the receiving node won't fill the trace if the related IOAM # 594 # namespace is not configured locally. 601 # namespace is not configured locally. # 595 ############################################ 602 ############################################################################## 596 local desc="Unknown IOAM namespace" 603 local desc="Unknown IOAM namespace" 597 604 598 [ "$1" = "encap" ] && mode="$1 tundst db01:: 605 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 599 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 606 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 600 607 601 ip -netns $ioam_node_alpha route change db01 !! 608 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 602 trace prealloc type 0x800000 ns 0 siz 609 trace prealloc type 0x800000 ns 0 size 4 dev veth0 603 610 604 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 611 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 605 db01::1 0x800000 0 $1 !! 612 db01::2 db01::1 veth0 0x800000 0 606 613 607 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 614 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 608 } 615 } 609 616 610 in_no_room() 617 in_no_room() 611 { 618 { 612 ############################################ 619 ############################################################################## 613 # Make sure that the receiving node won't fi 620 # Make sure that the receiving node won't fill the trace and will set the # 614 # Overflow flag if there is no room enough f 621 # Overflow flag if there is no room enough for its data. # 615 ############################################ 622 ############################################################################## 616 local desc="Missing trace room" 623 local desc="Missing trace room" 617 624 618 [ "$1" = "encap" ] && mode="$1 tundst db01:: 625 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 619 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 626 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 620 627 621 ip -netns $ioam_node_alpha route change db01 !! 628 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 622 trace prealloc type 0xc00000 ns 123 s 629 trace prealloc type 0xc00000 ns 123 size 4 dev veth0 623 630 624 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 631 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 625 db01::1 0xc00000 123 $1 !! 632 db01::2 db01::1 veth0 0xc00000 123 626 633 627 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 634 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 628 } 635 } 629 636 630 in_bits() 637 in_bits() 631 { 638 { 632 ############################################ 639 ############################################################################## 633 # Make sure that, for each trace type bit, t 640 # Make sure that, for each trace type bit, the receiving node will either: # 634 # (i) fill the trace with its data when it 641 # (i) fill the trace with its data when it is a supported bit # 635 # (ii) not fill the trace with its data whe 642 # (ii) not fill the trace with its data when it is an unsupported bit # 636 ############################################ 643 ############################################################################## 637 local desc="Trace type with bit <n> only" 644 local desc="Trace type with bit <n> only" 638 645 639 local tmp=${bit2size[22]} 646 local tmp=${bit2size[22]} 640 bit2size[22]=$(( $tmp + ${#BETA[9]} + ((4 - 647 bit2size[22]=$(( $tmp + ${#BETA[9]} + ((4 - (${#BETA[9]} % 4)) % 4) )) 641 648 642 [ "$1" = "encap" ] && mode="$1 tundst db01:: 649 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 643 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 650 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 644 651 645 for i in {0..11} {22..22} 652 for i in {0..11} {22..22} 646 do 653 do 647 ip -netns $ioam_node_alpha route change db !! 654 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 648 trace prealloc type ${bit2type[$i]} 655 trace prealloc type ${bit2type[$i]} ns 123 size ${bit2size[$i]} \ 649 dev veth0 656 dev veth0 650 657 651 run_test "in_bit$i" "${desc/<n>/$i} ($1 mo !! 658 run_test "in_bit$i" "${desc/<n>/$i} ($1 mode)" ioam-node-alpha \ 652 $ioam_node_beta db01::1 ${bit2type[ !! 659 ioam-node-beta db01::2 db01::1 veth0 ${bit2type[$i]} 123 653 done 660 done 654 661 655 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 662 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 656 663 657 bit2size[22]=$tmp 664 bit2size[22]=$tmp 658 } 665 } 659 666 660 in_oflag() 667 in_oflag() 661 { 668 { 662 ############################################ 669 ############################################################################## 663 # Make sure that the receiving node won't fi 670 # Make sure that the receiving node won't fill the trace since the Overflow # 664 # flag is set. 671 # flag is set. # 665 ############################################ 672 ############################################################################## 666 local desc="Overflow flag is set" 673 local desc="Overflow flag is set" 667 674 668 # Exception: 675 # Exception: 669 # Here, we need the sender to set the Over 676 # Here, we need the sender to set the Overflow flag. For that, we will add 670 # back the IOAM namespace that was previou 677 # back the IOAM namespace that was previously configured on the sender. 671 ip -netns $ioam_node_alpha ioam namespace ad !! 678 ip -netns ioam-node-alpha ioam namespace add 123 672 679 673 [ "$1" = "encap" ] && mode="$1 tundst db01:: 680 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 674 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 681 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 675 682 676 ip -netns $ioam_node_alpha route change db01 !! 683 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 677 trace prealloc type 0xc00000 ns 123 s 684 trace prealloc type 0xc00000 ns 123 size 4 dev veth0 678 685 679 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 686 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 680 db01::1 0xc00000 123 $1 !! 687 db01::2 db01::1 veth0 0xc00000 123 681 688 682 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 689 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 683 690 684 # And we clean the exception for this test t 691 # And we clean the exception for this test to get things back to normal for 685 # other INPUT tests 692 # other INPUT tests 686 ip -netns $ioam_node_alpha ioam namespace de !! 693 ip -netns ioam-node-alpha ioam namespace del 123 687 } 694 } 688 695 689 in_full_supp_trace() 696 in_full_supp_trace() 690 { 697 { 691 ############################################ 698 ############################################################################## 692 # Make sure that the receiving node will cor 699 # Make sure that the receiving node will correctly fill a full trace. Be # 693 # careful, "full trace" here does NOT mean a 700 # careful, "full trace" here does NOT mean all bits (only supported ones). # 694 ############################################ 701 ############################################################################## 695 local desc="Full supported trace" 702 local desc="Full supported trace" 696 703 697 [ "$1" = "encap" ] && mode="$1 tundst db01:: 704 [ "$1" = "encap" ] && mode="$1 tundst db01::1" || mode="$1" 698 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 705 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 up 699 706 700 ip -netns $ioam_node_alpha route change db01 !! 707 ip -netns ioam-node-alpha route change db01::/64 encap ioam6 mode $mode \ 701 trace prealloc type 0xfff002 ns 123 s 708 trace prealloc type 0xfff002 ns 123 size 80 dev veth0 702 709 703 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 710 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-beta \ 704 db01::1 0xfff002 123 $1 !! 711 db01::2 db01::1 veth0 0xfff002 123 705 712 706 [ "$1" = "encap" ] && ip -netns $ioam_node_b !! 713 [ "$1" = "encap" ] && ip -netns ioam-node-beta link set ip6tnl0 down 707 } 714 } 708 715 709 716 710 ############################################## 717 ################################################################################ 711 # 718 # # 712 # GLOBAL tests 719 # GLOBAL tests # 713 # 720 # # 714 # Three nodes (sender/router/receiver), IOAM 721 # Three nodes (sender/router/receiver), IOAM fully enabled on every node. # 715 ############################################## 722 ################################################################################ 716 723 717 fwd_full_supp_trace() 724 fwd_full_supp_trace() 718 { 725 { 719 ############################################ 726 ############################################################################## 720 # Make sure that all three nodes correctly f 727 # Make sure that all three nodes correctly filled the full supported trace # 721 # by checking that the trace data is consist 728 # by checking that the trace data is consistent with the predefined config. # 722 ############################################ 729 ############################################################################## 723 local desc="Forward - Full supported trace" 730 local desc="Forward - Full supported trace" 724 731 725 [ "$1" = "encap" ] && mode="$1 tundst db02:: 732 [ "$1" = "encap" ] && mode="$1 tundst db02::2" || mode="$1" 726 [ "$1" = "encap" ] && ip -netns $ioam_node_g !! 733 [ "$1" = "encap" ] && ip -netns ioam-node-gamma link set ip6tnl0 up 727 734 728 ip -netns $ioam_node_alpha route change db02 !! 735 ip -netns ioam-node-alpha route change db02::/64 encap ioam6 mode $mode \ 729 trace prealloc type 0xfff002 ns 123 s 736 trace prealloc type 0xfff002 ns 123 size 244 via db01::1 dev veth0 730 737 731 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" !! 738 run_test ${FUNCNAME[0]} "${desc} ($1 mode)" ioam-node-alpha ioam-node-gamma \ 732 db02::2 0xfff002 123 $1 !! 739 db01::2 db02::2 veth0 0xfff002 123 733 740 734 [ "$1" = "encap" ] && ip -netns $ioam_node_g !! 741 [ "$1" = "encap" ] && ip -netns ioam-node-gamma link set ip6tnl0 down 735 } 742 } 736 743 737 744 738 ############################################## 745 ################################################################################ 739 # 746 # # 740 # MAIN 747 # MAIN # 741 # 748 # # 742 ############################################## 749 ################################################################################ 743 750 744 npassed=0 751 npassed=0 745 nfailed=0 752 nfailed=0 746 753 747 if [ "$(id -u)" -ne 0 ] 754 if [ "$(id -u)" -ne 0 ] 748 then 755 then 749 echo "SKIP: Need root privileges" 756 echo "SKIP: Need root privileges" 750 exit $ksft_skip 757 exit $ksft_skip 751 fi 758 fi 752 759 753 if [ ! -x "$(command -v ip)" ] 760 if [ ! -x "$(command -v ip)" ] 754 then 761 then 755 echo "SKIP: Could not run test without ip to 762 echo "SKIP: Could not run test without ip tool" 756 exit $ksft_skip 763 exit $ksft_skip 757 fi 764 fi 758 765 759 ip ioam &>/dev/null 766 ip ioam &>/dev/null 760 if [ $? = 1 ] 767 if [ $? = 1 ] 761 then 768 then 762 echo "SKIP: iproute2 too old, missing ioam c 769 echo "SKIP: iproute2 too old, missing ioam command" 763 exit $ksft_skip 770 exit $ksft_skip 764 fi 771 fi 765 772 766 check_kernel_compatibility 773 check_kernel_compatibility 767 774 768 cleanup &>/dev/null 775 cleanup &>/dev/null 769 setup 776 setup 770 run 777 run 771 cleanup &>/dev/null 778 cleanup &>/dev/null
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.