You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2022/11/03 19:56:21 UTC

[trafficcontrol] branch 6.1.x updated (2301e274b4 -> 77b7c8109e)

This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a change to branch 6.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


 discard 2301e274b4 Update TR to use TO API v3.1 by default (#6778)
 discard 84c3cf16b3 Update Traffic Stats to use TO API v3 (#6844)
     new 7f658f116a Update Traffic Stats to use TO API v3 (#6844)
     new 77b7c8109e Update TR to use TO API v3.1 by default (#6778)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (2301e274b4)
            \
             N -- N -- N   refs/heads/6.1.x (77b7c8109e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[trafficcontrol] 02/02: Update TR to use TO API v3.1 by default (#6778)

Posted by zr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a commit to branch 6.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 77b7c8109e47184261fff862fcc80a0394e97bb1
Author: Rawlin Peters <ra...@apache.org>
AuthorDate: Mon May 2 10:52:50 2022 -0600

    Update TR to use TO API v3.1 by default (#6778)
    
    * Update TR to use TO API v3.1 by default
    
    Closes: #6653
    
    * Please weasel
    
    * Make weasel check non-TO-API-specific
    
    (cherry picked from commit 5de5ff844dabffa9be1ec0319e2c39481e9dab3c)
---
 .dependency_license                                            |  6 +++---
 CHANGELOG.md                                                   |  1 +
 .../traffic_router/core/dns/SignatureManager.java              |  2 +-
 .../traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java |  3 ++-
 .../traffic_router/core/ds/SteeringWatcher.java                |  3 ++-
 .../traffic_router/core/loc/FederationsWatcher.java            |  3 ++-
 .../traffic_router/core/secure/CertificatesClient.java         |  2 +-
 .../traffic_router/core/util/TrafficOpsUtils.java              |  4 +++-
 .../traffic_router/core/external/ConsistentHashTest.java       |  3 ++-
 .../traffic_router/core/external/HttpDataServer.java           | 10 +++++-----
 .../traffic_router/core/external/RouterTest.java               |  3 ++-
 .../traffic_router/core/external/SteeringTest.java             |  5 +++--
 .../test/resources/api/{2.0 => 3.1}/cdns/name/thecdn/sslkeys   |  0
 .../api/{2.0 => 3.1}/cdns/name/thecdn/sslkeys-missing-1        |  0
 .../core/src/test/resources/api/{2.0 => 3.1}/federations/all   |  0
 .../core/src/test/resources/api/{2.0 => 3.1}/steering          |  0
 .../core/src/test/resources/api/{2.0 => 3.1}/steering2         |  0
 traffic_router/core/src/test/resources/publish/CrConfig.json   | 10 +++++-----
 traffic_router/core/src/test/resources/publish/CrConfig2.json  | 10 +++++-----
 traffic_router/core/src/test/resources/publish/CrConfig3.json  | 10 +++++-----
 traffic_router/core/src/test/resources/publish/CrConfig4.json  | 10 +++++-----
 21 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/.dependency_license b/.dependency_license
index bdf745009a..14ab604ed5 100644
--- a/.dependency_license
+++ b/.dependency_license
@@ -50,9 +50,9 @@ traffic_ops/app/db/trafficvault/test/.*\.key$, Apache-2.0 # test AES key files
 traffic_ops/app/db/trafficvault/test/data/.*\.dat$, Apache-2.0 # test data files
 ^traffic_ops/experimental/goto/testFiles/, Apache-2.0
 \.pem$, Apache-2.0 # Single certificate file.
-traffic_router/core/src/test/resources/api/2.0/cdns/name/thecdn/sslkeys(-missing-1)?, Apache-2.0 #JSON files with no extension
-traffic_router/core/src/test/resources/api/2.0/steering*, Apache-2.0
-traffic_router/core/src/test/resources/api/2.0/federations/all, Apache-2.0
+traffic_router/core/src/test/resources/api/.*/cdns/name/thecdn/sslkeys(-missing-1)?, Apache-2.0 #JSON files with no extension
+traffic_router/core/src/test/resources/api/.*/steering*, Apache-2.0
+traffic_router/core/src/test/resources/api/.*/federations/all, Apache-2.0
 BUILD_NUMBER$, Apache-2.0
 
 # Images, created for this project or used under an Apache license.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24261624c3..e4ac7a66ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - Added Rocky Linux 8 support
 - Updated Apache Tomcat from 9.0.43 to 9.0.67
 - [#6694](https://github.com/apache/trafficcontrol/issues/6694) Traffic Stats now uses the TO API 3.0
+- Changed the default Traffic Ops API version requsted by Traffic Router from 2.0 to 3.1
 
 ## [6.1.0] - 2022-01-18
 ### Added
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/SignatureManager.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/SignatureManager.java
index 99e92daa72..803f38226b 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/SignatureManager.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/dns/SignatureManager.java
@@ -272,7 +272,7 @@ public final class SignatureManager {
 		final ObjectMapper mapper = new ObjectMapper();
 
 		try {
-			final String keyUrl = trafficOpsUtils.getUrl("keystore.api.url", "https://${toHostname}/api/2.0/cdns/name/${cdnName}/dnsseckeys");
+			final String keyUrl = trafficOpsUtils.getUrl("keystore.api.url", "https://${toHostname}/api/"+TrafficOpsUtils.TO_API_VERSION+"/cdns/name/${cdnName}/dnsseckeys");
 			final JsonNode config = cacheRegister.getConfig();
 			final int timeout = JsonUtils.optInt(config, "keystore.fetch.timeout", 30000); // socket timeouts are in ms
 			final int retries = JsonUtils.optInt(config, "keystore.fetch.retries", 5);
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
index 5a048fd3a7..8cd4600f12 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
@@ -19,6 +19,7 @@ import org.apache.traffic_control.traffic_router.core.config.ConfigHandler;
 import org.apache.traffic_control.traffic_router.core.util.AbstractResourceWatcher;
 import org.apache.traffic_control.traffic_router.core.util.JsonUtils;
 import org.apache.traffic_control.traffic_router.core.util.JsonUtilsException;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -37,7 +38,7 @@ import java.util.List;
 
 public class LetsEncryptDnsChallengeWatcher extends AbstractResourceWatcher {
     private static final Logger LOGGER = LogManager.getLogger(LetsEncryptDnsChallengeWatcher.class);
-    public static final String DEFAULT_LE_DNS_CHALLENGE_URL = "https://${toHostname}/api/2.0/letsencrypt/dnsrecords/";
+    public static final String DEFAULT_LE_DNS_CHALLENGE_URL = "https://${toHostname}/api/"+TrafficOpsUtils.TO_API_VERSION+"/letsencrypt/dnsrecords/";
 
     private String configFile;
     private ConfigHandler configHandler;
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/SteeringWatcher.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/SteeringWatcher.java
index 713eb2d8d5..d57c21f614 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/SteeringWatcher.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/ds/SteeringWatcher.java
@@ -16,6 +16,7 @@
 package org.apache.traffic_control.traffic_router.core.ds;
 
 import org.apache.traffic_control.traffic_router.core.util.AbstractResourceWatcher;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -23,7 +24,7 @@ public class SteeringWatcher extends AbstractResourceWatcher {
 	private static final Logger LOGGER = LogManager.getLogger(SteeringWatcher.class);
 	private SteeringRegistry steeringRegistry;
 
-	public static final String DEFAULT_STEERING_DATA_URL = "https://${toHostname}/api/2.0/steering";
+	public static final String DEFAULT_STEERING_DATA_URL = "https://${toHostname}/api/"+TrafficOpsUtils.TO_API_VERSION+"/steering";
 
 	public SteeringWatcher() {
 		setDatabaseUrl(DEFAULT_STEERING_DATA_URL);
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/FederationsWatcher.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/FederationsWatcher.java
index 5fdb1d282c..13434dd766 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/FederationsWatcher.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/FederationsWatcher.java
@@ -18,12 +18,13 @@ package org.apache.traffic_control.traffic_router.core.loc;
 import org.apache.traffic_control.traffic_router.core.util.AbstractResourceWatcher;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 
 public class FederationsWatcher extends AbstractResourceWatcher {
     private static final Logger LOGGER = LogManager.getLogger(FederationsWatcher.class);
     private FederationRegistry federationRegistry;
 
-    public static final String DEFAULT_FEDERATION_DATA_URL = "https://${toHostname}/api/2.0/federations/all";
+    public static final String DEFAULT_FEDERATION_DATA_URL = "https://${toHostname}/api/"+TrafficOpsUtils.TO_API_VERSION+"/federations/all";
     public FederationsWatcher() {
         setDatabaseUrl(DEFAULT_FEDERATION_DATA_URL);
         setDefaultDatabaseUrl(DEFAULT_FEDERATION_DATA_URL);
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/secure/CertificatesClient.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/secure/CertificatesClient.java
index a12fd01238..3006516877 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/secure/CertificatesClient.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/secure/CertificatesClient.java
@@ -77,7 +77,7 @@ public class CertificatesClient {
 			}
 		}
 
-		final String certificatesUrl = trafficOpsUtils.getUrl("certificate.api.url", "https://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys");
+		final String certificatesUrl = trafficOpsUtils.getUrl("certificate.api.url", "https://${toHostname}/api/"+TrafficOpsUtils.TO_API_VERSION+"/cdns/name/${cdnName}/sslkeys");
 
 		try {
 			final ProtectedFetcher fetcher = new ProtectedFetcher(trafficOpsUtils.getAuthUrl(), trafficOpsUtils.getAuthJSON().toString(), 15000);
diff --git a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/util/TrafficOpsUtils.java b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/util/TrafficOpsUtils.java
index 94a2241033..766d57c431 100644
--- a/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/util/TrafficOpsUtils.java
+++ b/traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/util/TrafficOpsUtils.java
@@ -23,6 +23,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 public class TrafficOpsUtils {
+	public static final String TO_API_VERSION = "3.1";
+
 	private String username;
 	private String password;
 	private String hostname;
@@ -53,7 +55,7 @@ public class TrafficOpsUtils {
 	}
 
 	public String getAuthUrl() {
-		return getUrl("api.auth.url", "https://${toHostname}/api/2.0/user/login");
+		return getUrl("api.auth.url", "https://${toHostname}/api/"+TO_API_VERSION+"/user/login");
 	}
 
 	public String getUsername() {
diff --git a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/ConsistentHashTest.java b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/ConsistentHashTest.java
index 0b277c7533..3757bda213 100644
--- a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/ConsistentHashTest.java
+++ b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/ConsistentHashTest.java
@@ -18,6 +18,7 @@ package org.apache.traffic_control.traffic_router.core.external;
 import org.apache.traffic_control.traffic_router.core.util.CidrAddress;
 import org.apache.traffic_control.traffic_router.core.util.ExternalTest;
 import org.apache.traffic_control.traffic_router.core.util.JsonUtils;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -58,7 +59,7 @@ public class ConsistentHashTest {
 	public void before() throws Exception {
 		closeableHttpClient = HttpClientBuilder.create().build();
 
-		String resourcePath = "api/2.0/steering";
+		String resourcePath = "api/"+TrafficOpsUtils.TO_API_VERSION+"/steering";
 		InputStream inputStream = getClass().getClassLoader().getResourceAsStream(resourcePath);
 
 		if (inputStream == null) {
diff --git a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/HttpDataServer.java b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/HttpDataServer.java
index 6fe5b1cd9b..72a689ecde 100644
--- a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/HttpDataServer.java
+++ b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/HttpDataServer.java
@@ -19,6 +19,7 @@ import com.sun.net.httpserver.Headers;
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpHandler;
 import com.sun.net.httpserver.HttpServer;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -32,7 +33,6 @@ import java.net.URI;
 public class HttpDataServer implements HttpHandler {
 	private HttpServer httpServer;
 	private int testHttpServerPort;
-	private static String apiVersion = "2.0";
 
 	public HttpDataServer(int testHttpServerPort) {
 		this.testHttpServerPort = testHttpServerPort;
@@ -120,7 +120,7 @@ public class HttpDataServer implements HttpHandler {
 					path += ".json";
 				}
 
-				if (("api/" + apiVersion + "/user/login").equals(path)) {
+				if (("api/" + TrafficOpsUtils.TO_API_VERSION + "/user/login").equals(path)) {
 					try {
 						Headers headers = httpExchange.getResponseHeaders();
 						headers.set("Set-Cookie", new HttpCookie("mojolicious","fake-cookie").toString());
@@ -131,12 +131,12 @@ public class HttpDataServer implements HttpHandler {
 				}
 
 				// Pretend that someone externally changed steering.json data
-				if (receivedSteeringPost && ("api/" + apiVersion + "/steering").equals(path)) {
-					path = "api/" + apiVersion + "/steering2";
+				if (receivedSteeringPost && ("api/" + TrafficOpsUtils.TO_API_VERSION + "/steering").equals(path)) {
+					path = "api/" + TrafficOpsUtils.TO_API_VERSION + "/steering2";
 				}
 
 				// pretend certificates have not been updated
-				if (!receivedCertificatesPost && ("api/" + apiVersion + "/cdns/name/thecdn/sslkeys").equals(path)) {
+				if (!receivedCertificatesPost && ("api/" + TrafficOpsUtils.TO_API_VERSION + "/cdns/name/thecdn/sslkeys").equals(path)) {
 					path = path.replace("/sslkeys", "/sslkeys-missing-1");
 				}
 
diff --git a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/RouterTest.java b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/RouterTest.java
index 232c4c7f32..fd7f5e93fc 100644
--- a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/RouterTest.java
+++ b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/RouterTest.java
@@ -17,6 +17,7 @@ package org.apache.traffic_control.traffic_router.core.external;
 
 import org.apache.traffic_control.traffic_router.core.util.ExternalTest;
 import org.apache.traffic_control.traffic_router.core.util.JsonUtils;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -106,7 +107,7 @@ public class RouterTest {
 	public void before() throws Exception {
 		ObjectMapper objectMapper = new ObjectMapper(new JsonFactory());
 
-		String resourcePath = "api/2.0/steering";
+		String resourcePath = "api/"+TrafficOpsUtils.TO_API_VERSION+"/steering";
 		InputStream inputStream = getClass().getClassLoader().getResourceAsStream(resourcePath);
 
 		if (inputStream == null) {
diff --git a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/SteeringTest.java b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/SteeringTest.java
index 791d7fd3be..f1e0687c2f 100644
--- a/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/SteeringTest.java
+++ b/traffic_router/core/src/test/java/org/apache/traffic_control/traffic_router/core/external/SteeringTest.java
@@ -17,6 +17,7 @@ package org.apache.traffic_control.traffic_router.core.external;
 
 import org.apache.traffic_control.traffic_router.core.http.RouterFilter;
 import org.apache.traffic_control.traffic_router.core.util.ExternalTest;
+import org.apache.traffic_control.traffic_router.core.util.TrafficOpsUtils;
 import com.fasterxml.jackson.core.JsonFactory;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -140,7 +141,7 @@ public class SteeringTest {
 
 	@Before
 	public void before() throws Exception {
-		steeringDeliveryServiceId = setupSteering(targetDomains, targetWeights, "api/2.0/steering");
+		steeringDeliveryServiceId = setupSteering(targetDomains, targetWeights, "api/"+TrafficOpsUtils.TO_API_VERSION+"/steering");
 		setupCrConfig();
 
 		httpClient = HttpClientBuilder.create().disableRedirectHandling().build();
@@ -272,7 +273,7 @@ public class SteeringTest {
 		Map<String, String> domains = new HashMap<>();
 		Map<String, Integer> weights = new HashMap<>();
 
-		setupSteering(domains, weights, "api/2.0/steering2");
+		setupSteering(domains, weights, "api/"+TrafficOpsUtils.TO_API_VERSION+"/steering2");
 
 		List<String> randomPaths = new ArrayList<>();
 
diff --git a/traffic_router/core/src/test/resources/api/2.0/cdns/name/thecdn/sslkeys b/traffic_router/core/src/test/resources/api/3.1/cdns/name/thecdn/sslkeys
similarity index 100%
rename from traffic_router/core/src/test/resources/api/2.0/cdns/name/thecdn/sslkeys
rename to traffic_router/core/src/test/resources/api/3.1/cdns/name/thecdn/sslkeys
diff --git a/traffic_router/core/src/test/resources/api/2.0/cdns/name/thecdn/sslkeys-missing-1 b/traffic_router/core/src/test/resources/api/3.1/cdns/name/thecdn/sslkeys-missing-1
similarity index 100%
rename from traffic_router/core/src/test/resources/api/2.0/cdns/name/thecdn/sslkeys-missing-1
rename to traffic_router/core/src/test/resources/api/3.1/cdns/name/thecdn/sslkeys-missing-1
diff --git a/traffic_router/core/src/test/resources/api/2.0/federations/all b/traffic_router/core/src/test/resources/api/3.1/federations/all
similarity index 100%
rename from traffic_router/core/src/test/resources/api/2.0/federations/all
rename to traffic_router/core/src/test/resources/api/3.1/federations/all
diff --git a/traffic_router/core/src/test/resources/api/2.0/steering b/traffic_router/core/src/test/resources/api/3.1/steering
similarity index 100%
rename from traffic_router/core/src/test/resources/api/2.0/steering
rename to traffic_router/core/src/test/resources/api/3.1/steering
diff --git a/traffic_router/core/src/test/resources/api/2.0/steering2 b/traffic_router/core/src/test/resources/api/3.1/steering2
similarity index 100%
rename from traffic_router/core/src/test/resources/api/2.0/steering2
rename to traffic_router/core/src/test/resources/api/3.1/steering2
diff --git a/traffic_router/core/src/test/resources/publish/CrConfig.json b/traffic_router/core/src/test/resources/publish/CrConfig.json
index 29080e802d..29c143a1c9 100644
--- a/traffic_router/core/src/test/resources/publish/CrConfig.json
+++ b/traffic_router/core/src/test/resources/publish/CrConfig.json
@@ -1916,11 +1916,11 @@
     }
   },
   "config": {
-    "certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
+    "certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
     "client.steering.forced.diversity": "true",
-    "federationmapping.polling.url": "http://${toHostname}/api/2.0/federations/all",
+    "federationmapping.polling.url": "http://${toHostname}/api/3.1/federations/all",
     "federationmapping.polling.interval": "600000",
-    "steeringmapping.polling.url": "http://${toHostname}/api/2.0/steering",
+    "steeringmapping.polling.url": "http://${toHostname}/api/3.1/steering",
     "steeringmapping.polling.interval": "15000",
     "weight": "1.0",
     "requestHeaders": [
@@ -1939,7 +1939,7 @@
     },
     "coveragezone.polling.interval": "86400000",
     "regional_geoblock.polling.url.renamed": "http://testing-tm-01.cdn.example.com/some/path",
-    "keystore.auth.url": "http://localhost:3000/api/2.0/user/login",
+    "keystore.auth.url": "http://localhost:3000/api/3.1/user/login",
     "neustar.polling.interval": "12800000",
     "geolocation6.polling.interval": "86400000",
     "domain_name": "thecdn.example.com",
@@ -1953,7 +1953,7 @@
     },
     "coveragezone.polling.url": "http://localhost:8889/czf.json",
     "deepcoveragezone.polling.url": "http://localhost:8889/dczmap.json",
-    "api.auth.url": "http://${toHostname}/api/2.0/user/login",
+    "api.auth.url": "http://${toHostname}/api/3.1/user/login",
     "certificates.polling.interval": "10000",
     "dnssec.enabled": "false",
     "edge.dns.routing": "true",
diff --git a/traffic_router/core/src/test/resources/publish/CrConfig2.json b/traffic_router/core/src/test/resources/publish/CrConfig2.json
index 191480fe61..4b3fb4f1bc 100644
--- a/traffic_router/core/src/test/resources/publish/CrConfig2.json
+++ b/traffic_router/core/src/test/resources/publish/CrConfig2.json
@@ -1210,10 +1210,10 @@
     }
   },
   "config": {
-    "federationmapping.polling.url": "http://${toHostname}/api/2.0/federations/all",
-    "certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
+    "federationmapping.polling.url": "http://${toHostname}/api/3.1/federations/all",
+    "certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
     "federationmapping.polling.interval": "600000",
-    "steeringmapping.polling.url": "http://${toHostname}/api/2.0/steering",
+    "steeringmapping.polling.url": "http://${toHostname}/api/3.1/steering",
     "steeringmapping.polling.interval": "15000",
     "weight": "1.0",
     "requestHeaders": [
@@ -1232,7 +1232,7 @@
     },
     "coveragezone.polling.interval": "86400000",
     "regional_geoblock.polling.url.renamed": "http://testing-tm-01.cdn.example.com/some/path",
-    "keystore.auth.url": "http://localhost:3000/api/2.0/user/login",
+    "keystore.auth.url": "http://localhost:3000/api/3.1/user/login",
     "neustar.polling.interval": "12800000",
     "geolocation6.polling.interval": "86400000",
     "domain_name": "thecdn.example.com",
@@ -1245,7 +1245,7 @@
       "refresh": "28800"
     },
     "coveragezone.polling.url": "http://localhost:8889/czf.json",
-    "api.auth.url": "http://${toHostname}/api/2.0/user/login",
+    "api.auth.url": "http://${toHostname}/api/3.1/user/login",
     "certificates.polling.interval": "10000",
     "dnssec.enabled": "false"
   }
diff --git a/traffic_router/core/src/test/resources/publish/CrConfig3.json b/traffic_router/core/src/test/resources/publish/CrConfig3.json
index 58521d5839..0332da8d1c 100644
--- a/traffic_router/core/src/test/resources/publish/CrConfig3.json
+++ b/traffic_router/core/src/test/resources/publish/CrConfig3.json
@@ -1210,10 +1210,10 @@
     }
   },
   "config": {
-    "federationmapping.polling.url": "http://${toHostname}/api/2.0/federations/all",
-    "certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
+    "federationmapping.polling.url": "http://${toHostname}/api/3.1/federations/all",
+    "certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
     "federationmapping.polling.interval": "600000",
-    "steeringmapping.polling.url": "http://${toHostname}/api/2.0/steering",
+    "steeringmapping.polling.url": "http://${toHostname}/api/3.1/steering",
     "steeringmapping.polling.interval": "15000",
     "weight": "1.0",
     "requestHeaders": [
@@ -1232,7 +1232,7 @@
     },
     "coveragezone.polling.interval": "86400000",
     "regional_geoblock.polling.url.renamed": "http://testing-tm-01.cdn.example.com/some/path",
-    "keystore.auth.url": "http://localhost:3000/api/2.0/user/login",
+    "keystore.auth.url": "http://localhost:3000/api/3.1/user/login",
     "neustar.polling.interval": "12800000",
     "geolocation6.polling.interval": "86400000",
     "domain_name": "thecdn.example.com",
@@ -1245,7 +1245,7 @@
       "refresh": "28800"
     },
     "coveragezone.polling.url": "http://localhost:8889/czf.json",
-    "api.auth.url": "http://${toHostname}/api/2.0/user/login",
+    "api.auth.url": "http://${toHostname}/api/3.1/user/login",
     "certificates.polling.interval": "10000",
     "dnssec.enabled": "false"
   }
diff --git a/traffic_router/core/src/test/resources/publish/CrConfig4.json b/traffic_router/core/src/test/resources/publish/CrConfig4.json
index 08fcecb8e8..e61417dbeb 100644
--- a/traffic_router/core/src/test/resources/publish/CrConfig4.json
+++ b/traffic_router/core/src/test/resources/publish/CrConfig4.json
@@ -1255,10 +1255,10 @@
     }
   },
   "config": {
-    "federationmapping.polling.url": "http://${toHostname}/api/2.0/federations/all",
-    "certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
+    "federationmapping.polling.url": "http://${toHostname}/api/3.1/federations/all",
+    "certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
     "federationmapping.polling.interval": "600000",
-    "steeringmapping.polling.url": "http://${toHostname}/api/2.0/steering",
+    "steeringmapping.polling.url": "http://${toHostname}/api/3.1/steering",
     "steeringmapping.polling.interval": "15000",
     "weight": "1.0",
     "requestHeaders": [
@@ -1277,7 +1277,7 @@
     },
     "coveragezone.polling.interval": "86400000",
     "regional_geoblock.polling.url.renamed": "http://testing-tm-01.cdn.example.com/some/path",
-    "keystore.auth.url": "http://localhost:3000/api/2.0/user/login",
+    "keystore.auth.url": "http://localhost:3000/api/3.1/user/login",
     "neustar.polling.interval": "12800000",
     "geolocation6.polling.interval": "86400000",
     "domain_name": "thecdn.example.com",
@@ -1290,7 +1290,7 @@
       "refresh": "28800"
     },
     "coveragezone.polling.url": "http://localhost:8889/czf.json",
-    "api.auth.url": "http://${toHostname}/api/2.0/user/login",
+    "api.auth.url": "http://${toHostname}/api/3.1/user/login",
     "certificates.polling.interval": "10000",
     "dnssec.enabled": "false"
   }


[trafficcontrol] 01/02: Update Traffic Stats to use TO API v3 (#6844)

Posted by zr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zrhoffman pushed a commit to branch 6.1.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 7f658f116a9bc2abeecd6320d0cfc446eba8765a
Author: jhowar201 <ju...@cable.comcast.com>
AuthorDate: Thu May 19 17:17:15 2022 -0400

    Update Traffic Stats to use TO API v3 (#6844)
    
    * Switching TS api client to v3
    
    * Updating TS to use API3 TO client
    
    * Added issue to changelog entry
    
    (cherry picked from commit 1c9fd16c555073537e7afacae3d15923cf9e1410)
---
 CHANGELOG.md                   | 1 +
 traffic_stats/traffic_stats.go | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4548362599..24261624c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 ### Changed
 - Added Rocky Linux 8 support
 - Updated Apache Tomcat from 9.0.43 to 9.0.67
+- [#6694](https://github.com/apache/trafficcontrol/issues/6694) Traffic Stats now uses the TO API 3.0
 
 ## [6.1.0] - 2022-01-18
 ### Added
diff --git a/traffic_stats/traffic_stats.go b/traffic_stats/traffic_stats.go
index 65680990c9..e6cb98392f 100644
--- a/traffic_stats/traffic_stats.go
+++ b/traffic_stats/traffic_stats.go
@@ -38,7 +38,7 @@ import (
 	"github.com/apache/trafficcontrol/lib/go-log"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/lib/go-util"
-	client "github.com/apache/trafficcontrol/traffic_ops/v2-client"
+	client "github.com/apache/trafficcontrol/traffic_ops/v3-client"
 
 	"github.com/cihub/seelog"
 	influx "github.com/influxdata/influxdb/client/v2"
@@ -546,7 +546,7 @@ func getToData(config StartupConfig, init bool, configChan chan RunningConfig) {
 		return
 	}
 
-	servers, _, err := to.GetServers()
+	servers, _, err := to.GetServers(nil)
 	if err != nil {
 		msg := fmt.Sprintf("Error getting server list from %v: %v ", config.ToURL, err)
 		if init {