summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-03-04 09:21:24 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-03-04 09:21:52 +0100
commit58c3a23e4b41752845eb25e1d369bf9468f56285 (patch)
treeafb191bdcc6abb450f67d7579ca5d39abf8dd385
parent833ca1604774d927a9b2d3dd7ce38ea9b68c24d5 (diff)
Fix NPE in VppIetfInterfaceListener if Ietf interface is not augumented
Change-Id: I9cdfbe67f089c74bf9205e447553b4ae07c2f2c6 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java53
1 files changed, 29 insertions, 24 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java
index 481c0ef60..c45fe1fe1 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppIetfInterfaceListener.java
@@ -274,7 +274,7 @@ public class VppIetfInterfaceListener implements DataTreeChangeListener<Interfac
private void vppSetInterface(final Interface swIf, final DataChangeType type,
final Interface originalIf) {
VppInterfaceAugmentation vppInterface =
- swIf.getAugmentation(VppInterfaceAugmentation.class);
+ swIf.getAugmentation(VppInterfaceAugmentation.class); // FIXME what if vppInterface is null?
int ctxId = 0;
int cnt = 0;
int rv = -77;
@@ -332,8 +332,8 @@ public class VppIetfInterfaceListener implements DataTreeChangeListener<Interfac
swIf.getType().getSimpleName(), swIf.getName());
}
- } else if ((ifType != null)
- && ifType.isAssignableFrom(VxlanTunnel.class)) {
+ } else if ((ifType != null) && ifType.isAssignableFrom(VxlanTunnel.class)
+ && vppInterface != null) { // FIXME handle vppInterface==null case in consistent manner
LOG.info("VPPCFG-INFO: VxLAN tunnel configuration");
// TODO: check name of interface, make use of renumber to change vpp
@@ -414,28 +414,33 @@ public class VppIetfInterfaceListener implements DataTreeChangeListener<Interfac
} else {
api.setInterfaceDescription(swIfName, "");
}
- Routing rt = vppInterface.getRouting();
- int vrfId = (rt != null) ? rt.getVrfId().intValue() : 0;
- LOG.info("VPPCFG-INFO: vrfId = {}", vrfId);
- if (vrfId > 0) {
- apiName = "api.swInterfaceSetTable";
- ctxId = api.swInterfaceSetTable(swIfIndex,
- (byte)0, /* isIpv6 */
- vrfId);
- LOG.info("VPPCFG-INFO: {}({} ([]), 0 /* isIpv6 */, {} /* vrfId */)"
- + " : ctxId = {}", apiName, swIfName, swIfIndex,
- vrfId, ctxId);
- cnt = 0;
- rv = -77;
- while (rv == -77) {
- rv = api.getRetval(ctxId, 1 /* release */);
- cnt++;
- }
- if (rv < 0) {
- LOG.warn("VPPCFG-WARNING: api.swInterfaceSetTable() ctxId = {} failed: retval = {}!", ctxId, rv);
+
+ if (vppInterface != null) { // FIXME handle vppInterface==null case in consistent manner
+ Routing rt = vppInterface.getRouting();
+ int vrfId = (rt != null)
+ ? rt.getVrfId().intValue()
+ : 0;
+ LOG.info("VPPCFG-INFO: vrfId = {}", vrfId);
+ if (vrfId > 0) {
+ apiName = "api.swInterfaceSetTable";
+ ctxId = api.swInterfaceSetTable(swIfIndex,
+ (byte) 0, /* isIpv6 */
+ vrfId);
+ LOG.info("VPPCFG-INFO: {}({} ([]), 0 /* isIpv6 */, {} /* vrfId */)"
+ + " : ctxId = {}", apiName, swIfName, swIfIndex,
+ vrfId, ctxId);
+ cnt = 0;
+ rv = -77;
+ while (rv == -77) {
+ rv = api.getRetval(ctxId, 1 /* release */);
+ cnt++;
+ }
+ if (rv < 0) {
+ LOG.warn("VPPCFG-WARNING: api.swInterfaceSetTable() ctxId = {} failed: retval = {}!", ctxId, rv);
/* DAW-FIXME: throw exception on failure? */
- } else {
- LOG.info("VPPCFG-INFO: {}() ctxId = {} retval = {} after {} tries.", apiName, ctxId, rv, cnt);
+ } else {
+ LOG.info("VPPCFG-INFO: {}() ctxId = {} retval = {} after {} tries.", apiName, ctxId, rv, cnt);
+ }
}
}