Automation to provide users a easiest way to collect different essential OTG and System information to debug any failures.
This script has dependencies on the following components:
- Go (>=1.23)
- sshpass
- Go yq (by Mike Farah), not Python yq.
- It will be automatically installed by the script or you can install it manually.
go install github.com/mikefarah/yq/v4@latest
- It will be automatically installed by the script or you can install it manually.
- Ubuntu
- Debian
- KNE
- OTG-HW
- UHD400
Get the entire repository and make it a working directory. All the temporary files created inside this directory.
```bash
git clone --recurse-submodule https://github.com/open-traffic-generator/otg-diagnostics.git
cd otg-diagnostics
chmod u+x ./diag.sh
```
```bash
# collect logs for kne topology
./diag.sh -m kne -t <kne-topology-file-path>
```
```bash
# collect logs from containers specified in docker-compose topology file. examples: keng-controller and otg-gnmi-server
./diag.sh -m docker -t <docker-compose-topology-file-path>
# collect logs from containers specified in docker-compose topology file and project name. examples: keng-controller and otg-gnmi-server
./diag.sh -m docker -t <docker-compose-topology-file-path> -p <project-name> # project-name is optional
# collect all logs from containers and chassis.
./diag.sh -m docker -t <docker-compose-topology-file-path> -b <binding-file-path> -c <cred-file-path>
```
GO_BIN_PATH=/usr/local/go/bin ./diag.sh -m docker -t <docker-compose-topology-file-path>- `creds.yaml`
```yml
ixhw:
chassis:
<ip/hostname>:
username: ...
password: ...
uhd400:
chassis:
<ip/hostname>:
username: ...
password: ...
server:
<ip/hostname>:
username: ...
password: ...
```
Keng-Controller has the facility to store last 10 OTG configurations in logs/configs so that user can easily reproduce and debug any issues that causing tests failure.
-
Configs are stored in compressed format (*.tar.gz)
-
Use the following command to extract.
tar -xvzf Set_Config_11_4th_JAN_02_15_27PM_UTC.08265_pb.tar.gz
-
Uncompressed configs can be in the following formats
- pb
- pbtxt (if streaming enabled)
-
Use the following go snippets to retrieve back the
gosnappiconfig injsonformat from the*.pb/pbtxtfile.*.pbdata, _ := os.ReadFile("Set_Config_11_4th_JAN_02_15_27PM_UTC.08265.pb") pb := otg.Config{} proto.Unmarshal(data, &pb) otgCfg := gosnappi.NewConfig() otgCfg, _ = otgCfg.Unmarshal().FromProto(&pb) jsonCfg, _ := otgCfg.Marshal().ToJson() os.WriteFile("config.json", []byte(jsonCfg), 0644)
*.pbtxtdata, _ := os.ReadFile("Set_Config_11_4th_JAN_02_15_27PM_UTC.08265.pbtxt") otgCfg := gosnappi.NewConfig() otgCfg.Unmarshal().FromPbText(string(data)) jsonCfg, _ := otgCfg.Marshal().ToJson() os.WriteFile("config.json", []byte(jsonCfg), 0644)
