SfcServicePathId { public static boolean allocate_pathid(long pathid) { ServicePathIdKey servicePathIdKey = new ServicePathIdKey(pathid/Long.SIZE); long bitEntry = pathid % Long.SIZE; long pathIdBitArray = 0; InstanceIdentifier<ServicePathId> spIID; spIID = InstanceIdentifier.builder(ServicePathIds.class) .child(ServicePathId.class, servicePathIdKey) .build(); ServicePathId servicePathId = SfcDataStoreAPI. readTransactionAPI(spIID, LogicalDatastoreType.OPERATIONAL); if (servicePathId != null) { pathIdBitArray = (servicePathId.getPathIdBitarray() != null) ? servicePathId.getPathIdBitarray() : 0; } ServicePathIdBuilder servicePathIdBuilder = new ServicePathIdBuilder(); servicePathIdBuilder.setPathIdBitarray(pathIdBitArray | (1L << (Long.SIZE - bitEntry))); servicePathIdBuilder.setKey(servicePathIdKey); return SfcDataStoreAPI. writeMergeTransactionAPI(spIID, servicePathIdBuilder.build(), LogicalDatastoreType.OPERATIONAL); }  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 testAllocate_pathId() throws Exception { for (Integer pathId : pathIdList) { assertTrue(SfcServicePathId.allocate_pathid(pathId)); } for (Integer pathId : pathIdList) { assertFalse(SfcServicePathId.check_suitable_pathid(pathId)); } for (Integer pathId : pathIdList) { assertTrue(SfcServicePathId.free_pathid(pathId)); } }