summaryrefslogtreecommitdiffstats
path: root/routing/routing-impl/src/main
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-01-12 10:46:28 +0100
committerJan Srnicek <jsrnicek@cisco.com>2017-01-12 14:07:40 +0000
commit765cb29e4c12c48fca6326c434b985e655bafc1a (patch)
treea30c03a4530826ae82e7fdfd73f1d45c117026b8 /routing/routing-impl/src/main
parent7cf98fe610c2912873bdf5fe5fea353adb9d2cbf (diff)
HONEYCOMB-325 - Null pointer while routing attr not defined
Fixes multiple null pointers Change-Id: Iaa1df9a8b0a886d1835fe7cb87bcf7cf5130c6f5 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'routing/routing-impl/src/main')
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java15
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java20
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);
}