trafficcontrol icon indicating copy to clipboard operation
trafficcontrol copied to clipboard

Port TO check scripts to Go

Open ARMmaster17 opened this issue 3 years ago • 1 comments

This PR includes all changes from #4010, but has been modified to use the newer V3 API, and with all merge conflicts resolved.

The original PR ported several check scripts from Perl to Go. Key changes from original PR:

This change ports (most) of the legacy perl server checks to go.
- Performance (and logic problems) of the original DSCP check script was the primary motivation - in our environment, the DSCP scan was taking ~20 hours to run, and the results were unreliable.
- ADD support for performing DSCP checks of SSL delivery services, which was previously missing.
- ADD option to FQDN check for validating PTR records
- Other scripts were ported over for sake of consistency.

Closes: #4010


Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Ops
  • Automation (build Docker image for Traffic Ops)

What is the best way to verify this PR?

  • Pull code locally and build the Traffic Ops RPM with ./pkg -b traffic_ops_build. Install Traffic Ops from RPM and verify binaries are present alongside existing Perl scripts in the checks/ directory. OR
  • Manually build using Go v1.17 or later (requires libpcap-devel, libpcap-dev or WinPcap on non-MacOS systems):
# From project root
cd traffic_ops
go mod vendor -v
cd app/bin/checks
go build -v -o ToATSCheck ToATSCheck.go
go build -v -o ToCheck ToCheck.go
go build -v -o ToDSCPCheck ToDSCPCheck.go
go build -v -o ToFQDNCheck ToFQDNCheck.go
go build -v -o ToPingCheck ToPingCheck.go

GitHub Actions is failing on my fork because GHA pulls the build Docker image instead of building from the Dockerfile, so the libpcap-devel dependency is missing when GHA runs.

PR submission checklist

  • [ ] This PR has tests (original PR and existing Perls scripts do not have tests. Suggestions for testing methods are welcome)
  • [x] This PR has documentation
  • [x] This PR has a CHANGELOG.md entry
  • [x] This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

ARMmaster17 avatar Jan 12 '22 16:01 ARMmaster17

In addition to failing checks, there are a lot of warnings being output by the documentation build action on this PR

ocket8888 avatar Jan 12 '22 17:01 ocket8888