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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049
|
AT_BANNER([OVN Interconnection Controller])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- AZ register])
ovn_init_ic_db
ovn_start az1
ovn_start az2
OVS_WAIT_UNTIL([test 2 = `ovn-ic-sbctl show | wc -l`])
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn-ic-sbctl show], [0], [dnl
availability-zone az1
availability-zone az2
])
ovn_as az1
check ovn-nbctl set NB_Global . name=az3
OVS_WAIT_UNTIL([ovn-ic-sbctl show | grep -q az3])
AT_CHECK([ovn-ic-sbctl show], [0], [dnl
availability-zone az2
availability-zone az3
])
ovn_as az2
check ovn-nbctl set NB_Global . name=\"\"
OVS_WAIT_WHILE([ovn-ic-sbctl show | grep -q az2])
AT_CHECK([ovn-ic-sbctl show], [0], [dnl
availability-zone az3
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- AZ update in GW])
ovn_init_ic_db
net_add n1
ovn_start az1
sim_add gw-az1
as gw-az1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
az_uuid=$(fetch_column ic-sb:availability-zone _uuid name="az1")
ovn_as az1 ovn-nbctl set NB_Global . name="az2"
check ovn-ic-nbctl --wait=sb sync
check_column "$az_uuid" ic-sb:availability-zone _uuid name="az2"
# make sure that gateway still point to the same AZ with new name
check_column "$az_uuid" ic-sb:gateway availability_zone name="gw-az1"
OVN_CLEANUP_IC([az1])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- transit switch handling])
ovn_init_ic_db
ovn_start az1
# create fake chassis with vxlan encap to enforce requested tunnel key checks
check ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2
AT_CHECK([ovn-ic-nbctl ts-add ts1])
AT_CHECK([ovn-ic-nbctl --wait=sb ts-add ts2])
# Check ISB
check_row_count ic-sb:Datapath_Binding 1 transit_switch=ts1
check_row_count ic-sb:Datapath_Binding 1 transit_switch=ts2
check_column "ts1 ts2" ic-sb:Datapath_Binding transit_switch
check_column "ts1 ts2" nb:Logical_Switch name
check ovn-nbctl --wait=hv sync
# Check SB DP key
ts1_key=$(fetch_column ic-sb:Datapath_Binding tunnel_key transit_switch=ts1)
check_column "$ts1_key" Datapath_Binding tunnel_key external_ids:interconn-ts=ts1
# Test delete
AT_CHECK([ovn-ic-nbctl --wait=sb ts-del ts1])
check_row_count ic-sb:Datapath_Binding 0 transit_switch=ts1
check_column ts2 ic-sb:Datapath_Binding transit_switch
check_column ts2 nb:Logical_Switch name
OVN_CLEANUP_IC([az1])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- VXLAN tunnel key])
ovn_init_ic_db
net_add n1
ovn_start az1
sim_add gw-az1
as gw-az1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
AT_CHECK([ovn-ic-nbctl --wait=sb ts-add ts1])
# Check ISB
check_row_count ic-sb:Datapath_Binding 1 transit_switch=ts1
check_column "ts1" ic-sb:Datapath_Binding transit_switch
check_column "ts1" nb:Logical_Switch name
wait_column "ic-vxlan_mode=false interconn-ts=ts1 requested-tnl-key=16711682" nb:Logical_Switch other_config name="ts1"
# Check tunnel key fits in VXLAN space
check ovn-ic-nbctl --wait=sb set IC_NB_Global . options:vxlan_mode=true
wait_column "ic-vxlan_mode=true interconn-ts=ts1 requested-tnl-key=1025" nb:Logical_Switch other_config name="ts1"
check ovn-ic-nbctl --wait=sb set IC_NB_Global . options:vxlan_mode=false
wait_column "ic-vxlan_mode=false interconn-ts=ts1 requested-tnl-key=16711682" nb:Logical_Switch other_config name="ts1"
OVN_CLEANUP_IC([az1])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- port-bindings deletion upon TS deletion])
ovn_init_ic_db
net_add n1
# 1 GW per AZ
for i in 1 2; do
az=az$i
ovn_start $az
sim_add gw-$az
as gw-$az
check ovs-vsctl add-br br-phys
ovn_az_attach $az n1 br-phys 192.168.1.$i
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
done
ovn_as az1
# create transit switch and connect to LR
check ovn-ic-nbctl --wait=sb ts-add ts1
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp1 00:00:00:00:00:01 10.0.0.1/24
check ovn-nbctl lrp-set-gateway-chassis lrp1 gw-az1
check ovn-nbctl lsp-add ts1 lsp1 -- \
lsp-set-addresses lsp1 router -- \
lsp-set-type lsp1 router -- \
lsp-set-options lsp1 router-port=lrp1
wait_row_count Datapath_Binding 1 external_ids:interconn-ts=ts1
# Sync ic-sb DB to see the TS changes.
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn-ic-sbctl show | grep -A2 lsp1], [0], [dnl
port lsp1
transit switch: ts1
address: [["00:00:00:00:00:01 10.0.0.1/24"]]
])
# remove transit switch and check if port_binding is deleted
check ovn-ic-nbctl --wait=sb ts-del ts1
check_row_count ic-sb:Port_Binding 0 logical_port=lsp1
for i in 1 2; do
az=az$i
ovn_as $az
OVN_CLEANUP_SBOX(gw-$az)
OVN_CLEANUP_AZ([$az])
done
OVN_CLEANUP_IC
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route deletion upon TS deletion])
ovn_init_ic_db
net_add n1
# 1 GW per AZ
for i in 1 2; do
az=az$i
ovn_start $az
sim_add gw-$az
as gw-$az
check ovs-vsctl add-br br-phys
ovn_az_attach $az n1 br-phys 192.168.1.$i
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
check ovn-nbctl set nb-global . \
options:ic-route-adv=true \
options:ic-route-adv-default=true \
options:ic-route-learn=true \
options:ic-route-learn-default=true
done
create_ic_infra() {
az_id=$1
ts_id=$2
az=az$1
lsp=lsp${az_id}-${ts_id}
lrp=lrp${az_id}-${ts_id}
ts=ts${az_id}-${ts_id}
lr=lr${az_id}-${ts_id}
ovn_as $az
check ovn-ic-nbctl --wait=sb ts-add $ts
check ovn-nbctl lr-add $lr
check ovn-nbctl --wait=sb lrp-add $lr $lrp 00:00:00:00:00:0$az_id 10.0.$az_id.1/24
check ovn-nbctl lrp-set-gateway-chassis $lrp gw-$az
check ovn-nbctl lsp-add $ts $lsp -- \
lsp-set-addresses $lsp router -- \
lsp-set-type $lsp router -- \
lsp-set-options $lsp router-port=$lrp
check ovn-nbctl --wait=sb lr-route-add $lr 192.168.0.0/16 10.0.$az_id.10
}
create_ic_infra 1 1
create_ic_infra 1 2
create_ic_infra 2 1
check ovn-ic-nbctl --wait=sb sync
ovn_as az1
check_row_count ic-sb:Route 3 ip_prefix=192.168.0.0/16
# remove transit switch 1 (from az1) and check if its route is deleted
# same route from another AZ and ts should remain, as
check ovn-ic-nbctl --wait=sb ts-del ts1-1
ovn-ic-sbctl list route
ovn-ic-nbctl list transit_switch
check_row_count ic-sb:route 2 ip_prefix=192.168.0.0/16
ovn-ic-sbctl list route
for i in 1 2; do
az=az$i
ovn_as $az
OVN_CLEANUP_SBOX(gw-$az)
OVN_CLEANUP_AZ([$az])
done
OVN_CLEANUP_IC
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- duplicate NB route adv/learn])
ovn_init_ic_db
net_add n1
# 1 GW per AZ
for i in 1 2; do
az=az$i
ovn_start $az
sim_add gw-$az
as gw-$az
check ovs-vsctl add-br br-phys
ovn_az_attach $az n1 br-phys 192.168.1.$i
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
check ovn-nbctl set nb-global . \
options:ic-route-adv=true \
options:ic-route-adv-default=true \
options:ic-route-learn=true \
options:ic-route-learn-default=true
done
ovn_as az1
# create transit switch and connect to LR
check ovn-ic-nbctl --wait=sb ts-add ts1
for i in 1 2; do
ovn_as az$i
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24
check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i
check ovn-nbctl --wait=sb lsp-add ts1 lsp$i -- \
lsp-set-addresses lsp$i router -- \
lsp-set-type lsp$i router -- \
lsp-set-options lsp$i router-port=lrp$i
done
ovn_as az1
check_uuid ovn-nbctl \
--id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \
add logical-router lr1 static_routes @id
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
check_row_count ic-sb:route 1 ip_prefix=1.1.1.1/32
for i in 1 2; do
az=az$i
ovn_as $az
OVN_CLEANUP_SBOX(gw-$az)
OVN_CLEANUP_AZ([$az])
done
OVN_CLEANUP_IC
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- local duplicate connected route])
ovn_init_ic_db
net_add n1
# 1 GW per AZ
for i in 1 2; do
az=az$i
ovn_start $az
sim_add gw-$az
as gw-$az
check ovs-vsctl add-br br-phys
ovn_az_attach $az n1 br-phys 192.168.1.$i
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
check ovn-nbctl set nb-global . \
options:ic-route-adv=true \
options:ic-route-adv-default=true \
options:ic-route-learn=true \
options:ic-route-learn-default=true
done
ovn_as az1
# create transit switch and connect to LR
check ovn-ic-nbctl --wait=sb ts-add ts1
for i in 1 2; do
ovn_as az$i
check \
grep -vq "connected route advertisement was suppressed! NB lrp" \
az$i/ic/ovn-ic.log
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24
check ovn-nbctl lrp-add lr1 lrp-dup1 00:00:00:00:0$i:42 10.0.42.1/24
check ovn-nbctl lrp-add lr1 lrp-dup2 00:00:00:00:0$i:51 10.0.42.1/24
check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i
check ovn-nbctl --wait=sb lsp-add ts1 lsp$i -- \
lsp-set-addresses lsp$i router -- \
lsp-set-type lsp$i router -- \
lsp-set-options lsp$i router-port=lrp$i
check ovn-ic-nbctl --wait=sb sync
check \
grep -q "connected route advertisement was suppressed! NB lrp" \
az$i/ic/ovn-ic.log
done
for i in 1 2; do
az=az$i
ovn_as $az
OVN_CLEANUP_SBOX(gw-$az)
OVN_CLEANUP_AZ([$az])
done
OVN_CLEANUP_IC
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- gateway sync])
ovn_init_ic_db
net_add n1
ovn_start az1
ovn_start az2
sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true external-ids:hostname=gw1
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep "192.168.0.1"])
AT_CHECK([ovn_as az2 ovn-sbctl show | sort -r], [0], [dnl
Chassis gw1
hostname: gw1
Encap vxlan
Encap geneve
options: {csum="true"}
options: {csum="true"}
ip: "192.168.0.1"
ip: "192.168.0.1"
])
AT_CHECK([ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns other_config list chassis], [0], [dnl
is-remote=true
])
ovs-vsctl set open . external-ids:ovn-is-interconn=false
OVS_WAIT_UNTIL([test "$(ovn_as az2 ovn-sbctl show)" = ""])
ovs-vsctl set open . external-ids:ovn-is-interconn=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep gw1])
OVN_CLEANUP_SBOX(gw1)
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-sbctl show], [0], [dnl
])
# Test encap change
sim_add gw2
as gw2
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep "192.168.0.1"])
ovs-vsctl set open . external_ids:ovn-encap-ip=192.168.0.2
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep "192.168.0.2"])
ovs-vsctl set open . external_ids:ovn-encap-type="geneve,vxlan"
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep vxlan])
OVN_CLEANUP_SBOX([gw2])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- port sync])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
net_add n1
ovn_start az1
ovn_start az2
# sync IC-NB to IC-SB and AZs after AZs creation.
check ovn-ic-nbctl --wait=sb sync
sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true
ovn_as az1
# Create LRP and connect to TS
check ovn-nbctl lr-add lr1
check ovn-nbctl lrp-add lr1 lrp-lr1-ts1 aa:aa:aa:aa:aa:01 169.254.100.1/24
check ovn-nbctl lsp-add ts1 lsp-ts1-lr1
check ovn-nbctl lsp-set-addresses lsp-ts1-lr1 router
check ovn-nbctl lsp-set-type lsp-ts1-lr1 router
check ovn-nbctl --wait=hv lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl show | grep lsp-ts1-lr1])
ovn_as az2 ovn-nbctl lsp-set-options lsp-ts1-lr1 requested-chassis=gw1
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl show | uuidfilt], [0], [dnl
switch <0> (ts1)
port lsp-ts1-lr1
type: remote
addresses: [["aa:aa:aa:aa:aa:01 169.254.100.1/24"]]
])
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns logical_port,type list port_binding], [0], [dnl
lsp-ts1-lr1,remote
])
check ovn-nbctl lrp-set-gateway-chassis lrp-lr1-ts1 gw1
OVS_WAIT_UNTIL([ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1])
ovn_as az2 ovn-nbctl lsp-set-options lsp-ts1-lr1 requested-chassis=""
check ovn-nbctl lrp-del-gateway-chassis lrp-lr1-ts1 gw1
OVS_WAIT_WHILE([ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1])
check ovn-nbctl set logical_router_port lrp-lr1-ts1 mac="\"aa:aa:aa:aa:aa:02\"" \
networks="169.254.100.2/24 169.254.200.3/24"
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl show | grep "aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24"])
# Delete the router port from az1, the remote port in az2 should still remain
# but just lost address.
check ovn-nbctl lrp-del lrp-lr1-ts1
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl show | grep "aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24"])
AT_CHECK([ovn_as az2 ovn-nbctl show | uuidfilt], [0], [dnl
switch <0> (ts1)
port lsp-ts1-lr1
type: remote
])
# Delete the lsp from az1, the remote port in az2 should be gone
check ovn-nbctl lsp-del lsp-ts1-lr1
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl show | grep lsp-ts1-lr1])
# ts1 should not be local datapath since lsp-ts1-lr1 has been deleted.
OVN_CLEANUP_SBOX(gw1, [], [], [ts1,lr1])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
check ovn-ic-nbctl --wait=sb sync
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
# Create static routes
check ovn-nbctl lr-route-add lr$i 10.11.$i.0/24 169.254.0.1
# Create a src-ip route, which shouldn't be synced
check ovn-nbctl --policy=src-ip lr-route-add lr$i 10.22.$i.0/24 169.254.0.2
done
for i in 1 2; do
OVS_WAIT_UNTIL([ovn_as az$i ovn-nbctl lr-route-list lr$i | grep learned])
done
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table <main>:
10.11.1.0/24 169.254.0.1 dst-ip
10.11.2.0/24 169.254.100.2 dst-ip (learned)
10.22.1.0/24 169.254.0.2 src-ip
])
# Delete route in AZ1, AZ2's learned route should be deleted.
ovn_as az1 ovn-nbctl lr-route-del lr1 10.11.1.0/24
ovn-ic-nbctl --wait=sb sync
ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep -c learned], [1], [dnl
0
])
# Add the route back
ovn_as az1 ovn-nbctl lr-route-add lr1 10.11.1.0/24 169.254.0.1
ovn-ic-nbctl --wait=sb sync
ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep -c learned], [0], [dnl
1
])
# Disable route-learning for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=false
ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table <main>:
10.11.1.0/24 169.254.0.1 dst-ip
10.22.1.0/24 169.254.0.2 src-ip
])
# AZ1 should still advertise and AZ2 should still learn the route
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned], [0], [ignore])
# Disable route-advertising for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=false
# AZ2 shouldn't have the route learned, because AZ1 should have stopped
# advertising.
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
10.11.2.0/24 169.254.0.1 dst-ip
10.22.2.0/24 169.254.0.2 src-ip
])
# Add default route in AZ1
ovn_as az1 ovn-nbctl lr-route-add lr1 0.0.0.0/0 169.254.0.3
# Re-enable router-advertising & learn for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=true
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=true
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
# Default route should NOT get advertised or learned, by default.
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
10.11.1.0/24 169.254.100.1 dst-ip (learned)
10.11.2.0/24 169.254.0.1 dst-ip
10.22.2.0/24 169.254.0.2 src-ip
])
# Enable default route advertising in AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv-default=true
OVS_WAIT_UNTIL([ovn-ic-sbctl list route | grep 0.0.0.0])
# Enable default route learning in AZ2
ovn_as az2 ovn-nbctl set nb_global . options:ic-route-learn-default=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 0.0.0.0])
# Test directly connected subnet route advertising.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# Delete the directly connected subnet from AZ1, learned route should be
# removed from AZ2.
ovn_as az1 ovn-nbctl lrp-del lrp-lr1-ls1
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# Test denylist routes
# Add back the directly connected 192.168 route.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# Ensure AZ1 learned AZ2's 10.11.2.0 route as well.
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11])
# Now black list 10.11.0.0/16 and 192.168.0.0/16 in AZ2.
ovn_as az2 ovn-nbctl set nb_global . options:ic-route-denylist="10.11.0.0/16,192.168.0.0/16"
# AZ2 shouldn't learn 192.168 route any more.
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# AZ1 shouldn't learn 10.11 any more.
OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11])
# cleanup
ovn-ic-nbctl --if-exists ts-del ts1
ovn_as az1 ovn-nbctl lr-del lr1
ovn_as az2 ovn-nbctl lr-del lr2
# Create new transit switches and LRs. Test topology is next:
# logical router (lr11) - transit switch (ts11) - logical router (lr12)
# logical router (lr21) - transit switch (ts22) - logical router (lr22)
#
# lr12 has static route 10.0.0.0/24 and directly connected network 192.168.0.0/24
for i in 1 2; do
ovn_as az$i
# Ensure route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Ensure route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Drop denylist
check ovn-nbctl remove nb_global . options ic-route-denylist
for j in 1 2; do
ts=ts$j$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
# Create LRP and connect to TS
lr=lr$j$i
echo lr: $lr, ts: $ts
check ovn-nbctl lr-add $lr
check ovn-nbctl lrp-add $lr lrp-$lr-$ts aa:aa:aa:aa:aa:0$j 169.254.100.$i/24
check ovn-nbctl lsp-add $ts lsp-$ts-$lr \
-- lsp-set-addresses lsp-$ts-$lr router \
-- lsp-set-type lsp-$ts-$lr router \
-- lsp-set-options lsp-$ts-$lr router-port=lrp-$lr-$ts
done
done
# Create directly-connected routes
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr12 lrp-lr12-ls2 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
ovn_as az2 ovn-nbctl lr-route-add lr12 10.10.10.0/24 192.168.0.10
ovn_as az1 ovn-nbctl --wait=sb sync
echo az1
ovn_as az1 ovn-nbctl show
echo az2
ovn_as az2 ovn-nbctl show
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
# Test routes from lr12 were learned to lr11
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 |
grep learned | awk '{print $1, $2}' | sort], [0], [dnl
10.10.10.0/24 169.254.100.2
192.168.0.0/24 169.254.100.2
])
# Test routes from lr12 didn't leak as learned to lr21
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr21], [0], [])
# cleanup
ovn-ic-nbctl --if-exists ts-del ts1
ovn_as az1 ovn-nbctl lr-del lr11
ovn_as az1 ovn-nbctl lr-del lr21
ovn_as az2 ovn-nbctl lr-del lr12
ovn_as az2 ovn-nbctl lr-del lr22
# check routes origin advertisement and learning
# setup topology with connected, static and source routes
ovn-ic-nbctl --wait=sb ts-add ts1
for i in 1 2; do
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
check ovn-nbctl lrp-add lr$i lrp-lr$i-p$i 00:00:00:00:00:0$i 192.168.$i.1/24
# Create static routes
check ovn-nbctl --wait=sb lr-route-add lr$i 10.11.$i.0/24 169.254.0.1
# Create a src-ip route, which shouldn't be synced
check ovn-nbctl --policy=src-ip lr-route-add lr$i 10.22.$i.0/24 169.254.0.2
done
check ovn-ic-nbctl --wait=sb sync
# check that advertised routes in ic-sb have correct origin
ovn-ic-sbctl list route
wait_row_count ic-sb:Route 1 ip_prefix=10.11.1.0/24 origin=static
wait_row_count ic-sb:Route 1 ip_prefix=192.168.1.1/24 origin=connected
wait_row_count ic-sb:Route 1 ip_prefix=10.11.2.0/24 origin=static
wait_row_count ic-sb:Route 1 ip_prefix=192.168.2.1/24 origin=connected
# check that learned routes in ic-sb have correct origin
ovn_as az1
wait_row_count nb:Logical_Router_Static_Route 1 ip_prefix=10.11.2.0/24 options:origin=static
wait_row_count nb:Logical_Router_Static_Route 1 ip_prefix=192.168.2.1/24 options:origin=connected
ovn_as az2
wait_row_count nb:Logical_Router_Static_Route 1 ip_prefix=10.11.1.0/24 options:origin=static
wait_row_count nb:Logical_Router_Static_Route 1 ip_prefix=192.168.1.1/24 options:origin=connected
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- loadbalancer])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
check ovn-ic-nbctl --wait=sb sync
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Enable route advertising for loadbalancer VIP
check ovn-nbctl set nb_global . options:ic-route-adv-lb=true
# Enable route learning for loadbalancer VIP
check ovn-nbctl set nb_global . options:ic-route-learn-lb=true
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24 2001:db8:1::$i/64
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
# Create LB
check ovn-nbctl lb-add lb$i 200.1.$i.50:80 1.1.$i.1:80,1.1.$i.2:80
check ovn-nbctl lr-lb-add lr$i lb$i
done
for i in 1 2; do
OVS_WAIT_UNTIL([ovn_as az$i ovn-nbctl lr-route-list lr$i | grep learned])
done
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.50/32 origin=loadbalancer
wait_row_count ic-sb:Route 1 ip_prefix=200.1.2.50/32 origin=loadbalancer
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.2.50 169.254.100.2 dst-ip (learned)
])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
])
# Add another few instances of LB in AZ1, some with same VIP IP.
check ovn_as az1 ovn-nbctl lb-add lb3 200.1.1.53:80 1.1.1.1:80,1.1.1.2:80,1.1.1.3:80
check ovn_as az1 ovn-nbctl lb-add lb4 200.1.1.53:8080 1.1.1.1:8080,1.1.1.2:8080
check ovn_as az1 ovn-nbctl lb-add lb5 200.1.1.54:80 1.1.1.1:80,1.1.1.2:80
check ovn_as az1 ovn-nbctl lr-lb-add lr1 lb3
check ovn_as az1 ovn-nbctl lr-lb-add lr1 lb4
check ovn_as az1 ovn-nbctl lr-lb-add lr1 lb5
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.53/32 origin=loadbalancer
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.54/32 origin=loadbalancer
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.53])
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.54])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
200.1.1.54 169.254.100.1 dst-ip (learned)
])
# Remove one LB.
check ovn_as az1 ovn-nbctl lr-lb-del lr1 lb5
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.54])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Add load balancer group.
check ovn_as az1 ovn-nbctl lb-add lb6 250.1.1.11:80 1.1.1.1:80,1.1.1.2:80
check ovn_as az1 ovn-nbctl lb-add lb7 250.1.1.12:80 1.1.1.1:80,1.1.1.2:80
lb6=$(ovn_as az1 fetch_column nb:load_balancer _uuid name=lb6)
lb7=$(ovn_as az1 fetch_column nb:load_balancer _uuid name=lb7)
ovn_as az1
lbg=$(ovn-nbctl create load_balancer_group name=lbg -- \
add load_balancer_group lbg load_balancer $lb6 -- \
add load_balancer_group lbg load_balancer $lb7)
check ovn_as az1 ovn-nbctl add logical_router lr1 load_balancer_group $lbg
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 250.1.1.11])
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 250.1.1.12])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
250.1.1.11 169.254.100.1 dst-ip (learned)
250.1.1.12 169.254.100.1 dst-ip (learned)
])
# Remove the LB group from LR.
check ovn_as az1 ovn-nbctl remove logical_router lr1 load_balancer_group $lbg
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 250.1.1.11])
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 250.1.1.12])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Disable LB route-advertising for AZ1.
check ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv-lb=false
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [])
# Enable LB route-advertising back for AZ1.
check ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv-lb=true
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.50/32 origin=loadbalancer
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.53/32 origin=loadbalancer
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.50])
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.53])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Disable LB route-learning for AZ2.
check ovn_as az2 ovn-nbctl set nb_global . options:ic-route-learn-lb=false
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.50/32 origin=loadbalancer
wait_row_count ic-sb:Route 1 ip_prefix=200.1.1.53/32 origin=loadbalancer
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [])
# Enable LB route-learning back for AZ2.
check ovn_as az2 ovn-nbctl set nb_global . options:ic-route-learn-lb=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.50])
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.53])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Add IPv6 LB.
check ovn_as az1 ovn-nbctl lb-add lb_v6 [[4242::1]]:80 "[[4242::2]]:80"
check ovn_as az1 ovn-nbctl lr-lb-add lr1 lb_v6
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 4242])
AT_CHECK([ovn-ic-sbctl list route | grep 'ip_prefix.*4242' -A 2], [0], [dnl
ip_prefix : "4242::1/128"
nexthop : "2001:db8:1::1"
origin : loadbalancer
])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
IPv6 Routes
Route Table <main>:
4242::1 2001:db8:1::1 dst-ip (learned)
])
# Remove IPv6 LB
check ovn_as az1 ovn-nbctl lr-lb-del lr1 lb_v6
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 4242])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Configure same LB VIP locally as in remote az. Ensure learnt route is removed.
check ovn_as az2 ovn-nbctl lb-add lb_temp 200.1.1.50:80 1.1.1.1:80,1.1.1.2:80
check ovn_as az2 ovn-nbctl lr-lb-add lr2 lb_temp
wait_row_count ic-sb:Route 2 ip_prefix=200.1.1.50/32 origin=loadbalancer
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.50])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.53 169.254.100.1 dst-ip (learned)
])
check ovn_as az2 ovn-nbctl lr-lb-del lr2 lb_temp
check ovn_as az2 ovn-nbctl lb-del lb_temp
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.1.50])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Configure static route in remote az. Route would be learnt. Add local LB VIP
# same as static route prefix. Ensure route is removed.
check ovn_as az1 ovn-nbctl lr-route-add lr1 200.1.3.55 169.1.1.1
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.3.55])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
200.1.3.55 169.254.100.1 dst-ip (learned)
])
check ovn_as az2 ovn-nbctl lb-add lb_temp 200.1.3.55:80 1.1.1.1:80,1.1.1.2:80
check ovn_as az2 ovn-nbctl lr-lb-add lr2 lb_temp
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.3.55])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
check ovn_as az2 ovn-nbctl lr-lb-del lr2 lb_temp
check ovn_as az2 ovn-nbctl lb-del lb_temp
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.3.55])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
200.1.3.55 169.254.100.1 dst-ip (learned)
])
check ovn_as az1 ovn-nbctl lr-route-del lr1 200.1.3.55 169.1.1.1
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.3.55])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
])
# Create a third az
ovn_start az3
ovn_as az3
check ovn-ic-nbctl --wait=sb sync
check ovn-nbctl set nb_global . options:ic-route-learn=true
check ovn-nbctl set nb_global . options:ic-route-adv=true
check ovn-nbctl set nb_global . options:ic-route-adv-lb=true
check ovn-nbctl set nb_global . options:ic-route-learn-lb=true
check ovn-nbctl lr-add lr3
check ovn-nbctl lrp-add lr3 lrp-lr3-ts1 aa:aa:aa:aa:aa:03 169.254.100.3/24 2001:db8:1::3/64
check ovn-nbctl lsp-add ts1 lsp-ts1-lr3 \
-- lsp-set-addresses lsp-ts1-lr3 router \
-- lsp-set-type lsp-ts1-lr3 router \
-- lsp-set-options lsp-ts1-lr3 router-port=lrp-lr3-ts1
# Create LB in 3rd az and check that the route propagates to az1 LR
check ovn_as az3 ovn-nbctl lb-add lb3 200.1.3.50:80 1.1.3.1:80,1.1.3.2:80
check ovn_as az3 ovn-nbctl lr-lb-add lr3 lb3
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 200.1.3.50])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned)
200.1.1.53 169.254.100.1 dst-ip (learned)
200.1.3.50 169.254.100.3 dst-ip (learned)
])
# Create LB in az3 with same VIP as az1, check for ECMP route in az2 LR
check ovn_as az3 ovn-nbctl lb-add lb4 200.1.1.50:80 1.1.3.1:80,1.1.3.2:80
check ovn_as az3 ovn-nbctl lr-lb-add lr3 lb4
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep ecmp])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
200.1.1.50 169.254.100.1 dst-ip (learned) ecmp
200.1.1.50 169.254.100.3 dst-ip (learned) ecmp
200.1.1.53 169.254.100.1 dst-ip (learned)
200.1.3.50 169.254.100.3 dst-ip (learned)
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- IPv6 route tables])
AT_KEYWORDS([IPv6-route-sync])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
check ovn-ic-nbctl --wait=sb sync
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 2001:db8:1::$i/64
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
check ovn-nbctl --wait=sb lrp-add lr$i lrp-lr$i-p$i 00:00:00:00:00:0$i 2002:db8:1::$i/64
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1 | awk '/learned/{print $1, $2}'], [0], [dnl
2002:db8:1::/64 2001:db8:1::2
])
# Do not learn routes from link-local nexthops
for i in 1 2; do
ovn_as az$i
check ovn-nbctl lrp-del lrp-lr$i-ts1
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
done
OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep -q learned], [1])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- route tables])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
check ovn-ic-nbctl --wait=sb sync
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
# Create static routes
check ovn-nbctl lr-route-add lr$i 10.11.$i.0/24 169.254.0.1
# Create a src-ip route, which shouldn't be synced
check ovn-nbctl --policy=src-ip --route-table=rtb1 lr-route-add lr$i 10.22.$i.0/24 169.254.0.2
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table <main>:
10.11.1.0/24 169.254.0.1 dst-ip
10.11.2.0/24 169.254.100.2 dst-ip (learned)
Route Table rtb1:
10.22.1.0/24 169.254.0.2 src-ip
])
# move routes from <main> route table to rtb1
for i in 1 2; do
ovn_as az$i ovn-nbctl lr-route-del lr$i 10.11.$i.0/24 169.254.0.1
ovn_as az$i ovn-nbctl --route-table=rtb1 lr-route-add lr$i 10.11.$i.0/24 169.254.0.1
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
# ensure route from rtb1 is not learned to any route table as route table is
# not set to TS port
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.1.0/24 169.254.0.1 dst-ip
10.22.1.0/24 169.254.0.2 src-ip
])
# assign route table rtb1 to TS port on AZ2 and check routes are advertised to IC SB DB
check ovn_as az2 ovn-nbctl lrp-set-options lrp-lr2-ts1 route_table=rtb1
check ovn-ic-nbctl --wait=sb sync
# ensure route was not learned as on AZ1 TS port's LRP was not set to route table rtb1
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.1.0/24 169.254.0.1 dst-ip
10.22.1.0/24 169.254.0.2 src-ip
])
# set TS port's LRP to route table rtb1 to learn routes from AZ2 from rtb1
check ovn_as az1 ovn-nbctl lrp-set-options lrp-lr1-ts1 route_table=rtb1
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.1.0/24 169.254.0.1 dst-ip
10.11.2.0/24 169.254.100.2 dst-ip (learned)
10.22.1.0/24 169.254.0.2 src-ip
])
# Delete route in AZ1, AZ2's learned route should be deleted.
ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-del lr1 10.11.1.0/24
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl --route-table=rtb1 lr-route-list lr2 | grep learned])
# Add the route back
ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-add lr1 10.11.1.0/24 169.254.0.1
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned])
# Disable route-learning for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=false
OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.1.0/24 169.254.0.1 dst-ip
10.22.1.0/24 169.254.0.2 src-ip
])
# AZ1 should still advertise and AZ2 should still learn the route
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned], [0], [ignore])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.1.0/24 169.254.100.1 dst-ip (learned)
10.11.2.0/24 169.254.0.1 dst-ip
10.22.2.0/24 169.254.0.2 src-ip
])
# Disable route-advertising for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=false
# AZ2 shouldn't have the route learned, because AZ1 have stopped advertising.
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned])
# Add default route in AZ1
ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-add lr1 0.0.0.0/0 169.254.0.3
# Re-enable router-advertising & learn for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=true
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=true
for i in 1 2; do
OVS_WAIT_UNTIL([ovn_as az$i ovn-nbctl lr-route-list lr$i | grep learned])
done
# Default route should NOT get advertised or learned, by default.
AT_CHECK([ovn-ic-sbctl find route ip_prefix="0.0.0.0/0"], [0], [])
# Enable default route advertising in AZ1, ensure it advertised, but not learned
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv-default=true
OVS_WAIT_UNTIL([ovn-ic-sbctl find route ip_prefix="0.0.0.0/0" route_table=rtb1 | grep 0.0.0.0])
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl --route-table=rtb1 lr-route-list lr2 | grep learned | grep 0.0.0.0])
# Enable default route learning in AZ2
ovn_as az2 ovn-nbctl set nb_global . options:ic-route-learn-default=true
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl --route-table=rtb1 lr-route-list lr2 | grep learned | grep 0.0.0.0])
# Test directly connected subnet route advertising. Route should go to <main> route table.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_UNTIL([ovn-ic-sbctl find route ip_prefix="192.168.0.1/24" route_table="\"\"" | grep 192.168.0.1/24])
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table <main>:
192.168.0.0/24 169.254.100.1 dst-ip (learned)
Route Table rtb1:
10.11.1.0/24 169.254.100.1 dst-ip (learned)
10.11.2.0/24 169.254.0.1 dst-ip
10.22.2.0/24 169.254.0.2 src-ip
0.0.0.0/0 169.254.100.1 dst-ip (learned)
])
# Delete the directly connected subnet from AZ1, learned route should be
# removed from AZ2.
ovn_as az1 ovn-nbctl lrp-del lrp-lr1-ls1
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# Test denylist routes
# Add back the directly connected 192.168 route.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_UNTIL([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# Now add 10.11.0.0/16 and 192.168.0.0/16 to denylist in AZ2.
check ovn_as az2 ovn-nbctl set nb_global . options:ic-route-denylist="10.11.0.0/16,192.168.0.0/16"
# AZ2 shouldn't learn 192.168 route any more.
OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168])
# AZ1 shouldn't learn 10.11 any more.
OVS_WAIT_WHILE([ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr2], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.11.2.0/24 169.254.0.1 dst-ip
10.22.2.0/24 169.254.0.2 src-ip
0.0.0.0/0 169.254.100.1 dst-ip (learned)
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- multiple route tables])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
# VPC1:
# / transit switch (ts11) \
# logical router (lr11) - transit switch (ts12) - logical router (lr12)
# \ transit switch (ts13) /
#
# VPC2:
# / transit switch (ts21) \
# logical router (lr21) logical router (lr22)
# \ transit switch (ts22) /
#
# each LR has one connected subnet except TS port
# VPC1
# create lr11, lr12, ts11, ts12, ts13 and connect them
# assign route tables rtb1, rtb2, rtb3 to ts ports
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1 2 3; do
ts=ts1$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lrp-set-options $lrp route_table=rtb$j
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# VPC2
# create lr21, lr22, ts21, ts22 and connect them
# assign route tables rtb1, rtb2, rtb3 to ts ports
for i in 1 2; do
ovn_as az$i
lr=lr2$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts2$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lrp-set-options $lrp route_table=rtb$j
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected and static routes in VPC1
ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
ovn_as az2 ovn-nbctl --route-table=rtb1 lr-route-add lr12 10.10.10.0/24 192.168.0.10
ovn_as az2 ovn-nbctl --route-table=rtb2 lr-route-add lr12 10.10.10.0/24 192.168.0.11
ovn_as az2 ovn-nbctl --route-table=rtb3 lr-route-add lr12 10.10.10.0/24 192.168.0.12
# Create directly-connected route in VPC2
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr22 lrp-lr22 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
# Test direct routes from lr12 were learned to lr11
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2, $5}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2 ecmp
192.168.0.0/24 169.254.102.2 ecmp
192.168.0.0/24 169.254.103.2 ecmp
])
# Test static routes from lr12 rtbs rtb1,rtb2,rtb3 were learned to lr11
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb1:
10.10.10.0/24 169.254.101.2 dst-ip (learned)
])
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb2 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb2:
10.10.10.0/24 169.254.102.2 dst-ip (learned)
])
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl --route-table=rtb3 lr-route-list lr11], [0], [dnl
IPv4 Routes
Route Table rtb3:
10.10.10.0/24 169.254.103.2 dst-ip (learned)
])
# Test routes from lr12 didn't leak as learned to lr21
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 192.168 | sort], [0], [dnl
192.168.0.0/24 169.254.101.2 dst-ip (learned) ecmp
192.168.0.0/24 169.254.102.2 dst-ip (learned) ecmp
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- multiple route tables IPv6])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
# VPC1:
# / transit switch (ts11) \
# logical router (lr11) - transit switch (ts12) - logical router (lr12)
# \ transit switch (ts13) /
#
# VPC2:
# / transit switch (ts21) \
# logical router (lr21) logical router (lr22)
# \ transit switch (ts22) /
#
# each LR has one connected subnet except TS port
# VPC1
# create lr11, lr12, ts11, ts12, ts13 and connect them
# assign route tables rtb1, rtb2, rtb3 to ts ports
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1 2 3; do
ts=ts1$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 2001:db8:$j::$i/64
check ovn-nbctl lrp-set-options $lrp route_table=rtb$j
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# VPC2
# create lr21, lr22, ts21, ts22 and connect them
# assign route tables rtb1, rtb2, rtb3 to ts ports
for i in 1 2; do
ovn_as az$i
lr=lr2$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts2$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 2001:db8:$j::$i/64
check ovn-nbctl lrp-set-options $lrp route_table=rtb$j
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected and static routes in VPC1
ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "2001:db8:200::1/64"
ovn_as az2 ovn-nbctl --route-table=rtb1 lr-route-add lr12 2001:db8:aaaa::/64 2001:db8:200::10
ovn_as az2 ovn-nbctl --route-table=rtb2 lr-route-add lr12 2001:db8:aaaa::/64 2001:db8:200::11
ovn_as az2 ovn-nbctl --route-table=rtb3 lr-route-add lr12 2001:db8:aaaa::/64 2001:db8:200::12
# Create directly-connected route in VPC2
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr22 lrp-lr22 aa:aa:aa:aa:bb:01 "2001:db8:200::1/64"
# Test direct routes from lr12 were learned to lr11
#
# We need to wait twice: first time for az2/ic to handle port addition and update ic/sb and
# second time for az1/ic to handle ic/sb update.
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 2001:db8:200 |
grep learned | awk '{print $1, $2, $5}' | sort], [0], [dnl
2001:db8:200::/64 2001:db8:1::2 ecmp
2001:db8:200::/64 2001:db8:2::2 ecmp
2001:db8:200::/64 2001:db8:3::2 ecmp
])
# Test static routes from lr12 rtbs rtb1,rtb2,rtb3 were learned to lr11
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-list lr11 | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb1 lr-route-list lr11], [0], [dnl
IPv6 Routes
Route Table rtb1:
2001:db8:aaaa::/64 2001:db8:1::2 dst-ip (learned)
])
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl --route-table=rtb2 lr-route-list lr11 | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb2 lr-route-list lr11], [0], [dnl
IPv6 Routes
Route Table rtb2:
2001:db8:aaaa::/64 2001:db8:2::2 dst-ip (learned)
])
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl --route-table=rtb3 lr-route-list lr11 | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl --route-table=rtb3 lr-route-list lr11], [0], [dnl
IPv6 Routes
Route Table rtb3:
2001:db8:aaaa::/64 2001:db8:3::2 dst-ip (learned)
])
# Test routes from lr12 didn't leak as learned to lr21
OVS_WAIT_UNTIL([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep "2001:db8:2::2" | grep learned])
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 2001 | sort], [0], [dnl
2001:db8:200::/64 2001:db8:1::2 dst-ip (learned) ecmp
2001:db8:200::/64 2001:db8:2::2 dst-ip (learned) ecmp
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- same routes destination])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
check ovn-ic-nbctl --wait=sb sync
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
check ovn-nbctl set nb_global . options:ic-route-learn-default=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
check ovn-nbctl set nb_global . options:ic-route-adv-default=true
lr=lr1$i
check ovn-nbctl lr-add $lr
lrp=lrp-$lr-ts1
lsp=lsp-ts1-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
check ovn-nbctl lsp-add ts1 $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
check ovn-nbctl lrp-add $lr lrp-local-subnet 00:00:00:00:00:0$i 192.168.$i.1/24
ovn-nbctl list logical-router-static-route
check ovn-nbctl lr-route-add $lr 10.0.0.0/24 192.168.$i.10
check ovn-nbctl --wait=sb lr-route-add $lr 0.0.0.0/0 192.168.$i.11
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep dst-ip | sort] , [0], [dnl
0.0.0.0/0 192.168.1.11 dst-ip
10.0.0.0/24 192.168.1.10 dst-ip
192.168.2.0/24 169.254.100.2 dst-ip (learned)
])
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep dst-ip | sort], [0], [dnl
0.0.0.0/0 192.168.2.11 dst-ip
10.0.0.0/24 192.168.2.10 dst-ip
192.168.1.0/24 169.254.100.1 dst-ip (learned)
])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- multiple logical routers])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
#
# logical router (lr11) - transit switch (ts1) - logical router (lr21)
# \- logical router (lr22)
#
# each LR has one connected subnet except TS port
# create lr11, lr21, lr22 and connect them
ovn_as az1
check ovn-ic-nbctl --wait=sb sync
lr=lr11
check ovn-nbctl lr-add $lr
lrp=lrp-$lr-ts1
lsp=lsp-ts1-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a1:01 169.254.10.11/24
check ovn-nbctl lsp-add ts1 $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
ovn_as az2
for i in 1 2; do
lr=lr2$i
check ovn-nbctl lr-add $lr
lrp=lrp-$lr-ts1
lsp=lsp-ts1-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a2:0$i 169.254.10.2$i/24
check ovn-nbctl lsp-add ts1 $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
# Create directly-connected routes
ovn_as az1 ovn-nbctl lrp-add lr11 lrp-lr11 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
ovn_as az2 ovn-nbctl lrp-add lr21 lrp-lr21 aa:aa:aa:aa:bc:01 "192.168.1.1/24"
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr22 lrp-lr22 aa:aa:aa:aa:bc:02 "192.168.2.1/24"
# Test direct routes from lr21 and lr22 were learned to lr11
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.1.0/24 169.254.10.21
192.168.2.0/24 169.254.10.22
])
# Test direct routes from lr11 and lr22 were learned to lr21
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr21 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.10.11
192.168.2.0/24 169.254.10.22
])
# Test direct routes from lr11 and lr21 were learned to lr22
AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr22 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.10.11
192.168.1.0/24 169.254.10.21
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- sync ISB status to INB])
ovn_init_ic_db
net_add n1
ovn_start az1
sim_add gw-az1
as gw-az1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
as az1
# pause ovn-ic instance
check ovn-appctl -t ic/ovn-ic pause
# run sync command in the background this commands
# supposed to stuck since ovn-ic is paused.
ovn-ic-nbctl --wait=sb sync &
OVS_WAIT_UNTIL([test $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg) -gt $(ovn-ic-nbctl get ic_nb_global . sb_ic_cfg)])
AT_CHECK([ovn-ic-nbctl get ic_nb_global . nb_ic_cfg], [0], [dnl
1
])
AT_CHECK([ovn-ic-nbctl get ic_nb_global . sb_ic_cfg], [0], [dnl
0
])
# resume ovn-ic instance
check ovn-appctl -t ic/ovn-ic resume
OVS_WAIT_UNTIL([test $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg) -eq $(ovn-ic-nbctl get ic_nb_global . sb_ic_cfg)])
AT_CHECK([ovn-ic-nbctl get ic_nb_global . nb_ic_cfg], [0], [dnl
1
])
AT_CHECK([ovn-ic-nbctl get ic_nb_global . sb_ic_cfg], [0], [dnl
1
])
OVN_CLEANUP_IC([az1])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route sync -- IPv6 denylist filter])
AT_KEYWORDS([IPv6-route-sync-denylist])
ovn_init_ic_db
check ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Enable denylist single filter for IPv6
check ovn-nbctl set nb_global . options:ic-route-denylist=" \
2003:db08:1::/64,2004:aaaa::/32,2005:1234::/21"
check ovn-ic-nbctl --wait=sb sync
# Create LRP and connect to TS
check ovn-nbctl lr-add lr$i
check ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i \
2001:db8:1::$i/64
check ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
-- lsp-set-addresses lsp-ts1-lr$i router \
-- lsp-set-type lsp-ts1-lr$i router \
-- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1
check ovn-nbctl lrp-add lr$i lrp-lr$i-p$i 00:00:00:00:00:0$i \
2002:db8:1::$i/64
# Create denylisted LRPs and connect to TS
check ovn-nbctl lrp-add lr$i lrp-lr$i-p-ext$i \
11:11:11:11:11:1$i 2003:db88:1::$i/64
check ovn-nbctl lrp-add lr$i lrp-lr$i-p-ext1$i \
11:11:11:11:12:1$i 2003:db08:1::$i/64
check ovn-nbctl lrp-add lr$i lrp-lr$i-p-ext2$i \
22:22:22:22:22:2$i 2004:aaaa:bbb::$i/48
# filtered by 2005:1234::/21 - (2005:1000: - 2005:17ff:)
check ovn-nbctl lrp-add lr$i lrp-lr$i-p-ext3$i \
33:33:33:33:33:3$i 2005:1734:5678::$i/50
# additional not filtered prefix -> different subnet bits
check ovn-nbctl --wait=sb lrp-add lr$i lrp-lr$i-p-ext4$i \
44:44:44:44:44:4$i 2005:1834:5678::$i/50
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1 |
awk '/learned/{print $1, $2}' ], [0], [dnl
2002:db8:1::/64 2001:db8:1::2
2003:db88:1::/64 2001:db8:1::2
2005:1834:5678::/50 2001:db8:1::2
])
for i in 1 2; do
ovn_as az$i
# Drop denylist
check ovn-nbctl remove nb_global . options ic-route-denylist
done
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1 |
awk '/learned/{print $1, $2}' | sort ], [0], [dnl
2002:db8:1::/64 2001:db8:1::2
2003:db08:1::/64 2001:db8:1::2
2003:db88:1::/64 2001:db8:1::2
2004:aaaa:bbb::/48 2001:db8:1::2
2005:1734:5678::/50 2001:db8:1::2
2005:1834:5678::/50 2001:db8:1::2
])
for i in 1 2; do
ovn_as az$i
check ovn-nbctl set nb_global . \
options:ic-route-denylist="2003:db88:1::/64,2004:db8:1::/64"
# Create an 'extra' denylisted LRP and connect to TS
check ovn-nbctl lrp-add lr$i lrp-lr$i-p-ext5$i \
55:55:55:55:55:5$i 2004:db8:1::$i/64
done
check ovn-ic-nbctl --wait=sb sync
AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr1 |
awk '/learned/{print $1, $2}' | sort ], [0], [dnl
2002:db8:1::/64 2001:db8:1::2
2003:db08:1::/64 2001:db8:1::2
2004:aaaa:bbb::/48 2001:db8:1::2
2005:1734:5678::/50 2001:db8:1::2
2005:1834:5678::/50 2001:db8:1::2
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([interconnection])
AT_KEYWORDS([slowtest])
ovn_init_ic_db
# The number needs to stay relatively low due to high memory consumption
# with address sanitizers enabled.
n_az=3
n_ts=3
for i in `seq 1 $n_az`; do
ovn_start az$i
done
net_add n1
# 1 HV and 1 GW per AZ
for az in `seq 1 $n_az`; do
sim_add hv$az
as hv$az
check ovs-vsctl add-br br-phys
ovn_az_attach az$az n1 br-phys 192.168.$az.1 16
for p in `seq 1 $n_ts`; do
check ovs-vsctl -- add-port br-int vif$p -- \
set interface vif$p external-ids:iface-id=lsp$az-$p \
options:tx_pcap=hv$az/vif$p-tx.pcap \
options:rxq_pcap=hv$az/vif$p-rx.pcap \
ofport-request=$p
done
sim_add gw$az
as gw$az
check ovs-vsctl add-br br-phys
ovn_az_attach az$az n1 br-phys 192.168.$az.2 16
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
done
for ts in `seq 1 $n_ts`; do
AT_CHECK([ovn-ic-nbctl --wait=sb create Transit_Switch name=ts$ts], [0], [ignore])
done
for az in `seq 1 $n_az`; do
ovn_as az$az
check ovn-nbctl set nb_global . options:ic-route-learn=true
check ovn-nbctl set nb_global . options:ic-route-adv=true
# Each AZ has n_ts LSPi->LSi->LRi connecting to each TSi
echo
echo "az$az"
for i in `seq 1 $n_ts`; do
lsp_mac=00:00:00:0$az:0$i:00
lrp_ls_mac=00:00:00:0$az:0$i:01
lrp_ts_mac=00:00:00:0$az:0$i:02
lsp_ip=10.$az.$i.123
lrp_ls_ip=10.$az.$i.1
lrp_ts_ip=169.254.$i.$az
check ovn-nbctl ls-add ls$az-$i
check ovn-nbctl lsp-add ls$az-$i lsp$az-$i
check ovn-nbctl lsp-set-addresses lsp$az-$i "$lsp_mac $lsp_ip"
check ovn-nbctl lr-add lr$az-$i
check ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ls$az-$i $lrp_ls_mac $lrp_ls_ip/24
check ovn-nbctl lsp-add ls$az-$i lsp-ls$az-$i-lr$az-$i
check ovn-nbctl lsp-set-addresses lsp-ls$az-$i-lr$az-$i router
check ovn-nbctl lsp-set-type lsp-ls$az-$i-lr$az-$i router
check ovn-nbctl lsp-set-options lsp-ls$az-$i-lr$az-$i router-port=lrp-lr$az-$i-ls$az-$i
check ovn-nbctl -- lrp-add lr$az-$i lrp-lr$az-$i-ts$i $lrp_ts_mac $lrp_ts_ip/24 \
-- lsp-add ts$i lsp-ts$i-lr$az-$i \
-- lsp-set-addresses lsp-ts$i-lr$az-$i router \
-- lsp-set-type lsp-ts$i-lr$az-$i router \
-- lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i \
-- lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az
done
check ovn-nbctl --wait=hv sync
ovn-sbctl list Port_Binding > az$az.ports
wait_for_ports_up
done
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
OVN_POPULATE_ARP
for i in `seq 1 $n_az`; do
check ovn_as az$i ovn-nbctl --wait=hv sync
ovn_as az$i ovn-sbctl dump-flows > az$i/sbflows
done
# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2
# Populate requested-chassis options for remote lsps
for az in $(seq 1 $n_az); do
ovn_as az${az}
for ts in $(seq 1 $n_ts); do
for i in $(seq 1 $n_ts); do
if [[ $i -eq ${az} ]]; then
continue
fi
check ovn-nbctl lsp-set-options lsp-ts${ts}-lr${i}-${ts} requested-chassis=gw$i
done
done
done
ovn-ic-nbctl show > ic-nbctl.dump
AT_CAPTURE_FILE([ic-nbctl.dump])
(echo "---------ISB dump-----"
ovn-ic-sbctl show
echo "---------------------"
ovn-ic-sbctl list gateway
echo "---------------------"
ovn-ic-sbctl list datapath_binding
echo "---------------------"
ovn-ic-sbctl list port_binding
echo "---------------------"
ovn-ic-sbctl list route
echo "---------------------") > ic-sbctl.dump
AT_CAPTURE_FILE([ic-sbctl.dump])
AT_CAPTURE_FILE([expected])
AT_CAPTURE_FILE([received])
check_packets() {
> expected
> received
for az in `seq 1 $n_az`; do
for i in `seq 1 $n_ts`; do
pcap=hv$az/vif$i-tx.pcap
echo "--- $pcap" | tee -a expected >> received
if test -e $az-$i.expected; then
sort $az-$i.expected >> expected
fi
if test -e $pcap; then
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received
fi
echo | tee -a expected >> received
done
done
$at_diff expected received >/dev/null
}
# Send packets between AZs on each TS
for s_az in $(seq 1 $n_az); do
ovn_as az${s_az}
as hv${s_az}
for d_az in $(seq 1 $n_az); do
if test $s_az = $d_az; then
continue
fi
for i in $(seq 1 $n_ts); do
echo
AS_BOX([packet from az$s_az to az$d_az via ts$i])
lsp_smac=00:00:00:0${s_az}:0$i:00
lsp_dmac=00:00:00:0${d_az}:0$i:00
lrp_ls_smac=00:00:00:0${s_az}:0$i:01
lrp_ls_dmac=00:00:00:0${d_az}:0$i:01
lsp_sip=10.${s_az}.$i.123
lsp_dip=10.${d_az}.$i.123
ovn_inport=lsp${s_az}-$i
packet="inport==\"$ovn_inport\" && eth.src==$lsp_smac && eth.dst==$lrp_ls_smac &&
ip4 && ip.ttl==64 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip &&
udp && udp.src==53 && udp.dst==4369"
echo "sending: $packet"
AT_CHECK([ovn_trace --ovs "$packet" > ${s_az}-${d_az}-$i.ovn-trace])
OVS_WAIT_UNTIL([ovn-appctl -t ovn-controller inject-pkt "$packet"])
ovs_inport=$(ovs-vsctl --bare --columns=ofport find Interface external-ids:iface-id="$ovn_inport")
ovs_packet=$(echo $packet | ovstest test-ovn expr-to-packets)
echo ovs_inport=$ovs_inport ovs_packet=$ovs_packet
AT_CHECK([ovs-appctl ofproto/trace br-int in_port="$ovs_inport" "$ovs_packet" > ${s_az}-${d_az}-$i.ovs-trace])
# Packet to Expect
# The TTL should be decremented by 2.
packet="eth.src==$lrp_ls_dmac && eth.dst==$lsp_dmac &&
ip4 && ip.ttl==62 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip &&
udp && udp.src==53 && udp.dst==4369"
echo $packet | ovstest test-ovn expr-to-packets >> ${d_az}-$i.expected
done
done
done
OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' expected received])
ovn_as az1 OVN_CLEANUP_SBOX([hv1])
ovn_as az2 OVN_CLEANUP_SBOX([hv2])
ovn_as az3 OVN_CLEANUP_SBOX([hv3])
for az in `seq 1 $n_az`; do
ovn_as az$az
OVN_CLEANUP_SBOX([gw$az])
OVN_CLEANUP_AZ([az$az])
done
OVN_CLEANUP_IC
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([interconnection - static multicast])
# Logical network:
#
# AZ1 | AZ2
# ---------------------------------------------------------------------
# |
# | +-- LR2 --- LS2 --- LSP2 (sender)
# | | |
# | | +----- LSP4 (receiver)
# | /
# LSP1 --- LS1 --- LR1 --- TS ---
# (receiver) | \
# | +-- LR3 --- LS3 --- LSP3 (receiver)
#
# LS1, LS2, LS3 configured to flood unregistered IP multicast.
# LR1, LR2, LR3 configured to relay IP multicast.
# LR1-LS1 configured to flood IP multicast traffic unconditionally.
# LR3-LS3 configured to flood IP multicast traffic unconditionally.
AT_CAPTURE_FILE([exp])
AT_CAPTURE_FILE([rcv])
check_packets() {
> exp
> rcv
if test "$1" = --uniq; then
sort="sort -u"; shift
else
sort=sort
fi
for tuple in "$@"; do
set $tuple; pcap=$1 type=$2
echo "--- $pcap" | tee -a exp >> rcv
$sort "$type" >> exp
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
echo | tee -a exp >> rcv
done
$at_diff exp rcv >/dev/null
}
ovn_init_ic_db
ovn_start az1
ovn_start az2
net_add n1
sim_add hv1
as hv1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1 16
check ovs-vsctl -- add-port br-int hv1-vif1 \
-- set interface hv1-vif1 external-ids:iface-id=lsp1 \
options:tx_pcap=hv1/vif1-tx.pcap \
options:rxq_pcap=hv1/vif1-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
sim_add hv2
as hv2
check ovs-vsctl add-br br-phys
ovn_az_attach az2 n1 br-phys 192.168.2.1 16
check ovs-vsctl -- add-port br-int hv2-vif1 \
-- set interface hv2-vif1 external-ids:iface-id=lsp2 \
options:tx_pcap=hv2/vif1-tx.pcap \
options:rxq_pcap=hv2/vif1-rx.pcap
check ovs-vsctl -- add-port br-int hv2-vif2 \
-- set interface hv2-vif2 external-ids:iface-id=lsp3 \
options:tx_pcap=hv2/vif2-tx.pcap \
options:rxq_pcap=hv2/vif2-rx.pcap
check ovs-vsctl -- add-port br-int hv2-vif3 \
-- set interface hv2-vif3 external-ids:iface-id=lsp4 \
options:tx_pcap=hv2/vif3-tx.pcap \
options:rxq_pcap=hv2/vif3-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
AT_CHECK([ovn-ic-nbctl --wait=sb create Transit_Switch name=ts], [0], [ignore])
ovn_as az1
check ovn-nbctl lr-add lr1 \
-- lrp-add lr1 lr1-ts 00:00:00:01:00:01 42.42.42.1/24 \
-- lrp-add lr1 lr1-ls1 00:00:00:01:01:00 43.43.43.1/24 \
-- lrp-set-gateway-chassis lr1-ts hv1
check ovn-nbctl ls-add ls1 \
-- lsp-add ls1 ls1-lr1 \
-- lsp-set-addresses ls1-lr1 router \
-- lsp-set-type ls1-lr1 router \
-- lsp-set-options ls1-lr1 router-port=lr1-ls1 \
-- lsp-add ls1 lsp1
check ovn-nbctl lsp-add ts ts-lr1 \
-- lsp-set-addresses ts-lr1 router \
-- lsp-set-type ts-lr1 router \
-- lsp-set-options ts-lr1 router-port=lr1-ts
wait_for_ports_up
ovn_as az2
check ovn-nbctl lr-add lr2 \
-- lrp-add lr2 lr2-ts 00:00:00:02:00:01 42.42.42.2/24 \
-- lrp-add lr2 lr2-ls2 00:00:00:02:01:00 44.44.44.1/24 \
-- lrp-set-gateway-chassis lr2-ts hv2
check ovn-nbctl ls-add ls2 \
-- lsp-add ls2 ls2-lr2 \
-- lsp-set-addresses ls2-lr2 router \
-- lsp-set-type ls2-lr2 router \
-- lsp-set-options ls2-lr2 router-port=lr2-ls2 \
-- lsp-add ls2 lsp2 \
-- lsp-add ls2 lsp4
check ovn-nbctl lsp-add ts ts-lr2 \
-- lsp-set-addresses ts-lr2 router \
-- lsp-set-type ts-lr2 router \
-- lsp-set-options ts-lr2 router-port=lr2-ts
check ovn-nbctl lr-add lr3 \
-- lrp-add lr3 lr3-ts 00:00:00:02:00:02 42.42.42.3/24 \
-- lrp-add lr3 lr3-ls3 00:00:00:02:02:00 44.44.45.1/24 \
-- lrp-set-gateway-chassis lr3-ts hv2
check ovn-nbctl ls-add ls3 \
-- lsp-add ls3 ls3-lr3 \
-- lsp-set-addresses ls3-lr3 router \
-- lsp-set-type ls3-lr3 router \
-- lsp-set-options ls3-lr3 router-port=lr3-ls3 \
-- lsp-add ls3 lsp3
check ovn-nbctl lsp-add ts ts-lr3 \
-- lsp-set-addresses ts-lr3 router \
-- lsp-set-type ts-lr3 router \
-- lsp-set-options ts-lr3 router-port=lr3-ts
wait_for_ports_up
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
ovn_as az1
check ovn-nbctl lsp-set-options ts-lr2 requested-chassis=hv2
check ovn-nbctl lsp-set-options ts-lr3 requested-chassis=hv2
ovn_as az2
check ovn-nbctl lsp-set-options ts-lr1 requested-chassis=hv1
dnl Enable unregistered IP multicast flooding and IP multicast relay.
ovn_as az1
check ovn-nbctl set logical_switch ls1 other_config:mcast_snoop="true" \
other_config:mcast_flood_unregistered="true"
check ovn-nbctl set logical_router lr1 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr1-ls1 options:mcast_flood="true"
ovn_as az2
check ovn-nbctl set logical_switch ls2 other_config:mcast_snoop="true" \
other_config:mcast_flood_unregistered="true"
check ovn-nbctl set logical_router lr2 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr2-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ls3 other_config:mcast_snoop="true" \
other_config:mcast_flood_unregistered="true"
check ovn-nbctl set logical_router lr3 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr3-ls3 options:mcast_flood="true"
check ovn_as az1 ovn-nbctl --wait=hv sync
check ovn_as az2 ovn-nbctl --wait=hv sync
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
OVN_POPULATE_ARP
# Send an IP multicast packet from lsp2, it should be forwarded
# statically to lsp1, lsp3 and lsp4.
> expected_az1
> expected_az2
> expected_az2_switched
send_ip_multicast_pkt hv2-vif1 hv2 \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 20 7c6b 11 \
e518e518000aed350000
store_ip_multicast_pkt \
000000010100 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az1
store_ip_multicast_pkt \
000000020200 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az2
store_ip_multicast_pkt \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 20 7c6b 11 \
e518e518000aed350000 expected_az2_switched
OVS_WAIT_UNTIL(
[check_packets 'hv1/vif1-tx.pcap expected_az1' \
'hv2/vif2-tx.pcap expected_az2' \
'hv2/vif3-tx.pcap expected_az2_switched'],
[$at_diff -F'^---' exp rcv])
# Send an IP multicast packet from lsp2 towards 224.0.0.x, it should be
# forwarded statically only to lsp3.
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
> expected_az1
> expected_az2
> expected_az2_switched
send_ip_multicast_pkt hv2-vif1 hv2 \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 224 0 0 1) 1e 20 8cae 11 \
e518e518000aed350000
store_ip_multicast_pkt \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 224 0 0 1) 1e 20 8cae 11 \
e518e518000aed350000 expected_az2_switched
OVS_WAIT_UNTIL(
[check_packets 'hv1/vif1-tx.pcap expected_az1' \
'hv2/vif2-tx.pcap expected_az2' \
'hv2/vif3-tx.pcap expected_az2_switched'],
[$at_diff -F'^---' exp rcv])
OVN_CLEANUP_SBOX([hv1],["/IGMP Querier enabled without a valid IPv4 or IPv6 address/d
/IGMP Querier enabled with invalid ETH src address/d"])
OVN_CLEANUP_SBOX([hv2],["/IGMP Querier enabled without a valid IPv4 or IPv6 address/d
/IGMP Querier enabled with invalid ETH src address/d"])
OVN_CLEANUP_IC([az1],[az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([interconnection - IGMP/MLD multicast])
AT_KEYWORDS([IP-multicast])
# Logical network:
#
# AZ1 | AZ2
# ---------------------------------------------------------------------
# |
# | +-- LR2 --- LS2 --- LSP2 (sender)
# | /
# LSP1 --- LS1 --- LR1 --- TS ---
# (receiver) | \
# | +-- LR3 --- LS3 --- LSP3 (receiver)
#
# LS1, LS2, LS3, TS configured to snoop IP multicast.
# LR1, LR2, LR3 configured to relay IP multicast.
# LR1-TS configured to flood IP multicast traffic unconditionally.
# LR2-TS configured to flood IP multicast traffic unconditionally.
# LR3-TS configured to flood IP multicast traffic unconditionally.
AT_CAPTURE_FILE([exp])
AT_CAPTURE_FILE([rcv])
check_packets() {
> exp
> rcv
if test "$1" = --uniq; then
sort="sort -u"; shift
else
sort=sort
fi
for tuple in "$@"; do
set $tuple; pcap=$1 type=$2
echo "--- $pcap" | tee -a exp >> rcv
$sort "$type" >> exp
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
echo | tee -a exp >> rcv
done
$at_diff exp rcv >/dev/null
}
ovn_init_ic_db
ovn_start az1
ovn_start az2
net_add n1
sim_add hv1
as hv1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1 16
check ovs-vsctl -- add-port br-int hv1-vif1 \
-- set interface hv1-vif1 external-ids:iface-id=lsp1 \
options:tx_pcap=hv1/vif1-tx.pcap \
options:rxq_pcap=hv1/vif1-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
sim_add hv2
as hv2
check ovs-vsctl add-br br-phys
ovn_az_attach az2 n1 br-phys 192.168.2.1 16
check ovs-vsctl -- add-port br-int hv2-vif1 \
-- set interface hv2-vif1 external-ids:iface-id=lsp2 \
options:tx_pcap=hv2/vif1-tx.pcap \
options:rxq_pcap=hv2/vif1-rx.pcap
check ovs-vsctl -- add-port br-int hv2-vif2 \
-- set interface hv2-vif2 external-ids:iface-id=lsp3 \
options:tx_pcap=hv2/vif2-tx.pcap \
options:rxq_pcap=hv2/vif2-rx.pcap
check ovs-vsctl -- add-port br-int hv2-vif3 \
-- set interface hv2-vif3 external-ids:iface-id=lsp4 \
options:tx_pcap=hv2/vif3-tx.pcap \
options:rxq_pcap=hv2/vif3-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
AT_CHECK([ovn-ic-nbctl --wait=sb create Transit_Switch name=ts], [0], [ignore])
check ovn_as az1 ovn-nbctl wait-until logical_switch ts
check ovn_as az2 ovn-nbctl wait-until logical_switch ts
ovn_as az1
check ovn-nbctl lr-add lr1 \
-- lrp-add lr1 lr1-ts 00:00:00:01:00:01 42.42.42.1/24 4242::1/64 \
-- lrp-add lr1 lr1-ls1 00:00:00:01:01:00 43.43.43.1/24 4343::1/64\
-- lrp-set-gateway-chassis lr1-ts hv1
check ovn-nbctl ls-add ls1 \
-- lsp-add ls1 ls1-lr1 \
-- lsp-set-addresses ls1-lr1 router \
-- lsp-set-type ls1-lr1 router \
-- lsp-set-options ls1-lr1 router-port=lr1-ls1 \
-- lsp-add ls1 lsp1
check ovn-nbctl lsp-add ts ts-lr1 \
-- lsp-set-addresses ts-lr1 router \
-- lsp-set-type ts-lr1 router \
-- lsp-set-options ts-lr1 router-port=lr1-ts
wait_for_ports_up
ovn_as az2
check ovn-nbctl lr-add lr2 \
-- lrp-add lr2 lr2-ts 00:00:00:02:00:01 42.42.42.2/24 4242::2/64 \
-- lrp-add lr2 lr2-ls2 00:00:00:02:01:00 44.44.44.1/24 4444::1/64 \
-- lrp-set-gateway-chassis lr2-ts hv2
check ovn-nbctl ls-add ls2 \
-- lsp-add ls2 ls2-lr2 \
-- lsp-set-addresses ls2-lr2 router \
-- lsp-set-type ls2-lr2 router \
-- lsp-set-options ls2-lr2 router-port=lr2-ls2 \
-- lsp-add ls2 lsp2
check ovn-nbctl lsp-add ts ts-lr2 \
-- lsp-set-addresses ts-lr2 router \
-- lsp-set-type ts-lr2 router \
-- lsp-set-options ts-lr2 router-port=lr2-ts
check ovn-nbctl lsp-add ts lsp4 \
-- lsp-set-addresses lsp4 unknown
check ovn-nbctl lr-add lr3 \
-- lrp-add lr3 lr3-ts 00:00:00:02:00:02 42.42.42.3/24 4242::3/64 \
-- lrp-add lr3 lr3-ls3 00:00:00:02:02:00 44.44.45.1/24 4445::1/64 \
-- lrp-set-gateway-chassis lr3-ts hv2
check ovn-nbctl ls-add ls3 \
-- lsp-add ls3 ls3-lr3 \
-- lsp-set-addresses ls3-lr3 router \
-- lsp-set-type ls3-lr3 router \
-- lsp-set-options ls3-lr3 router-port=lr3-ls3 \
-- lsp-add ls3 lsp3
check ovn-nbctl lsp-add ts ts-lr3 \
-- lsp-set-addresses ts-lr3 router \
-- lsp-set-type ts-lr3 router \
-- lsp-set-options ts-lr3 router-port=lr3-ts
wait_for_ports_up
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
ovn_as az1
check ovn-nbctl lsp-set-options ts-lr2 requested-chassis=hv2
check ovn-nbctl lsp-set-options ts-lr3 requested-chassis=hv2
ovn_as az2
check ovn-nbctl lsp-set-options ts-lr1 requested-chassis=hv1
dnl Enable IP multicast snooping and IP multicast relay. Reports are
dnl forwarded statically.
ovn_as az1
check ovn-nbctl set logical_switch ls1 other_config:mcast_snoop="true"
check ovn-nbctl set Logical_Switch_Port ls1-lr1 options:mcast_flood_reports="true"
check ovn-nbctl set logical_router lr1 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr1-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
check ovn-nbctl set logical_switch_port ts-lr1 options:mcast_flood_reports="true"
check ovn-nbctl set logical_switch_port ts-lr2 options:mcast_flood_reports="true"
check ovn-nbctl set logical_switch_port ts-lr3 options:mcast_flood_reports="true"
ovn_as az2
check ovn-nbctl set logical_switch ls2 other_config:mcast_snoop="true"
check ovn-nbctl set Logical_Switch_Port ls2-lr2 options:mcast_flood_reports="true"
check ovn-nbctl set logical_router lr2 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr2-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ls3 other_config:mcast_snoop="true"
check ovn-nbctl set Logical_Switch_Port ls3-lr3 options:mcast_flood_reports="true"
check ovn-nbctl set logical_router lr3 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr3-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
check ovn-nbctl set logical_switch_port ts-lr1 options:mcast_flood_reports="true"
check ovn-nbctl set logical_switch_port ts-lr2 options:mcast_flood_reports="true"
check ovn-nbctl set logical_switch_port ts-lr3 options:mcast_flood_reports="true"
check ovn_as az1 ovn-nbctl --wait=hv sync
check ovn_as az2 ovn-nbctl --wait=hv sync
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
OVN_POPULATE_ARP
# Inject IGMP Join for 239.0.1.68 on LSP1.
send_igmp_v3_report hv1-vif1 hv1 \
000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
$(ip_to_hex 239 0 1 68) 04 e9b9 \
/dev/null
# Inject MLD Join for ff0a:dead:beef::1 on LSP1.
send_mld_v2_report hv1-vif1 hv1 \
000000000001 10000000000000000000000000000001 \
ff0adeadbeef00000000000000000001 04 c0e4 \
/dev/null
# Inject IGMP Join for 239.0.1.68 on LSP3.
send_igmp_v3_report hv2-vif2 hv2 \
000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
$(ip_to_hex 239 0 1 68) 04 e9b9 \
/dev/null
# Inject MLD Join for ff0a:dead:beef::1 on LSP3.
send_mld_v2_report hv2-vif2 hv2 \
000000000001 10000000000000000000000000000001 \
ff0adeadbeef00000000000000000001 04 c0e4 \
/dev/null
# Inject IGMP Join for 239.0.1.68 on LSP4.
send_igmp_v3_report hv2-vif3 hv2 \
000000000001 $(ip_to_hex 10 0 0 42) f9cf \
$(ip_to_hex 239 0 1 68) 04 e9b9 \
/dev/null
# Inject MLD Join for ff0a:dead:beef::1 on LSP3.
send_mld_v2_report hv2-vif3 hv2 \
000000000001 10000000000000000000000000000042 \
ff0adeadbeef00000000000000000001 04 c0a3 \
/dev/null
# Check that the IGMP and MLD groups are learned on both AZs (on the LS
# and TS).
ovn_as az1
wait_row_count IGMP_Group 2 address=239.0.1.68
wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"'
check ovn-nbctl --wait=hv sync
ovn_as az2
wait_row_count IGMP_Group 2 address=239.0.1.68
wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"'
check ovn-nbctl --wait=hv sync
# Send an IP multicast packet from LSP2, it should be forwarded
# to lsp1 and lsp3.
> expected_az1
> expected_az2
> expected_az2-lsp4
send_ip_multicast_pkt hv2-vif1 hv2 \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 20 7c6b 11 \
e518e518000aed350000
store_ip_multicast_pkt \
000000010100 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az1
store_ip_multicast_pkt \
000000020200 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az2
store_ip_multicast_pkt \
000000020001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1f 7d6b 11 \
e518e518000aed350000 expected_az2-lsp4
send_ip6_multicast_pkt hv2-vif1 hv2 \
000000000001 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 40 11 \
93407a69000e2b4e61736461640a
store_ip6_multicast_pkt \
000000010100 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 3e 11 \
93407a69000e2b4e61736461640a \
expected_az1
store_ip6_multicast_pkt \
000000020200 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 3e 11 \
93407a69000e2b4e61736461640a \
expected_az2
store_ip6_multicast_pkt \
000000020001 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 3f 11 \
93407a69000e2b4e61736461640a \
expected_az2-lsp4
OVS_WAIT_UNTIL(
[check_packets 'hv1/vif1-tx.pcap expected_az1' \
'hv2/vif2-tx.pcap expected_az2' \
'hv2/vif3-tx.pcap expected_az2-lsp4'],
[$at_diff -F'^---' exp rcv])
OVN_CLEANUP_SBOX([hv1], ["/IGMP Querier enabled without a valid IPv4/d
/IGMP Querier enabled with invalid ETH src/d"])
OVN_CLEANUP_SBOX([hv2], ["/IGMP Querier enabled without a valid IPv4/d
/IGMP Querier enabled with invalid ETH src/d"])
OVN_CLEANUP_IC([az1],[az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([interconnection - IGMP/MLD multicast - TS flood])
AT_KEYWORDS([IP-multicast])
# Logical network:
#
# AZ1 | AZ2
# ---------------------------------------------------------------------
# |
# | +-- LR2 --- LS2 --- LSP2 (sender)
# | /
# LSP1 --- LS1 --- LR1 --- TS ---
# (receiver) | \
# | +-- LR3 --- LS3 --- LSP3 (receiver)
#
# LS1, LS2, LS3, TS configured to snoop IP multicast.
# LR1, LR2, LR3 configured to relay IP multicast.
# LR1-TS configured to flood IP multicast traffic unconditionally.
# LR2-TS configured to flood IP multicast traffic unconditionally.
# LR3-TS configured to flood IP multicast traffic unconditionally.
AT_CAPTURE_FILE([exp])
AT_CAPTURE_FILE([rcv])
check_packets() {
> exp
> rcv
if test "$1" = --uniq; then
sort="sort -u"; shift
else
sort=sort
fi
for tuple in "$@"; do
set $tuple; pcap=$1 type=$2
echo "--- $pcap" | tee -a exp >> rcv
$sort "$type" >> exp
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
echo | tee -a exp >> rcv
done
$at_diff exp rcv >/dev/null
}
ovn_init_ic_db
ovn_start az1
ovn_start az2
net_add n1
sim_add hv1
as hv1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1 16
check ovs-vsctl -- add-port br-int hv1-vif1 \
-- set interface hv1-vif1 external-ids:iface-id=lsp1 \
options:tx_pcap=hv1/vif1-tx.pcap \
options:rxq_pcap=hv1/vif1-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
sim_add hv2
as hv2
check ovs-vsctl add-br br-phys
ovn_az_attach az2 n1 br-phys 192.168.2.1 16
check ovs-vsctl -- add-port br-int hv2-vif1 \
-- set interface hv2-vif1 external-ids:iface-id=lsp2 \
options:tx_pcap=hv2/vif1-tx.pcap \
options:rxq_pcap=hv2/vif1-rx.pcap
check ovs-vsctl -- add-port br-int hv2-vif2 \
-- set interface hv2-vif2 external-ids:iface-id=lsp3 \
options:tx_pcap=hv2/vif2-tx.pcap \
options:rxq_pcap=hv2/vif2-rx.pcap
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
AT_CHECK([ovn-ic-nbctl --wait=sb create Transit_Switch name=ts], [0], [ignore])
check ovn_as az1 ovn-nbctl wait-until logical_switch ts
check ovn_as az2 ovn-nbctl wait-until logical_switch ts
ovn_as az1
check ovn-nbctl lr-add lr1 \
-- lrp-add lr1 lr1-ts 00:00:00:01:00:01 42.42.42.1/24 4242::1/64 \
-- lrp-add lr1 lr1-ls1 00:00:00:01:01:00 43.43.43.1/24 4343::1/64\
-- lrp-set-gateway-chassis lr1-ts hv1
check ovn-nbctl ls-add ls1 \
-- lsp-add ls1 ls1-lr1 \
-- lsp-set-addresses ls1-lr1 router \
-- lsp-set-type ls1-lr1 router \
-- lsp-set-options ls1-lr1 router-port=lr1-ls1 \
-- lsp-add ls1 lsp1
check ovn-nbctl lsp-add ts ts-lr1 \
-- lsp-set-addresses ts-lr1 router \
-- lsp-set-type ts-lr1 router \
-- lsp-set-options ts-lr1 router-port=lr1-ts
wait_for_ports_up
ovn_as az2
check ovn-nbctl lr-add lr2 \
-- lrp-add lr2 lr2-ts 00:00:00:02:00:01 42.42.42.2/24 4242::2/64 \
-- lrp-add lr2 lr2-ls2 00:00:00:02:01:00 44.44.44.1/24 4444::1/64 \
-- lrp-set-gateway-chassis lr2-ts hv2
check ovn-nbctl ls-add ls2 \
-- lsp-add ls2 ls2-lr2 \
-- lsp-set-addresses ls2-lr2 router \
-- lsp-set-type ls2-lr2 router \
-- lsp-set-options ls2-lr2 router-port=lr2-ls2 \
-- lsp-add ls2 lsp2
check ovn-nbctl lsp-add ts ts-lr2 \
-- lsp-set-addresses ts-lr2 router \
-- lsp-set-type ts-lr2 router \
-- lsp-set-options ts-lr2 router-port=lr2-ts
check ovn-nbctl lr-add lr3 \
-- lrp-add lr3 lr3-ts 00:00:00:02:00:02 42.42.42.3/24 4242::3/64 \
-- lrp-add lr3 lr3-ls3 00:00:00:02:02:00 44.44.45.1/24 4445::1/64 \
-- lrp-set-gateway-chassis lr3-ts hv2
check ovn-nbctl ls-add ls3 \
-- lsp-add ls3 ls3-lr3 \
-- lsp-set-addresses ls3-lr3 router \
-- lsp-set-type ls3-lr3 router \
-- lsp-set-options ls3-lr3 router-port=lr3-ls3 \
-- lsp-add ls3 lsp3
check ovn-nbctl lsp-add ts ts-lr3 \
-- lsp-set-addresses ts-lr3 router \
-- lsp-set-type ts-lr3 router \
-- lsp-set-options ts-lr3 router-port=lr3-ts
wait_for_ports_up
check ovn-ic-nbctl --wait=sb sync
check ovn-ic-nbctl --wait=sb sync
ovn_as az1
check ovn-nbctl lsp-set-options ts-lr2 requested-chassis=hv2
check ovn-nbctl lsp-set-options ts-lr3 requested-chassis=hv2
ovn_as az2
check ovn-nbctl lsp-set-options ts-lr1 requested-chassis=hv1
dnl Enable IP multicast snooping and IP multicast relay. Reports are
dnl forwarded statically.
ovn_as az1
check ovn-nbctl set logical_switch ls1 other_config:mcast_snoop="true"
check ovn-nbctl set logical_router lr1 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr1-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
check ovn-nbctl set logical_switch ts other_config:mcast_flood_unregistered="true"
ovn_as az2
check ovn-nbctl set logical_switch ls2 other_config:mcast_snoop="true"
check ovn-nbctl set logical_router lr2 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr2-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ls3 other_config:mcast_snoop="true"
check ovn-nbctl set logical_router lr3 options:mcast_relay="true"
check ovn-nbctl set logical_router_port lr3-ts options:mcast_flood="true"
check ovn-nbctl set logical_switch ts other_config:mcast_snoop="true"
check ovn-nbctl set logical_switch ts other_config:mcast_flood_unregistered="true"
check ovn_as az1 ovn-nbctl --wait=hv sync
check ovn_as az2 ovn-nbctl --wait=hv sync
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
OVN_POPULATE_ARP
# Inject IGMP Join for 239.0.1.68 on LSP1.
send_igmp_v3_report hv1-vif1 hv1 \
000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
$(ip_to_hex 239 0 1 68) 04 e9b9 \
/dev/null
# Inject MLD Join for ff0a:dead:beef::1 on LSP1.
send_mld_v2_report hv1-vif1 hv1 \
000000000001 10000000000000000000000000000001 \
ff0adeadbeef00000000000000000001 04 c0e4 \
/dev/null
# Inject IGMP Join for 239.0.1.68 on LSP3.
send_igmp_v3_report hv2-vif2 hv2 \
000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
$(ip_to_hex 239 0 1 68) 04 e9b9 \
/dev/null
# Inject MLD Join for ff0a:dead:beef::1 on LSP3.
send_mld_v2_report hv2-vif2 hv2 \
000000000001 10000000000000000000000000000001 \
ff0adeadbeef00000000000000000001 04 c0e4 \
/dev/null
# Check that the IGMP and MLD groups are learned on both AZs (on the LS
# and TS).
ovn_as az1
wait_row_count IGMP_Group 2 address=239.0.1.68
wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"'
check ovn-nbctl --wait=hv sync
ovn_as az2
wait_row_count IGMP_Group 2 address=239.0.1.68
wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"'
check ovn-nbctl --wait=hv sync
# Send an IP multicast packet from LSP2, it should be forwarded
# to lsp1 and lsp3.
> expected_az1
> expected_az2
send_ip_multicast_pkt hv2-vif1 hv2 \
000000000001 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 20 7c6b 11 \
e518e518000aed350000
store_ip_multicast_pkt \
000000010100 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az1
store_ip_multicast_pkt \
000000020200 01005e000144 \
$(ip_to_hex 44 44 44 2) $(ip_to_hex 239 0 1 68) 1e 1e 7e6b 11 \
e518e518000aed350000 expected_az2
send_ip6_multicast_pkt hv2-vif1 hv2 \
000000000001 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 40 11 \
93407a69000e2b4e61736461640a
store_ip6_multicast_pkt \
000000010100 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 3e 11 \
93407a69000e2b4e61736461640a \
expected_az1
store_ip6_multicast_pkt \
000000020200 333300000001 \
00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
000e 3e 11 \
93407a69000e2b4e61736461640a \
expected_az2
OVS_WAIT_UNTIL(
[check_packets 'hv1/vif1-tx.pcap expected_az1' \
'hv2/vif2-tx.pcap expected_az2'],
[$at_diff -F'^---' exp rcv])
OVN_CLEANUP_SBOX([hv1], ["/IGMP Querier enabled without a valid IPv4/d
/IGMP Querier enabled with invalid ETH src/d"])
OVN_CLEANUP_SBOX([hv2], ["/IGMP Querier enabled without a valid IPv4/d
/IGMP Querier enabled with invalid ETH src/d"])
OVN_CLEANUP_IC([az1],[az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- route tag -- tagging and filtering routes])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
# VPC1:
# / transit switch (ts11) \
# logical router (lr11) - transit switch (ts12) - logical router (lr12)
# \ /
# transit switch (tspeer)
# VPC2: / \
# logical router (lr21) - transit switch (ts21) - logical router (lr22)
# \ transit switch (ts22) /
#
# VPC1
# create lr11, lr12, ts11, ts12 and connect them
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts1$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# VPC2
# create lr21, lr22, ts21, ts22 and connect them
for i in 1 2; do
ovn_as az$i
lr=lr2$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts2$j
ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected route in VPC1
ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
# Create directly-connected route in VPC2
ovn_as az2 ovn-nbctl --wait=sb lrp-add lr22 lrp-lr22 aa:aa:aa:aa:cc:01 "192.168.1.1/24"
check ovn-ic-nbctl --wait=sb sync
# Test direct routes from lr12 were learned to lr11
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2, $5}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2 ecmp
192.168.0.0/24 169.254.102.2 ecmp
])
# Test direct routes from lr22 were learned to lr21
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 192.168 |
grep learned | awk '{print $1, $2, $5}' | sort ], [0], [dnl
192.168.1.0/24 169.254.101.2 ecmp
192.168.1.0/24 169.254.102.2 ecmp
])
# Create peering TS
ovn-ic-nbctl --wait=sb --may-exist ts-add tspeer
# Create LRPs and connect to the peering TS
ovn_as az1
check ovn-nbctl lrp-add lr11 lrp-lr11-tspeer aa:aa:aa:aa:11:01 169.254.103.11/24
check ovn-nbctl lsp-add tspeer lsp-tspeer-lr11 \
-- lsp-set-addresses lsp-tspeer-lr11 router \
-- lsp-set-type lsp-tspeer-lr11 router \
-- lsp-set-options lsp-tspeer-lr11 router-port=lrp-lr11-tspeer
ovn_as az2
check ovn-nbctl lrp-add lr12 lrp-lr12-tspeer aa:aa:aa:aa:12:01 169.254.103.12/24
check ovn-nbctl lsp-add tspeer lsp-tspeer-lr12 \
-- lsp-set-addresses lsp-tspeer-lr12 router \
-- lsp-set-type lsp-tspeer-lr12 router \
-- lsp-set-options lsp-tspeer-lr12 router-port=lrp-lr12-tspeer
ovn_as az1
check ovn-nbctl lrp-add lr21 lrp-lr21-tspeer aa:aa:aa:aa:21:01 169.254.103.21/24
check ovn-nbctl lsp-add tspeer lsp-tspeer-lr21 \
-- lsp-set-addresses lsp-tspeer-lr21 router \
-- lsp-set-type lsp-tspeer-lr21 router \
-- lsp-set-options lsp-tspeer-lr21 router-port=lrp-lr21-tspeer
ovn_as az2
check ovn-nbctl lrp-add lr22 lrp-lr22-tspeer aa:aa:aa:aa:22:01 169.254.103.22/24
check ovn-nbctl lsp-add tspeer lsp-tspeer-lr22 \
-- lsp-set-addresses lsp-tspeer-lr22 router \
-- lsp-set-type lsp-tspeer-lr22 router \
-- lsp-set-options lsp-tspeer-lr22 router-port=lrp-lr22-tspeer
check ovn-ic-nbctl --wait=sb sync
# Test direct routes from lr12/lr22 were learned to lr11
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
192.168.0.0/24 169.254.103.12
192.168.1.0/24 169.254.103.22
])
# Test direct routes from lr22/lr12 were learned to lr21
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr21 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.103.12
192.168.1.0/24 169.254.101.2
192.168.1.0/24 169.254.102.2
192.168.1.0/24 169.254.103.22
])
# VPC1: Create a route tag for VPC1 mark its own routes via lrp-lr12
ovn_as az2 ovn-nbctl set logical_router_port lrp-lr12-tspeer options:ic-route-tag=vpc1
# Test advertised routes with the vpc1 route tag present
ovn-ic-sbctl list route
wait_row_count ic-sb:Route 1 ip_prefix=192.168.0.1/24 nexthop=169.254.103.12 origin=connected external_ids:ic-route-tag=vpc1
# Filter routes on VPC1 lrp-lr11-tspeer with the route tag vpc1 present
ovn_as az1 ovn-nbctl set logical_router_port lrp-lr11-tspeer options:ic-route-filter-tag=vpc1
# Test remaining direct routes from lr12 were learned to lr11
# Routes from the 169.254.101.2 nexthop have been filtered
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
192.168.1.0/24 169.254.103.22
])
# Remove the route tag used for advertisement
ovn_as az2 ovn-nbctl remove logical_router_port lrp-lr12-tspeer options ic-route-tag=vpc1
# Test advertised routes with the vpc1 route tag present
ovn-ic-sbctl list route
wait_row_count ic-sb:Route 0 ip_prefix=192.168.0.1/24 nexthop=169.254.103.12 origin=connected external_ids:ic-route-tag=vpc1
# Test the original direct routes from lr12/lr22 were learned to lr11
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
192.168.0.0/24 169.254.103.12
192.168.1.0/24 169.254.103.22
])
# Remove route tag filter and add route tag on lrp-lr12-tspeer advertised routes
ovn_as az1 ovn-nbctl remove logical_router_port lrp-lr11-tspeer options ic-route-filter-tag=vpc1
ovn_as az2 ovn-nbctl set logical_router_port lrp-lr12-tspeer options:ic-route-tag=vpc1
# Test if all the routes are learned because we no longer have the filter tag option enabled
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
192.168.0.0/24 169.254.103.12
192.168.1.0/24 169.254.103.22
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([spine-leaf: 3 AZs, 3 HVs, 3 LSs, connected via transit spine switch])
AT_KEYWORDS([spine leaf])
AT_SKIP_IF([test $HAVE_SCAPY = no])
ovn_init_ic_db
ovn_start az1
ovn_start az2
ovn_start az3
# Logical network:
# Single network 172.16.1.0/24. Three switches with VIF ports on HVs in three
# separate AZs, connected to a spine transit switch via 'switch' ports.
# Third switch has a port with unknown address, but we're only sending packets
# between ports on other two switches.
ovn-ic-nbctl ts-add spine
ovn_as az1 check ovn-nbctl ls-add ls1
ovn_as az2 check ovn-nbctl ls-add ls2
ovn_as az3 check ovn-nbctl ls-add ls3
# Connect ls1 to spine.
ovn_as az1
check ovn-nbctl lsp-add spine spine-to-ls1
check ovn-nbctl lsp-add ls1 ls1-to-spine
check ovn-nbctl lsp-set-type spine-to-ls1 switch peer=ls1-to-spine
check ovn-nbctl lsp-set-type ls1-to-spine switch peer=spine-to-ls1
# Connect ls2 to spine.
ovn_as az2
check ovn-nbctl lsp-add spine spine-to-ls2
check ovn-nbctl lsp-add ls2 ls2-to-spine
check ovn-nbctl lsp-set-type spine-to-ls2 switch peer=ls2-to-spine
check ovn-nbctl lsp-set-type ls2-to-spine switch peer=spine-to-ls2
# Connect ls3 to spine.
ovn_as az3
check ovn-nbctl lsp-add spine spine-to-ls3
check ovn-nbctl lsp-add ls3 ls3-to-spine
check ovn-nbctl lsp-set-type spine-to-ls3 switch peer=ls3-to-spine
check ovn-nbctl lsp-set-type ls3-to-spine switch peer=spine-to-ls3
# Create logical port ls1-lp1 in ls1
ovn_as az1 check ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:01 172.16.1.1"
# Create logical port ls1-lp2 in ls1
ovn_as az1 check ovn-nbctl lsp-add ls1 ls1-lp2 \
-- lsp-set-addresses ls1-lp2 "f0:00:00:01:02:02 172.16.1.2"
# Create logical port ls2-lp1 in ls2
ovn_as az2 check ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "f0:00:00:01:02:03 172.16.1.3"
# Create logical port ls2-lp2 in ls2
ovn_as az2 check ovn-nbctl lsp-add ls2 ls2-lp2 \
-- lsp-set-addresses ls2-lp2 "f0:00:00:01:02:04 172.16.1.4"
# Create logical port ls3-lp1 in ls3 with unknown address.
check ovn-nbctl lsp-add ls3 ls3-lp1 -- lsp-set-addresses ls3-lp1 unknown
# Create hypervisors and OVS ports corresponding to logical ports.
net_add n1
sim_add hv1
as hv1
check ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.1.1 16
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
ovs-vsctl -- add-port br-int vif1 -- \
set interface vif1 external-ids:iface-id=ls1-lp1 \
options:tx_pcap=hv1/vif1-tx.pcap \
options:rxq_pcap=hv1/vif1-rx.pcap \
ofport-request=1
ovs-vsctl -- add-port br-int vif2 -- \
set interface vif2 external-ids:iface-id=ls1-lp2 \
options:tx_pcap=hv1/vif2-tx.pcap \
options:rxq_pcap=hv1/vif2-rx.pcap \
ofport-request=2
sim_add hv2
as hv2
check ovs-vsctl add-br br-phys
ovn_az_attach az2 n1 br-phys 192.168.2.1 16
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
ovs-vsctl -- add-port br-int vif3 -- \
set interface vif3 external-ids:iface-id=ls2-lp1 \
options:tx_pcap=hv2/vif3-tx.pcap \
options:rxq_pcap=hv2/vif3-rx.pcap \
ofport-request=3
ovs-vsctl -- add-port br-int vif4 -- \
set interface vif4 external-ids:iface-id=ls2-lp2 \
options:tx_pcap=hv2/vif4-tx.pcap \
options:rxq_pcap=hv2/vif4-rx.pcap \
ofport-request=4
sim_add hv3
as hv3
check ovs-vsctl add-br br-phys
ovn_az_attach az3 n1 br-phys 192.168.3.1 16
check ovs-vsctl set open . external-ids:ovn-is-interconn=true
ovs-vsctl -- add-port br-int vif5 -- \
set interface vif5 external-ids:iface-id=ls3-lp1 \
options:tx_pcap=hv3/vif5-tx.pcap \
options:rxq_pcap=hv3/vif5-rx.pcap \
ofport-request=5
# Bind transit switch ports to their chassis.
check ovn_as az1 ovn-nbctl lsp-set-options spine-to-ls1 requested-chassis=hv1
check ovn_as az2 ovn-nbctl lsp-set-options spine-to-ls2 requested-chassis=hv2
check ovn_as az3 ovn-nbctl lsp-set-options spine-to-ls3 requested-chassis=hv3
# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
OVN_POPULATE_ARP
ovn_as az1
check ovn-nbctl --wait=hv sync
ovn-sbctl dump-flows > az1/sbflows
ovn_as az2
check ovn-nbctl --wait=hv sync
ovn-sbctl dump-flows > az2/sbflows
ovn_as az3
check ovn-nbctl --wait=hv sync
ovn-sbctl dump-flows > az3/sbflows
dnl Check that FDB learning is enabled for remote ports in the egress pipeline.
AT_CHECK([grep -E "ls_out.*fdb.*spine-to-" az1/sbflows | ovn_strip_lflows], [0], [dnl
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls2"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls3"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls2" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls3" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
])
AT_CHECK([grep -E "ls_out.*fdb.*spine-to-" az2/sbflows | ovn_strip_lflows], [0], [dnl
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls1"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls3"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls1" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls3" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
])
AT_CHECK([grep -E "ls_out.*fdb.*spine-to-" az3/sbflows | ovn_strip_lflows], [0], [dnl
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls1"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_lookup_fdb ), priority=100 , match=(inport == "spine-to-ls2"), action=(reg0[[11]] = lookup_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls1" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
table=??(ls_out_put_fdb ), priority=100 , match=(inport == "spine-to-ls2" && reg0[[11]] == 0), action=(put_fdb(inport, eth.src); next;)
])
check ovn-ic-nbctl --wait=sb sync
ovn-ic-nbctl show > ic-nbctl.dump
AT_CAPTURE_FILE([ic-nbctl.dump])
(echo "---------ISB dump-----"
ovn-ic-sbctl show
echo "---------------------"
ovn-ic-sbctl list gateway
echo "---------------------"
ovn-ic-sbctl list datapath_binding
echo "---------------------"
ovn-ic-sbctl list port_binding
echo "---------------------"
ovn-ic-sbctl list route
echo "---------------------") > ic-sbctl.dump
AT_CAPTURE_FILE([ic-sbctl.dump])
# Send ip packets between the two ports.
src_mac="f0:00:00:01:02:01"
dst_mac="f0:00:00:01:02:03"
src_ip=172.16.1.1
dst_ip=172.16.1.3
packet=$(fmt_pkt "Ether(dst='${dst_mac}', src='${src_mac}')/ \
IP(src='${src_ip}', dst='${dst_ip}')/ \
UDP(sport=1538, dport=4369)")
# Check that datapath is not doing any extra work and sends the packet out
# through the tunnels. We expect the packet to enter the spine switch, be
# sent to userspace for FDB learning, then get broadcasted to other two
# zones via remote ports.
AT_CHECK([ovn_as az1 as hv1 ovs-appctl ofproto/trace --names \
br-int in_port=vif1 $packet > ofproto-trace-1])
AT_CAPTURE_FILE([ofproto-trace-1])
AT_CHECK([grep 'Megaflow:' ofproto-trace-1], [0], [dnl
Megaflow: recirc_id=0,eth,ip,in_port=vif1,dl_src=f0:00:00:01:02:01,dl_dst=f0:00:00:01:02:03,nw_ecn=0,nw_frag=no
])
AT_CHECK([cat ofproto-trace-1 | tail -1 \
| grep -oE 'tnl_push|userspace|clone|br-phys_n1|vif[[0-9]]'], [0], [dnl
userspace
clone
tnl_push
br-phys_n1
tnl_push
br-phys_n1
])
# Actually send the packet.
check as hv1 ovs-appctl netdev-dummy/receive vif1 $packet
# Wait for the FDB entries to be created and propagated to OpenFlow. Only
# one entry will be created - the entry for spine-to-ls1 port in the spine
# switch.
ovn_as az1
wait_row_count FDB 1
check ovn-nbctl --wait=hv sync
# Two entries are expected in the other zones - one for the remote port on
# the spine switch and one for the switch port on the leaf.
ovn_as az2
wait_row_count FDB 2
check ovn-nbctl --wait=hv sync
ovn_as az3
wait_row_count FDB 2
check ovn-nbctl --wait=hv sync
# FDB entry was created from the userspace() action in the datapath, but
# those actions will be updated to not have it shortly, so just wait for
# that to happen and don't try to catch the action while it's still in the
# datapath.
as hv2 ovs-appctl revalidator/wait
as hv3 ovs-appctl revalidator/wait
# It's a little problematic to trace the other side, but we can check datapath
# actions. Note: 'actions:br-phys' is a stray tunnel packet destined for the
# other zone, but OVS from the 'main' namespace didn't learn addresses yet,
# so it broadcasts.
AT_CHECK([as hv2 ovs-appctl dpctl/dump-flows --names \
| grep actions | sed 's/.*\(actions:.*\)/\1/' | sort], [0], [dnl
actions:br-phys
actions:tnl_pop(genev_sys_6081)
actions:vif3
])
AT_CHECK([as hv3 ovs-appctl dpctl/dump-flows --names \
| grep actions | sed 's/.*\(actions:.*\)/\1/' | sort], [0], [dnl
actions:br-phys
actions:tnl_pop(genev_sys_6081)
actions:vif5
])
# No modifications expected.
AT_CHECK([echo $packet > expected])
AT_CHECK([touch empty])
# Check that it is delivered where needed and not delivered where not.
OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected])
OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv3/vif5-tx.pcap], [expected])
# Trace a reply packet.
reply=$(fmt_pkt "Ether(dst='${src_mac}', src='${dst_mac}')/ \
IP(src='${dst_ip}', dst='${src_ip}')/ \
UDP(sport=4369, dport=1538)")
# For the reply packet we expect only one userspace action for FDB update on
# the spine switch and only one tunnel push and send, because we already
# learned that MAC of vif1 is behind spine-ls1 and no longer need to broadcast
# to zone 3.
AT_CHECK([ovn_as az2 as hv2 ovs-appctl ofproto/trace --names \
br-int in_port=vif3 $reply > ofproto-trace-2])
AT_CAPTURE_FILE([ofproto-trace-2])
AT_CHECK([grep 'Megaflow:' ofproto-trace-2], [0], [dnl
Megaflow: recirc_id=0,eth,ip,in_port=vif3,dl_src=f0:00:00:01:02:03,dl_dst=f0:00:00:01:02:01,nw_ecn=0,nw_frag=no
])
AT_CHECK([cat ofproto-trace-2 | tail -1 \
| grep -oE 'tnl_push|userspace|clone|br-phys_n1|vif[[0-9]]'], [0], [dnl
userspace
tnl_push
br-phys_n1
])
# Now actually send it.
check as hv2 ovs-appctl netdev-dummy/receive vif3 $reply
AT_CHECK([echo $reply > reply])
# Check that it is delivered where needed and not delivered where not.
OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [reply])
OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected])
OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv3/vif5-tx.pcap], [expected])
# Zones 1 and 2 should have 2 FDB entries now each. One for a remote port and
# one per side of a switch-switch port connecting ls[12] with the spine. Zone
# 3 still only has two entries created for the original request from vif1.
ovn_as az1
wait_row_count FDB 3
check ovn-nbctl --wait=hv sync
ovn_as az2
wait_row_count FDB 3
check ovn-nbctl --wait=hv sync
ovn_as az3
wait_row_count FDB 2
check ovn-nbctl --wait=hv sync
# Packets should flow directly to the destination (via tunnels) in both
# directions now.
AT_CHECK([as hv1 ovs-appctl ofproto/trace --names \
br-int in_port=vif1 $packet | tail -2 \
| grep -oE 'Megaflow.*|tnl_push|userspace|clone|br-phys_n1|vif[[0-9]]'], [0], [dnl
Megaflow: recirc_id=0,eth,ip,in_port=vif1,dl_src=f0:00:00:01:02:01,dl_dst=f0:00:00:01:02:03,nw_ecn=0,nw_frag=no
tnl_push
br-phys_n1
])
AT_CHECK([as hv2 ovs-appctl ofproto/trace --names \
br-int in_port=vif3 $reply | tail -2 \
| grep -oE 'Megaflow.*|tnl_push|userspace|clone|br-phys_n1|vif[[0-9]]'], [0], [dnl
Megaflow: recirc_id=0,eth,ip,in_port=vif3,dl_src=f0:00:00:01:02:03,dl_dst=f0:00:00:01:02:01,nw_ecn=0,nw_frag=no
tnl_push
br-phys_n1
])
# Send and check one more time.
check as hv1 ovs-appctl netdev-dummy/receive vif1 $packet
check as hv2 ovs-appctl netdev-dummy/receive vif3 $reply
AT_CHECK([cp expected expected-vif5])
AT_CHECK([echo $packet >> expected])
AT_CHECK([echo $reply >> reply])
OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [reply])
OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected])
OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [empty])
OVN_CHECK_PACKETS([hv3/vif5-tx.pcap], [expected-vif5])
OVN_CLEANUP_IC([az1], [az2], [az3])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- Delete route lsp orphan])
ovn_init_ic_db
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
#
# / transit switch (ts11) \
# logical router (lr11) - - logical router (lr12)
# \ transit switch (ts12) /
#
# Create lr11, lr12, ts11, ts12 and connect them
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts1$j
check ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected route in lr11
check ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
])
check ovn_as az2 ovn-nbctl lrp-del lrp-lr12-ts12
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- Delete route lrp orphan])
ovn_init_ic_db
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
#
# / transit switch (ts11) \
# logical router (lr11) - - logical router (lr12)
# \ transit switch (ts12) /
#
# Create lr11, lr12, ts11, ts12 and connect them
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1 2; do
ts=ts1$j
check ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected route in lr11
check ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
192.168.0.0/24 169.254.102.2
])
check ovn_as az2 ovn-nbctl lsp-del lsp-ts12-lr12
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- Check loop with lsp orphan in same subnet of new lsp in other TS])
ovn_init_ic_db
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
#
# / transit switch (ts11) \
# logical router (lr11) - - logical router (lr12)
# \ transit switch (ts12) /
#
# Create lr11, lr12 and ts11 and connect them
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
for j in 1; do
ts=ts1$j
check ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
# Create directly-connected route in lr11
check ovn_as az2 ovn-nbctl lrp-add lr12 lrp-lr12 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.2
])
# Delete LRP connection from lr11 to ts11, keep lsp orphan
check ovn_as az1 ovn-nbctl lrp-del lrp-lr11-ts11
# Create ts12, and connect lr11 and lr21 to it in the same subnet of ts11 where
# exist one lsp orphan
for i in 1 2; do
ovn_as az$i
ts=ts12
lr=lr1$i
for j in 1; do
check ovn-ic-nbctl --wait=sb --may-exist ts-add $ts
lrp=lrp-$lr-$ts
lsp=lsp-$ts-$lr
# Create LRP and connect to TS
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a$j:0$i 169.254.10$j.$i$i/24
check ovn-nbctl lsp-add $ts $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
done
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.0.0/24 169.254.101.22
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- prefix filter -- filtering routes])
ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
for i in 1 2; do
ovn_start az$i
ovn_as az$i
# Enable route learning at AZ level.
check ovn-nbctl set nb_global . options:ic-route-learn=true
# Enable route advertising at AZ level.
check ovn-nbctl set nb_global . options:ic-route-adv=true
done
# Create new transit switches and LRs. Test topology is next:
# logical router (lr11) - transit switch (ts1) - logical router (lr12)
# Create lr11, lr12 and connect them to ts1.
for i in 1 2; do
ovn_as az$i
lr=lr1$i
check ovn-nbctl lr-add $lr
lrp=lrp-$lr-ts1
lsp=lsp-ts1-$lr
# Create LRP and connect to TS.
check ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:ab:0$i 169.254.101.$i/24 fe80:10::$i/64
check ovn-nbctl lsp-add ts1 $lsp \
-- lsp-set-addresses $lsp router \
-- lsp-set-type $lsp router \
-- lsp-set-options $lsp router-port=$lrp
done
# Create directly-connected route in lr12.
ovn_as az2 check ovn-nbctl lrp-add lr12 lrp-lr12-1 aa:aa:aa:aa:bb:01 "192.168.12.1/24" "2001:db12::1/64"
ovn_as az2 check ovn-nbctl lrp-add lr12 lrp-lr12-2 aa:aa:aa:aa:bb:02 "192.168.2.1/24" "2001:db22::1/64"
# Create directly-connected route in lr11.
ovn_as az1 check ovn-nbctl --wait=sb lrp-add lr11 lrp-lr11 aa:aa:aa:aa:cc:01 "192.168.11.1/24" "2001:db11::1/64"
check ovn-ic-nbctl --wait=sb sync
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.12.0/24 169.254.101.2
192.168.2.0/24 169.254.101.2
])
# Test direct routes from lr11 were learned to lr12.
OVS_WAIT_FOR_OUTPUT([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.11.0/24 169.254.101.1
])
ovn_as az2 check ovn-nbctl set logical_router_port lrp-lr12-ts1 options:ic-route-filter-adv=192.168.12.0/24
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.12.0/24 169.254.101.2
])
# Set ic-route-filter-adv with invalid CIDR to advertise just the valid route.
ovn_as az2 check ovn-nbctl set logical_router_port lrp-lr12-ts1 options:ic-route-filter-adv="192.168.12.0/24,invalid"
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.12.0/24 169.254.101.2
])
ovn_as az2 check ovn-nbctl remove logical_router_port lrp-lr12-ts1 options ic-route-filter-adv
ovn_as az1 check ovn-nbctl set logical_router_port lrp-lr11-ts1 options:ic-route-filter-learn=192.168.2.0/24
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
192.168.2.0/24 169.254.101.2
])
ovn_as az1 check ovn-nbctl remove logical_router_port lrp-lr11-ts1 options ic-route-filter-learn
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 2001 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
2001:db12::/64 fe80:10::2
2001:db22::/64 fe80:10::2
])
ovn_as az2 check ovn-nbctl set logical_router_port lrp-lr12-ts1 options:ic-route-filter-adv=2001:db22::/64
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 2001 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
2001:db22::/64 fe80:10::2
])
ovn_as az2 check ovn-nbctl remove logical_router_port lrp-lr12-ts1 options ic-route-filter-adv
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 2001 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
2001:db12::/64 fe80:10::2
2001:db22::/64 fe80:10::2
])
ovn_as az1 check ovn-nbctl set logical_router_port lrp-lr11-ts1 options:ic-route-filter-learn=2001:db12::/64
# Test direct routes from lr12 were learned to lr11.
OVS_WAIT_FOR_OUTPUT([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 2001 |
grep learned | awk '{print $1, $2}' | sort ], [0], [dnl
2001:db12::/64 fe80:10::2
])
OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
AT_BANNER([OVN Interconnection Service Monitor synchronization])
OVN_FOR_EACH_NORTHD([
AT_SETUP([ovn-ic -- Service Monitor synchronization: mock_test])
ovn_init_ic_db
ovn_start az1
ovn_start az2
ovn_start az3
#┌─────────────────────────────────────────────────────────────────────────────┐
#│ Service Monitor Sync Check (Cross-AZ LB Setup) │
#├───────────────┬───────────────┬─────────────────────────────────────────────┤
#│ AZ1 │ AZ2 │ AZ3 (Backends only) │
#├───────────────┼───────────────┼─────────────────────────────────────────────┤
#│ ┌─────────┐ │ ┌─────────┐ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
#│ │ LB1 │ │ │ LB2 │ │ │ lport5 │ │ lport6 │ │ lport7 │ │
#│ ├─────────┤ │ ├─────────┤ │ │ (AZ3) │ │ (AZ3) │ │ (AZ3) │ │
#│ │ - lport1├──┼──┤ - lport3│ │ └─────────┘ └─────────┘ └─────────┘ │
#│ │ (AZ1) │ │ │ (AZ2) │ │ │
#│ │ - lport3├──┼──┤ - lport5│ │ │
#│ │ (AZ2) │ │ │ (AZ3) │ │ │
#│ │ - lport5│ │ └─────────┘ │ │
#│ │ (AZ3) │ │ │ │
#│ │ - lport4│ │ ┌─────────┐ │ │
#│ │ (AZ2) │ │ │ LB3 │ │ │
#│ └─────────┘ │ ├─────────┤ │ │
#│ │ │ - lport5├──┼───────────────────┐ │
#│ │ │ (AZ3) │ │ │ │
#│ │ │ - lport6│ │ │ │
#│ │ │ (AZ3) │ │ │ │
#│ │ │ - lport2├──┘ │ │
#│ │ │ (AZ1) │ │ │
#│ │ └─────────┘ │ │
#│ │ │ │
#│ │ │ │
#│ └───────────────────────────────────┘ │
#└───────────────┴───────────────┴─────────────────────────────────────────────┘
#
# Physical Backend Locations:
# - AZ1: lport1, lport2
# - AZ2: lport3, lport4
# - AZ3: lport5, lport6 , lport7
#
# Load Balancer Configurations:
# - LB1 (AZ1): lport1(AZ1), lport3(AZ2), lport5(AZ3), lport4(az2)
# - LB2 (AZ2): lport3(AZ2), lport1(AZ3)
# - LB3 (AZ2): lport5(AZ3), lport6(AZ3), lport2(AZ1)
# AZ1 Configuration
ovn_as az1
# change the MAC address for more convenient search of logical flows
check ovn-nbctl set NB_Global . options:svc_monitor_mac="11:11:11:11:11:11"
check ovn-nbctl ls-add az1_ls1
check ovn-nbctl lsp-add az1_ls1 lport1_az1
check ovn-nbctl lsp-add az1_ls1 lport2_az1
check ovn-nbctl lb-add az1_lb1 10.10.10.1:80 1.1.1.1:10880,5.5.5.1:10880,3.3.3.1:10880,4.4.4.1:10880
check ovn-nbctl ls-lb-add az1_ls1 az1_lb1
AT_CHECK([ovn-nbctl --wait=sb \
-- --id=@hc create Load_Balancer_Health_Check vip="10.10.10.1\:80" \
options:failure_count=100 \
-- add Load_Balancer . health_check @hc | uuidfilt], [0], [<0>
])
# We will leave one backend without a service monitor since it is not expected to participate in load balancing.
check ovn-nbctl set load_balancer az1_lb1 ip_port_mappings:1.1.1.1=lport1_az1:1.1.1.9
check ovn-nbctl set load_balancer az1_lb1 ip_port_mappings:3.3.3.1=lport3_az2:3.3.3.9:az2
check ovn-nbctl set load_balancer az1_lb1 ip_port_mappings:5.5.5.1=lport5_az3:5.5.5.9:az3
# Сheck that all remote and local service monitors have been created.
check_row_count sb:Service_Monitor 3
check_column "3.3.3.1" sb:Service_Monitor ip logical_port=lport3_az2
check_column 10880 sb:Service_Monitor port logical_port=lport3_az2
check_column tcp sb:Service_Monitor protocol logical_port=lport3_az2
check_column "3.3.3.9" sb:Service_Monitor src_ip logical_port=lport3_az2
check_column false sb:Service_Monitor ic_learned logical_port=lport3_az2
check_column true sb:Service_Monitor remote logical_port=lport3_az2
check_column "1.1.1.1" sb:Service_Monitor ip logical_port=lport1_az1
check_column 10880 sb:Service_Monitor port logical_port=lport1_az1
check_column tcp sb:Service_Monitor protocol logical_port=lport1_az1
check_column "1.1.1.9" sb:Service_Monitor src_ip logical_port=lport1_az1
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
check_column false sb:Service_Monitor remote logical_port=lport1_az1
check_column "5.5.5.1" sb:Service_Monitor ip logical_port=lport5_az3
check_column 10880 sb:Service_Monitor port logical_port=lport5_az3
check_column tcp sb:Service_Monitor protocol logical_port=lport5_az3
check_column "5.5.5.9" sb:Service_Monitor src_ip logical_port=lport5_az3
check_column false sb:Service_Monitor ic_learned logical_port=lport5_az3
check_column true sb:Service_Monitor remote logical_port=lport5_az3
check_row_count ic-sb:Service_Monitor 2
check_column "5.5.5.1" ic-sb:Service_Monitor ip logical_port=lport5_az3
check_column 10880 ic-sb:Service_Monitor port logical_port=lport5_az3
check_column tcp ic-sb:Service_Monitor protocol logical_port=lport5_az3
check_column "5.5.5.9" ic-sb:Service_Monitor src_ip logical_port=lport5_az3
check_column az3 ic-sb:Service_Monitor target_availability_zone logical_port=lport5_az3
check_column az1 ic-sb:Service_Monitor source_availability_zone logical_port=lport5_az3
check_column az2 ic-sb:Service_Monitor target_availability_zone logical_port=lport3_az2
check_column az1 ic-sb:Service_Monitor source_availability_zone logical_port=lport3_az2
# Check that logical flows are created only for local service monitors.
AT_CHECK([ovn-sbctl lflow-list az1_ls1 | grep 'ls_in_arp_rsp'| ovn_strip_lflows], [0], [dnl
table=??(ls_in_arp_rsp ), priority=0 , match=(1), action=(next;)
table=??(ls_in_arp_rsp ), priority=110 , match=(arp.tpa == 1.1.1.9 && arp.op == 1), action=(eth.dst = eth.src; eth.src = 11:11:11:11:11:11; arp.op = 2; /* ARP reply */ arp.tha = arp.sha; arp.sha = 11:11:11:11:11:11; arp.tpa = arp.spa; arp.spa = 1.1.1.9; outport = inport; flags.loopback = 1; output;)
])
# AZ2 Configuration
ovn_as az2
# change the MAC address for more convenient search of logical flows
check ovn-nbctl set NB_Global . options:svc_monitor_mac="12:12:12:12:12:12"
check ovn-nbctl ls-add az2_ls1
check ovn-nbctl lsp-add az2_ls1 lport3_az2
check ovn-nbctl lsp-add az2_ls1 lport4_az2
check ovn-nbctl lb-add az2_lb1 20.20.20.1:80 3.3.3.1:10880,1.1.1.1:10880
check ovn-nbctl ls-lb-add az2_ls1 az2_lb1
AT_CHECK([ovn-nbctl --wait=sb \
-- --id=@hc create Load_Balancer_Health_Check vip="20.20.20.1\:80" \
options:failure_count=100 \
-- add Load_Balancer . health_check @hc | uuidfilt], [0], [<0>
])
# Create a cross-cutting backend with a balancer in the first availability zone to check that everything works correctly
check ovn-nbctl set load_balancer az2_lb1 ip_port_mappings:3.3.3.1=lport3_az2:3.3.3.9
check ovn-nbctl set load_balancer az2_lb1 ip_port_mappings:1.1.1.1=lport1_az1:1.1.1.9:az1
check_row_count sb:Service_Monitor 2
check_row_count ic-sb:Service_Monitor 3
ovn_as az1
check_row_count sb:Service_Monitor 3
# Check that the local backend, which intersects with the one created in another availability zone, remains local
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
check_column false sb:Service_Monitor remote logical_port=lport1_az1
ovn_as az2
check_column false sb:Service_Monitor ic_learned logical_port=lport1_az1
check_column true sb:Service_Monitor remote logical_port=lport1_az1
# Сheck that all remote and local service monitors have been created.
check_column az2 ic-sb:Service_Monitor target_availability_zone logical_port=lport3_az2
check_column az1 ic-sb:Service_Monitor source_availability_zone logical_port=lport3_az2
check_column az1 ic-sb:Service_Monitor target_availability_zone logical_port=lport1_az1
check_column az2 ic-sb:Service_Monitor source_availability_zone logical_port=lport1_az1
check_column az3 ic-sb:Service_Monitor target_availability_zone logical_port=lport5_az3
check_column az1 ic-sb:Service_Monitor source_availability_zone logical_port=lport5_az3
# AZ3 Configuration
ovn_as az3
check ovn-nbctl set NB_Global . options:svc_monitor_mac="13:13:13:13:13:13"
check ovn-nbctl ls-add az3_ls1
# Check there no Service_Monitor when we have no ports.
check_row_count sb:Service_Monitor 0
check_row_count nb:Load_Balancer 0
check ovn-nbctl lsp-add az3_ls1 lport5_az3
check ovn-nbctl lsp-add az3_ls1 lport6_az3
check ovn-nbctl lsp-add az3_ls1 lport7_az3
# Check there is one Service Monitor learned from az1.
check_row_count sb:Service_Monitor 1
check_column "5.5.5.1" sb:Service_Monitor ip logical_port=lport5_az3
check_column 10880 sb:Service_Monitor port logical_port=lport5_az3
check_column tcp sb:Service_Monitor protocol logical_port=lport5_az3
check_column "5.5.5.9" sb:Service_Monitor src_ip logical_port=lport5_az3
check_column true sb:Service_Monitor ic_learned logical_port=lport5_az3
check_column false sb:Service_Monitor remote logical_port=lport5_az3
# Check that logical flows are created for ic_learned service monitors when we have no load balancers.
AT_CHECK([ovn-sbctl lflow-list az3_ls1 | grep 'ls_in_arp_rsp' | ovn_strip_lflows], [0], [dnl
table=??(ls_in_arp_rsp ), priority=0 , match=(1), action=(next;)
table=??(ls_in_arp_rsp ), priority=110 , match=(arp.tpa == 5.5.5.9 && arp.op == 1), action=(eth.dst = eth.src; eth.src = 13:13:13:13:13:13; arp.op = 2; /* ARP reply */ arp.tha = arp.sha; arp.sha = 13:13:13:13:13:13; arp.tpa = arp.spa; arp.spa = 5.5.5.9; outport = inport; flags.loopback = 1; output;)
])
# Add more lb in AZ2, change port for one backend, check we will have one more
# records for this Service_Monitor
ovn_as az2
check ovn-nbctl lb-add az2_lb2 20.20.20.2:80 2.2.2.1:10880,5.5.5.1:10880,6.6.6.1:10880
check ovn-nbctl ls-lb-add az2_ls1 az2_lb2
AT_CHECK([ovn-nbctl --wait=sb \
-- --id=@hc create Load_Balancer_Health_Check vip="20.20.20.2\:80" \
options:failure_count=100 \
-- add Load_Balancer az2_lb2 health_check @hc | uuidfilt], [0], [<0>
])
# We will leave one backend without a service monitor since it is not expected to participate in load balancing.
check ovn-nbctl set load_balancer az2_lb2 ip_port_mappings:2.2.2.1=lport2_az1:2.2.2.9:az1
check ovn-nbctl set load_balancer az2_lb2 ip_port_mappings:6.6.6.1=lport6_az3:6.6.6.9:az3
ovn_as az1
check_row_count sb:Service_Monitor 4
check_column true sb:Service_Monitor ic_learned logical_port=lport2_az1
check_column false sb:Service_Monitor remote logical_port=lport2_az1
ovn_as az2
check_row_count sb:Service_Monitor 4
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep 'ls_in_arp_rsp'| ovn_strip_lflows], [0], [dnl
table=??(ls_in_arp_rsp ), priority=0 , match=(1), action=(next;)
table=??(ls_in_arp_rsp ), priority=110 , match=(arp.tpa == 3.3.3.9 && arp.op == 1), action=(eth.dst = eth.src; eth.src = 12:12:12:12:12:12; arp.op = 2; /* ARP reply */ arp.tha = arp.sha; arp.sha = 12:12:12:12:12:12; arp.tpa = arp.spa; arp.spa = 3.3.3.9; outport = inport; flags.loopback = 1; output;)
])
ovn_as az3
check_row_count sb:Service_Monitor 2
AT_CHECK([ovn-sbctl lflow-list az3_ls1 | grep 'ls_in_arp_rsp' | ovn_strip_lflows], [0], [dnl
table=??(ls_in_arp_rsp ), priority=0 , match=(1), action=(next;)
table=??(ls_in_arp_rsp ), priority=110 , match=(arp.tpa == 5.5.5.9 && arp.op == 1), action=(eth.dst = eth.src; eth.src = 13:13:13:13:13:13; arp.op = 2; /* ARP reply */ arp.tha = arp.sha; arp.sha = 13:13:13:13:13:13; arp.tpa = arp.spa; arp.spa = 5.5.5.9; outport = inport; flags.loopback = 1; output;)
table=??(ls_in_arp_rsp ), priority=110 , match=(arp.tpa == 6.6.6.9 && arp.op == 1), action=(eth.dst = eth.src; eth.src = 13:13:13:13:13:13; arp.op = 2; /* ARP reply */ arp.tha = arp.sha; arp.sha = 13:13:13:13:13:13; arp.tpa = arp.spa; arp.spa = 6.6.6.9; outport = inport; flags.loopback = 1; output;)
])
# Check status propogation: since this is a mock test, the statuses will be changed
# manually, waiting for the desired behavior of the code
# az1: az1_lb1 10.10.10.1:80 1.1.1.1:10880,5.5.5.1:10880,3.3.3.1:10880,4.4.4.1:10880
# (4.4.4.1 - does not have a service monitor)
# az2: az2_lb1 20.20.20.1:80 3.3.3.1:10880,1.1.1.1:10880
# az2_lb2 20.20.20.2:80 2.2.2.1:10880,5.5.5.1:10880,6.6.6.1:10880
# (5.5.5.1 - does not have a service monitor)
# Check that if the service monitors are not initialized, balancing is performed on all but the 4th
ovn_as az1
AT_CHECK([ovn-sbctl lflow-list az1_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.10.10.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 10.10.10.1; reg2[[0..15]] = 80; ct_lb_mark(backends=1.1.1.1:10880,5.5.5.1:10880,3.3.3.1:10880);)
])
# Check that if the service monitors are not initialized, balancing is performed on all but the 5th
ovn_as az2
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.1; reg2[[0..15]] = 80; ct_lb_mark(backends=3.3.3.1:10880,1.1.1.1:10880);)
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.2 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.2; reg2[[0..15]] = 80; ct_lb_mark(backends=2.2.2.1:10880,6.6.6.1:10880);)
])
# Change statuses
ovn_as az1
svc_lport1_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport1_az1)
check ovn-sbctl set Service_Monitor $svc_lport1_uuid status="offline"
check_column offline ic-sb:Service_Monitor status logical_port=lport1_az1
# Since port1 is a backend in another availability zone, we check that the status has also been updated there
ovn_as az1
AT_CHECK([ovn-sbctl lflow-list az1_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.10.10.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 10.10.10.1; reg2[[0..15]] = 80; ct_lb_mark(backends=5.5.5.1:10880,3.3.3.1:10880);)
])
# Check the status in the interconet db.
check_column offline ic-sb:Service_Monitor status logical_port=lport1_az1
ovn_as az2
check_column offline sb:Service_Monitor status logical_port=lport1_az1
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.1; reg2[[0..15]] = 80; ct_lb_mark(backends=3.3.3.1:10880);)
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.2 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.2; reg2[[0..15]] = 80; ct_lb_mark(backends=2.2.2.1:10880,6.6.6.1:10880);)
])
# Change all statuses to offline to check online propogation.
ovn_as az3
svc_lport6_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport6_az3)
check ovn-sbctl set Service_Monitor $svc_lport6_uuid status="offline"
check_column offline ic-sb:Service_Monitor status logical_port=lport6_az3
ovn_as az2
check_column offline sb:Service_Monitor status logical_port=lport6_az3
ovn_as az2
ovn-sbctl list service_m
svc_lport3_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport3_az2)
check ovn-sbctl set Service_Monitor $svc_lport3_uuid status="offline"
check_column offline sb:Service_Monitor status logical_port=lport3_az2
check_column offline ic-sb:Service_Monitor status logical_port=lport3_az2
ovn_as az2
check_column offline sb:Service_Monitor status logical_port=lport3_az2
ovn_as az1
svc_lport2_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport2_az1)
check ovn-sbctl set Service_Monitor $svc_lport2_uuid status="offline"
check_column offline sb:Service_Monitor status logical_port=lport2_az1
check_column offline ic-sb:Service_Monitor status logical_port=lport2_az1
ovn_as az3
svc_lport5_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport5_az3)
check ovn-sbctl set Service_Monitor $svc_lport5_uuid status="offline"
check_column offline sb:Service_Monitor status logical_port=lport5_az3
check_column offline ic-sb:Service_Monitor status logical_port=lport5_az3
ovn_as az1
check_column offline sb:Service_Monitor status logical_port=lport5_az3
ovn_as az1
AT_CHECK([ovn-sbctl lflow-list az1_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl])
ovn_as az2
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl])
ovn_as az1
# Change one backend and check that it is correctly removed from the databases
az1_lb1_uuid=$(ovn-nbctl --bare --no-headings --columns=_uuid find Load_Balancer name=az1_lb1)
check_row_count sb:Service_Monitor 1 logical_port=lport3_az2
check ovn-nbctl set Load_Balancer $az1_lb1_uuid vip='"10.10.10.1:80"="1.1.1.1:10880,5.5.5.1:10880,2.2.2.1:10880"'
check ovn-nbctl set load_balancer az1_lb1 ip_port_mappings:2.2.2.1=lport2_az1:2.2.2.9
check_row_count sb:Service_Monitor 0 logical_port=lport3_az2
# Check deletion from ICSB.
check_row_count ic-sb:Service_Monitor 0 logical_port=lport3_az2
ovn_as az3
svc_lport6_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport6_az3)
check ovn-sbctl set Service_Monitor $svc_lport6_uuid status="online"
check_column online ic-sb:Service_Monitor status logical_port=lport6_az3
ovn_as az2
check_column online sb:Service_Monitor status logical_port=lport6_az3
check_row_count sb:Service_Monitor 1 logical_port=lport3_az2
check_column offline sb:Service_Monitor status logical_port=lport3_az2
# Need to check that the 3.3.3.1 backend retained its previous status
# and after deleting the record from the interconnect database - the old
# information remained in sbdb of the target availability zone.
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.2 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.2; reg2[[0..15]] = 80; ct_lb_mark(backends=6.6.6.1:10880);)
])
ovn_as az1
# set other statuses to online state.
svc_lport1_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport1_az1)
lport1_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Port_Binding logical_port=lport1_az1)
check ovn-sbctl set Port_Binding $lport1_uuid up=true
check ovn-sbctl set Service_Monitor $svc_lport1_uuid status="online"
check_column online ic-sb:Service_Monitor status logical_port=lport1_az1
svc_lport2_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Service_Monitor logical_port=lport2_az1)
lport2_uuid=$(ovn-sbctl -d bare --no-headings --columns _uuid find Port_Binding logical_port=lport2_az1)
check ovn-sbctl set Port_Binding $lport2_uuid up=true
check ovn-sbctl set Service_Monitor $svc_lport2_uuid status="online"
check_column online ic-sb:Service_Monitor status logical_port=lport2_az1
ovn_as az1
AT_CHECK([ovn-sbctl lflow-list az1_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.10.10.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 10.10.10.1; reg2[[0..15]] = 80; ct_lb_mark(backends=1.1.1.1:10880,2.2.2.1:10880);)
])
ovn_as az2
AT_CHECK([ovn-sbctl lflow-list az2_ls1 | grep ls_in_lb | grep backends | ovn_strip_lflows], [0], [dnl
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.1 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.1; reg2[[0..15]] = 80; ct_lb_mark(backends=1.1.1.1:10880);)
table=??(ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 20.20.20.2 && reg1[[16..23]] == 6 && reg1[[0..15]] == 80), action=(reg4 = 20.20.20.2; reg2[[0..15]] = 80; ct_lb_mark(backends=2.2.2.1:10880,6.6.6.1:10880);)
])
# Check deletion.
ovn_as az1
check ovn-nbctl lb-del az1_lb1
# az1_lb1 had : 1.1.1.1:10880,5.5.5.1:10880,2.2.2.1:10880,4.4.4.1:10880 backends
# (4.4.4.1 - no hc, 5.5.5.1 - no hc)
# az2: az2_lb1 20.20.20.1:80 3.3.3.1:10880,1.1.1.1:10880
# az2_lb2 20.20.20.2:80 2.2.2.1:10880,5.5.5.1:10880,6.6.6.1:10880
# Despite the balancer being removed, records for lport1 and lport2 should no
# be removed as they participate in balancing in other availability zones.
check_row_count sb:Service_Monitor 2
check_row_count sb:Service_Monitor 1 logical_port=lport1_az1
check_row_count sb:Service_Monitor 1 logical_port=lport2_az1
check_row_count ic-sb:Service_Monitor 3
ovn_as az2
# Need to check that there is no service_monitor left in az3,
# in az1 there will be one service monitors for 1.1.1.1 (used by az2_lb1)
# and in az2 there will be two service monitor for 3.3.3.1 and 1.1.1.1
check ovn-nbctl lb-del az2_lb2
ovn_as az1
# Check that the ic_learned records have been deleted
check_row_count sb:Service_Monitor 1
check_row_count ic-sb:Service_Monitor 1
ovn_as az2
check_row_count sb:Service_Monitor 2
ovn_as az3
check_row_count sb:Service_Monitor 0
ovn_as az2
check ovn-nbctl lb-del az2_lb1
check_row_count sb:Service_Monitor 0
check_row_count ic-sb:Service_Monitor 0
OVN_CLEANUP_IC([az1], [az2], [az3])
AT_CLEANUP
])
|