Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .dependency_license
Original file line number Diff line number Diff line change
Expand Up @@ -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
\.jks, Apache-2.0 # Java Key Store

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Traffic Monitors now peer with other Traffic Monitors of the same status (e.g. ONLINE with ONLINE, OFFLINE with OFFLINE), instead of all peering with ONLINE.
- Changed the Traffic Ops user last_authenticated update query to only update once per minute to avoid row-locking when the same user logs in frequently.
- Added new fields to the monitoring.json snapshot and made Traffic Monitor prefer data in monitoring.json to the CRConfig snapshot
- Changed the default Traffic Ops API version requsted by Traffic Router from 2.0 to 3.1
- Added permissions to the role form in traffic portal
- Updated the Cache Stats Traffic Portal page to use a more performant AG-Grid-based table.
- Updated the CDNs Traffic Portal page to use a more performant AG-Grid-based table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private JsonNode fetchKeyPairData(final CacheRegister cacheRegister) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand All @@ -37,7 +38,7 @@

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
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;

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public int fetchRawData(final StringBuilder stringBuilder) {
}
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
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;
Expand Down Expand Up @@ -53,7 +55,7 @@ public JsonNode getAuthJSON() throws IOException {
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand All @@ -32,7 +33,6 @@
public class HttpDataServer implements HttpHandler {
private HttpServer httpServer;
private int testHttpServerPort;
private static String apiVersion = "2.0";

public HttpDataServer(int testHttpServerPort) {
this.testHttpServerPort = testHttpServerPort;
Expand Down Expand Up @@ -120,7 +120,7 @@ public void run() {
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.add("Content-length", Integer.toString(0));
Expand All @@ -133,12 +133,12 @@ public void run() {
}

// 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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

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;
Expand Down Expand Up @@ -140,7 +141,7 @@ public void setupCrConfig() throws IOException {

@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();
Expand Down Expand Up @@ -272,7 +273,7 @@ public void z_itemsMigrateFromSmallerToLargerBucket() throws Exception {
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<>();

Expand Down
12 changes: 6 additions & 6 deletions traffic_router/core/src/test/resources/publish/CrConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -1916,13 +1916,13 @@
}
},
"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",
"dnschallengemapping.polling.url": "http://${toHostname}/api/2.0/dnsrecords/",
"dnschallengemapping.polling.url": "http://${toHostname}/api/3.1/dnsrecords/",
"dnschallengemapping.polling.interval": "600000",
"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": [
Expand All @@ -1941,7 +1941,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",
Expand All @@ -1955,7 +1955,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",
Expand Down
12 changes: 6 additions & 6 deletions traffic_router/core/src/test/resources/publish/CrConfig2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1210,12 +1210,12 @@
}
},
"config": {
"certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/2.0/dnsrecords/",
"certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/3.1/dnsrecords/",
"dnschallengemapping.polling.interval": "600000",
"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": [
Expand All @@ -1234,7 +1234,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",
Expand All @@ -1247,7 +1247,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"
}
Expand Down
12 changes: 6 additions & 6 deletions traffic_router/core/src/test/resources/publish/CrConfig3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1210,12 +1210,12 @@
}
},
"config": {
"certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/2.0/dnsrecords/",
"certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/3.1/dnsrecords/",
"dnschallengemapping.polling.interval": "600000",
"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": [
Expand All @@ -1234,7 +1234,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",
Expand All @@ -1247,7 +1247,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"
}
Expand Down
12 changes: 6 additions & 6 deletions traffic_router/core/src/test/resources/publish/CrConfig4.json
Original file line number Diff line number Diff line change
Expand Up @@ -1255,12 +1255,12 @@
}
},
"config": {
"certificate.api.url": "http://${toHostname}/api/2.0/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/2.0/dnsrecords/",
"certificate.api.url": "http://${toHostname}/api/3.1/cdns/name/${cdnName}/sslkeys",
"dnschallengemapping.polling.url": "http://${toHostname}/api/3.1/dnsrecords/",
"dnschallengemapping.polling.interval": "600000",
"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": [
Expand All @@ -1279,7 +1279,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",
Expand All @@ -1292,7 +1292,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"
}
Expand Down