import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.AttributesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
mpReach = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
}
if (mpReach != null) {
- this.ribWriter.updateRoutes(mpReach, attrs);
+ this.ribWriter.updateRoutes(mpReach, nextHopToAttribute(attrs, mpReach));
return;
}
MpUnreachNlri mpUnreach = null;
}
}
+ private static Attributes nextHopToAttribute(final Attributes attrs, final MpReachNlri mpReach) {
+ if (attrs.getCNextHop() == null && mpReach.getCNextHop() != null) {
+ final AttributesBuilder attributesBuilder = new AttributesBuilder(attrs);
+ attributesBuilder.setCNextHop(mpReach.getCNextHop());
+ return attributesBuilder.build();
+ }
+ return attrs;
+ }
+
/**
* Creates MPReach for the prefixes to be handled in the same way as linkstate routes
*