SfcServicePathId { public static boolean free_pathid(long pathid) { if (SfcConcurrencyAPI.getPathIdLock()) { try { ServicePathIdKey servicePathIdKey = new ServicePathIdKey(pathid/Long.SIZE); long bitEntry = pathid % Long.SIZE; InstanceIdentifier<ServicePathId> spIID; spIID = InstanceIdentifier.builder(ServicePathIds.class) .child(ServicePathId.class, servicePathIdKey) .build(); ServicePathId servicePathId = SfcDataStoreAPI. readTransactionAPI(spIID, LogicalDatastoreType.OPERATIONAL); ServicePathIdBuilder servicePathIdBuilder = new ServicePathIdBuilder(servicePathId); servicePathIdBuilder.setKey(servicePathIdKey); servicePathIdBuilder.setPathIdBitarray(servicePathId.getPathIdBitarray() & ~(1L << (Long.SIZE - bitEntry))); return SfcDataStoreAPI. writeMergeTransactionAPI(spIID, servicePathIdBuilder.build(), LogicalDatastoreType.OPERATIONAL); } finally { SfcConcurrencyAPI.releasePathIdLock(); } } return false; }  static int generatePathIdRandomIncrements(); static int generatePathIdSequentialIncrements(); static long check_and_allocate_pathid(long pathid); static long check_and_allocate_symmetric_pathid(long pathid); static long check_and_allocate_pathid(); static boolean check_suitable_pathid(long pathid); static boolean allocate_pathid(long pathid); static boolean free_pathid(long pathid); static GenerationAlgorithmEnum getGenerationAlgorithm(); static boolean setGenerationAlgorithm(int genAlgorithm); static boolean setGenerationAlgorithm(GenerationAlgorithmEnum genAlgorithm);  }
@Test public void testFree_pathId() throws Exception { for (Integer pathId : pathIdList) { assertTrue(SfcServicePathId.allocate_pathid(pathId)); } for (Integer pathId : pathIdList) { assertTrue(SfcServicePathId.free_pathid(pathId)); } for (Integer pathId : pathIdList) { assertTrue(SfcServicePathId.check_suitable_pathid(pathId)); } }