rawlinp commented on a change in pull request #4724:
URL: https://github.com/apache/trafficcontrol/pull/4724#discussion_r442558486
##########
File path:
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
##########
@@ -491,21 +491,36 @@ private void parseTopologyConfig(final JsonNode
allTopologies, final Map<String,
deliveryServiceMap.forEach((xmlId, ds) -> {
final List<DeliveryServiceReference> dsReferences = new
ArrayList<>();
+ final List<String> dsNames = new ArrayList<>(); // for
stats
Stream.of(ds.getTopology())
- .filter((topologyName) ->
!Objects.isNull(topologyName) && topologyMap.containsKey(topologyName))
- .flatMap((topologyName) ->
topologyMap.get(topologyName).stream())
- .flatMap((node) ->
cacheRegister.getCacheLocation(node).getCaches().stream())
- .filter((cache) ->
ds.hasRequiredCapabilities(cache.getCapabilities()))
- .forEach((cache) -> {
+ .filter(topologyName ->
!Objects.isNull(topologyName) && topologyMap.containsKey(topologyName))
+ .flatMap(topologyName -> {
+ statMap.put(ds.getId(),
dsNames);
+ return
topologyMap.get(topologyName).stream();
+ })
+ .flatMap(node ->
cacheRegister.getCacheLocation(node).getCaches().stream())
+ .filter(cache ->
ds.hasRequiredCapabilities(cache.getCapabilities()))
+ .forEach(cache -> {
+
cacheRegister.getDeliveryServiceMatchers(ds).stream()
+
.flatMap(deliveryServiceMatcher ->
deliveryServiceMatcher.getRequestMatchers().stream())
+
.map(requestMatcher -> requestMatcher.getPattern().pattern())
+
.forEach(pattern -> {
+ final
String remap = ds.getRemap(pattern);
+ final
String fqdn = pattern.contains(".*") && !ds.isDns()
+
? cache.getId() + "." + remap
+
: remap;
+
dsNames.add(getDsName(fqdn, tld));
+ try {
+
dsReferences.add(new DeliveryServiceReference(ds.getId(), fqdn));
Review comment:
Ok, this is better, but it still doesn't seem to account for DNS-routed
delivery services. Referring to my example above, it _appears_ to be adding
`xmlId.cdnDomain` to `dsReferences`, when really I think that is supposed to be
`routingName.xmlId.cdnDomain`. From my example, it should add
`bar.bar.cdn.example.com` not `bar.example.cdn.com`.
Does that make sense? If I create that DNS-routed delivery service, assign
it to a Topology, snapshot, then `dig @localhost -p1053 bar.bar.example.cdn.com
a`, I should get a NOERROR response back with the cache IP addresses, but I'm
getting NXDOMAIN. Are you getting proper responses back?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]