FABRIC–SPHERE integration: automation plan and design record
- This post serves as a summary for anyone in the future seeking to understand the design choices I made for connecting FABRIC slices to SPHERE experiments and how to continue where I left off.
- A working familiarity with Mars, Canopy, and Linux bridging/VXLAN is assumed.
- Throughout, N is the facility VNI and V is the experiment’s XPNet VLAN.
Design Philosophy
A FABRIC slice should reach a SPHERE experiment directly, over XPNet, without giving up Merge’s isolation and lifecycle guarantees. Mars decides when an experiment is attached, and Canopy configures the host networking. It also needs to keep working in Mars’s “infrapod traffic disabled, networking active” case, so the infrapod can’t be in the data path.
-
Peer with the fabric, don’t treat it as a trunk
- The facility VLAN is terminated on the switch and carried to the host as VXLAN over the BGP-routed underlay. It never reaches the host as a raw tagged VLAN.
- So the host needs its own VTEP peered with the switch VTEP, not a VLAN subinterface.
- The VTEP is the VXLAN peer. The veth is only the local connection from the facility bridge to wherever the traffic needs to go.
-
The facility bridge is the handoff point
- Plugging the tunnel straight into one experiment’s VLAN would tie it to that experiment, since an access port only carries one VLAN.
- It would also put shared infrastructure inside an experiment’s broadcast domain.
- With a bridge in between, any number of experiments can share the tunnel, each through its own veth.
-
Experiments stay apart
- Each FABRIC interface’s facility-side port is isolated on the bridge, so it can reach the tunnel but not other experiments’ ports.
- The XPNet-side port carries only the experiment’s VLAN. Linux adds VLAN 1 to new bridge ports by default, so that gets removed, otherwise VLAN 1 traffic on the host would leak out to FABRIC.
Two experiments sharing one FABRIC connection
- Operator and Merge ownership
- The operator owns the physical path that delivers FABRIC traffic to Merge: the FABRIC facility port and facility VLAN, switch configuration and underlay reachability, and the interface and bond names in the facility configuration, which Canopy uses by name but never creates.
- Mars and Canopy own the networking on Merge-managed services hosts: the persistent facility tunnel and bridge, each experiment’s FABRIC interface and its XPNet VLAN membership, and cleanup when the experiment is dematerialized.
- Mars doesn’t elect a “main” infrapod services host today. Newer materializations take the host from the infranet config and older ones from the infrapod server parameter, and only one infrapod server is supported. The FABRIC host will be named explicitly in the facility configuration, and Mars will check that it has the infrapod server role and the right underlay interface.
First-pass PoC
The first working design routed FABRIC traffic through the experiment’s infrapod. The FABRIC facility network was terminated on the Merge services host, connected into the infrapod namespace, and then routed onward to the experiment node. This proved that FABRIC and SPHERE could exchange traffic, but it also made the infrapod a required data-plane router. That rules out experiments where infranet communication is intentionally blocked while experiment networking remains active.
Before that path worked, we initially treated the facility connection as though its tagged VLAN reached the services host directly. We created a VLAN subinterface and could see tagged ARP requests leaving the host, but no replies returned. The facility VLAN was actually being terminated by the switch and transported through the VXLAN fabric over the routed underlay. The services host therefore needed a VTEP connected to the switch-side VTEP rather than a raw VLAN subinterface.
The working XPNet-path configuration on the services host used a shared facility bridge, a VXLAN endpoint for facility VNI N, and a veth pair connecting that bridge directly to the experiment’s VLAN on the XPNet bridge:
sudo ip link add name fabbrN type bridge
sudo ip link set dev fabbrN up
sudo ip link add name fabvtepN type vxlan id N local <host-underlay-ip> remote <switch-vtep-ip> dev <underlay-iface> dstport 4789 nolearning
sudo ip link set dev fabvtepN mtu 1500
sudo ip link set dev fabvtepN master fabbrN
sudo ip link set dev fabvtepN up
sudo ip link add name fabxpfN type veth peer name fabxpxN
sudo ip link set dev fabxpfN mtu 1500
sudo ip link set dev fabxpxN mtu 1500
sudo ip link set dev fabxpfN master fabbrN
sudo ip link set dev fabxpxN master <xpnet-bridge>
sudo bridge vlan del dev fabxpxN vid 1
sudo bridge vlan add dev fabxpxN vid <experiment-vid> pvid untagged
sudo ip link set dev fabxpfN up
sudo ip link set dev fabxpxN up
Unlike the earlier infrapod path, neither end of the veth was moved into a container namespace. The facility-facing end remained on the shared FABRIC bridge, while the other end became an access port in the experiment’s XPNet VLAN. The existing XPNet VTEP then carried the traffic from the services host to the experiment node.
The experiment node was given an address from the SPHERE-side facility subnet directly on its XPNet interface, along with a route to the FABRIC slice’s subnet:
sudo ip address replace <sphere-ip>/24 dev <xpnet-interface>
sudo ip link set dev <xpnet-interface> up
sudo ip route replace <fabric-subnet>/24 via <sphere-gw> dev <xpnet-interface> src <sphere-ip>
The node’s ordinary management address and default route were left unchanged. Only traffic destined for the FABRIC subnet used the new XPNet route.
On the FABRIC VM, the dataplane interface received its FABNet address and a route back toward the SPHERE facility subnet:
sudo ip address replace <fabric-ip>/24 dev <dataplane-interface>
sudo ip link set dev <dataplane-interface> up
sudo ip route replace <sphere-subnet>/24 via <fabric-gw> dev <dataplane-interface> src <fabric-ip>
Each stage was tested independently:
# FABRIC VM to its local FABNet gateway
ping -c 3 -I <dataplane-interface> <fabric-gw>
# FABRIC VM to the SPHERE-side facility gateway
ping -c 3 -I <dataplane-interface> <sphere-gw>
# FABRIC VM to the SPHERE experiment node over XPNet
ping -c 5 -I <dataplane-interface> <sphere-ip>
# SPHERE experiment node to the FABRIC VM over XPNet
ping -c 5 -I <sphere-ip> <fabric-ip>
TCP connections were also tested in both directions, confirming that each side could initiate an application connection rather than merely exchange ICMP traffic. The final tests passed with no packet loss and approximately millisecond-scale latency.
The first FABRIC-initiated attempt did not immediately reach the SPHERE node while the ARP and VXLAN forwarding state was cold. After the SPHERE node initiated traffic, the immediate retry succeeded. The eventual automation should therefore allow neighbor and forwarding state to converge before reporting the attachment as failed.
The important difference from the infrapod design is that the infrapod is no longer a router or data-plane dependency. Mars may still own the attachment lifecycle, but packets travel from the shared FABRIC bridge into the experiment VLAN and across XPNet directly to the node.
Traffic path and ownership
The facility transport is persistent and shared, while the FABRIC interface into XPNet belongs to one materialization. This separation lets the shared VTEP serve multiple experiments without attaching it directly to any one experiment VLAN. Each experiment receives its own temporary interface, which can be isolated from the other experiment-facing ports and removed during dematerialization.
Every part of the PoC was assembled and discovered manually. We looked up the materialization’s XPNet VLAN and VNI, built the VTEP, bridge, and veth configuration, and matched learned MAC addresses to determine which interface inside the node belonged to XPNet. The realization already contains the endpoint, VLAN, VNI, MAC, and node-interface relationships, so the Mars automation now reads that information directly instead of reproducing the manual lookup process.
What’s implemented from the PoC
The per-experiment half of the PoC is automated. All changes are on a Mars feature branch as a single commit against main.
- New files
- cmd/mrs/fabric.go: the mrs show, init, and deinit fabric commands
- internal/fabric/fabric.go: reads the realization and writes/clears the etcd keys
- pkg/canopy/fabric.go: interface naming, VLAN handling, and port isolation
- unit tests for both packages
- Changed files
- pkg/canopy/veth.go: VethEnsure calls the new FABRIC helpers
- internal/materialize/dematerialize.go: removes FABRIC interfaces on dematerialize
- cmd/mrs/main.go: registers the new commands
How an experiment gets its FABRIC interface
-
Find the attachment point
- mrs show fabric reads the realization and lists each experiment VTEP on the services host’s XPNet bridge, along with the node interfaces on that segment.
- This replaces the manual VLAN and MAC lookup from the PoC.
-
Create the FABRIC interface
-
mrs init fabric names the interface pair from the facility VNI and experiment VLAN (fxN-Va and fxN-Vb).
-
A VLAN only belongs to one experiment at a time, so names can’t collide.
-
Two keys are written in a single etcd transaction, only if the first doesn’t already exist:
/net/<host>/veth/fxN-Va what Canopy builds /fabric/<mzid>/<host>/fxN-Va ownership record used for cleanup -
If another experiment already owns the key, the command refuses and says which one.
-
-
Canopy builds it
- VethEnsure creates the pair, attaches both ends, isolates the facility side, restricts the XPNet side to the experiment’s VLAN, sets MTU, and brings both ends up.
- Everything is configured while both ends are still down.
- It refuses any config that would turn off VLAN filtering on the XPNet bridge. Canopy’s existing bridge code would otherwise take that bridge down and merge every experiment’s VLAN on the host.
- These steps only run for FABRIC interfaces (the fx prefix), so every other veth Canopy manages behaves the same as before.
-
Remove it
- mrs deinit fabric, or dematerializing the experiment, deletes both keys if that experiment still owns them.
- Canopy then removes the pair.
Usage:
mrs show fabric <mzid> --host <services-host> # list attachment points, changes nothing
mrs init fabric <mzid> --host <services-host> --facility-vni N # create the FABRIC interface
mrs deinit fabric <mzid> # remove it (also automatic on dematerialize)
To check a FABRIC interface on the services host:
bridge link show dev fxN-Va # on fabbrN, forwarding
bridge -d link show dev fxN-Va | grep -o 'isolated on' # isolation set
bridge vlan show dev fxN-Vb # only VLAN V, PVID, untagged
What’s Next:
-
Canopy is the next focus
- The current implementation assumes the shared facility VTEP and bridge already exist, as they did in the PoC.
- The next step is to represent that persistent termination as Mars/Canopy desired state so Canopy can create, reconcile, and restore it after a reboot or host replacement.
- We also need to verify the Canopy behavior for the per-experiment interface
-
Not run for real yet
- It hasn’t been run on a facility host.
-
Facility tunnel and bridge
- The automation still assumes these already exist, as they did in the PoC.
- They need to become Mars/Canopy desired state so they come back after a reboot or host replacement.
-
Testing
- Two experiments on the same facility VNI at once. Both should reach the facility gateway but not each other.
-
Still manual
- An operator or admin decides which experiments get FABRIC by running mrs init fabric.
- The node’s facility address and route are configured manually.
- There’s no address allocation, so nothing stops two experiments from using the same address on the shared facility subnet.
