Skip to content

open-traffic-generator/otg-diagnostics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OTG Diagnostics Collection

Automation to provide users a easiest way to collect different essential OTG and System information to debug any failures.

otg-diag

Dependencies

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

Supported Operating System

  • Ubuntu
  • Debian

Supported OTG platforms

  • KNE
  • OTG-HW
  • UHD400

Usage

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
```

KNE Topology

```bash
# collect logs for kne topology
./diag.sh -m kne -t <kne-topology-file-path>
```

Docker-compose Topology [For Both UHD400 & OTG-HW]

```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>
``` 

Using Custom GO Binary [This is optional, only needed if default go path is not desired to be used]

  GO_BIN_PATH=/usr/local/go/bin ./diag.sh -m docker -t <docker-compose-topology-file-path>

Creds File must be of specific structure as follow:

- `creds.yaml`

  ```yml
    ixhw:
      chassis:
        <ip/hostname>:
          username: ...
          password: ...
    uhd400:
      chassis:
        <ip/hostname>:
          username: ...
          password: ...
      server:
        <ip/hostname>:
          username: ...
          password: ...
  ```

OTG Configs Archival

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 gosnappi config in json format from the *.pb/pbtxt file.

    • *.pb
          data, _ := 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)
    • *.pbtxt
          data, _ := 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)

About

Automation to provide users a easiest way to collect different essential OTG and System information to debug any failures.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages