Repository navigation
[swadm,multicast] add multicast subcommand (->list, ->get, ->add, ->del) - #366
zeeshanlakhani wants to merge 16 commits into
Conversation
cb72382 to
0ea6ca4
Compare
0ea6ca4 to
d5121e0
Compare
d5121e0 to
87483a1
Compare
87483a1 to
842fa41
Compare
842fa41 to
e51be15
Compare
This work constrains group and SSM source validation based on a variety of specs, linked throughout the PR. Previously, DPD was accepting groups and (S, G) sources that no packet could actually exercise, including ones that can never leave a host/link or, worse, sources a switch can't forward. Here's the list (the first classifier one was the most obvious): | address | verdict | spec | |--------------------------------|---------|-------------------------------| | ff3x::/32 in ff30::/12 only | is SSM | RFC 4607 §1; RFC 3306 is ASM | | ff3x:: group ID > 0x40000000 | accept | RFC 4607 §4.3 | | v6 scopes other than 4/5/8/e | reject | RFC 7346; no Ethernet realm | | class E (240.0.0.0/4) source | reject | RFC 6890 "Source: False" | | 0.0.0.0/8 source | reject | RFC 6890 "Forwardable: False" | | 100.64.0.0/10 source | accept | RFC 6598, operator-internal | | source/group family mismatch | reject | (local choice) | | 232.0.0.0 (SSM null) | reject | RFC 4607 §4.3 | | v4-mapped/compat v6 source | reject | RFC 4291 §2.5.5, aliases IPv4 |
The external-group docs say “IPv4 and non-admin-local IPv6 multicast traffic,” but external groups can use admin-local IPv6 too. The exception, however, is the `ff04::/64` underlay range, which is reserved for the underlay mcast group mapped from the external mcast group. This makes the information explicit. The old wording is in a blessed spec, so this needs a new API version: `MCAST_EXTERNAL_SCOPE_DOCS`.
This adds a READ-only (no-mutation) `swadm multicast` subcommand (aliased as `mcast` as well) for inspecting the multicast groups programmed on the switch. The two commands are essentially a LIST and GET: - `multicast list [-t <tag>] [-k external|underlay]` renders all groups as a table view, filtered by tag, by replication kind, or both. - `multicast get <group-ip>` shows one group's full configuration. The kind filter matches on the response type: `external` means an external group with a NAT target and no (underlying) direction membership; `underlay` groups sit in the reserved ff04::/64 subnet and replicate to the member ports (to guest subscribers).
e51be15 to
5c0477d
Compare
860fcdc to
6e49b3f
Compare
There was a problem hiding this comment.
swadm now has common infra for tests. Can we move this module over to the new expectorate pattern?
There was a problem hiding this comment.
In my understanding, this test uses the dropshot client to create/delete multicast assets so that we can then inspect the output using swadm. Doing so requires the updated tokio dependency.
First, I'd like to use the shared expectorate infra for swadm validation as stated above.
Taking it further, can we add multicast asset creation/deletion to swadm so that this test doesn't need the dropshot client at all?
Doing so creeps the scope of this PR, and restricting to dropshot makes sense if you know of a reason swadm definitely should not support multicast creation/deletion. But adding that to swadm sounds like useful functionality and would simplify this test.
Simplifying swadm tests isn't an end goal in itself, but swadm tests are close enough to human/hand testing that I want to be thoughtful. For example, could you then set up a multicast demo just using cli commands? That would be pretty cool.
There was a problem hiding this comment.
Btw the "request changes" is for you to please check out the new expectorate test structure. Which was merged since you opened this PR, so apologies for the churn!
Adding create/delete and using tabwriter in multicast_get are your decision.
3e97732 to
47ab9cc
Compare
This update moves the swadm multicast testing harness onto the common expectorate setup from #350, and gives swadm multicast group create/delete (add/del) semantics, removing the tests' need for tokio and the dropshot client. `add/del` subcommands work on a pair (of groups) by default: `add` creates the underlay group, then the external group that maps to it (1:1, rolling the underlay back out if the external create fails), and `del` checks both (shared) tags before removing either group. `-t` defaults to the client tag on both subcommands, similar to `arp add`. `del --underlay-only` removes unreferenced underlay groups, including any left behind after a failed pair deletion. Includes: - `multicast get` runs through `TabWriter`, like `list`, for consistency. - `list` headers use Title Casing, like `nat`/`attached`. - `add` flags match what `nat add` has, i.e. `-i` underlay, `-m` mac, `-v` vni, and `--member` is long-only. - clap parses right into our new types (parent commit ~ type-validation), with bad addresses failing at arg parse-time. - extended test coverage and test helpers
47ab9cc to
5125d95
Compare
| // CI exports RUST_BACKTRACE=1, which forces anyhow to append a "Stack | ||
| // backtrace:" section to every error swadm prints, and stderr would | ||
| // differ from a local run and never match an expectation file. | ||
| // | ||
| // We still keep panic backtraces but turn off the library-level ones, | ||
| // just like omdb's test harness does: | ||
| // https://github.com/oxidecomputer/omicron/blob/654472b6368b48743f34c0744e2acfb06278f796/dev-tools/omdb/tests/test_all_output.rs#L961-L969 |
This adds a
swadm multicastsubcommand (aliased asmcastas well) for inspecting, creating, and deleting the multicast groups programmed on the switch:multicast list [-t <tag>] [-k external|underlay]renders all groups as atable view, filtered by tag, by replication kind, or both.
multicast get <group-ip>shows one group's full configuration.multicast add <ext-ip> -i <underlay> -m <mac> -v <vni> [--member port/link:dir]... [--vlan <id>] [-s <src>]... [-t <tag>]creates an external group and the underlay group that it maps to.multicast del <group-ip> [-t <tag>] [--underlay-only]deletes the pair, or just an unreferenced underlay group with--underlay-only.The kind filter matches on the response type:
externalmeans an external multicast group with a NAT target and no (underlying) direction membership;underlaygroups reside in the reservedff04::/64subnet and replicate to the member ports (to guest subscribers).add/delsubcommands work together as a pair (of groups) by default:addcreates the underlay group, then the external group that maps to it (1:1, rolling the underlay back out if the external create fails), anddelchecks both (shared) tags before removing either group. The-tflag defaults to the client tag on both subcommands, similar toarp add.del --underlay-onlyremoves unreferenced underlay groups, including any left behind after a failed pair deletion.Includes:
multicast getruns throughTabWriter, likelist;listheaders use Title Casing, likenat/attached.addflags match whatnat addhas, i.e.-iunderlay,-mmac,-vvni, and--memberis long-only.