Loading src/pathcomp/backend/pathComp_RESTapi.c +10 −5 Original line number Diff line number Diff line Loading @@ -281,7 +281,6 @@ void add_comp_path_deviceId_endpointId_json(cJSON* pathObj, struct path_t* p, st return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -812,10 +811,16 @@ void parsing_json_serviceList_array(cJSON* serviceArray) { parse_service_constraints(constraintArray, service); } // Get the maximum number of paths to be computed (kPaths) cJSON* kPathsObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths"); if (cJSON_IsNumber(kPathsObj)){ service->kPaths = (guint)(kPathsObj->valuedouble); // Get the maximum number of paths to be computed (kPaths) inspected/explored cJSON* kPathsInspObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths_inspection"); if (cJSON_IsNumber(kPathsInspObj)){ service->kPaths_inspected = (guint)(kPathsInspObj->valuedouble); } // Get the maximum number of paths to be computed (kPaths) returned cJSON* kPathsRetpObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths_return"); if (cJSON_IsNumber(kPathsRetpObj)){ service->kPaths_returned = (guint)(kPathsRetpObj->valuedouble); } // Append the requested service to the serviceList Loading src/pathcomp/backend/pathComp_ksp.c +6 −6 Original line number Diff line number Diff line Loading @@ -64,14 +64,13 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { for (GList* listnode = g_list_first(serviceList); listnode; listnode = g_list_next(listnode), i++){ //struct service_t* service = &(serviceList->services[i]); struct service_t* service = (struct service_t*)(listnode->data); DEBUG_PC("Starting the Computation for ServiceId: %s [ContextId: %s]", service->serviceId.service_uuid, service->serviceId.contextId); struct compRouteOutput_t* pathService = &(outputList->compRouteConnection[i]); // check endpoints of the service are different (PE devices/nodes are different) if (same_src_dst_pe_nodeid(service) == 0) { DEBUG_PC("PEs are the same... no path computation"); DEBUG_PC("PEs are the same... NO PATH COMPUTATION"); comp_route_connection_issue_handler(pathService, service); outputList->numCompRouteConnList++; continue; Loading @@ -84,6 +83,7 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { outputList->numCompRouteConnList++; continue; } alg_comp(service, pathService, g, NO_OPTIMIZATION_ARGUMENT); // last parameter 0 is related to an optimization computation argument outputList->numCompRouteConnList++; Loading @@ -92,7 +92,8 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { if (pathService->noPathIssue == NO_PATH_CONS_ISSUE) { continue; } struct path_t* path = &(pathService->paths[pathService->numPaths - 1]); // Out of the comnputed paths for the pathservice, the first one is chosen to be locally allocated struct path_t* path = &(pathService->paths[0]); allocate_graph_resources(path, service, g); allocate_graph_reverse_resources(path, service, g); print_graph(g); Loading @@ -111,8 +112,7 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { * @date 2022 */ ///////////////////////////////////////////////////////////////////////////////////////// gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList) { gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList) { g_assert(routeConnList); gint numSuccesPathComp = 0, numPathCompIntents = 0; Loading src/pathcomp/backend/pathComp_tools.c +24 −7 Original line number Diff line number Diff line Loading @@ -3221,6 +3221,18 @@ void set_path_attributes(struct compRouteOutputItem_t* p, struct map_t* mapV) { void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_t* g, guint arg) { g_assert(s); g_assert(path); g_assert(g); // Check if the service specifies a nuumber of K paths to be explored/computed for the // service. If not, compute that number; otherwise set the max number of explored // computed paths to MAX_KSP_VALUE guint maxK = 0; if(s->kPaths_inspected == 0) { maxK = MAX_KSP_VALUE; } else { maxK = s->kPaths_inspected; } DEBUG_PC("The KSP considers K: %d", maxK); // create map of devices/nodes to handle the path computation using the context struct map_nodes_t* mapNodes = create_map_node(); build_map_node(mapNodes, g); Loading Loading @@ -3265,14 +3277,14 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ } path->num_service_endpoints_id = s->num_service_endpoints_id; DEBUG_PC("COMPUTE UP TO K Feasible Paths A[%d]", MAX_KSP_VALUE); DEBUG_PC("COMPUTE UP TO K Feasible Paths A[%d]", maxK); // Create A and B sets of paths to handle the YEN algorithm struct path_set_t *A = create_path_set(), *B = create_path_set(); // Add 1st Computed path into A->paths[0] duplicate_path(p, &A->paths[0]); A->numPaths++; g_free(predecessors); g_free(p); for (gint k = 1; k < MAX_KSP_VALUE; k++) { for (gint k = 1; k < maxK; k++) { DEBUG_PC("*************************** kth (%d) ***********************************", k); struct compRouteOutputItem_t* p = create_path_item(); duplicate_path(&A->paths[k - 1], p); Loading Loading @@ -3377,8 +3389,8 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ DEBUG_PC("Number of paths: %d", path->numPaths); // For all the computed paths in A, pick the one being feasible wrt the service constraints for (gint ksp = 0; ksp < A->numPaths; ksp++) { if (ksp >= MAX_KSP_VALUE) { DEBUG_PC("Number Requested paths (%d) REACHED - STOP", ksp); if (ksp >= s->kPaths_returned) { DEBUG_PC("Number Requested/returned paths (%d) REACHED - STOP", ksp); break; } gdouble feasibleRoute = check_computed_path_feasibility(s, &A->paths[ksp]); Loading @@ -3390,13 +3402,18 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ struct path_t* targetedPath = &path->paths[path->numPaths - 1]; duplicate_path_t(pathaux, targetedPath); print_path_t(targetedPath); remove_path_set(A); remove_path_set(B); return; //remove_path_set(A); //remove_path_set(B); //return; } } remove_path_set(A); remove_path_set(B); // At least 1 out (K) paths was found, then K-SP succeded if (path->numPaths > 0) { DEBUG_PC("K-SP succeeded"); return; } // No paths found --> Issue DEBUG_PC("K-SP failed!!!"); comp_route_connection_issue_handler(path, s); Loading src/pathcomp/backend/pathComp_tools.h +5 −6 Original line number Diff line number Diff line Loading @@ -355,10 +355,9 @@ struct constraint_t { #define MAX_NUM_SERVICE_CONSTRAINTS 10 struct service_t { // Indentifier used to determine the used Algorithm Id, e.g., KSP gchar algId[MAX_ALG_ID_LENGTH]; // PATHS expected for the output guint kPaths; gchar algId[MAX_ALG_ID_LENGTH]; // Indentifier used to determine the used Algorithm Id, e.g., KSP guint kPaths_inspected; // PATHS expected to be inspected guint kPaths_returned; // Maximum number of PATHS to be returned struct serviceId_t serviceId; guint service_type; // unknown, l2nm, l3nm, tapi Loading Loading @@ -432,7 +431,7 @@ struct pathLink_t { gchar zEndPointId[UUID_CHAR_LENGTH]; struct topology_id_t topologyId; struct linkTopology_t linkTopologies[2]; // a p2p link (at most) can connect to devices (endpoints) attached to 2 different topologies struct linkTopology_t linkTopologies[2]; // A p2p link (at most) can connect to devices (endpoints) attached to 2 different topologies gint numLinkTopologies; }; Loading Loading
src/pathcomp/backend/pathComp_RESTapi.c +10 −5 Original line number Diff line number Diff line Loading @@ -281,7 +281,6 @@ void add_comp_path_deviceId_endpointId_json(cJSON* pathObj, struct path_t* p, st return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -812,10 +811,16 @@ void parsing_json_serviceList_array(cJSON* serviceArray) { parse_service_constraints(constraintArray, service); } // Get the maximum number of paths to be computed (kPaths) cJSON* kPathsObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths"); if (cJSON_IsNumber(kPathsObj)){ service->kPaths = (guint)(kPathsObj->valuedouble); // Get the maximum number of paths to be computed (kPaths) inspected/explored cJSON* kPathsInspObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths_inspection"); if (cJSON_IsNumber(kPathsInspObj)){ service->kPaths_inspected = (guint)(kPathsInspObj->valuedouble); } // Get the maximum number of paths to be computed (kPaths) returned cJSON* kPathsRetpObj = cJSON_GetObjectItemCaseSensitive(item, "kPaths_return"); if (cJSON_IsNumber(kPathsRetpObj)){ service->kPaths_returned = (guint)(kPathsRetpObj->valuedouble); } // Append the requested service to the serviceList Loading
src/pathcomp/backend/pathComp_ksp.c +6 −6 Original line number Diff line number Diff line Loading @@ -64,14 +64,13 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { for (GList* listnode = g_list_first(serviceList); listnode; listnode = g_list_next(listnode), i++){ //struct service_t* service = &(serviceList->services[i]); struct service_t* service = (struct service_t*)(listnode->data); DEBUG_PC("Starting the Computation for ServiceId: %s [ContextId: %s]", service->serviceId.service_uuid, service->serviceId.contextId); struct compRouteOutput_t* pathService = &(outputList->compRouteConnection[i]); // check endpoints of the service are different (PE devices/nodes are different) if (same_src_dst_pe_nodeid(service) == 0) { DEBUG_PC("PEs are the same... no path computation"); DEBUG_PC("PEs are the same... NO PATH COMPUTATION"); comp_route_connection_issue_handler(pathService, service); outputList->numCompRouteConnList++; continue; Loading @@ -84,6 +83,7 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { outputList->numCompRouteConnList++; continue; } alg_comp(service, pathService, g, NO_OPTIMIZATION_ARGUMENT); // last parameter 0 is related to an optimization computation argument outputList->numCompRouteConnList++; Loading @@ -92,7 +92,8 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { if (pathService->noPathIssue == NO_PATH_CONS_ISSUE) { continue; } struct path_t* path = &(pathService->paths[pathService->numPaths - 1]); // Out of the comnputed paths for the pathservice, the first one is chosen to be locally allocated struct path_t* path = &(pathService->paths[0]); allocate_graph_resources(path, service, g); allocate_graph_reverse_resources(path, service, g); print_graph(g); Loading @@ -111,8 +112,7 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) { * @date 2022 */ ///////////////////////////////////////////////////////////////////////////////////////// gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList) { gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList) { g_assert(routeConnList); gint numSuccesPathComp = 0, numPathCompIntents = 0; Loading
src/pathcomp/backend/pathComp_tools.c +24 −7 Original line number Diff line number Diff line Loading @@ -3221,6 +3221,18 @@ void set_path_attributes(struct compRouteOutputItem_t* p, struct map_t* mapV) { void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_t* g, guint arg) { g_assert(s); g_assert(path); g_assert(g); // Check if the service specifies a nuumber of K paths to be explored/computed for the // service. If not, compute that number; otherwise set the max number of explored // computed paths to MAX_KSP_VALUE guint maxK = 0; if(s->kPaths_inspected == 0) { maxK = MAX_KSP_VALUE; } else { maxK = s->kPaths_inspected; } DEBUG_PC("The KSP considers K: %d", maxK); // create map of devices/nodes to handle the path computation using the context struct map_nodes_t* mapNodes = create_map_node(); build_map_node(mapNodes, g); Loading Loading @@ -3265,14 +3277,14 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ } path->num_service_endpoints_id = s->num_service_endpoints_id; DEBUG_PC("COMPUTE UP TO K Feasible Paths A[%d]", MAX_KSP_VALUE); DEBUG_PC("COMPUTE UP TO K Feasible Paths A[%d]", maxK); // Create A and B sets of paths to handle the YEN algorithm struct path_set_t *A = create_path_set(), *B = create_path_set(); // Add 1st Computed path into A->paths[0] duplicate_path(p, &A->paths[0]); A->numPaths++; g_free(predecessors); g_free(p); for (gint k = 1; k < MAX_KSP_VALUE; k++) { for (gint k = 1; k < maxK; k++) { DEBUG_PC("*************************** kth (%d) ***********************************", k); struct compRouteOutputItem_t* p = create_path_item(); duplicate_path(&A->paths[k - 1], p); Loading Loading @@ -3377,8 +3389,8 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ DEBUG_PC("Number of paths: %d", path->numPaths); // For all the computed paths in A, pick the one being feasible wrt the service constraints for (gint ksp = 0; ksp < A->numPaths; ksp++) { if (ksp >= MAX_KSP_VALUE) { DEBUG_PC("Number Requested paths (%d) REACHED - STOP", ksp); if (ksp >= s->kPaths_returned) { DEBUG_PC("Number Requested/returned paths (%d) REACHED - STOP", ksp); break; } gdouble feasibleRoute = check_computed_path_feasibility(s, &A->paths[ksp]); Loading @@ -3390,13 +3402,18 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ struct path_t* targetedPath = &path->paths[path->numPaths - 1]; duplicate_path_t(pathaux, targetedPath); print_path_t(targetedPath); remove_path_set(A); remove_path_set(B); return; //remove_path_set(A); //remove_path_set(B); //return; } } remove_path_set(A); remove_path_set(B); // At least 1 out (K) paths was found, then K-SP succeded if (path->numPaths > 0) { DEBUG_PC("K-SP succeeded"); return; } // No paths found --> Issue DEBUG_PC("K-SP failed!!!"); comp_route_connection_issue_handler(path, s); Loading
src/pathcomp/backend/pathComp_tools.h +5 −6 Original line number Diff line number Diff line Loading @@ -355,10 +355,9 @@ struct constraint_t { #define MAX_NUM_SERVICE_CONSTRAINTS 10 struct service_t { // Indentifier used to determine the used Algorithm Id, e.g., KSP gchar algId[MAX_ALG_ID_LENGTH]; // PATHS expected for the output guint kPaths; gchar algId[MAX_ALG_ID_LENGTH]; // Indentifier used to determine the used Algorithm Id, e.g., KSP guint kPaths_inspected; // PATHS expected to be inspected guint kPaths_returned; // Maximum number of PATHS to be returned struct serviceId_t serviceId; guint service_type; // unknown, l2nm, l3nm, tapi Loading Loading @@ -432,7 +431,7 @@ struct pathLink_t { gchar zEndPointId[UUID_CHAR_LENGTH]; struct topology_id_t topologyId; struct linkTopology_t linkTopologies[2]; // a p2p link (at most) can connect to devices (endpoints) attached to 2 different topologies struct linkTopology_t linkTopologies[2]; // A p2p link (at most) can connect to devices (endpoints) attached to 2 different topologies gint numLinkTopologies; }; Loading