@Test public void testUnsetEndpointGroupConditions() throws Exception { WriteTransaction wt = newWriteTransactionMock(); EndpointGroupId endpointGroupId = new EndpointGroupId(EPG_ID); EndpointGroupCondition endpointGroupCondition = new EndpointGroupConditionBuilder().setCondition(new ConditionName(CONDITION_NAME)).build(); List<EndpointGroupCondition> endpointGroupConditionList = new ArrayList<>(); endpointGroupConditionList.add(endpointGroupCondition); UnsetEndpointGroupConditionsInput unsetEndpointGroupConditionsInput = new UnsetEndpointGroupConditionsInputBuilder().setEndpointGroup(endpointGroupId) .setEndpointGroupCondition(endpointGroupConditionList) .build(); endpointRpcRegistry.unsetEndpointGroupConditions(unsetEndpointGroupConditionsInput); verify(wt, times(1)).delete(eq(LogicalDatastoreType.OPERATIONAL), Mockito.<InstanceIdentifier<EndpointGroupCondition>>any()); }
@Override public Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); ConditionMappingKey key = new ConditionMappingKey(input.getEndpointGroup()); for (EndpointGroupCondition condition : input.getEndpointGroupCondition()) { EndpointGroupConditionKey ckey = new EndpointGroupConditionKey(condition.getCondition()); InstanceIdentifier<EndpointGroupCondition> iid = InstanceIdentifier.builder(Endpoints.class) .child(ConditionMapping.class, key) .child(EndpointGroupCondition.class, ckey) .build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); ConditionMappingKey key = new ConditionMappingKey(input.getEndpointGroup()); for (EndpointGroupCondition condition : input.getEndpointGroupCondition()) { EndpointGroupConditionKey ckey = new EndpointGroupConditionKey(condition.getCondition()); InstanceIdentifier<EndpointGroupCondition> iid = InstanceIdentifier.builder(Endpoints.class) .child(ConditionMapping.class, key) .child(EndpointGroupCondition.class, ckey) .build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } }
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); ConditionMappingKey key = new ConditionMappingKey(input.getEndpointGroup()); for (EndpointGroupCondition condition : input.getEndpointGroupCondition()) { EndpointGroupConditionKey ckey = new EndpointGroupConditionKey(condition.getCondition()); InstanceIdentifier<EndpointGroupCondition> iid = InstanceIdentifier.builder(Endpoints.class) .child(ConditionMapping.class, key) .child(EndpointGroupCondition.class, ckey) .build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } 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>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); ConditionMappingKey key = new ConditionMappingKey(input.getEndpointGroup()); for (EndpointGroupCondition condition : input.getEndpointGroupCondition()) { EndpointGroupConditionKey ckey = new EndpointGroupConditionKey(condition.getCondition()); InstanceIdentifier<EndpointGroupCondition> iid = InstanceIdentifier.builder(Endpoints.class) .child(ConditionMapping.class, key) .child(EndpointGroupCondition.class, ckey) .build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } 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>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input) { WriteTransaction t = dataProvider.newWriteOnlyTransaction(); ConditionMappingKey key = new ConditionMappingKey(input.getEndpointGroup()); for (EndpointGroupCondition condition : input.getEndpointGroupCondition()) { EndpointGroupConditionKey ckey = new EndpointGroupConditionKey(condition.getCondition()); InstanceIdentifier<EndpointGroupCondition> iid = InstanceIdentifier.builder(Endpoints.class) .child(ConditionMapping.class, key) .child(EndpointGroupCondition.class, ckey) .build(); t.delete(LogicalDatastoreType.OPERATIONAL, iid); } 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);  }