use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAddPathsConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetAfiSafiWithDefault.
@Test
public void testGetAfiSafiWithDefault() {
final AfiSafi v4afi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build();
final ImmutableMap<AfiSafiKey, AfiSafi> defaultValue = ImmutableMap.of(v4afi.key(), v4afi);
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(new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(SHORT).build()).build();
final Map<AfiSafiKey, AfiSafi> afiSafiIpv6List = BindingMap.of(afiSafiIpv6);
final Map<AfiSafiKey, AfiSafi> v6 = OpenConfigMappingUtil.getAfiSafiWithDefault(new AfiSafisBuilder().setAfiSafi(afiSafiIpv6List).build(), true);
assertEquals(2, v6.size());
assertTrue(v6.containsValue(afiSafiIpv6));
assertTrue(v6.containsValue(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).build()));
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).values().iterator().next());
assertEquals(AFI_SAFI, OpenConfigMappingUtil.getAfiSafiWithDefault(createAfiSafi(), false));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.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(new NeighborAddPathsConfigBuilder().setReceive(Boolean.TRUE).setSendMax(ALL_PATHS).build()).build());
families.add(new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class).addAugmentation(new NeighborAddPathsConfigBuilder().setReceive(Boolean.FALSE).setSendMax(N_PATHS).build()).build());
families.add(new AfiSafiBuilder().setAfiSafiName(IPV6LABELLEDUNICAST.class).addAugmentation(new NeighborAddPathsConfigBuilder().setReceive(Boolean.FALSE).build()).build());
final List<AddressFamilies> result = OpenConfigMappingUtil.toAddPathCapability(families, tableTypeRegistry);
assertEquals(FAMILIES, result);
}
Aggregations