@Test public void testCreateBackboneConnection() { Configuration cfg = newAwsConfiguration("test", "aws"); String policyName = "export policy"; createBackboneConnection(cfg, cfg.getDefaultVrf(), policyName); assertTrue(cfg.getAllInterfaces().containsKey(BACKBONE_FACING_INTERFACE_NAME)); assertThat(cfg.getDefaultVrf().getBgpProcess().getRouterId(), equalTo(LINK_LOCAL_IP)); assertThat( cfg.getDefaultVrf().getBgpProcess().getInterfaceNeighbors(), equalTo( ImmutableMap.of( BACKBONE_FACING_INTERFACE_NAME, BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(policyName).build()) .build()))); }
static void createBackboneConnection(Configuration cfgNode, Vrf vrf, String exportPolicyName) { Utils.newInterface( BACKBONE_FACING_INTERFACE_NAME, cfgNode, vrf.getName(), LinkLocalAddress.of(LINK_LOCAL_IP), "To AWS backbone"); BgpProcess bgpProcess = BgpProcess.builder() .setRouterId(LINK_LOCAL_IP) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setBgpProcess(bgpProcess) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(exportPolicyName).build()) .build(); }
Utils { static void createBackboneConnection(Configuration cfgNode, Vrf vrf, String exportPolicyName) { Utils.newInterface( BACKBONE_FACING_INTERFACE_NAME, cfgNode, vrf.getName(), LinkLocalAddress.of(LINK_LOCAL_IP), "To AWS backbone"); BgpProcess bgpProcess = BgpProcess.builder() .setRouterId(LINK_LOCAL_IP) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setBgpProcess(bgpProcess) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(exportPolicyName).build()) .build(); } }
Utils { static void createBackboneConnection(Configuration cfgNode, Vrf vrf, String exportPolicyName) { Utils.newInterface( BACKBONE_FACING_INTERFACE_NAME, cfgNode, vrf.getName(), LinkLocalAddress.of(LINK_LOCAL_IP), "To AWS backbone"); BgpProcess bgpProcess = BgpProcess.builder() .setRouterId(LINK_LOCAL_IP) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setBgpProcess(bgpProcess) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(exportPolicyName).build()) .build(); } private  Utils(); }
Utils { static void createBackboneConnection(Configuration cfgNode, Vrf vrf, String exportPolicyName) { Utils.newInterface( BACKBONE_FACING_INTERFACE_NAME, cfgNode, vrf.getName(), LinkLocalAddress.of(LINK_LOCAL_IP), "To AWS backbone"); BgpProcess bgpProcess = BgpProcess.builder() .setRouterId(LINK_LOCAL_IP) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setBgpProcess(bgpProcess) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(exportPolicyName).build()) .build(); } private  Utils(); @Nullable static IpProtocol toIpProtocol(String ipProtocolAsString); static TraceElement getTraceElementForRule(@Nullable String ruleDescription); static TraceElement getTraceElementForSecurityGroup(String securityGroupName); }
Utils { static void createBackboneConnection(Configuration cfgNode, Vrf vrf, String exportPolicyName) { Utils.newInterface( BACKBONE_FACING_INTERFACE_NAME, cfgNode, vrf.getName(), LinkLocalAddress.of(LINK_LOCAL_IP), "To AWS backbone"); BgpProcess bgpProcess = BgpProcess.builder() .setRouterId(LINK_LOCAL_IP) .setVrf(vrf) .setAdminCostsToVendorDefaults(ConfigurationFormat.AWS) .build(); BgpUnnumberedPeerConfig.builder() .setPeerInterface(BACKBONE_FACING_INTERFACE_NAME) .setRemoteAs(AWS_BACKBONE_ASN) .setLocalIp(LINK_LOCAL_IP) .setLocalAs(BACKBONE_PEERING_ASN) .setBgpProcess(bgpProcess) .setIpv4UnicastAddressFamily( Ipv4UnicastAddressFamily.builder().setExportPolicy(exportPolicyName).build()) .build(); } private  Utils(); @Nullable static IpProtocol toIpProtocol(String ipProtocolAsString); static TraceElement getTraceElementForRule(@Nullable String ruleDescription); static TraceElement getTraceElementForSecurityGroup(String securityGroupName);  }