SONiC Developement Common Question
====
###### tags: `SONiC`
- [SONiC User Manual](https://github.com/Azure/SONiC/blob/master/doc/SONiC-User-Manual.md)
- [Command line Interface](https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md)
# Database
### 1. Can not find the keys?
Chosse the right database to find the keys.
```bash
redis-cli
127.0.0.1:6379[4]> select 1
# or
redis-cli -n <database index>
```
The database index mapping is in `src/sonic-swss-common/common/schema.h`
```c=
#define APPL_DB 0
#define ASIC_DB 1
#define COUNTERS_DB 2
#define LOGLEVEL_DB 3
#define CONFIG_DB 4
#define PFC_WD_DB 5
#define FLEX_COUNTER_DB 5
#define STATE_DB 6
#define SNMP_OVERLAY_DB 7
#define RESTAPI_DB 8
#define GB_ASIC_DB 9
#define GB_COUNTERS_DB 10
#define GB_FLEX_COUNTER_DB 11
#define CHASSIS_APP_DB 12
#define CHASSIS_STATE_DB 13
```
# Debug Skill
### How to load the GDB debug source code?
Build the sonic with `INSTALL_DEBUG_TOOLS=y make target/sonic-vs.img.gz`
The source code will place at `/src/sonic_src.tar.gz`
Please do the following:
```bash=
tar -zxvf sonic_src.tar.gz -C /debug/
```
Then, you could load the source in the GDB.
# scp or wget not work in the docker:
We could create a temporarily http server.
For example, your file is locate on 10.168.4.2 server.
- Create a http server in your folder:
```
cd sonic-buildimage/target/debs/buster
python3 -m http.server 8000
```
- Open your browser: `http://10.168.4.2:8000/`
and Get the link from web page. `http://10.168.4.2:8000/frr_7.5.1-sonic-0_amd64.deb.log`
Go to your docker:
```
curl -O http://10.168.4.2:8000/frr_7.5.1-sonic-0_amd64.deb.log
```
# Create same branch for all submodule
```bash=
git submodule foreach --recursive git checkout -b 202012.clounix
```
# Common Interface Alias
- LAG Interface (PortChannel)
- Loopback Interface
- Normal Port
- Vlan Interface
# Notation
- rif: Router Interface (Interface with known IP addr)