NPE fix for secRules and secGroups with no tenantId
[groupbasedpolicy.git] / neutron-mapper / src / main / java / org / opendaylight / groupbasedpolicy / neutron / mapper / mapping / rule / NeutronSecurityRuleAware.java
index 3e493ddc20caa0a05f9862a7b040353c0bde8931..2bc757f074989899f9c10871c86c2a62afdb80cc 100644 (file)
@@ -157,6 +157,11 @@ public class NeutronSecurityRuleAware implements NeutronAware<SecurityRule> {
 
     public boolean addNeutronSecurityRuleWithAction(SecurityRule secRule, Neutron neutron, ActionChoice action,
             ReadWriteTransaction rwTx) {
+        if (secRule.getTenantId() == null) {
+            LOG.warn("Skip processing rule {} because TenantId is null.", secRule);
+            // TODO This needs to be reworked, SecRules shouldn't use TenantId, Neutron doesn't always configure it
+            return true;
+        }
         TenantId tenantId = new TenantId(secRule.getTenantId().getValue());
         Uuid providerSecGroupId = secRule.getSecurityGroupId();
         EndpointGroupId providerEpgId = new EndpointGroupId(providerSecGroupId.getValue());