Search in sources :

Example 1 with RemoveKeyInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput in project lispflowmapping by opendaylight.

the class SubnetDataProcessorTest method deleteTest.

/**
 * Tests {@link SubnetDataProcessor#delete} method.
 */
@Test
public void deleteTest() throws ExecutionException, InterruptedException {
    final RemoveKeyInput removeKeyInput = new RemoveKeyInputBuilder().setEid(EID).build();
    commonStubbing();
    Mockito.when(odlMappingserviceServiceMock.removeKey(removeKeyInput)).thenReturn(future);
    subnetDataProcessor.delete(subnet);
    assertEquals(true, rpcResult.isSuccessful());
}
Also used : RemoveKeyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInputBuilder) RemoveKeyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput) Test(org.junit.Test)

Example 2 with RemoveKeyInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput in project lispflowmapping by opendaylight.

the class LispUtil method buildRemoveKeyInput.

public static RemoveKeyInput buildRemoveKeyInput(Eid eid) {
    RemoveKeyInputBuilder kib = new RemoveKeyInputBuilder();
    kib.setEid(eid);
    return kib.build();
}
Also used : RemoveKeyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInputBuilder)

Example 3 with RemoveKeyInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput in project lispflowmapping by opendaylight.

the class SubnetDataProcessor method delete.

/**
 * Method removes the EID prefix and key associated with the deleted subnet
 * from Lisp mapping service.
 */
@Override
public void delete(Subnet subnet) {
    LOG.info("Neutron Subnet Deleted Request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr() + "Key: " + subnet.getUuid());
    LOG.debug("Lisp Neutron Subnet: " + subnet.toString());
    // Determine the IANA code for the subnet IP version
    // Default is set to IPv4 for neutron subnets
    final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
    try {
        final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();
        if (lfmdb == null) {
            LOG.debug("lfmdb is null!!!");
            return;
        }
        final RemoveKeyInput removeKeyInput = LispUtil.buildRemoveKeyInput(eid);
        final Future<RpcResult<Void>> result = lfmdb.removeKey(removeKeyInput);
        final Boolean isSuccessful = result.get().isSuccessful();
        if (isSuccessful) {
            LOG.debug("Neutron Subnet Deleted from MapServer : Subnet name: " + subnet.getName() + " Eid Prefix: " + subnet.getCidr() + " Key: " + subnet.getUuid());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Deleting subnet's EID prefix from mapping service failed + Subnet: " + subnet.toString() + "Error: " + ExceptionUtils.getStackTrace(e));
    }
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) OdlMappingserviceService(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.OdlMappingserviceService) RemoveKeyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput) ExecutionException(java.util.concurrent.ExecutionException)

Example 4 with RemoveKeyInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput in project lispflowmapping by opendaylight.

the class LispUtilTest method buildRemoveKeyInputTest.

/**
 * Tests {@link LispUtil#buildRemoveKeyInput} method.
 */
@Test
public void buildRemoveKeyInputTest() {
    final RemoveKeyInput expectedResult = new RemoveKeyInputBuilder().setEid(EID).build();
    final RemoveKeyInput result = LispUtil.buildRemoveKeyInput(EID);
    assertEquals(expectedResult, result);
}
Also used : RemoveKeyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInputBuilder) RemoveKeyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput) Test(org.junit.Test)

Example 5 with RemoveKeyInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput in project lispflowmapping by opendaylight.

the class MappingServiceTest method removeKeyTest.

/**
 * Tests {@link MappingService#removeKey} method.
 */
@Test
public void removeKeyTest() throws ExecutionException, InterruptedException {
    final RemoveKeyInput removeKeyInput = new RemoveKeyInputBuilder().setEid(IPV4_EID).build();
    final Future<RpcResult<Void>> result = mappingService.removeKey(removeKeyInput);
    Mockito.verify(dsbe).removeAuthenticationKey(RPCInputConvertorUtil.toAuthenticationKey(removeKeyInput));
    assertEquals(RPC_RESULT_SUCCESS.getErrors(), result.get().getErrors());
    assertEquals(RPC_RESULT_SUCCESS.getResult(), result.get().getResult());
    assertEquals(RPC_RESULT_SUCCESS.isSuccessful(), result.get().isSuccessful());
}
Also used : RemoveKeyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) RemoveKeyInput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput) Test(org.junit.Test)

Aggregations

RemoveKeyInput (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInput)4 RemoveKeyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.RemoveKeyInputBuilder)4 Test (org.junit.Test)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 ExecutionException (java.util.concurrent.ExecutionException)1 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)1 OdlMappingserviceService (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.OdlMappingserviceService)1