Skip to content

Enh/fabric - #181

Draft
Giluerre wants to merge 3 commits into
ironcore-dev:mainfrom
Giluerre:enh/fabric
Draft

Giluerre wants to merge 3 commits into
ironcore-dev:mainfrom
Giluerre:enh/fabric

Conversation

@Giluerre

Copy link
Copy Markdown
Contributor

This commit introduces a name abstraction layer between SONiC's native interface
names (e.g. Ethernet0) and abstract names (e.g. eth0-0), alias management, a full
wirelet implementation for network-operator compatibility, FRR BGP config generation,
host-service module installation, and TLS support for the agent server.

Proto/gRPC:
- Added RPCs to SwitchAgentService: Reboot, OnieBootModeInstall, RestartSystemdService,
  RebootCause, FactoryReset, GetReadiness
- Added 5 new provider services: DeviceProviderService, InterfaceProviderService,
  DHCPRelayProviderService, VLANProviderService, LLDPProviderService
- Added WireSonicSwitchService with full SwitchConfig (hostname, loopback IPs, VLANs
  with DHCP relay and port members, BGP peer groups with VLAN/interface-based neighbors)
- Added native_name, alias_name fields to Interface message; new SetInterfaceAliasName
  and SaveConfig RPCs

Agent Server:
- TLS support: loads cert/key pair from flags or auto-generates self-signed ECDSA/P256
  certificate; --enable-plain-mode flag disables TLS
- Registers all new gRPC services at startup
- Added provider server files delegating to SwitchAgent interface
- Added wire_sonic_switch_server.go implementing WireSonicSwitchService

SONiC Agent:
- Detects SONiC OS version, sets OSProfile (edgecore or default)
- Background goroutine waits for org.SONiC.HostService, runs compatibility check,
  installs missing host-service modules, triggers Reprovision once ready
- SaveConfig refactored to use hostservices handler registry
- New methods: Reboot, OnieBootModeInstall, RestartSystemdService, RebootCause,
  FactoryReset, GetReadiness, GetLastRebootTime, Reprovision, ListInterfacesV2
- EnsureInterface: handles Loopback, Physical, RoutedVLAN types; syncs IPs, admin
  state, MTU, VLAN memberships via dbAccessor
- ApplySwitch: applies full WireSwitchConfig — sets hostname, ensures Loopback0,
  creates VLANs with interfaces/DHCP relay/port members,
  generates frr.conf via FRR template, restarts bgp service, writes cell state to
  WIRE_CELL_STATE|<device> in STATE_DB
- DeleteSwitch: sets state to Reprovisioning, calls Reprovision async, returns
  in-progress sentinel (code=2) on repeated calls
- ListInterfaces reads oper status from APPL_DB instead of STATE_DB
- Name conversion utils: NativeNameToAbstractName/AbstractNameToNativeName helpers

DB Accessor (db_accessor.go):
- New dbAccessor holding CONFIG_DB, STATE_DB, APPL_DB clients
- Full CRUD for: port config/state, admin/oper status, MTU/FEC/speed, loopback and
  VLAN lifecycle, IP address sync, VLAN member sync, DHCP relay, cell provisioning state

FRR (frr/frr.go, frr.conf.tmpl):
- GenerateFRRConfig renders frr.conf from embedded template using WireBGPConfig
- Topology inferred from peer group names: NORTH group → leaf, otherwise spine
- VLAN stanzas emitted for every unique non-zero VLAN ID in BGP neighbor list

Host Services (hostservices/hostservices.go):
- DbusMapping YAML schema with Handler entries; embedded default and edgecore modules
- HostServicesCompatibilityCheck: gates on D-Bus availability, introspects each handler
- InstallHostServiceModule: copies Python module, patches sonic-host-server imports
- SystemDbusClient wrapping godbus/dbus
- Embedded Python modules: onie.py (default and edgecore), extension.py, reboot.py

CLI:
- apply-switch command: reads SwitchConfig JSON (protojson) and calls ApplySwitch RPC
- delete-switch command: calls DeleteSwitch; --wait flag polls until state clears
- gnoi save-config subcommand

Agent Types:
- Added: PortDetails, EnsureInterfaceRequest, InterfaceStatus, DHCPRelayRequest,
  DHCPRelayStatus, VLANRequest, VLANStatus, LLDPRequest, LLDPStatus
- Added wire types: WireVLANMember, WireVLAN, WireBGPNeighbor, WireBGPPeerGroup,
  WireBGPConfig, WireSwitchConfig, ApplySwitchRequest

@Giluerre
Giluerre requested a review from a team as a code owner September 21, 2026 07:35
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 21, 2026
@Giluerre
Giluerre force-pushed the enh/fabric branch 6 times, most recently from e3bf3f5 to ff4710a Compare September 21, 2026 09:32
…briclet implementation

This commit introduces a name abstraction layer between SONiC's native interface
names (e.g. Ethernet0) and abstract names (e.g. eth0-0), alias management, a full
wirelet implementation for network-operator compatibility, FRR BGP config generation,
host-service module installation, and TLS support for the agent server.

Proto/gRPC:
- Added RPCs to SwitchAgentService: Reboot, OnieBootModeInstall, RestartSystemdService,
  RebootCause, FactoryReset, GetReadiness
- Added 5 new provider services: DeviceProviderService, InterfaceProviderService,
  DHCPRelayProviderService, VLANProviderService, LLDPProviderService
- Added WireSonicSwitchService with full SwitchConfig (hostname, loopback IPs, VLANs
  with DHCP relay and port members, BGP peer groups with VLAN/interface-based neighbors)
- Added native_name, alias_name fields to Interface message; new SetInterfaceAliasName
  and SaveConfig RPCs

Agent Server:
- TLS support: loads cert/key pair from flags or auto-generates self-signed ECDSA/P256
  certificate; --enable-plain-mode flag disables TLS
- Registers all new gRPC services at startup
- Added provider server files delegating to SwitchAgent interface
- Added wire_sonic_switch_server.go implementing WireSonicSwitchService

SONiC Agent:
- Detects SONiC OS version, sets OSProfile (edgecore or default)
- Background goroutine waits for org.SONiC.HostService, runs compatibility check,
  installs missing host-service modules, triggers Reprovision once ready
- SaveConfig refactored to use hostservices handler registry
- New methods: Reboot, OnieBootModeInstall, RestartSystemdService, RebootCause,
  FactoryReset, GetReadiness, GetLastRebootTime, Reprovision, ListInterfacesV2
- EnsureInterface: handles Loopback, Physical, RoutedVLAN types; syncs IPs, admin
  state, MTU, VLAN memberships via dbAccessor
- ApplySwitch: applies full WireSwitchConfig — sets hostname, ensures Loopback0,
  creates VLANs with interfaces/DHCP relay/port members (MTU 9100, FEC rs, speed 25G),
  generates frr.conf via FRR template, restarts bgp service, writes cell state to
  WIRE_CELL_STATE|<device> in STATE_DB
- DeleteSwitch: sets state to Reprovisioning, calls Reprovision async, returns
  in-progress sentinel (code=2) on repeated calls
- ListInterfaces reads oper status from APPL_DB instead of STATE_DB
- Name conversion utils: NativeNameToAbstractName/AbstractNameToNativeName helpers

DB Accessor (db_accessor.go):
- New dbAccessor holding CONFIG_DB, STATE_DB, APPL_DB clients
- Full CRUD for: port config/state, admin/oper status, MTU/FEC/speed, loopback and
  VLAN lifecycle, IP address sync, VLAN member sync, DHCP relay, cell provisioning state

FRR (frr/frr.go, frr.conf.tmpl):
- GenerateFRRConfig renders frr.conf from embedded template using WireBGPConfig
- Topology inferred from peer group names: NORTH group → leaf, otherwise spine
- VLAN stanzas emitted for every unique non-zero VLAN ID in BGP neighbor list

Host Services (hostservices/hostservices.go):
- DbusMapping YAML schema with Handler entries; embedded default and edgecore modules
- HostServicesCompatibilityCheck: gates on D-Bus availability, introspects each handler
- InstallHostServiceModule: copies Python module, patches sonic-host-server imports
- SystemDbusClient wrapping godbus/dbus
- Embedded Python modules: onie.py (default and edgecore), extension.py, reboot.py

CLI:
- apply-switch command: reads SwitchConfig JSON (protojson) and calls ApplySwitch RPC
- delete-switch command: calls DeleteSwitch; --wait flag polls until state clears
- gnoi save-config subcommand

Agent Types:
- Added: PortDetails, EnsureInterfaceRequest, InterfaceStatus, DHCPRelayRequest,
  DHCPRelayStatus, VLANRequest, VLANStatus, LLDPRequest, LLDPStatus
- Added wire types: WireVLANMember, WireVLAN, WireBGPNeighbor, WireBGPPeerGroup,
  WireBGPConfig, WireSwitchConfig, ApplySwitchRequest

Controller:
- EnsureInterface creates SwitchInterface CR with NativeName and owner reference to Switch
- SwitchInterface CRD: added nativeName to spec, aliasName to status, Initializing state
- Reconciler syncs interface alias name to spec.handle if mismatched

Signed-off-by: Daniel Beres <daniel.beres@sap.com>
@hardikdr hardikdr added the area/switch-automation Automation processes for network switch management and operations. label Sep 22, 2026
@hardikdr hardikdr added this to Roadmap Sep 22, 2026
Signed-off-by: Daniel Beres <daniel.beres@sap.com>
@hardikdr hardikdr moved this from Todo to Needs Review in Fabric Automation Sep 22, 2026
@Giluerre
Giluerre marked this pull request as draft September 24, 2026 11:54
Signed-off-by: Daniel Beres <daniel.beres@sap.com>

@hardikdr hardikdr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we close this one since there is not much activity going on now? @Giluerre @byteocean

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations. documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants