use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetAfiSafiWithDefault.
@Test
public void testGetAfiSafiWithDefault() {
final ImmutableList<AfiSafi> defaultValue = ImmutableList.of(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build());
assertEquals(defaultValue, OpenConfigMappingUtil.getAfiSafiWithDefault(null, true));
final AfiSafis afiSafi = new AfiSafisBuilder().build();
assertEquals(defaultValue, OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafi, true));
final AfiSafi afiSafiIpv6 = new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(SHORT).build()).build();
final List<AfiSafi> afiSafiIpv6List = new ArrayList<>();
afiSafiIpv6List.add(afiSafiIpv6);
final List<AfiSafi> expected = new ArrayList<>(afiSafiIpv6List);
expected.add(AFI_SAFI_IPV4);
assertEquals(afiSafiIpv6, OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), true).get(0));
assertEquals(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build(), OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), true).get(1));
assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), true));
assertTrue(OpenConfigMappingUtil.getAfiSafiWithDefault(null, false).isEmpty());
assertTrue(OpenConfigMappingUtil.getAfiSafiWithDefault(afiSafi, false).isEmpty());
assertEquals(afiSafiIpv6, OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), false).get(0));
assertEquals(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build(), OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), false).get(1));
assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), false));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.NeighborAddPathsConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method toAddPathCapability.
@Test
public void toAddPathCapability() {
final List<AfiSafi> families = new ArrayList<>();
families.add(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(Shorts.checkedCast(ALL_PATHS)).build()).build());
families.add(new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(false).setSendMax(Shorts.checkedCast(N_PATHS)).build()).build());
families.add(new AfiSafiBuilder().setAfiSafiName(IPV6LABELLEDUNICAST.class).addAugmentation(NeighborAddPathsConfig.class, new NeighborAddPathsConfigBuilder().setReceive(false).build()).build());
final List<AddressFamilies> result = OpenConfigMappingUtil.toAddPathCapability(families, this.tableTypeRegistry);
assertEquals(FAMILIES, result);
}
Aggregations