You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/01/12 16:55:29 UTC

[GitHub] [trafficcontrol] ARMmaster17 opened a new pull request #6510: Port TO check scripts to Go

ARMmaster17 opened a new pull request #6510:
URL: https://github.com/apache/trafficcontrol/pull/6510


   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
   
   <hr/>
   
   ## 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](https://apache.org/security) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #6510: Port TO check scripts to Go

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #6510:
URL: https://github.com/apache/trafficcontrol/pull/6510#discussion_r784218795



##########
File path: traffic_ops/app/bin/checks/ToPingCheck.go
##########
@@ -0,0 +1,363 @@
+/*
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+/* ToPingCheck.go
+   Used for checking ILO ping,  MTU test, 10G (IPv4), and 10G6 (IPv6) pings.
+*/
+
+package main
+
+import (
+	"encoding/json"
+	"flag"
+	"log"
+	"log/syslog"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"regexp"
+	"strconv"
+	"strings"
+	"time"
+
+	tc "github.com/apache/trafficcontrol/lib/go-tc"
+	toclient "github.com/apache/trafficcontrol/traffic_ops/v3-client"
+	"github.com/romana/rlog"

Review comment:
       [`github.com/apache/trafficcontrol/lib/go-log`](https://pkg.go.dev/github.com/apache/trafficcontrol/lib/go-log) is preferred for logging

##########
File path: traffic_ops/app/bin/checks/ToCheck.go
##########
@@ -0,0 +1,126 @@
+/*
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+/* ToCheck.go
+   This is a simple app that allows you to submit arbitrary
+   check data to the Traffic Ops API. You need to supply check
+   name, server ID for the check, and the check value as an
+   integer. Useful for testing.
+*/
+
+package main
+
+import (
+	"encoding/json"
+	"flag"
+	"fmt"
+	"os"
+	"path/filepath"
+	"strings"
+	"time"
+
+	tc "github.com/apache/trafficcontrol/lib/go-tc"
+	toclient "github.com/apache/trafficcontrol/traffic_ops/v3-client"
+	"github.com/romana/rlog"

Review comment:
       Is there anything special about `github.com/romana/rlog`? Any reason not to use [`github.com/apache/trafficcontrol/lib/go-log`](https://pkg.go.dev/github.com/apache/trafficcontrol/lib/go-log) for logging?

##########
File path: traffic_ops/app/bin/checks/ToFQDNCheck.go
##########
@@ -0,0 +1,350 @@
+/*
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+
+/* ToFQDNCheck.go
+   This app verifies that forward DNS (A/AAAA) records match what is
+   recorded in TODB for each server. Optionally, it will validate
+   reverse (PTR) records as well to ensure that they agree with
+   forward DNS.
+*/
+
+package main
+
+import (
+	"context"
+	"encoding/json"
+	"flag"
+	"log"
+	"log/syslog"
+	"net"
+	"os"
+	"path/filepath"
+	"regexp"
+	"strings"
+	"time"
+
+	tc "github.com/apache/trafficcontrol/lib/go-tc"
+	toclient "github.com/apache/trafficcontrol/traffic_ops/v3-client"
+	"github.com/romana/rlog"

Review comment:
       [`github.com/apache/trafficcontrol/lib/go-log`](https://pkg.go.dev/github.com/apache/trafficcontrol/lib/go-log) should be used for logging




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on pull request #6510: Port TO check scripts to Go

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on pull request #6510:
URL: https://github.com/apache/trafficcontrol/pull/6510#issuecomment-1011267613


   In addition to failing checks, there are a lot of warnings being output by [the documentation build action on this PR](https://github.com/apache/trafficcontrol/runs/4792555847?check_suite_focus=true)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org