Repository navigation
Commit 93d9d22
committed
extensions: let NetworkOrchestrator extensions handle VPC gateways and routes
NetworkExtensionElement implements every other VpcProvider method by delegating
to the extension script, but four of them throw UnsupportedOperationException:
createPrivateGateway, deletePrivateGateway, applyStaticRoutes and
applyACLItemsToPrivateGw. The restriction is at the framework level, so it
applies to every network extension whatever its backend can do, and an
extension-backed VPC cannot reach parity with the VPC virtual router.
This wires them up the same way as their neighbours, adding four script
commands:
create-private-gateway
delete-private-gateway
apply-static-routes
apply-private-gw-acl
Private gateway operations resolve the owning VPC and go through the existing
VPC-level script path, carrying the gateway's id, uuid, address, netmask,
broadcast URI and derived VLAN alongside the usual VPC fields.
applyStaticRoutes and applyACLItemsToPrivateGw are full rebuilds that send the
complete non-revoked set on every call, matching applyFWRules and
applyNetworkACLs rather than the per-object style of add-static-nat; a backend
reconciles instead of tracking deltas.
An extension that does not implement these verbs is unaffected: the commands
are new, and before this change the operations failed with
UnsupportedOperationException regardless of the script, so no previously
working behaviour changes.
addPrivateGatewayToPayload documents gateway_vlan as conditional but emitted it
unconditionally whenever a broadcast URI was present. BroadcastDomainType
returns null for a URI whose scheme it does not recognise, so a non-VLAN
gateway shipped "gateway_vlan": "" to the script. It is now emitted only when
it has a value, which is what the javadoc already claimed and what every
neighbouring field does.
Adds NetworkExtensionElementTest, the first unit test this class has had. 30
cases over the four methods: the payload fields each sends, the VPC and gateway
identity the script needs to find the router, the omit-when-blank branch of
every optional field, both failure styles (createPrivateGateway and
deletePrivateGateway return false, applyStaticRoutes and
applyACLItemsToPrivateGw throw ResourceUnavailableException), full
serialisation of a static route and of an ACL rule, rule ordering by number and
routes by CIDR, a null CIDR through the route comparator, a null gateway handed
to each of the three public entry points, and a route whose state is not yet
set. The command name constants are asserted against their literals, since they
are the wire contract
with every deployed script.
Adds NetworkExtensionElementPayloadContractTest, 6 more. It asserts the keys
the script cannot run without -- a transcription of a reference
implementation's require_arg calls, with the source named in each test -- and
writes the payloads this class actually produces to target/extension-payloads/.
The unit tests assert what this class writes and an extension's own tests
assert what it reads, each checked against a fixture written by the same hand,
so both would pass if a key name drifted between them. Replaying the real
payloads against a real backend is what closes that: the six captured payloads
pass 21 assertions against a live OVN northbound database, including that
ovn-northd resolves the static routes this class emitted.
381 tests pass in framework/extensions.1 parent 6a0fcd6 commit 93d9d22
3 files changed
Lines changed: 1109 additions & 7 deletions
File tree
- framework/extensions/src
- main/java/org/apache/cloudstack/framework/extensions/network
- test/java/org/apache/cloudstack/framework/extensions/network
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
2459 | 2464 | | |
2460 | 2465 | | |
2461 | 2466 | | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
2462 | 2489 | | |
2463 | 2490 | | |
2464 | 2491 | | |
2465 | | - | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
2466 | 2504 | | |
2467 | 2505 | | |
2468 | | - | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
2469 | 2511 | | |
2470 | 2512 | | |
2471 | 2513 | | |
2472 | | - | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
2473 | 2526 | | |
2474 | 2527 | | |
2475 | | - | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
2476 | 2538 | | |
2477 | 2539 | | |
2478 | 2540 | | |
2479 | | - | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
2480 | 2564 | | |
2481 | 2565 | | |
2482 | | - | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
2483 | 2574 | | |
2484 | 2575 | | |
2485 | 2576 | | |
2486 | | - | |
| 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 | + | |
2487 | 2684 | | |
2488 | 2685 | | |
2489 | 2686 | | |
| |||
0 commit comments