if (maybeOldAsSegments.isPresent() && !((UnkeyedListNode) maybeOldAsSegments.get()).getValue().isEmpty()) {
// Builder of inner list
final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> ilb = Builders.unkeyedListBuilder();
- ilb.withNodeIdentifier(this.asPathSegments);
+ ilb.withNodeIdentifier(this.asPathSequence);
ilb.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(this.asPathSequence).withChild(ImmutableNodes.leafNode(this.asPathId, localAs)).build());
/*
final AugmentationIdentifier ai = (AugmentationIdentifier) child.getIdentifier();
for (final QName name : ai.getPossibleChildNames()) {
LOG.trace("Augmented QNAME {}", name);
- if (transitiveCollection.contains(name)) {
+ if (this.transitiveCollection.contains(name)) {
return true;
}
}
return false;
}
- if (transitiveCollection.contains(child.getNodeType())) {
+ if (this.transitiveCollection.contains(child.getNodeType())) {
return true;
}
if (UnrecognizedAttributes.QNAME.equals(child.getNodeType())) {
// - we assume that all paths are learned
// 4. prefer the path with the shortest AS_PATH.
- if (this.bestState.getAsPathLength() > state.getAsPathLength()) {
- return true;
+ if (this.bestState.getAsPathLength() != state.getAsPathLength()) {
+ return this.bestState.getAsPathLength() < state.getAsPathLength();
}
// 5. prefer the path with the lowest origin type
if (maybeSet.isPresent()) {
final LeafSetNode<?> list = (LeafSetNode<?>)maybeSet.get();
for (final LeafSetEntryNode<?> as : list.getValue()) {
- ases.add(new AsNumber(Long.valueOf((String)as.getValue())));
+ ases.add(new AsNumber((Long)as.getValue()));
}
}
return new ASetCaseBuilder().setASet(new ASetBuilder().setAsSet(ases).build()).build();
final Optional<NormalizedNode<?, ?>> maybeAsSeq = NormalizedNodes.findNode(as, this.ids.getAs());
if (maybeAsSeq.isPresent()) {
final LeafNode<?> asLeaf = (LeafNode<?>)maybeAsSeq.get();
- ases.add(new AsSequenceBuilder().setAs(new AsNumber(Long.valueOf((String)asLeaf.getValue()))).build());
+ ases.add(new AsSequenceBuilder().setAs(new AsNumber((Long)asLeaf.getValue())).build());
}
}
}
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.primitives.UnsignedInteger;
-
import java.util.ArrayList;
import java.util.List;
-
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.as.path.Segments;
.addChild(Builders.choiceBuilder().withNodeIdentifier(cSegmentsNid)
.addChild(Builders.containerBuilder().withNodeIdentifier(aSetNid)
.addChild(Builders.leafSetBuilder().withNodeIdentifier(asSetNid)
- .addChild(Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue(asNumberQ, "10")).withValue("10").build())
- .addChild(Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue(asNumberQ, "11")).withValue("11").build())
+ .addChild(Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue(asNumberQ, 10L)).withValue(10L).build())
+ .addChild(Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue(asNumberQ, 11L)).withValue(11L).build())
.build())
.build())
.build())
.addChild(Builders.containerBuilder().withNodeIdentifier(aListNid)
.addChild(Builders.unkeyedListBuilder().withNodeIdentifier(asSeqNid)
.addChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(asSeqNid)
- .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue("1").build())
+ .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue(1L).build())
.build())
.addChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(asSeqNid)
- .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue("2").build())
+ .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue(2L).build())
.build())
.addChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(asSeqNid)
- .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue("3").build())
+ .addChild(Builders.leafBuilder().withNodeIdentifier(asNid).withValue(3L).build())
.build())
.build())
.build())