Search in sources :

Example 11 with MappingAuthkey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey 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 12 with MappingAuthkey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey 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 13 with MappingAuthkey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey 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 14 with MappingAuthkey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey in project lispflowmapping by opendaylight.

the class MappingServiceShell method addDefaultKeyIPv6.

@Override
public void addDefaultKeyIPv6() {
    Eid eid = LispAddressUtil.toEid(new Ipv6Prefix("::0/0"), null);
    MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
    mappingService.addAuthenticationKey(eid, key);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) MappingAuthkeyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)

Example 15 with MappingAuthkey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey in project lispflowmapping by opendaylight.

the class MappingServiceShell method addDefaultKeyIPv4.

@Override
public void addDefaultKeyIPv4() {
    Eid eid = LispAddressUtil.toEid(new Ipv4Prefix("0.0.0.0/0"), null);
    MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
    mappingService.addAuthenticationKey(eid, key);
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) MappingAuthkeyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)

Aggregations

MappingAuthkey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)16 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)9 Test (org.junit.Test)6 MappingAuthkeyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder)4 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)4 AddKeyInput (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddKeyInput)3 AddKeyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.AddKeyInputBuilder)3 AuthenticationKeyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder)3 RpcError (org.opendaylight.yangtools.yang.common.RpcError)3 ILispDAO (org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO)2 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)2 MapRegisterCacheMetadataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.MapRegisterCacheMetadataBuilder)2 MapRegisterCacheValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.value.grouping.MapRegisterCacheValueBuilder)2 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)2 MappingRecordItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem)2 EidUri (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri)2 AuthenticationKey (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1