Merge "Add buildNetworkTemplateForUpstreamType() helper method" into main