Search in sources :

Example 1 with FloatingIpPortInfo

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.FloatingIpPortInfo in project netvirt by opendaylight.

the class NeutronFloatingToFixedIpMappingChangeListener method remove.

@Override
public void remove(InstanceIdentifier<Floatingip> identifier, Floatingip input) {
    LOG.trace("Neutron Floating IP deleted : key: {}, value={}", identifier, input);
    IpAddress fixedIp = input.getFixedIpAddress();
    if (fixedIp != null) {
        // update FloatingIpPortInfo to set isFloatingIpDeleted as true to enable deletion of FloatingIpPortInfo
        // map once it is used for processing in the NAT removal path
        updateFloatingIpPortInfo(input.getUuid(), input.getPortId());
        clearFromFloatingIpInfo(input.getRouterId().getValue(), input.getPortId().getValue(), fixedIp.getIpv4Address().getValue());
    } else {
        // delete FloatingIpPortInfo mapping since floating IP is deleted and no fixed IP is associated to it
        removeFromFloatingIpPortInfo(input.getUuid());
    }
}
Also used : IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 2 with FloatingIpPortInfo

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.FloatingIpPortInfo in project netvirt by opendaylight.

the class NeutronFloatingToFixedIpMappingChangeListener method updateFloatingIpPortInfo.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private // updates FloatingIPPortInfo to have isFloatingIPDeleted set to true on a floating IP delete
void updateFloatingIpPortInfo(Uuid floatingIpId, Uuid floatingIpPortId) {
    InstanceIdentifier<FloatingIpIdToPortMapping> id = buildfloatingIpIdToPortMappingIdentifier(floatingIpId);
    try {
        FloatingIpIdToPortMappingBuilder floatingIpIdToPortMappingBuilder = new FloatingIpIdToPortMappingBuilder().setFloatingIpId(floatingIpId).setFloatingIpDeleted(true);
        LOG.debug("Updating floating IP UUID {} to Floating IP neutron port {} mapping in Floating IP" + " Port Info Config DS to set isFloatingIpDeleted flag as true", floatingIpId.getValue(), floatingIpPortId.getValue());
        MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, id, floatingIpIdToPortMappingBuilder.build());
    } catch (Exception e) {
        LOG.error("Updating floating IP UUID {} to Floating IP neutron port {} mapping in Floating IP" + " Port Info Config DS to set isFloatingIpDeleted flag as true failed", floatingIpId.getValue(), floatingIpPortId.getValue(), e);
    }
}
Also used : FloatingIpIdToPortMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingBuilder) FloatingIpIdToPortMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMapping) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 FloatingIpIdToPortMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMapping)1 FloatingIpIdToPortMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.port.info.FloatingIpIdToPortMappingBuilder)1