1*3b1a8d12SJagpal Singh Gill# Liquid Leak Detection 2*3b1a8d12SJagpal Singh Gill 3*3b1a8d12SJagpal Singh GillAuthor: Jagpal Singh Gill <paligill@gmail.com> 4*3b1a8d12SJagpal Singh Gill 5*3b1a8d12SJagpal Singh GillCreated: July 26, 2024 6*3b1a8d12SJagpal Singh Gill 7*3b1a8d12SJagpal Singh Gill## Problem Description 8*3b1a8d12SJagpal Singh Gill 9*3b1a8d12SJagpal Singh GillLiquid cooling is becoming a promising alternative to traditional air flow 10*3b1a8d12SJagpal Singh Gillcooling for high performance computing in data center environments. However, 11*3b1a8d12SJagpal Singh Gillthis technique presents its own set of challenges, as liquids can be harmful to 12*3b1a8d12SJagpal Singh Gillelectronic components. Therefore, it is crucial for any system that uses liquid 13*3b1a8d12SJagpal Singh Gillcooling to have a mechanism for detecting and reporting leaks so that 14*3b1a8d12SJagpal Singh Gillremediation actions can be taken. Currently, there is no service available in 15*3b1a8d12SJagpal Singh GillopenBMC to handle this task. 16*3b1a8d12SJagpal Singh Gill 17*3b1a8d12SJagpal Singh Gill## Background and References 18*3b1a8d12SJagpal Singh Gill 19*3b1a8d12SJagpal Singh GillIn this document, a leak is considered to be an entity with digital (present or 20*3b1a8d12SJagpal Singh Gillnot-present) value. Currently, openBMC has a framework for sensors, but it is 21*3b1a8d12SJagpal Singh Gillprimarily designed for numerical readings rather than detectors with digital 22*3b1a8d12SJagpal Singh Gillvalues. The 23*3b1a8d12SJagpal Singh Gill[phosphor-gpio-monitor](https://github.com/openbmc/phosphor-gpio-monitor) is too 24*3b1a8d12SJagpal Singh Gillgeneric in its design and does not meet most of the requirements. 25*3b1a8d12SJagpal Singh Gill 26*3b1a8d12SJagpal Singh Gill## Requirements 27*3b1a8d12SJagpal Singh Gill 28*3b1a8d12SJagpal Singh Gill1. Able to identify leak presence for GPIO-based detectors and generate 29*3b1a8d12SJagpal Singh Gill corresponding redfish events. 30*3b1a8d12SJagpal Singh Gill2. Able to classify leaks events according to their severity levels based on 31*3b1a8d12SJagpal Singh Gill certain attributes. 32*3b1a8d12SJagpal Singh Gill - For example, the physical location of detectors can be used to determine 33*3b1a8d12SJagpal Singh Gill the severity level of a leak. A leak may be considered minor if it is 34*3b1a8d12SJagpal Singh Gill contained within a tray, but its severity level increases as it spreads 35*3b1a8d12SJagpal Singh Gill into a drip pan. 36*3b1a8d12SJagpal Singh Gill3. Capable of performing actions based on leak classification, which can be 37*3b1a8d12SJagpal Singh Gill optionally delegated to another component. 38*3b1a8d12SJagpal Singh Gill4. Capable of generating a D-Bus interface that adheres to 39*3b1a8d12SJagpal Singh Gill [Redfish Leak Detection](https://redfish.dmtf.org/schemas/v1/LeakDetection.v1_0_1.json) 40*3b1a8d12SJagpal Singh Gill standards, allowing for the exposure of leak detection status to clients. 41*3b1a8d12SJagpal Singh Gill 42*3b1a8d12SJagpal Singh Gill## Proposed Design 43*3b1a8d12SJagpal Singh Gill 44*3b1a8d12SJagpal Singh Gill### Dbus interfaces 45*3b1a8d12SJagpal Singh Gill 46*3b1a8d12SJagpal Singh GillThe DBus Interface for leak detection will consist of following - 47*3b1a8d12SJagpal Singh Gill 48*3b1a8d12SJagpal Singh Gill| Interface Name | New/Existing | Purpose/Updates | 49*3b1a8d12SJagpal Singh Gill| :------------------------------------------- | :----------: | :----------------------------: | 50*3b1a8d12SJagpal Singh Gill| xyz.openbmc_project.State.Leak.DetectorGroup | New | Implements Leak Detector Group | 51*3b1a8d12SJagpal Singh Gill| xyz.openbmc_project.State.Leak.Detector | New | Implements Leak Detector | 52*3b1a8d12SJagpal Singh Gill 53*3b1a8d12SJagpal Singh GillRefer to 54*3b1a8d12SJagpal Singh Gill[patch](https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/73151) 55*3b1a8d12SJagpal Singh Gillfor related D-Bus changes. 56*3b1a8d12SJagpal Singh Gill 57*3b1a8d12SJagpal Singh Gill### BMCWeb 58*3b1a8d12SJagpal Singh Gill 59*3b1a8d12SJagpal Singh GillThis design involves implementing following Redfish schemas and associated 60*3b1a8d12SJagpal Singh Gillproperties in BMCWeb. 61*3b1a8d12SJagpal Singh Gill 62*3b1a8d12SJagpal Singh Gill| Redfish Schema | Properties | 63*3b1a8d12SJagpal Singh Gill| :--------------: | :---------------------------------------------------------------------: | 64*3b1a8d12SJagpal Singh Gill| ThermalSubsystem | LeakDetection | 65*3b1a8d12SJagpal Singh Gill| LeakDetection | Name, Status, LeakDetectors, LeakDetectorGroups | 66*3b1a8d12SJagpal Singh Gill| | LeakDetectorGroup: GroupName, Detectors, Detectors\@odata.count, Status | 67*3b1a8d12SJagpal Singh Gill| LeakDetector | Name, DetectorState, Status | 68*3b1a8d12SJagpal Singh Gill 69*3b1a8d12SJagpal Singh GillNOTE: The ThermalSubsystem is required because it contains the LeakDetection 70*3b1a8d12SJagpal Singh Gillendpoint. 71*3b1a8d12SJagpal Singh Gill 72*3b1a8d12SJagpal Singh Gill### Liquid Leak Detector 73*3b1a8d12SJagpal Singh Gill 74*3b1a8d12SJagpal Singh Gill```mermaid 75*3b1a8d12SJagpal Singh Gill--- 76*3b1a8d12SJagpal Singh Gillconfig: 77*3b1a8d12SJagpal Singh Gill layout: fixed 78*3b1a8d12SJagpal Singh Gill--- 79*3b1a8d12SJagpal Singh Gillflowchart LR 80*3b1a8d12SJagpal Singh Gill A["EntityManager"] -- Detector Configuration 81*3b1a8d12SJagpal Singh Gill(via D-Bus) --> B["Leak Detection Manager"] 82*3b1a8d12SJagpal Singh Gill B -- Creates --> C["Leak Detector Group"] & F["Leak Detectors"] 83*3b1a8d12SJagpal Singh Gill C -- Creates Interface --> E["xyz.openbmc_project.State.Leak.DetectorGroup at /xyz/openbmc_project/state/leak/detectorgroup/<GroupX>"] 84*3b1a8d12SJagpal Singh Gill F -- Creates Interface --> G["xyz.openbmc_project.State.Leak.Detector at /xyz/openbmc_project/state/leak/detector/<DetectorY>"] 85*3b1a8d12SJagpal Singh Gill C -. contains .- F 86*3b1a8d12SJagpal Singh Gill F@{ shape: procs} 87*3b1a8d12SJagpal Singh Gill``` 88*3b1a8d12SJagpal Singh Gill 89*3b1a8d12SJagpal Singh Gill#### Entity Manager Configuration 90*3b1a8d12SJagpal Singh Gill 91*3b1a8d12SJagpal Singh Gill##### Json Schema 92*3b1a8d12SJagpal Singh Gill 93*3b1a8d12SJagpal Singh GillFor information on the configuration schema for leak detectors, please 94*3b1a8d12SJagpal Singh Gill[refer](https://gerrit.openbmc.org/c/openbmc/entity-manager/+/75734). 95*3b1a8d12SJagpal Singh Gill 96*3b1a8d12SJagpal Singh Gill##### Configuration Example 97*3b1a8d12SJagpal Singh Gill 98*3b1a8d12SJagpal Singh GillAn example of entity manager configuration for leak detector is as under - 99*3b1a8d12SJagpal Singh Gill 100*3b1a8d12SJagpal Singh Gill```json 101*3b1a8d12SJagpal Singh Gill"Exposes": [ 102*3b1a8d12SJagpal Singh Gill... 103*3b1a8d12SJagpal Singh Gill { 104*3b1a8d12SJagpal Singh Gill "Type": "GPIOLeakDetector", 105*3b1a8d12SJagpal Singh Gill "Name": "ManifoldFrontDetector", 106*3b1a8d12SJagpal Singh Gill "SubType": "LeakSensingCable", 107*3b1a8d12SJagpal Singh Gill "PinName": "DETECTOR1_GPIO", 108*3b1a8d12SJagpal Singh Gill "Polarity": "ActiveLow", 109*3b1a8d12SJagpal Singh Gill "Level": "Critical" 110*3b1a8d12SJagpal Singh Gill} 111*3b1a8d12SJagpal Singh Gill... 112*3b1a8d12SJagpal Singh Gill] 113*3b1a8d12SJagpal Singh Gill``` 114*3b1a8d12SJagpal Singh Gill 115*3b1a8d12SJagpal Singh Gill#### LeakDetection Manager 116*3b1a8d12SJagpal Singh Gill 117*3b1a8d12SJagpal Singh GillThe LeakDetection Manager is responsible for processing input configuration 118*3b1a8d12SJagpal Singh Gillobjects from the Entity Manager via DBus. Based on related interface signals, it 119*3b1a8d12SJagpal Singh Gillcreates or deletes the corresponding detector and detector group D-Bus 120*3b1a8d12SJagpal Singh Gillinterfaces. Additionally, it monitors detector GPIO events and triggers systemd 121*3b1a8d12SJagpal Singh Gilltargets based on the leak level if a leak is detected. It also raises or 122*3b1a8d12SJagpal Singh Gillresolves the appropriate leak-related alerts. This fulfills requirements# 1 123*3b1a8d12SJagpal Singh Gilland 3. 124*3b1a8d12SJagpal Singh Gill 125*3b1a8d12SJagpal Singh Gill### Error Reporting 126*3b1a8d12SJagpal Singh Gill 127*3b1a8d12SJagpal Singh GillA 128*3b1a8d12SJagpal Singh Gill[leak detection](https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/73707) 129*3b1a8d12SJagpal Singh Gilldefinition is proposed for events through Redfish based on 130*3b1a8d12SJagpal Singh Gill[event logging design](https://github.com/openbmc/docs/blob/master/designs/event-logging.md). 131*3b1a8d12SJagpal Singh Gill 132*3b1a8d12SJagpal Singh Gill#### Leak Severity 133*3b1a8d12SJagpal Singh Gill 134*3b1a8d12SJagpal Singh GillThe entity manager configuration specifies the severity level for a leak 135*3b1a8d12SJagpal Singh Gilldetector. When the corresponding detector detects a leak, the LeakDetection 136*3b1a8d12SJagpal Singh GillManager generates an event message with the appropriate severity level as 137*3b1a8d12SJagpal Singh Gilldefined in the configuration. This fulfills requirement# 2. 138*3b1a8d12SJagpal Singh Gill 139*3b1a8d12SJagpal Singh Gill## Alternatives Considered 140*3b1a8d12SJagpal Singh Gill 141*3b1a8d12SJagpal Singh Gill### phosphor-gpio-monitor 142*3b1a8d12SJagpal Singh Gill 143*3b1a8d12SJagpal Singh GillThe current design of the phosphor-gpio-monitor is too generic and does not meet 144*3b1a8d12SJagpal Singh Gillmost of the requirements, particularly Requirement #2 and #4. Any changes to the 145*3b1a8d12SJagpal Singh Gillphosphor-gpio-monitor to add these requirements would result in a monolithic 146*3b1a8d12SJagpal Singh Gilldaemon that would need to be extended for every other such feature. Currently, 147*3b1a8d12SJagpal Singh Gillthe phosphor-gpio-monitor performs generic tasks in a simple manner and does so 148*3b1a8d12SJagpal Singh Gilleffectively, so it's better suited for that. 149*3b1a8d12SJagpal Singh Gill 150*3b1a8d12SJagpal Singh Gill## Impacts 151*3b1a8d12SJagpal Singh Gill 152*3b1a8d12SJagpal Singh Gill### API Impacts 153*3b1a8d12SJagpal Singh Gill 154*3b1a8d12SJagpal Singh Gill- A new D-Bus interface for leak detection is being proposed as part of this 155*3b1a8d12SJagpal Singh Gill design. This would require implementation in the BMCWeb. 156*3b1a8d12SJagpal Singh Gill 157*3b1a8d12SJagpal Singh Gill### Performance Impacts 158*3b1a8d12SJagpal Singh Gill 159*3b1a8d12SJagpal Singh GillThe design may cause a minor reduction in system performance due to the need for 160*3b1a8d12SJagpal Singh Gillprocessing leak detector GPIO events, but the impact is negligible. 161*3b1a8d12SJagpal Singh Gill 162*3b1a8d12SJagpal Singh Gill### Organizational 163*3b1a8d12SJagpal Singh Gill 164*3b1a8d12SJagpal Singh Gill- Does this repository require a new repository? No. 165*3b1a8d12SJagpal Singh Gill- Who will be the initial maintainer(s) of this repository? NA 166*3b1a8d12SJagpal Singh Gill- Which repositories are expected to be modified to execute this design? BMCWeb, 167*3b1a8d12SJagpal Singh Gill dbus-sensors, phosphor-dbus-interfaces 168*3b1a8d12SJagpal Singh Gill- Make a list, and add listed repository maintainers to the gerrit review. 169*3b1a8d12SJagpal Singh Gill 170*3b1a8d12SJagpal Singh Gill## Testing 171*3b1a8d12SJagpal Singh Gill 172*3b1a8d12SJagpal Singh Gill### Unit Testing 173*3b1a8d12SJagpal Singh Gill 174*3b1a8d12SJagpal Singh GillAll the functional testing of the reference implementation will be performed 175*3b1a8d12SJagpal Singh Gillusing GTest. 176*3b1a8d12SJagpal Singh Gill 177*3b1a8d12SJagpal Singh Gill### Integration Testing 178*3b1a8d12SJagpal Singh Gill 179*3b1a8d12SJagpal Singh GillIntegration testing for generating Redfish events will be conducted using the 180*3b1a8d12SJagpal Singh GillGPIO sim tool to simulate leak detection GPIOs, which can be triggered as 181*3b1a8d12SJagpal Singh Gillneeded. 182