Search in sources :

Example 11 with ClusterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier in project bgpcep by opendaylight.

the class TestUtil method createAttributes.

private static Attributes createAttributes() {
    final List<AsNumber> asSequences = Lists.newArrayList(new AsNumber(Uint32.valueOf(72)), new AsNumber(Uint32.valueOf(82)), new AsNumber(Uint32.valueOf(92)));
    final List<Segments> segments = new ArrayList<>();
    final SegmentsBuilder segmentsBuild = new SegmentsBuilder();
    segmentsBuild.setAsSequence(asSequences).build();
    return new AttributesBuilder().setAggregator(new AggregatorBuilder().setAsNumber(new AsNumber(Uint32.valueOf(72))).setNetworkAddress(IPV4_ADDRESS_20).build()).setAigp(new AigpBuilder().setAigpTlv(new AigpTlvBuilder().setMetric(new AccumulatedIgpMetric(Uint64.ONE)).build()).build()).setAsPath(new AsPathBuilder().setSegments(segments).build()).setAtomicAggregate(new AtomicAggregateBuilder().build()).setClusterId(new ClusterIdBuilder().setCluster(Lists.newArrayList(new ClusterIdentifier(IPV4_ADDRESS_30), new ClusterIdentifier(IPV4_ADDRESS_40))).build()).setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(IPV4_ADDRESS_100).build()).build()).setCommunities(createCommunities()).setLocalPref(new LocalPrefBuilder().setPref(Uint32.valueOf(2)).build()).setMultiExitDisc(new MultiExitDiscBuilder().setMed(Uint32.valueOf(123)).build()).setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build()).setOriginatorId(new OriginatorIdBuilder().setOriginator(IPV4_ADDRESS_12).build()).build();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.LocalPrefBuilder) OriginBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginBuilder) MultiExitDiscBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.MultiExitDiscBuilder) ArrayList(java.util.ArrayList) Segments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.Segments) AccumulatedIgpMetric(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.AccumulatedIgpMetric) AtomicAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AtomicAggregateBuilder) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) OriginatorIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginatorIdBuilder) AsPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder) Ipv4NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder) AigpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AigpBuilder) Ipv4NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCaseBuilder) SegmentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder) AggregatorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AggregatorBuilder) AigpTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.aigp.AigpTlvBuilder) ClusterIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)

Example 12 with ClusterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier in project bgpcep by opendaylight.

the class MatchClusterIdSetHandler method matchClusterIdCondition.

private boolean matchClusterIdCondition(final ClusterIdentifier localClusterId, final ClusterId clusterId, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.cluster.id.set.condition.grouping.MatchClusterIdSetCondition matchClusterIdSetCondition) {
    final ClusterIdSet clusterIdSet = this.sets.getUnchecked(StringUtils.substringBetween(matchClusterIdSetCondition.getClusterIdSet(), "=\"", "\""));
    if (clusterIdSet == null) {
        return false;
    }
    final MatchSetOptionsType matchOption = matchClusterIdSetCondition.getMatchSetOptions();
    if (clusterId != null) {
        List<ClusterIdentifier> newList = new ArrayList<>();
        if (clusterIdSet.getClusterId() != null) {
            newList.addAll(clusterIdSet.getClusterId());
        }
        if (clusterIdSet.getLocal() != null) {
            newList.add(localClusterId);
        }
        final List<ClusterIdentifier> matchClusterList = clusterId.getCluster();
        if (matchOption.equals(MatchSetOptionsType.ALL)) {
            return matchClusterList.containsAll(newList) && newList.containsAll(matchClusterList);
        }
        final boolean noneInCommon = Collections.disjoint(matchClusterList, newList);
        if (matchOption.equals(MatchSetOptionsType.ANY)) {
            return !noneInCommon;
        } else if (matchOption.equals(MatchSetOptionsType.INVERT)) {
            return noneInCommon;
        }
    } else if (matchOption.equals(MatchSetOptionsType.INVERT)) {
        return true;
    }
    return false;
}
Also used : MatchSetOptionsType(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsType) ArrayList(java.util.ArrayList) ClusterIdSet(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.cluster.id.set.ClusterIdSet) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier)

Example 13 with ClusterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier in project bgpcep by opendaylight.

the class OpenConfigMappingUtil method getGlobalClusterIdentifier.

static ClusterIdentifier getGlobalClusterIdentifier(final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config globalConfig) {
    final GlobalConfigAugmentation globalConfigAugmentation = globalConfig.augmentation(GlobalConfigAugmentation.class);
    final Ipv4Address addr;
    if (globalConfigAugmentation != null && globalConfigAugmentation.getRouteReflectorClusterId() != null) {
        addr = globalConfigAugmentation.getRouteReflectorClusterId().getIpv4Address();
    } else {
        addr = globalConfig.getRouterId();
    }
    return new ClusterIdentifier(IetfInetUtil.INSTANCE.ipv4AddressNoZoneFor(addr));
}
Also used : GlobalConfigAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.GlobalConfigAugmentation) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 14 with ClusterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier in project bgpcep by opendaylight.

the class RibImpl method isGlobalEqual.

synchronized boolean isGlobalEqual(final Global global) {
    final Collection<AfiSafi> globalAfiSafi = getAfiSafiWithDefault(global.getAfiSafis(), true).values();
    final Config globalConfig = global.getConfig();
    final AsNumber globalAs = globalConfig.getAs();
    final Ipv4Address globalRouterId = global.getConfig().getRouterId();
    final ClusterIdentifier globalClusterId = getGlobalClusterIdentifier(globalConfig);
    return afiSafi.containsAll(globalAfiSafi) && globalAfiSafi.containsAll(afiSafi) && globalAs.equals(asNumber) && globalRouterId.getValue().equals(routerId.getValue()) && globalClusterId.getValue().equals(clusterId.getValue());
}
Also used : Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) OpenConfigMappingUtil.getGlobalClusterIdentifier(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getGlobalClusterIdentifier) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 15 with ClusterIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier in project bgpcep by opendaylight.

the class ExportAttributeTestUtil method createClusterIdInput.

private static ClusterId createClusterIdInput() {
    final ClusterIdentifier cluster1 = new ClusterIdentifier(new Ipv4AddressNoZone("1.1.1.1"));
    final ClusterIdentifier cluster2 = new ClusterIdentifier(new Ipv4AddressNoZone("1.1.1.2"));
    return new ClusterIdBuilder().setCluster(Arrays.asList(cluster1, cluster2)).build();
}
Also used : Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier) ClusterIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder)

Aggregations

ClusterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier)13 ClusterIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder)10 ArrayList (java.util.ArrayList)8 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)7 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)6 ByteBuf (io.netty.buffer.ByteBuf)5 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder)4 MultiExitDiscBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.MultiExitDiscBuilder)4 OriginatorIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginatorIdBuilder)4 Test (org.junit.Test)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)3 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)3 LocalPrefBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.LocalPrefBuilder)3 OriginBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginBuilder)3 ClusterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier)3 MatchSetOptionsType (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsType)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)2 Segments (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.Segments)2 SegmentsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder)2