@Test public void testCreateBgpProcess() { Configuration tgwCfg = Utils.newAwsConfiguration("tgw", "local"); Vrf vrf = Vrf.builder().setOwner(tgwCfg).setName("vrf").build(); ConvertedConfiguration awsConfiguration = new ConvertedConfiguration(); createBgpProcess(tgwCfg, vrf, awsConfiguration); Interface bgpInterface = tgwCfg.getAllInterfaces().get("bgp-loopback-" + vrf.getName()); assertThat(bgpInterface, hasVrfName(vrf.getName())); assertThat(vrf.getBgpProcess(), notNullValue()); }
@VisibleForTesting static void createBgpProcess( Configuration tgwCfg, Vrf vrf, ConvertedConfiguration awsConfiguration) { LinkLocalAddress loopbackBgpAddress = LinkLocalAddress.of(LINK_LOCAL_IP); Utils.newInterface( "bgp-loopback-" + vrf.getName(), tgwCfg, vrf.getName(), loopbackBgpAddress, "BGP loopback for " + vrf.getName()); BgpProcess proc = BgpProcess.builder() .setRouterId(loopbackBgpAddress.getIp()) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); proc.setMultipathEquivalentAsPathMatchMode(MultipathEquivalentAsPathMatchMode.EXACT_PATH); RoutingPolicy.builder() .setName(bgpExportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP_AND_STATIC)) .build(); RoutingPolicy.builder() .setName(bgpImportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP)) .build(); }
TransitGateway implements AwsVpcEntity, Serializable { @VisibleForTesting static void createBgpProcess( Configuration tgwCfg, Vrf vrf, ConvertedConfiguration awsConfiguration) { LinkLocalAddress loopbackBgpAddress = LinkLocalAddress.of(LINK_LOCAL_IP); Utils.newInterface( "bgp-loopback-" + vrf.getName(), tgwCfg, vrf.getName(), loopbackBgpAddress, "BGP loopback for " + vrf.getName()); BgpProcess proc = BgpProcess.builder() .setRouterId(loopbackBgpAddress.getIp()) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); proc.setMultipathEquivalentAsPathMatchMode(MultipathEquivalentAsPathMatchMode.EXACT_PATH); RoutingPolicy.builder() .setName(bgpExportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP_AND_STATIC)) .build(); RoutingPolicy.builder() .setName(bgpImportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP)) .build(); } }
TransitGateway implements AwsVpcEntity, Serializable { @VisibleForTesting static void createBgpProcess( Configuration tgwCfg, Vrf vrf, ConvertedConfiguration awsConfiguration) { LinkLocalAddress loopbackBgpAddress = LinkLocalAddress.of(LINK_LOCAL_IP); Utils.newInterface( "bgp-loopback-" + vrf.getName(), tgwCfg, vrf.getName(), loopbackBgpAddress, "BGP loopback for " + vrf.getName()); BgpProcess proc = BgpProcess.builder() .setRouterId(loopbackBgpAddress.getIp()) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); proc.setMultipathEquivalentAsPathMatchMode(MultipathEquivalentAsPathMatchMode.EXACT_PATH); RoutingPolicy.builder() .setName(bgpExportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP_AND_STATIC)) .build(); RoutingPolicy.builder() .setName(bgpImportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP)) .build(); } TransitGateway(
      String gatewayId, TransitGatewayOptions options, String ownerId, Map<String, String> tags); }
TransitGateway implements AwsVpcEntity, Serializable { @VisibleForTesting static void createBgpProcess( Configuration tgwCfg, Vrf vrf, ConvertedConfiguration awsConfiguration) { LinkLocalAddress loopbackBgpAddress = LinkLocalAddress.of(LINK_LOCAL_IP); Utils.newInterface( "bgp-loopback-" + vrf.getName(), tgwCfg, vrf.getName(), loopbackBgpAddress, "BGP loopback for " + vrf.getName()); BgpProcess proc = BgpProcess.builder() .setRouterId(loopbackBgpAddress.getIp()) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); proc.setMultipathEquivalentAsPathMatchMode(MultipathEquivalentAsPathMatchMode.EXACT_PATH); RoutingPolicy.builder() .setName(bgpExportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP_AND_STATIC)) .build(); RoutingPolicy.builder() .setName(bgpImportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP)) .build(); } TransitGateway(
      String gatewayId, TransitGatewayOptions options, String ownerId, Map<String, String> tags); @Nonnull TransitGatewayOptions getOptions(); @Override String getId(); @Nonnull String getOwnerId(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); }
TransitGateway implements AwsVpcEntity, Serializable { @VisibleForTesting static void createBgpProcess( Configuration tgwCfg, Vrf vrf, ConvertedConfiguration awsConfiguration) { LinkLocalAddress loopbackBgpAddress = LinkLocalAddress.of(LINK_LOCAL_IP); Utils.newInterface( "bgp-loopback-" + vrf.getName(), tgwCfg, vrf.getName(), loopbackBgpAddress, "BGP loopback for " + vrf.getName()); BgpProcess proc = BgpProcess.builder() .setRouterId(loopbackBgpAddress.getIp()) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); proc.setMultipathEquivalentAsPathMatchMode(MultipathEquivalentAsPathMatchMode.EXACT_PATH); RoutingPolicy.builder() .setName(bgpExportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP_AND_STATIC)) .build(); RoutingPolicy.builder() .setName(bgpImportPolicyName(vrf.getName())) .setOwner(tgwCfg) .setStatements(Collections.singletonList(ACCEPT_ALL_BGP)) .build(); } TransitGateway(
      String gatewayId, TransitGatewayOptions options, String ownerId, Map<String, String> tags); @Nonnull TransitGatewayOptions getOptions(); @Override String getId(); @Nonnull String getOwnerId(); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }