|
| 1 | +# Serial-console global config HLD |
| 2 | +## <a name='TableofContent'></a>Table of Content |
| 3 | +- [Serial-console config HLD](#serial-console-global-config-hld) |
| 4 | +- [Table of Content](#table-of-content) |
| 5 | +- [Revision](#revision) |
| 6 | +- [1. Introduction](#11-introduction) |
| 7 | +- [1.1. Scope](#11-scope) |
| 8 | +- [1.2. Definitions/Abbreviations](#12-definitionsabbreviations) |
| 9 | +- [1.3. Overview](#13-overview) |
| 10 | +- [1.4. Requirements](#14-requirements) |
| 11 | +- [2. Architecture Design](#2-architecture-design) |
| 12 | + - [2.1. Configuration modules](#21-configuration-modules) |
| 13 | +- [3. High-Level Design](#3-high-level-design) |
| 14 | + - [Flow diagram](#flow-diagram) |
| 15 | + - [3.1 Flow description](#31-flow-description) |
| 16 | + - [3.2 serial-console configurations](#32-serial-console-configurations) |
| 17 | +- [4. Init flow](#4-init-flow) |
| 18 | + - [4.1. Feature Default](#41-feature-default) |
| 19 | +- [5. SAI api](#19-sai-api) |
| 20 | +- [6. Configuration and management](#6-configuration-and-management) |
| 21 | + - [6.1. SERIAL_CONNECTION configDB table](#61-serial-connection-configdb-table) |
| 22 | + - [6.2. ConfigDB schemas](#62-configdb-schemas) |
| 23 | + - [6.3. CLI/YANG model Enhancements](#63-cliyang-model-enhancements) |
| 24 | + - [6.4. Config DB Enhancements](#64-config-db-enhancements) |
| 25 | + - [6.5. Manifest (if the feature is an Application Extension)](#65-manifest-if-the-feature-is-an-application-extension) |
| 26 | +- [7. Warmboot and Fastboot Design Impact](#7-warmboot-and-fastboot-design-impact) |
| 27 | +- [8. Restrictions/Limitations](#8-restrictionslimitations) |
| 28 | +- [9. Testing Requirements/Design](#9-testing-requirementsdesign) |
| 29 | + - [9.1. Unit Test cases](#91-unit-test-cases) |
| 30 | + - [9.2. System Test cases](#92-system-test-cases) |
| 31 | +- [10. Open/Action items - if any](#10-openaction-items---if-any) |
| 32 | +### <a name='Revision'></a>Revision |
| 33 | + |
| 34 | +| Rev | Date | Author | Change Description | |
| 35 | +| :---: | :------: | :--------: | ------------------ | |
| 36 | +| 0.1 | 16/06/23 | Ivan Davydenko | Initial version | |
| 37 | + |
| 38 | +## 1 <a name='Introduction'></a>Introduction |
| 39 | + |
| 40 | +### 1.1. <a name='Scope'></a>Scope |
| 41 | + |
| 42 | +This hld doc for serial cli global configurations describes the requirements, architecture and general flow details of serial connection config in SONIC OS based switches. |
| 43 | + |
| 44 | +### 1.2. <a name='DefinitionsAbbreviations'></a>Definitions/Abbreviations |
| 45 | + |
| 46 | + serial - secure shell |
| 47 | + TCP - Transmission Control protocol |
| 48 | + |
| 49 | +### 1.3. <a name='Overview'></a>Overview |
| 50 | + |
| 51 | +We want to allow configuring serial console global settings. This will feature will include two configurations on first phase. |
| 52 | + |
| 53 | +### 1.4. <a name='Requirements'></a>Requirements |
| 54 | + |
| 55 | +This feature requires a dedicated table in the configuration DB, enhancements of hostcfg demon and separate service that updates configutaion files. In order to update the serial-console configurations, we need to have write access in /etc/profile.d/, /proc/sys/kernel/sysrq and /etc/sysctl.d/95-sysrq-sysctl.conf. |
| 56 | + |
| 57 | +## 2. <a name='ArchitectureDesign'></a>Architecture Design |
| 58 | +### 2.1. <a name='ConfigModules'></a>Configuration modules |
| 59 | + |
| 60 | + |
| 61 | +We want to enhance configDB to include table for serial-console global configurations. In addition, serial_console.service will be added to modify configuration files. |
| 62 | + |
| 63 | +## 3. <a name='High-LevelDesign'></a>High-Level Design |
| 64 | + |
| 65 | +We want to enable serial-console configuration in SONIC. In order to do so will touch few areas in the system: |
| 66 | +1. configDB - to include a dedicated table for configurations |
| 67 | +2. hostcfg demon - to trigger dedicated service on config apply. |
| 68 | +3. OS config files - specific for this stage we are only /etc/profile.d/serial_tmout.sh and /etc/sysctl.d/95-sysctl.d/95-sysrq-sysctl.conf and /proc/sys/kernel/sysrq are going to be modifed by the service-script. |
| 69 | + |
| 70 | +##### Flow diagram |
| 71 | + |
| 72 | +### 3.1 <a name='Flow description'></a>Flow description |
| 73 | +When the feature is enabled, by modifying the DB manually, user will set serial-console configurations by modifing CONFIG_DB in SERIAL_CONSOLE table. |
| 74 | + |
| 75 | +The hostcfgd daemon will be extended to listen to confogurations from SERIAL_CONSOLE table and restarts the serial_console.service. Serial console script will read SERIAL_CONSOLE table and update config files accordingly. |
| 76 | + |
| 77 | + |
| 78 | +### 3.2 <a name='serial-console configurations'></a>serial-console configurations |
| 79 | + |
| 80 | +We want to enable configuring the following attributes: |
| 81 | +| Policy | Action | Param values | Default | |
| 82 | +|--------------------|-----------------------------------------------------------------------|---------------------|--------------| |
| 83 | +| auto logout | Inactivity timeout for serial-console session | 0-35000 (min) | 15 | |
| 84 | +| sysrq capabilities | Enabling or disabling SysRq functionality for serial-consoles | enabled/disabled | disabled | |
| 85 | + |
| 86 | + |
| 87 | +## 4. <a name='Init flow'></a>Init flow |
| 88 | + |
| 89 | +During init flow we will set default configurations as mentioned in the table abowe. Default values will be added to init_cfg.json.j2 . |
| 90 | +### 4.1. <a name='FeatureDefault'></a>Feature Default |
| 91 | + |
| 92 | +Description of default values in init_cfg.json regarding serial-console config: |
| 93 | +``` |
| 94 | +auto logout: 15 //minutes |
| 95 | +sysrq capabilities: disabled |
| 96 | +``` |
| 97 | +## 5. <a name='SAI api'></a>SAI api |
| 98 | +NA |
| 99 | +## 6. <a name='Configurationandmanagement'></a>Configuration and management |
| 100 | + |
| 101 | +### 6.1. <a name='SERIAL_CONSOLEconfigDBtable'></a>SERIAL_CONSOLE configDB table |
| 102 | + |
| 103 | +``` |
| 104 | +SERIAL_CONSOLE:{ |
| 105 | + "auto_logout": {{min}} |
| 106 | + "sysrq-capabilities": {{enabled|disabled}} |
| 107 | +} |
| 108 | +``` |
| 109 | +### 6.2. ConfigDB schemas |
| 110 | +``` |
| 111 | +; Defines schema for SERIAL_CONSOLE configuration attributes in SERIAL_CONSOLE table: |
| 112 | +auto_logout = 5*DIGIT ; autologout timer - max is 35000 minutes |
| 113 | +max_syslogins = "enabled/disabled" ; enabling or disabling sysrq capabilities in linux, default is disabled. |
| 114 | +``` |
| 115 | + |
| 116 | +### 6.3. <a name='CLIYANGmodelEnhancements'></a>CLI/YANG model Enhancements |
| 117 | +```yang |
| 118 | +//filename: sonic-serial-console.yang |
| 119 | +module sonic-serial-console { |
| 120 | +
|
| 121 | + yang-version 1.1; |
| 122 | +
|
| 123 | + namespace "http://github.com/Azure/sonic-serial-console"; |
| 124 | + prefix cli-sessions; |
| 125 | +
|
| 126 | + description "SERIAL_CONSOLE YANG Module for SONiC-based OS"; |
| 127 | +
|
| 128 | + revision 2023-06-07 { |
| 129 | + description "First Revision"; |
| 130 | + } |
| 131 | +
|
| 132 | + container sonic-serial-console { |
| 133 | +
|
| 134 | + container SERIAL_CONSOLE { |
| 135 | +
|
| 136 | + description "SERIAL_CONSOLE part of config_db.json"; |
| 137 | +
|
| 138 | + key "name"; |
| 139 | +
|
| 140 | + leaf auto_logout { |
| 141 | + description "serial-console auto-logout timer value in minutes"; |
| 142 | + type int32 { |
| 143 | + range "0..15000"; |
| 144 | + } |
| 145 | + default 15; |
| 146 | + } |
| 147 | +
|
| 148 | + leaf sysrq_capabilities { |
| 149 | + description "managing SysRq capabilities"; |
| 150 | + type enumeration { |
| 151 | + enum disabled; |
| 152 | + enum enabled; |
| 153 | + } |
| 154 | + default disabled; |
| 155 | + } |
| 156 | + } |
| 157 | + /* end of container SERIAL_CONSOLE */ |
| 158 | + } |
| 159 | + /* end of top level container */ |
| 160 | +} |
| 161 | +/* end of module sonic-serial-console */ |
| 162 | +
|
| 163 | +``` |
| 164 | +### 6.4. <a name='ConfigDBEnhancements'></a>Config DB Enhancements |
| 165 | + |
| 166 | +The ConfigDB will be extended with next objects: |
| 167 | + |
| 168 | +```json |
| 169 | +{ |
| 170 | + "SERIAL_CONSOLE": { |
| 171 | + "auto_logout": "15", |
| 172 | + "sysrq_capabilities": "disabled", |
| 173 | + } |
| 174 | +} |
| 175 | +``` |
| 176 | + |
| 177 | +### 6.5. <a name='ManifestifthefeatureisanApplicationExtension'></a>Manifest (if the feature is an Application Extension) |
| 178 | + |
| 179 | + |
| 180 | +NA |
| 181 | + |
| 182 | + |
| 183 | +## 7. <a name='WarmbootandFastbootDesignImpact'></a>Warmboot and Fastboot Design Impact |
| 184 | +NA |
| 185 | + |
| 186 | +## 8. <a name='RestrictionsLimitations'></a>Restrictions/Limitations |
| 187 | + |
| 188 | +## 9. <a name='TestingRequirementsDesign'></a>Testing Requirements/Design |
| 189 | +Explain what kind of unit testing, system testing, regression testing, warmboot/fastboot testing, etc., |
| 190 | +Ensure that the existing warmboot/fastboot requirements are met. For example, if the current warmboot feature expects maximum of 1 second or zero second data disruption, the same should be met even after the new feature/enhancement is implemented. Explain the same here. |
| 191 | +Example sub-sections for unit test cases and system test cases are given below. |
| 192 | + |
| 193 | +### 9.1. <a name='UnitTestcases'></a>Unit Test cases |
| 194 | +Configuration |
| 195 | +1. Configure auto-logout for serial-console. |
| 196 | +1.1. Configure and apply non-default auto-logout value (1-2 min.) |
| 197 | +1.2. Connect and login via serial-console. Validate auto-logout happend in configured time (1-2 min.) |
| 198 | +2. Init flow for auto-logout. |
| 199 | +2.1. Don`t save previous auto-logout configuration and reboot the switch. |
| 200 | +2.2. After boot connect and login via serial-console. Validate that auto-logout didn`t happend in previously configured time (1-2 min.) |
| 201 | +3. Configure sysrq parameter. |
| 202 | +3.1. Configure and apply non-default sysrq-capabilities parameter (enabled) |
| 203 | +3.2. Check sysrq parameter value in linux proc filesystem being changed to new applied value of "1: |
| 204 | +4. Init flow for sysrq parameter. |
| 205 | +4.1. Don`t save previous sysrq configuration and reboot the switch. |
| 206 | +4.2. Check sysrq parameter value in linux proc filesystem being equal to default value of "0". |
| 207 | + |
| 208 | + |
| 209 | +### 9.2. <a name='SystemTestcases'></a>System Test cases |
| 210 | + |
| 211 | +## 10. <a name='OpenActionitems-ifany'></a>Open/Action items - if any |
| 212 | + |
| 213 | + |
| 214 | +NOTE: All the sections and sub-sections given above are mandatory in the design document. Users can add additional sections/sub-sections if required. |
0 commit comments