---
# -----------------------------------------------------------------------------
# LACP ports are aggregating-ethernet interfaces, e.g. 'ae0'
# -----------------------------------------------------------------------------

LacpPortTable:
  rpc: get-lacp-interface-information
  args_key: interface_name
  item: lacp-interface-information
  key: lag-lacp-header/aggregate-name
  view: LacpPortView

# the view provides access to two tables states and protocols

LacpPortView:
  fields:
    state: _LacpPortStateTable
    proto: _LacpPortProtoTable

# -----------------------------------------------------------------------------
# Each LACP port maintains a "state" table that ha a composite key of the
# interface name and it's role (Actor/Partner).  name with the "_" so this 
# item does not get exported to the global namespace
# -----------------------------------------------------------------------------

_LacpPortStateTable:
  item: lag-lacp-state
  key:
    - name 
    - lacp-role 
  view: _LacpPortStateView

_LacpPortStateView:
  fields:
    activity: lacp-activity
    timeout: lacp-timeout   
    expired: { lacp-expired: True=Yes }
    defaulted: { lacp-defaulted: True=Yes }
    distributing: { lacp-distributing: True=Yes }
    collecting: { lacp-collecting: True=Yes }
    sync : { lacp-synchronization: True=Yes }
    aggregation: { lacp-aggregation: True=Yes }

# -----------------------------------------------------------------------------
# Each LACP port maintains a "protocol" table
# -----------------------------------------------------------------------------

_LacpPortProtoTable:
  item: lag-lacp-protocol
  view: _LacpPortProtoView

_LacpPortProtoView:
  fields:
    rx_state: lacp-receive-state
    tx_state: lacp-transmit-state
    mx_state: lacp-mux-state
