Search in sources :

Example 1 with NeighborAddPathsConfigBuilder

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));
}
Also used : AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) AfiSafiKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiKey) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) BgpPeerTest.createAfiSafi(org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi) AfiSafisBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder) AfiSafis(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis) IPV4UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST) NeighborAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAddPathsConfigBuilder) Test(org.junit.Test)

Example 2 with NeighborAddPathsConfigBuilder

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);
}
Also used : AfiSafiBuilder(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder) IPV6LABELLEDUNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6LABELLEDUNICAST) AddressFamilies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.add.path.capability.AddressFamilies) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) BgpPeerTest.createAfiSafi(org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi) ArrayList(java.util.ArrayList) IPV4UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST) NeighborAddPathsConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAddPathsConfigBuilder) IPV6UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BgpPeerTest.createAfiSafi (org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi)2 AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)2 AfiSafiBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder)2 IPV4UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST)2 NeighborAddPathsConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAddPathsConfigBuilder)2 ArrayList (java.util.ArrayList)1 AfiSafiKey (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiKey)1 AfiSafis (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis)1 AfiSafisBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder)1 IPV6LABELLEDUNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6LABELLEDUNICAST)1 IPV6UNICAST (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST)1 AddressFamilies (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.add.path.capability.AddressFamilies)1