diff options
Diffstat (limited to 'routing/routing-impl/src/main/java')
2 files changed, 16 insertions, 19 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java index 4599c8b82..4497e81dc 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java @@ -16,8 +16,6 @@ package io.fd.hc2vpp.routing.write.factory; -import static com.google.common.base.Preconditions.checkNotNull; - import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.routing.write.factory.base.BasicHopRequestFactory; import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer; @@ -57,13 +55,12 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.Route route, @Nonnull final NextHop hop, @Nonnull final MappingContext mappingContext) { - - final VppIpv4Route routingAttributes = checkNotNull(route.getVppIpv4Route(), "VppIpv4Route not defined"); + final VppIpv4Route routingAttributes = route.getVppIpv4Route(); final int nextHopInterfaceIndex = getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext); - if (classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), + if (routingAttributes!= null && classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), mappingContext)) { return getMultipathHopRequest(add, route.getDestinationPrefix(), @@ -82,7 +79,7 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement hop.getAddress(), toByte(hop.getWeight()), getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext), - optionalVni(routingAttributes.getSecondaryVrf()), + optionalVni(null), 0, false); } @@ -93,12 +90,12 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.Route route, @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.next.hop.list.NextHop hop, @Nonnull final MappingContext mappingContext) { - final VppIpv6Route routingAttributes = checkNotNull(route.getVppIpv6Route(), "VppIpv6Route not defined"); + final VppIpv6Route routingAttributes = route.getVppIpv6Route(); final int nextHopInterfaceIndex = getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext); - if (classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), + if (routingAttributes != null && classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), mappingContext)) { return getMultipathHopRequest(add, route.getDestinationPrefix(), @@ -117,7 +114,7 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement hop.getAddress(), toByte(hop.getWeight()), getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext), - optionalVni(routingAttributes.getSecondaryVrf()), + optionalVni(null), 0, false); } diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java index 68a5f3d71..98c36e4ad 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java @@ -16,8 +16,6 @@ package io.fd.hc2vpp.routing.write.factory; -import static com.google.common.base.Preconditions.checkNotNull; - import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.routing.write.factory.base.BasicHopRequestFactory; import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer; @@ -58,12 +56,13 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R @Nonnull final MappingContext mappingContext) { final SimpleNextHop hop = SimpleNextHop.class.cast(route.getNextHopOptions()); - final VppIpv4Route routingAttributes = checkNotNull(route.getVppIpv4Route(), "VppIpv4Route not defined"); + final VppIpv4Route routingAttributes = route.getVppIpv4Route(); final int nextHopInterfaceIndex = getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext); - if (classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), - mappingContext)) { + if (routingAttributes != null && + classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), + mappingContext)) { return getSimpleHopRequest(add, route.getDestinationPrefix(), nextHopInterfaceIndex, @@ -79,7 +78,7 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R nextHopInterfaceIndex, hop.getNextHop(), getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext), - optionalVni(routingAttributes.getSecondaryVrf()), + optionalVni(null), 0, false); } @@ -93,12 +92,13 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R hop = (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SimpleNextHop) route .getNextHopOptions(); - final VppIpv6Route routingAttributes = checkNotNull(route.getVppIpv6Route(), "VppIpv6Route not defined"); + final VppIpv6Route routingAttributes = route.getVppIpv6Route(); final int nextHopInterfaceIndex = getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext); - if (classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), - mappingContext)) { + if (routingAttributes != null && + classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(), + mappingContext)) { return getSimpleHopRequest(add, route.getDestinationPrefix(), nextHopInterfaceIndex, @@ -114,7 +114,7 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R nextHopInterfaceIndex, hop.getNextHop(), getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext), - optionalVni(routingAttributes.getSecondaryVrf()), + optionalVni(null), 0, false); } |