use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup in project netvirt by opendaylight.
the class NeutronSecurityGroupListener method toAclBuilder.
private AclBuilder toAclBuilder(SecurityGroup securityGroup, Integer aclTag) {
AclBuilder aclBuilder = new AclBuilder();
aclBuilder.setAclName(securityGroup.key().getUuid().getValue());
aclBuilder.setAclType(NeutronSecurityGroupConstants.ACLTYPE);
aclBuilder.setAccessListEntries(new AccessListEntriesBuilder().setAce(new ArrayList<>()).build());
if (aclTag != NeutronSecurityGroupConstants.INVALID_ACL_TAG) {
AclserviceAugmentationBuilder aclserviceAugmentationBuilder = new AclserviceAugmentationBuilder();
aclserviceAugmentationBuilder.setAclTag(aclTag);
aclBuilder.addAugmentation(aclserviceAugmentationBuilder.build());
}
return aclBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup in project netvirt by opendaylight.
the class NeutronSecurityRuleListener method remove.
@Override
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void remove(InstanceIdentifier<SecurityRule> instanceIdentifier, SecurityRule securityRule) {
LOG.trace("removed securityRule: {}", securityRule);
InstanceIdentifier<Ace> identifier = getAceInstanceIdentifier(securityRule);
try {
Ace ace = toAceBuilder(securityRule, true).build();
String jobKey = securityRule.getSecurityGroupId().getValue();
jobCoordinator.enqueueJob(jobKey, () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.mergeParentStructureMerge(identifier, ace))), NeutronSecurityGroupConstants.DJC_MAX_RETRIES);
} catch (Exception ex) {
/*
If there are out of sequence events where-in Sg-Rule delete could occur after SecurityGroup delete.
we would hit with exception here, trying to delete a child-node, after it's parent has got deleted.
Logging it as Warn, because if such event occur we are handling it in the AclEventListeners' Remove method.
*/
LOG.warn("Exception occured while removing acl for security rule: {}. ", securityRule, ex);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.groups.attributes.security.groups.SecurityGroup in project netvirt by opendaylight.
the class NeutronSecurityGroupListener method add.
@Override
public void add(InstanceIdentifier<SecurityGroup> instanceIdentifier, SecurityGroup securityGroup) {
LOG.trace("Adding securityGroup: {}", securityGroup);
String securityGroupId = securityGroup.key().getUuid().getValue();
InstanceIdentifier<Acl> identifier = getAclInstanceIdentifier(securityGroup);
jobCoordinator.enqueueJob(securityGroupId, () -> {
Integer aclTag = neutronSecurityGroupUtils.allocateAclTag(securityGroupId);
Acl acl = toAclBuilder(securityGroup, aclTag).build();
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.mergeParentStructurePut(identifier, acl)));
});
}
Aggregations