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());
}
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();
}
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));
}
}
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);
}
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());
}
Aggregations