Search in sources :

Example 51 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project lispflowmapping by opendaylight.

the class MappingService method addKey.

@Override
public Future<RpcResult<Void>> addKey(AddKeyInput input) {
    Preconditions.checkNotNull(input, "add-key RPC input must be not null!");
    LOG.trace("RPC received to add the following key: " + input.toString());
    RpcResultBuilder<Void> rpcResultBuilder;
    MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
    if (key != null) {
        String message = "Key already exists! Please use update-key if you want to change it.";
        rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.PROTOCOL, DATA_EXISTS_TAG, message);
        return Futures.immediateFuture(rpcResultBuilder.build());
    }
    dsbe.addAuthenticationKey(RPCInputConvertorUtil.toAuthenticationKey(input));
    rpcResultBuilder = RpcResultBuilder.success();
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)

Example 52 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project lispflowmapping by opendaylight.

the class MappingService method updateKey.

@Override
public Future<RpcResult<Void>> updateKey(UpdateKeyInput input) {
    Preconditions.checkNotNull(input, "update-key RPC input must be not null!");
    LOG.trace("RPC received to update the following key: " + input.toString());
    RpcResultBuilder<Void> rpcResultBuilder;
    MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
    if (key == null) {
        String message = "Key doesn't exist! Please use add-key if you want to create a new authentication key.";
        rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.PROTOCOL, NOT_FOUND_TAG, message);
        return Futures.immediateFuture(rpcResultBuilder.build());
    }
    dsbe.updateAuthenticationKey(RPCInputConvertorUtil.toAuthenticationKey(input));
    rpcResultBuilder = RpcResultBuilder.success();
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)

Example 53 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project lispflowmapping by opendaylight.

the class MappingService method getKey.

@Override
public Future<RpcResult<GetKeyOutput>> getKey(GetKeyInput input) {
    Preconditions.checkNotNull(input, "get-key RPC input must be not null!");
    LOG.trace("RPC received to get the following key: " + input.toString());
    RpcResultBuilder<GetKeyOutput> rpcResultBuilder;
    MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
    if (key == null) {
        String message = "Key was not found in the mapping database";
        rpcResultBuilder = RpcResultBuilder.<GetKeyOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
    } else {
        rpcResultBuilder = RpcResultBuilder.success(new GetKeyOutputBuilder().setMappingAuthkey(key));
    }
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : GetKeyOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetKeyOutputBuilder) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) GetKeyOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetKeyOutput)

Example 54 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project lispflowmapping by opendaylight.

the class MappingService method getMapping.

@Override
public Future<RpcResult<GetMappingOutput>> getMapping(GetMappingInput input) {
    Preconditions.checkNotNull(input, "get-mapping RPC input must be not null!");
    LOG.trace("RPC received to get the following mapping: " + input.toString());
    RpcResultBuilder<GetMappingOutput> rpcResultBuilder;
    MappingData reply = mappingSystem.getMapping(convertToBinaryIfNecessary(input.getEid()));
    if (reply == null) {
        String message = "No mapping was found in the mapping database";
        rpcResultBuilder = RpcResultBuilder.<GetMappingOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
    } else {
        final MappingRecord convertedReply = convertFromBinaryIfNecessary(reply.getRecord());
        rpcResultBuilder = RpcResultBuilder.success(new GetMappingOutputBuilder().setMappingRecord(convertedReply));
    }
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) GetMappingOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingOutputBuilder) GetMappingOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingOutput)

Example 55 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project lispflowmapping by opendaylight.

the class MappingDataListener method onDataTreeChanged.

@Override
public void onDataTreeChanged(Collection<DataTreeModification<Mapping>> changes) {
    for (DataTreeModification<Mapping> change : changes) {
        final DataObjectModification<Mapping> mod = change.getRootNode();
        if (ModificationType.DELETE == mod.getModificationType()) {
            // Process deleted mappings
            final Mapping mapping = mod.getDataBefore();
            // before being persisted, except for cluster slaves
            if (mapping.getOrigin() == MappingOrigin.Southbound && mapSystem.isMaster()) {
                continue;
            }
            LOG.trace("Received deleted data");
            LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
            LOG.trace("Value: {}", mapping);
            final Mapping convertedMapping = convertToBinaryIfNecessary(mapping);
            mapSystem.removeMapping(convertedMapping.getOrigin(), convertedMapping.getMappingRecord().getEid());
        } else if (ModificationType.SUBTREE_MODIFIED == mod.getModificationType() || ModificationType.WRITE == mod.getModificationType()) {
            final Mapping mapping = mod.getDataAfter();
            // SB notifications
            if (mapping.getOrigin() == MappingOrigin.Southbound && mapSystem.isMaster()) {
                continue;
            }
            final Mapping convertedMapping = convertToBinaryIfNecessary(mapping);
            Eid convertedEid = convertedMapping.getMappingRecord().getEid();
            if (ModificationType.SUBTREE_MODIFIED == mod.getModificationType()) {
                LOG.trace("Received update data");
                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
                LOG.trace("Value: {}", mapping);
                mapSystem.updateMapping(convertedMapping.getOrigin(), convertedEid, new MappingData(convertedMapping.getMappingRecord()));
            } else {
                LOG.trace("Received write data");
                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
                LOG.trace("Value: {}", mapping);
                mapSystem.addMapping(convertedMapping.getOrigin(), convertedEid, new MappingData(convertedMapping.getMappingRecord()));
            }
        } else {
            LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
        }
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)29 ArrayList (java.util.ArrayList)24 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)23 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)18 BigInteger (java.math.BigInteger)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 List (java.util.List)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 Test (org.junit.Test)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)12 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 UnknownHostException (java.net.UnknownHostException)10 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)9 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)9 Collections (java.util.Collections)8 Map (java.util.Map)8 VpnInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface)8