Emulation Scenarios

Some basic sequence diagrams of some initial emulation scenarios. These are rough sketches/brainstorms and not finalized ideas. For now, for the sake of simplicity/understanding, these diagrams ignore the eventual timing/events aspect of the emulator.

Success: Configure

@startuml EmulatorScenarioConfigureSuccess
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [All modules initialized and in IDLE state]

controller -> mac_api : Configure
activate mac_api #LightSeaGreen
mac_api -> mac_module : Configure
activate mac_module #PaleTurquoise
mac_module -> mac_module : Set state CONFIGURING
mac_module -> mac_module : Set state READY
return #LimeGreen (RespCode.OK, details)
note right : Store //details// in a JSON-like object? \ne.g. message (if any), status of certain registers, etc.
return #LimeGreen (RespCode.OK, details)

controller -> wib_api : Configure
activate wib_api #LightSeaGreen
wib_api -> wib_module : Configure
activate wib_module #PaleTurquoise
wib_module -> wib_module : Set state CONFIGURING
wib_module -> wib_module : Set state READY
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

controller -> vcc20_api : Configure
activate vcc20_api #LightSeaGreen
vcc20_api -> vcc20_module : Configure
activate vcc20_module #PaleTurquoise
vcc20_module -> vcc20_module : Set state CONFIGURING
vcc20_module -> vcc20_module : Set state READY
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)
@enduml

Success: On

@startuml EmulatorScenarioSuccessOn
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [Configured, all modules in READY state]

controller -> mac_api : On
activate mac_api #LightSeaGreen
mac_api -> mac_module : On
activate mac_module #PaleTurquoise
mac_module -> dish_module : Get data
note over dish_module
  Presumably this "data", for the purposes of emulation,
  would be a JSON-like object containing "packet data",
  e.g. sample rate, FW configured band, or any other info
  that the next block might be interested in.
  For example:
  "data": {
    "firmware_band": "1",
    "sample_rate": 220200000,
    "timestamp": 1712070537000,
    ...etc
  }
end note
note over mac_module
  Additionally, when we factor in the event system,
  this is also probably the stage where we request
  the processing of upstream events?
  (maybe this "data object" also comes from
  an event of some kind?) 
end note
mac_module <-- dish_module : //dataObj//
mac_module -> mac_module : Check that sample rate > 0
activate mac_module #LightPink
return #LimeGreen //True//
mac_module -> mac_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

controller -> wib_api : On
activate wib_api #LightSeaGreen
wib_api -> wib_module : On
activate wib_module #PaleTurquoise
wib_module -> mac_module : Get data
wib_module <-- mac_module : //dataObj//
wib_module -> wib_module : Check that sample rate > 0
activate wib_module #LightPink
return #LimeGreen //True//
note over wib_module
  Do we actually care about the previous IP block "state"
  e.g. does the WIB module, or even the WIB API,
  need to know or care whether MAC is ENABLED,
  or is it only concerned with sample rate?
end note
wib_module -> wib_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

controller -> vcc20_api : On
activate vcc20_api #LightSeaGreen
vcc20_api -> vcc20_module : On
activate vcc20_module #PaleTurquoise
vcc20_module -> wib_module : Get data
vcc20_module <-- wib_module : //dataObj//
vcc20_module -> vcc20_module : Check that sample rate > 0
activate vcc20_module #LightPink
return #LimeGreen //True//
vcc20_module -> vcc20_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)
@enduml

Error: On (Out of Order)

@startuml EmulatorScenarioErrorOnOutOfOrder
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [Configured, all modules in READY state]

controller -> wib_api : On
activate wib_api #LightSeaGreen
wib_api -> wib_module : On
activate wib_module #PaleTurquoise
wib_module -> mac_module : Get data
wib_module <-- mac_module : //dataObj//
wib_module -> wib_module : Check that sample rate > 0
activate wib_module #LightPink
return #red //False (MAC not enabled//\n//so sample rate will be 0)//
wib_module -> wib_module : Set state ENABLED
note over wib_module
  Does the WIB turn on regardless of whether data is coming in,
  or should it maintain its READY state until the MAC turns on
  (and possibly a new API call is made)?
end note
return #red (RespCode.ERROR, details)
return #red (RespCode.ERROR, details)

controller -> mac_api : On
activate mac_api #LightSeaGreen
mac_api -> mac_module : On
activate mac_module #PaleTurquoise
mac_module -> dish_module : Get data
mac_module <-- dish_module : //dataObj//
mac_module -> mac_module : Check that sample rate > 0
activate mac_module #LightPink
return #LimeGreen //True//
mac_module -> mac_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

controller -> vcc20_api : On
activate vcc20_api #LightSeaGreen
vcc20_api -> vcc20_module : On
activate vcc20_module #PaleTurquoise
vcc20_module -> wib_module : Get data
vcc20_module <-- wib_module : //dataObj//
vcc20_module -> vcc20_module : Check that sample rate > 0
activate vcc20_module #LightPink
return #LimeGreen //True//
note over vcc20_module
  Would data actually be correctly flowing in at this point?
  The WIB and the MAC were enabled out of order,
  but if they are both enabled by the time VCC-Ch20 turns on,
  does that mean data will be flowing regardless?
  Or would an intermediate API call need to happen
  to ensure the WIB is running correctly?
end note
vcc20_module -> vcc20_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)
@enduml

Error: On (Injected Fault)

@startuml EmulatorScenarioErrorOnInjectedTemperatureWarning
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [Configured, all modules in READY state]

controller -> mac_api : On
activate mac_api #LightSeaGreen
mac_api -> mac_module : On
activate mac_module #PaleTurquoise
mac_module -> dish_module : Get data
mac_module <-- dish_module : //dataObj//
mac_module -> mac_module : Check that sample rate > 0
activate mac_module #LightPink
return #LimeGreen //True//
mac_module -> mac_module : Set state ENABLED
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

fault_injector -> wib_module : Inject "Link failure" fault
activate wib_module #OrangeRed
note over fault_injector
  TBD: Where does the trigger
  for fault injection come from?
end note
wib_module -> wib_module : Process fault,\nand change state if necessary
return #LimeGreen (RespCode.OK, details)

controller -> wib_api : On
activate wib_api #LightSeaGreen
wib_api -> wib_module : On
activate wib_module #PaleTurquoise
note over wib_module
  Do we bother checking the incoming sample rate
  from the MAC here if we know a fault has occurred?
end note
wib_module -> wib_module : Fault has occurred;\ntransition to ENABLED if possible\nbut return an error code w/ details
note over wib_module
  Does a fault actually impact the module's state change?
  Is there any reason it wouldn't change to ENABLED here,
  outside of possibly a transition to FAULT state if the fault is critical?
end note
return #red (RespCode.ERROR, details)
return #red (RespCode.ERROR, details)

controller -> vcc20_api : On
activate vcc20_api #LightSeaGreen
vcc20_api -> vcc20_module : On
activate vcc20_module #PaleTurquoise
vcc20_module -> wib_module : Get data
vcc20_module <-- wib_module : //dataObj//
vcc20_module -> vcc20_module : Check that sample rate > 0
activate vcc20_module #LightPink
return #red //False (Link failure fault//\n//means sample rate is 0)//
vcc20_module -> vcc20_module : Set state ENABLED (?)
return #red (RespCode.ERROR, details)
return #red (RespCode.ERROR, details)

@enduml

Success: Change Sample Rate Between Scans

@startuml EmulatorScenarioSuccessChangeSampleRateBetweenScans
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [Previous scan finished, all modules in READY state]

controller -> wib_api : Configure
activate wib_api #LightSeaGreen
wib_api -> wib_module : Configure
activate wib_module #PaleTurquoise
wib_module -> wib_module : Check if reconfiguration is possible
hnote right of wib_module #SeaGreen
  <color white>Currently in READY state;</color>
  <color white>reconfiguration is acceptable.</color>
end note
activate wib_module #LightPink
return #LimeGreen //True//
wib_module -> wib_module : Reconfigure
activate wib_module #LightPink
wib_module -> wib_module : Set state CONFIGURING
wib_module -> wib_module : Set state READY
return Done
return #LimeGreen (RespCode.OK, details)
return #LimeGreen (RespCode.OK, details)

hnote across : [Now OK to begin next scan]
@enduml

Error: Attempting to Change Sample Rate While Scanning

@startuml EmulatorScenarioErrorChangeSampleRateWhileRunning
participant "Controller" as controller
participant "Fault Injector" as fault_injector
participant "DISH" as dish_module
participant "100GbE MAC API" as mac_api
participant "100GbE MAC Module" as mac_module
participant "WIB API" as wib_api
participant "WIB Module" as wib_module
participant "VCC Ch20 API" as vcc20_api
participant "VCC Ch20 Module" as vcc20_module

hnote across : [Scanning, all modules in ENABLED state]

controller -> wib_api : Configure
activate wib_api #LightSeaGreen
wib_api -> wib_module : Configure
activate wib_module #PaleTurquoise
wib_module -> wib_module : Check if reconfiguration is possible
hnote right of wib_module #OrangeRed
  <color white>Currently in ENABLED state;</color>
  <color white>cannot reconfigure while active.</color>
end note
activate wib_module #LightPink
return #red //False//
return #red (RespCode.ERROR, details)
return #red (RespCode.ERROR, details)
@enduml