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();
}
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;
}
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));
}
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());
}
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();
}
Aggregations