extends AsyncDataTreeChangeListenerBase<SecurityRule, NeutronSecurityRuleListener> {
private static final Logger LOG = LoggerFactory.getLogger(NeutronSecurityRuleListener.class);
private final DataBroker dataBroker;
- private static final ImmutableBiMap<Class<? extends DirectionBase>, Class<? extends org.opendaylight.yang.gen.
- v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionBase>> DIRECTION_MAP = ImmutableBiMap.of(
+ private static final ImmutableBiMap<Class<? extends DirectionBase>,
+ Class<?extends org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionBase>>
+ DIRECTION_MAP = ImmutableBiMap.of(
DirectionEgress.class, NeutronSecurityRuleConstants.DIRECTION_EGRESS,
DirectionIngress.class, NeutronSecurityRuleConstants.DIRECTION_INGRESS);
private static final ImmutableBiMap<Class<? extends ProtocolBase>, Short> PROTOCOL_MAP = ImmutableBiMap.of(
}
@Override
+ // TODO Clean up the exception handling
+ @SuppressWarnings("checkstyle:IllegalCatch")
protected void add(InstanceIdentifier<SecurityRule> instanceIdentifier, SecurityRule securityRule) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("added securityRule: {}", securityRule);
- }
+ LOG.trace("added securityRule: {}", securityRule);
try {
Ace ace = toAceBuilder(securityRule).build();
InstanceIdentifier<Ace> identifier = getAceInstanceIdentifier(securityRule);
isDirectionIngress = securityRule.getDirection().equals(DirectionIngress.class);
}
if (securityRule.getPortRangeMax() != null) {
- if (isDirectionIngress) {
- sourcePortRangeBuilder.setUpperPort(new PortNumber(securityRule.getPortRangeMax()));
- } else {
- destinationPortRangeBuilder.setUpperPort(new PortNumber(securityRule.getPortRangeMax()));
- }
+ destinationPortRangeBuilder.setUpperPort(new PortNumber(securityRule.getPortRangeMax()));
+
}
if (securityRule.getPortRangeMin() != null) {
- if (isDirectionIngress) {
- sourcePortRangeBuilder.setLowerPort(new PortNumber(securityRule.getPortRangeMin()));
- // set source port range if lower port is specified as it is mandatory parameter in acl model
- aceIpBuilder.setSourcePortRange(sourcePortRangeBuilder.build());
- } else {
- destinationPortRangeBuilder.setLowerPort(new PortNumber(securityRule.getPortRangeMin()));
- // set destination port range if lower port is specified as it is mandatory parameter in acl model
- aceIpBuilder.setDestinationPortRange(destinationPortRangeBuilder.build());
- }
+ destinationPortRangeBuilder.setLowerPort(new PortNumber(securityRule.getPortRangeMin()));
+ // set destination port range if lower port is specified as it is mandatory parameter in acl model
+ aceIpBuilder.setDestinationPortRange(destinationPortRangeBuilder.build());
}
aceIpBuilder = handleRemoteIpPrefix(securityRule, aceIpBuilder, isDirectionIngress);
if (securityRule.getRemoteGroupId() != null) {
}
@Override
+ // TODO Clean up the exception handling
+ @SuppressWarnings("checkstyle:IllegalCatch")
protected void remove(InstanceIdentifier<SecurityRule> instanceIdentifier, SecurityRule securityRule) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("removed securityRule: {}", securityRule);
- }
+ LOG.trace("removed securityRule: {}", securityRule);
try {
InstanceIdentifier<Ace> identifier = getAceInstanceIdentifier(securityRule);
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, identifier);
}
@Override
- protected void update(InstanceIdentifier<SecurityRule> instanceIdentifier, SecurityRule oldSecurityRule, SecurityRule updatedSecurityRule) {
+ protected void update(InstanceIdentifier<SecurityRule> instanceIdentifier,
+ SecurityRule oldSecurityRule, SecurityRule updatedSecurityRule) {
// security rule updation is not supported from openstack, so no need to handle update.
LOG.trace("updates on security rules not supported.");
}