@Test public void testUnregisterEndpoint() throws Exception { WriteTransaction wt = newWriteTransactionMock(); UnregisterEndpointInput unregisterEndpointInput = unregisterEndpointInput(); endpointRpcRegistry.unregisterEndpoint(unregisterEndpointInput); verify(wt, times(3)).delete(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class)); }
@Override public Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2() != null) { for (L2 l2a : input.getL2()) { EndpointKey key = new EndpointKey(l2a.getL2Context(), l2a.getMacAddress()); InstanceIdentifier<Endpoint> iid = InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } } if (input.getL3() != null) { for (L3 l3addr : input.getL3()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); InstanceIdentifier<EndpointL3> iid_l3 = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, key3).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid_l3); } } if (input.getL3Prefix() != null) { for (L3Prefix l3prefix : input.getL3Prefix()) { EndpointL3PrefixKey key = new EndpointL3PrefixKey(l3prefix.getIpPrefix(), l3prefix.getL3Context()); InstanceIdentifier<EndpointL3Prefix> iidL3Prefix = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3Prefix.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iidL3Prefix); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2() != null) { for (L2 l2a : input.getL2()) { EndpointKey key = new EndpointKey(l2a.getL2Context(), l2a.getMacAddress()); InstanceIdentifier<Endpoint> iid = InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } } if (input.getL3() != null) { for (L3 l3addr : input.getL3()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); InstanceIdentifier<EndpointL3> iid_l3 = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, key3).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid_l3); } } if (input.getL3Prefix() != null) { for (L3Prefix l3prefix : input.getL3Prefix()) { EndpointL3PrefixKey key = new EndpointL3PrefixKey(l3prefix.getIpPrefix(), l3prefix.getL3Context()); InstanceIdentifier<EndpointL3Prefix> iidL3Prefix = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3Prefix.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iidL3Prefix); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2() != null) { for (L2 l2a : input.getL2()) { EndpointKey key = new EndpointKey(l2a.getL2Context(), l2a.getMacAddress()); InstanceIdentifier<Endpoint> iid = InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } } if (input.getL3() != null) { for (L3 l3addr : input.getL3()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); InstanceIdentifier<EndpointL3> iid_l3 = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, key3).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid_l3); } } if (input.getL3Prefix() != null) { for (L3Prefix l3prefix : input.getL3Prefix()) { EndpointL3PrefixKey key = new EndpointL3PrefixKey(l3prefix.getIpPrefix(), l3prefix.getL3Context()); InstanceIdentifier<EndpointL3Prefix> iidL3Prefix = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3Prefix.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iidL3Prefix); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } EndpointRpcRegistry(DataBroker dataProvider); }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2() != null) { for (L2 l2a : input.getL2()) { EndpointKey key = new EndpointKey(l2a.getL2Context(), l2a.getMacAddress()); InstanceIdentifier<Endpoint> iid = InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } } if (input.getL3() != null) { for (L3 l3addr : input.getL3()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); InstanceIdentifier<EndpointL3> iid_l3 = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, key3).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid_l3); } } if (input.getL3Prefix() != null) { for (L3Prefix l3prefix : input.getL3Prefix()) { EndpointL3PrefixKey key = new EndpointL3PrefixKey(l3prefix.getIpPrefix(), l3prefix.getL3Context()); InstanceIdentifier<EndpointL3Prefix> iidL3Prefix = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3Prefix.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iidL3Prefix); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } EndpointRpcRegistry(DataBroker dataProvider); @Override void register(EpRendererAugmentation epRendererAugmentation); @Override void unregister(EpRendererAugmentation regImp); @Override void close(); @Override Future<RpcResult<Void>> registerEndpoint(RegisterEndpointInput input); @Override Future<RpcResult<Void>> registerL3PrefixEndpoint(RegisterL3PrefixEndpointInput input); @Override Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input); @Override Future<RpcResult<Void>> setEndpointGroupConditions(SetEndpointGroupConditionsInput input); @Override Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input); }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2() != null) { for (L2 l2a : input.getL2()) { EndpointKey key = new EndpointKey(l2a.getL2Context(), l2a.getMacAddress()); InstanceIdentifier<Endpoint> iid = InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } } if (input.getL3() != null) { for (L3 l3addr : input.getL3()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); InstanceIdentifier<EndpointL3> iid_l3 = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, key3).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid_l3); } } if (input.getL3Prefix() != null) { for (L3Prefix l3prefix : input.getL3Prefix()) { EndpointL3PrefixKey key = new EndpointL3PrefixKey(l3prefix.getIpPrefix(), l3prefix.getL3Context()); InstanceIdentifier<EndpointL3Prefix> iidL3Prefix = InstanceIdentifier.builder(Endpoints.class).child(EndpointL3Prefix.class, key).build(); t.delete(LogicalDatastoreType.OPERATIONAL, iidL3Prefix); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } EndpointRpcRegistry(DataBroker dataProvider); @Override void register(EpRendererAugmentation epRendererAugmentation); @Override void unregister(EpRendererAugmentation regImp); @Override void close(); @Override Future<RpcResult<Void>> registerEndpoint(RegisterEndpointInput input); @Override Future<RpcResult<Void>> registerL3PrefixEndpoint(RegisterL3PrefixEndpointInput input); @Override Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input); @Override Future<RpcResult<Void>> setEndpointGroupConditions(SetEndpointGroupConditionsInput input); @Override Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input);  }