# BGP, OSPF, BFD, VRRP/HSRP, Multicast PIM & OpenFlow Examples

> **FrameAssembly v3.2.2** · Anthology 04 (Layer 3 · 13 Recipes) · MIT License · Canonical URL: https://frameassembly-lang.dev/docs/examples/routing-bfd-redundancy

Control-plane routing sessions, sub-second BFD failure-detection timers, first-hop gateway redundancy (`vrrp` and `hsrp`), multicast Rendezvous Point joins (`pim`), and SDN `openflow` channels.

## Key Wire & Syntax Takeaways

- `bgp` and `openflow` share the stateful 4-tuple TCP engine on ports 179 and 6653, prepending protocol markers and length headers automatically.
- Link-local control protocols (`ospf`, `vrrp`, `bfd` multihop/single-hop) pair naturally with `ttl 1` or `ttl 255` GTSM security checks and `dscp 48` (CS6).
- Multicast destinations (`224.0.0.5`, `224.0.0.18`, `224.0.0.2`) derive RFC 1112 `01:00:5e:xx:xx:xx` Ethernet MACs automatically.

## 04.01 · eBGP Session Bring-Up Paired with 50ms BFD Echo Liveness (`ebgp_with_bfd_timers.frasm`)

Establishes an eBGP session on TCP 179 (AS 65001 <-> AS 65002), exchanges an IPv4 prefix update, and runs rapid UDP 3784 BFD control packets alongside it.

- **Protocols:** `tcp`, `bgp`, `bfd` (10 Ethernet frames)
- **Wire Behavior:** Combines stateful TCP 179 BGP framing (marker, OPEN, KEEPALIVE, UPDATE) with UDP 3784 BFD state 3 (Up) timers.
- **Wireshark Filter:** `bgp || bfd`
- **CLI Build:** `frameassembly ebgp_with_bfd_timers.frasm`

```frameassembly
host edge_rtr1 { ip 198.51.100.1 }
host isp_rtr2  { ip 198.51.100.2 }

compile {
    edge_rtr1 -> isp_rtr2 tcp syn srcport 54179 dstport 179 ttl 1 dscp 48 wait 1ms
    edge_rtr1 <- isp_rtr2 tcp syn ack ttl 1 dscp 48 wait 1ms
    edge_rtr1 -> isp_rtr2 tcp ack ttl 1 dscp 48 wait 1ms
    edge_rtr1 -> isp_rtr2 bgp open asn 65001 holdtime 90 bgpid 198.51.100.1 ttl 1 dscp 48 wait 2ms
    edge_rtr1 <- isp_rtr2 bgp open asn 65002 holdtime 90 bgpid 198.51.100.2 ttl 1 dscp 48 wait 2ms
    edge_rtr1 -> isp_rtr2 bgp keepalive ttl 1 dscp 48 wait 1ms
    edge_rtr1 <- isp_rtr2 bgp keepalive ttl 1 dscp 48 wait 2ms
    edge_rtr1 -> isp_rtr2 bgp update prefix "203.0.113.0/24" nexthop 198.51.100.1 asn 65001 ttl 1 dscp 48 wait 5ms
    edge_rtr1 -> isp_rtr2 bfd state 3 diag 0 mydisc 0x1001 yourdisc 0x2002 mintx 50000 minrx 50000 mult 3 ttl 255 wait 50ms
    edge_rtr1 <- isp_rtr2 bfd state 3 diag 0 mydisc 0x2002 yourdisc 0x1001 mintx 50000 minrx 50000 mult 3 ttl 255
}
```

## 04.02 · First-Hop Gateway Redundancy Comparison (VRRPv3 + HSRPv1) (`fhrp_vrrp_and_hsrp.frasm`)

Models active/standby gateway heartbeats on two VLANs—VLAN 10 running standard VRRP (IP Proto 112) and VLAN 20 running Cisco HSRP (UDP 1985).

- **Protocols:** `vlan`, `vrrp`, `hsrp` (2 Ethernet frames)
- **Wire Behavior:** VRRP sets TTL=255 automatically; HSRP validates hellotime 3 (u8 seconds) and active state 16.
- **Wireshark Filter:** `vrrp || hsrp`
- **CLI Build:** `frameassembly fhrp_vrrp_and_hsrp.frasm`

```frameassembly
host core_gw_a  { ip 10.10.0.2 mac 00:00:5e:00:01:0a }
host vrrp_mcast { ip 224.0.0.18 }
host dist_gw_a  { ip 10.20.0.2 mac 00:00:0c:07:ac:14 }
host hsrp_mcast { ip 224.0.0.2 }

compile {
    core_gw_a -> vrrp_mcast vlan 10 vrrp vrid 10 priority 120 advint 1 vip 10.10.0.1 wait 5ms
    dist_gw_a -> hsrp_mcast vlan 20 hsrp group 20 priority 110 state 16 hellotime 3 vip 10.20.0.1
}
```

## 04.03 · Minimal Two-Block BGP-4 / 4-Byte ASN (`bgp`) Quickstart (`bgp_quickstart.frasm`)

Smallest zero-boilerplate `host` + `compile` capture for Border Gateway Protocol 4 & 4-Byte ASN Capability (TCP 179, Dual-Stack IPv4/IPv6).

- **Protocols:** `bgp` (3 Ethernet frames)
- **Wire Behavior:** Tracks TCP sequence and acknowledgment numbers automatically on port `179` (`psh ack` flags set by default) and prepends the 16-byte `ff..ff` BGP marker.
- **Wireshark Filter:** `bgp`
- **CLI Build:** `frameassembly bgp_quickstart.frasm`

```frameassembly
host spine_01 { ip 10.255.0.1 }
host leaf_01  { ip 10.255.0.2 }

compile {
    spine_01 -> leaf_01 bgp open asn 65001 holdtime 90 bgpid 10.255.0.1 wait 2ms
    spine_01 <- leaf_01 bgp open asn 65101 holdtime 90 bgpid 10.255.0.2 wait 2ms
    spine_01 -> leaf_01 bgp keepalive
}
```

## 04.04 · Minimal Two-Block OSPFv2 / OSPFv3 (`ospf`) Quickstart (`ospf_quickstart.frasm`)

Smallest zero-boilerplate `host` + `compile` capture for Open Shortest Path First — OSPFv2 & Dual-Stack OSPFv3 (IP Proto 89 (TTL 1), Dual-Stack Morphing (v4/v6)).

- **Protocols:** `ospf` (1 Ethernet frame)
- **Wire Behavior:** Selects OSPFv2 (24B header, IPv4 Proto `89`) over IPv4 hosts or OSPFv3 (16B header, IPv6 Next Header `89`, IPv6 pseudo-header checksum) over IPv6 hosts.
- **Wireshark Filter:** `ospf`
- **CLI Build:** `frameassembly ospf_quickstart.frasm`

```frameassembly
host rtr_a { ip 10.0.0.1 }
host rtr_b { ip 10.0.0.2 }

compile {
    rtr_a -> rtr_b ospf hello routerid 1.1.1.1 areaid 0
}
```

## 04.05 · Minimal Two-Block BFD (`bfd`) Quickstart (`bfd_quickstart.frasm`)

Smallest zero-boilerplate `host` + `compile` capture for Bidirectional Forwarding Detection Control Packet (UDP 3784 (Multihop 4784, TTL 255), Dual-Stack IPv4/IPv6).

- **Protocols:** `bfd` (2 Ethernet frames)
- **Wire Behavior:** Defaults UDP `srcport` to RFC 5881 range (`49152+`), `dstport` to `3784`, and IP `ttl` / Hop Limit to `255`.
- **Wireshark Filter:** `bfd`
- **CLI Build:** `frameassembly bfd_quickstart.frasm`

```frameassembly
host rtr_leaf  { ip 172.16.0.1 }
host rtr_spine { ip 172.16.0.2 }

compile {
    rtr_leaf -> rtr_spine bfd state 3 mydisc 101 yourdisc 202 mintx 50000 minrx 50000 mult 3 wait 50ms
    rtr_leaf <- rtr_spine bfd state 3 mydisc 202 yourdisc 101 mintx 50000 minrx 50000 mult 3
}
```

## 04.06 · OSPFv2 / OSPFv3 (`ospf`): Full OSPF Adjacency Synchronization Plus OSPFv3 IPv6 Backbone Hello (`ospf_adjacency_v2_v3.frasm`)

Walks two core routers through OSPFv2 `hello`, `dbd`, `lsr`, `lsu`, and `lsack` exchange on Area 0, followed by an OSPFv3 IPv6 Hello using 32-bit `routerid`.

- **Protocols:** `ospf` (7 Ethernet frames)
- **Wire Behavior:** Selects OSPFv2 (24B header, IPv4 Proto `89`) over IPv4 hosts or OSPFv3 (16B header, IPv6 Next Header `89`, IPv6 pseudo-header checksum) over IPv6 hosts. Defaults IP `ttl` / Hop Limit to `1` and derives multicast destination MACs automatically when sending to `224.0.0.5` / `224.0.0.6` or `ff02::5` / `ff02::6`.
- **Wireshark Filter:** `ospf`
- **CLI Build:** `frameassembly show ospf_adjacency_v2_v3.frasm`

```frameassembly
host core_1_v4 { ip 172.16.0.1 }
host core_2_v4 { ip 172.16.0.2 }
host allspf_v6 { ip ff02::5 }
host core_1_v6 { ip fe80::1c73:1 }

compile {
    // 1. OSPFv2 Area 0 adjacency bring-up and LSA exchange
    core_1_v4 -> core_2_v4 ospf hello routerid 1.1.1.1 areaid 0 hellointerval 10 deadinterval 40 priority 100 dscp 48 wait 2ms
    core_1_v4 <- core_2_v4 ospf hello routerid 2.2.2.2 areaid 0 hellointerval 10 deadinterval 40 priority 1 dscp 48 wait 2ms
    core_1_v4 -> core_2_v4 ospf dbd routerid 1.1.1.1 areaid 0 dscp 48 wait 1ms
    core_1_v4 <- core_2_v4 ospf lsr routerid 2.2.2.2 areaid 0 dscp 48 wait 1ms
    core_1_v4 -> core_2_v4 ospf lsu routerid 1.1.1.1 areaid 0 dscp 48 wait 1ms
    core_1_v4 <- core_2_v4 ospf lsack routerid 2.2.2.2 areaid 0 dscp 48 wait 4ms
    // 2. OSPFv3 over IPv6 multicast ff02::5 (routerid stays 32-bit dotted-quad!)
    core_1_v6 -> allspf_v6 ospf hello routerid 1.1.1.1 areaid 0.0.0.0 hellointerval 10 deadinterval 40
}
```

## 04.07 · BGP-4 / 4-Byte ASN (`bgp`): Stateful TCP Handshake + 4-Byte ASN eBGP Peering & Route Advertisement (`bgp_4byte_asn_session.frasm`)

Establishes a GTSM-protected (`ttl 255`) TCP 179 session between two 4-byte ASN switches (`4200000001` and `4200000101`), exchanges `OPEN` + `KEEPALIVE`, and advertises `10.100.0.0/16`.

- **Protocols:** `bgp`, `tcp` (8 Ethernet frames)
- **Wire Behavior:** Tracks TCP sequence and acknowledgment numbers automatically on port `179` (`psh ack` flags set by default) and prepends the 16-byte `ff..ff` BGP marker. On `bgp open` with `asn > 65535`, writes `AS_TRANS` (`23456`) in the 16-bit My AS field and encodes Optional Parameter `2` (Capabilities) -> Capability `65` (4-octet AS) with the full 32-bit `asn`.
- **Wireshark Filter:** `bgp`
- **CLI Build:** `frameassembly show bgp_4byte_asn_session.frasm`

```frameassembly
host leaf_tor  { ip 172.16.255.1 }
host spine_agg { ip 172.16.255.2 }

compile {
    // 1. Stateful TCP 3-way handshake on port 179 with GTSM (ttl 255) and CS6 (dscp 48)
    leaf_tor -> spine_agg tcp syn srcport 53179 dstport 179 win 65535 mss 1460 ttl 255 dscp 48 wait 1ms
    leaf_tor <- spine_agg tcp syn ack win 65535 mss 1460 ttl 255 dscp 48 wait 1ms
    leaf_tor -> spine_agg tcp ack ttl 255 dscp 48 wait 1ms
    // 2. 4-Byte ASN OPEN negotiation (auto-encodes AS_TRANS 23456 + Capability 65)
    leaf_tor -> spine_agg bgp open asn 4200000101 holdtime 90 bgpid 10.0.1.1 ttl 255 dscp 48 wait 2ms
    leaf_tor <- spine_agg bgp open asn 4200000001 holdtime 90 bgpid 10.0.0.1 ttl 255 dscp 48 wait 2ms
    leaf_tor -> spine_agg bgp keepalive ttl 255 dscp 48 wait 1ms
    leaf_tor <- spine_agg bgp keepalive ttl 255 dscp 48 wait 2ms
    // 3. Advertise tenant CIDR 10.100.0.0/16 via BGP UPDATE
    leaf_tor -> spine_agg bgp update asn 4200000101 prefix "10.100.0.0/16" nexthop 172.16.255.1 ttl 255 dscp 48
}
```

## 04.08 · RIPv2 / RIPng (`rip`): RIPv2 Multicast Update, Route Poisoning (Metric 16), and IPv6 RIPng (`rip_v2_ripng.frasm`)

Shows a branch router advertising `10.50.10.0` (`metric 2`), subsequently poisoning the route (`metric 16`) upon link loss, and advertising an IPv6 prefix over RIPng (`ff02::9`).

- **Protocols:** `rip` (3 Ethernet frames)
- **Wire Behavior:** Selects RIPv2 on UDP `520 -> 520` over IPv4 hosts or RIPng on UDP `521 -> 521` over IPv6 hosts. Populates Address Family Identifier `2` (`AF_INET`), `255.255.255.0` default mask, Route Tag, Next Hop, and Metric in RIPv2—or 128-bit IPv6 prefix + prefix-length + 8-bit metric in RIPng.
- **Wireshark Filter:** `rip || ripng`
- **CLI Build:** `frameassembly show rip_v2_ripng.frasm`

```frameassembly
host rtr_branch { ip 172.16.10.2 }
host rip_mcast  { ip 224.0.0.9 }
host rtr6_a     { ip fe80::10:1 }
host ripng_all  { ip ff02::9 }

compile {
    // 1. Periodic RIPv2 multicast advertisement (metric 2, route tag 65010)
    rtr_branch -> rip_mcast rip response prefix 10.50.10.0 nexthop 0.0.0.0 metric 2 tag 65010 ttl 2 wait 10ms
    // 2. Triggered route-poison update (metric 16 = infinity / unreachable)
    rtr_branch -> rip_mcast rip response prefix 10.50.10.0 nexthop 0.0.0.0 metric 16 tag 65010 ttl 2 wait 5ms
    // 3. IPv6 RIPng advertisement on UDP 521 -> 521 to ff02::9
    rtr6_a -> ripng_all rip response prefix 2001:db8:50:: metric 1 tag 100 ttl 255
}
```

## 04.09 · PIM-SM (`pim`): End-to-End Multicast Control Plane: IGMPv3 Join + PIM Hello, Join/Prune & Register (`pim_multicast_tree.frasm`)

Combines a receiver `igmp v3 report` with upstream `pim hello`, `(S,G)` `joinprune`, and First-Hop `pim register` signaling to the Rendezvous Point.

- **Protocols:** `pim` (4 Ethernet frames)
- **Wire Behavior:** Encapsulates over IPv4 Protocol `103` or IPv6 Next Header `103` with PIM Version `2` (`0x20`). Computes full-message checksums (including IPv6 pseudo-header on v6) for `hello` and `joinprune`, while restricting `register` checksums to the 8-byte PIMv2 header per RFC 7761 §4.9.
- **Wireshark Filter:** `pim`
- **CLI Build:** `frameassembly show pim_multicast_tree.frasm`

```frameassembly
host receiver_01 { ip 10.40.1.50 }
host lhr_router  { ip 10.40.1.1 }
host pim_mcast   { ip 224.0.0.13 }
host core_rp     { ip 172.16.255.1 }

compile {
    // 1. PIMv2 Hello on multicast 224.0.0.13 electing DR (drpriority 200)
    lhr_router -> pim_mcast pim hello holdtime 105 drpriority 200 ttl 1 dscp 48 wait 2ms
    // 2. Receiver joins SSM channel 232.10.10.5 on LAN
    receiver_01 -> lhr_router igmp v3 report group 232.10.10.5 wait 2ms
    // 3. Last-Hop Router sends PIM Join/Prune upstream toward source 10.10.5.100
    lhr_router -> core_rp pim joinprune group 232.10.10.5 source 10.10.5.100 holdtime 210 dscp 48 wait 3ms
    // 4. Unicast PIM Register encapsulated to Rendezvous Point
    lhr_router -> core_rp pim register group 239.20.20.1 source 10.40.1.50 rp 172.16.255.1 ttl 64 dscp 48
}
```

## 04.10 · VRRPv2 / VRRPv3 (`vrrp`): Graceful VRRP Master Shutdown (Priority 0), Backup Takeover & VRRPv3 IPv6 (`vrrp_failover_v2_v3.frasm`)

Traces VRID 10 on VLAN 10 where the primary router sends a `priority 0` release, the backup router assumes mastership + sends GARP, alongside an IPv6 VRRPv3 advertisement.

- **Protocols:** `vrrp`, `vlan` (5 Ethernet frames)
- **Wire Behavior:** Sets IPv4 Protocol / IPv6 Next Header to `112` and defaults `ttl` / Hop Limit to `255` per RFC 3768 / RFC 5798. Selects VRRPv2 (`version 2`) over IPv4 and VRRPv3 (`version 3`, 12-bit centisecond `Max Adver Int` + pseudo-header checksum) over IPv6 automatically.
- **Wireshark Filter:** `vrrp`
- **CLI Build:** `frameassembly show vrrp_failover_v2_v3.frasm`

```frameassembly
host rtr_pri   { ip 10.10.10.2 mac 00:00:5e:00:01:0a }
host rtr_bkp   { ip 10.10.10.3 mac 00:00:5e:00:01:0a }
host vrrp_v4   { ip 224.0.0.18 }
host rtr6_pri  { ip fe80::10:2 mac 00:00:5e:00:02:0a }
host vrrp_v6   { ip ff02::12 }

compile {
    // 1. Primary router steady-state VRRPv2 heartbeat (VRID 10, Priority 150)
    rtr_pri -> vrrp_v4 vrrp vrid 10 priority 150 advint 1 vip 10.10.10.1 vlan 10 pcp 6 wait 5ms
    // 2. Primary router initiates graceful shutdown (Priority 0 triggers immediate takeover)
    rtr_pri -> vrrp_v4 vrrp vrid 10 priority 0 advint 1 vip 10.10.10.1 vlan 10 pcp 6 wait 2ms
    // 3. Backup router promotes to Master (Priority 120) and broadcasts GARP for VIP
    rtr_bkp -> vrrp_v4 vrrp vrid 10 priority 120 advint 1 vip 10.10.10.1 vlan 10 pcp 6 wait 1ms
    rtr_bkp -> vrrp_v4 arp gratuitous sendermac 00:00:5e:00:01:0a senderip 10.10.10.1 vlan 10 wait 3ms
    // 4. Dual-stack VRRPv3 over IPv6 (advint 100 = 100 centiseconds = 1.00s)
    rtr6_pri -> vrrp_v6 vrrp version 3 vrid 10 priority 150 advint 100 vip fe80::10:1 vlan 10
}
```

## 04.11 · HSRPv1 / HSRPv2 (`hsrp`): Campus VLAN 20 Active/Standby HSRP Pair Plus HSRPv2 IPv6 Gateway (`hsrp_active_standby.frasm`)

Models two distribution switches exchanging Active (`state 16`, `priority 110`) and Standby (`state 8`, `priority 100`) HSRPv1 Hellos on VLAN 20 alongside an IPv6 HSRPv2 Active router.

- **Protocols:** `hsrp`, `vlan` (3 Ethernet frames)
- **Wire Behavior:** Defaults UDP source and destination ports to `1985 -> 1985` on IPv4 (HSRPv1) or `2029 -> 2029` on IPv6 (HSRPv2 TLV). Zero-pads or truncates `auth` cleanly into the fixed 8-byte RFC 2281 Authentication Data field (default `"cisco\0\0\0"`).
- **Wireshark Filter:** `hsrp || hsrp2`
- **CLI Build:** `frameassembly show hsrp_active_standby.frasm`

```frameassembly
host dist_a   { ip 10.20.20.2 mac 00:00:0c:07:ac:14 }
host dist_b   { ip 10.20.20.3 mac 00:1c:73:20:00:03 }
host hsrp_v4  { ip 224.0.0.2 }
host dist6_a  { ip fe80::20:2 mac 00:05:73:a0:00:14 }
host hsrp_v6  { ip ff02::66 }

compile {
    // 1. Active router (state 16, priority 110, virtual MAC 00:00:0c:07:ac:14 for group 20)
    dist_a -> hsrp_v4 hsrp group 20 priority 110 state 16 hellotime 3 holdtime 10 auth "corpkey1" vip 10.20.20.1 vlan 20 ttl 1 dscp 48 wait 3ms
    // 2. Standby router (state 8, priority 100) monitoring Active peer
    dist_b -> hsrp_v4 hsrp group 20 priority 100 state 8 hellotime 3 holdtime 10 auth "corpkey1" vip 10.20.20.1 vlan 20 ttl 1 dscp 48 wait 5ms
    // 3. HSRPv2 over IPv6 on UDP 2029 -> ff02::66
    dist6_a -> hsrp_v6 hsrp group 20 priority 110 state 16 hellotime 3 holdtime 10 vip 2001:db8:20::1 vlan 20 ttl 255
}
```

## 04.12 · BFD (`bfd`): BFD 3-Way Session Bring-Up (Down -> Init -> Up) & Detection Timeout (`bfd_state_machine.frasm`)

Traces two routers negotiating a 50ms (`50000` us * `mult 3` = `150ms` detection) BFD session from `Down` (`1`) through `Init` (`2`) to `Up` (`3`), followed by a `diag 1` timeout.

- **Protocols:** `bfd` (5 Ethernet frames)
- **Wire Behavior:** Defaults UDP `srcport` to RFC 5881 range (`49152+`), `dstport` to `3784`, and IP `ttl` / Hop Limit to `255`. Bit-packs Version (`1`), `diag` (`0..31`), `state` (`0..3`), `mult` (default `3`), `Length = 24`, `mydisc`, `yourdisc`, `mintx` (`100000` us), `minrx` (`100000` us), and Echo RX interval.
- **Wireshark Filter:** `bfd`
- **CLI Build:** `frameassembly show bfd_state_machine.frasm`

```frameassembly
host pe_north { ip 10.255.1.1 }
host pe_south { ip 10.255.1.2 }

compile {
    // 1. Initial Down packet (state 1, yourdisc 0 = peer unknown, slow 1s timer)
    pe_north -> pe_south bfd state 1 diag 0 mydisc 0x1001 yourdisc 0 mintx 1000000 minrx 1000000 mult 3 dscp 48 wait 2ms
    // 2. Peer sees 0x1001 and transitions to Init (state 2)
    pe_north <- pe_south bfd state 2 diag 0 mydisc 0x2002 yourdisc 0x1001 mintx 50000 minrx 50000 mult 3 dscp 48 wait 2ms
    // 3. Both peers reach Up (state 3) at 50ms (50,000 us) intervals
    pe_north -> pe_south bfd state 3 diag 0 mydisc 0x1001 yourdisc 0x2002 mintx 50000 minrx 50000 mult 3 dscp 48 wait 50ms
    pe_north <- pe_south bfd state 3 diag 0 mydisc 0x2002 yourdisc 0x1001 mintx 50000 minrx 50000 mult 3 dscp 48 wait 150ms
    // 4. Link failure detected: state 1 (Down), diag 1 (Control Detection Time Expired)
    pe_north -> pe_south bfd state 1 diag 1 mydisc 0x1001 yourdisc 0x2002 mintx 1000000 minrx 1000000 mult 3 dscp 48
}
```

## 04.13 · OpenFlow SDN (`openflow`): Complete OpenFlow 1.3 Switch Onboarding, Packet-In Miss & FlowMod Programming (`openflow_sdn_pipeline.frasm`)

Walks through TCP 6653 connection establishment, OpenFlow 1.3 `HELLO` + `FEATURES_REPLY`, a switch table-miss `PACKET_IN`, controller `FLOW_MOD` installation in Table 0, and `ECHO` heartbeat.

- **Protocols:** `openflow`, `tcp` (12 Ethernet frames)
- **Wire Behavior:** Defaults to IANA OpenFlow port TCP `6653`, Version `4` (`0x04` = OpenFlow 1.3), and shares stateful 4-tuple TCP `seq`/`acknum` progression. Computes the exact 16-bit big-endian OpenFlow `length` field across both 8-byte header-only messages (`hello`, `featuresreq`, `echoreq`) and structured bodies (`32B` `featuresreply`, `56B` `flowmod`).
- **Wireshark Filter:** `openflow_v4 || openflow`
- **CLI Build:** `frameassembly show openflow_sdn_pipeline.frasm`

```frameassembly
host controller { ip 10.90.0.10 }
host leaf_ovs   { ip 10.90.0.51 }

compile {
    // 1. TCP handshake on port 6653
    leaf_ovs -> controller tcp syn srcport 54653 dstport 6653 win 65535 mss 1460 wait 1ms
    leaf_ovs <- controller tcp syn ack win 65535 mss 1460 wait 1ms
    leaf_ovs -> controller tcp ack wait 1ms
    // 2. OpenFlow 1.3 (version 4) Hello & Features negotiation
    leaf_ovs -> controller openflow hello version 4 xid 10 wait 1ms
    leaf_ovs <- controller openflow hello version 4 xid 10 wait 1ms
    leaf_ovs <- controller openflow featuresreq version 4 xid 11 wait 1ms
    leaf_ovs -> controller openflow featuresreply version 4 xid 11 dpid 0x0000001c73aa0051 wait 3ms
    // 3. Table-miss PacketIn triggers FlowMod rule installation + PacketOut
    leaf_ovs -> controller openflow packetin version 4 xid 0 tableid 0 wait 2ms
    leaf_ovs <- controller openflow flowmod version 4 xid 12 tableid 0 priority 1000 wait 1ms
    leaf_ovs <- controller openflow packetout version 4 xid 13 wait 5ms
    // 4. Liveness Echo Request / Reply
    leaf_ovs <- controller openflow echoreq version 4 xid 99 wait 1ms
    leaf_ovs -> controller openflow echoreply version 4 xid 99
}
```
