Loading src/pathcomp/backend/pathComp_RESTapi.c +152 −2 Original line number Diff line number Diff line Loading @@ -210,6 +210,77 @@ void rapi_add_date_header (char *date) return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c * @brief Function used to add DeviceId and EndpointId forming the computed path * * @param pathObj * @param p * * @author Ricardo Martínez <ricardo.martinez@cttc.es> * @date 2022 */ ///////////////////////////////////////////////////////////////////////////////////////// void add_comp_path_deviceId_endpointId_json(cJSON* pathObj, struct path_t* p, struct compRouteOutput_t* oElem) { g_assert(p); g_assert(pathObj); // add array for the devideId and endpointIds cJSON* devicesArray = cJSON_CreateArray(); cJSON_AddItemToObject(pathObj, "devices", devicesArray); // Add the source endpoint cJSON* sEndPointIdObj; cJSON_AddItemToArray(devicesArray, sEndPointIdObj = cJSON_CreateObject()); // Add the topology Id Object containing the topology uuid and context uuid cJSON* stopIdObj; cJSON_AddItemToObject(sEndPointIdObj, "topology_id", stopIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(stopIdObj, "contextId", cJSON_CreateString(oElem->service_endpoints_id[0].topology_id.contextId)); cJSON_AddItemToObject(stopIdObj, "topology_uuid", cJSON_CreateString(oElem->service_endpoints_id[0].topology_id.topology_uuid)); // Add the device Id (uuid) cJSON_AddItemToObject(sEndPointIdObj, "device_id", cJSON_CreateString(oElem->service_endpoints_id[0].device_uuid)); // Add the endpoint Id (uuid) cJSON_AddItemToObject(sEndPointIdObj, "endpoint_uuid", cJSON_CreateString(oElem->service_endpoints_id[0].endpoint_uuid)); for (gint i = 0; i < p->numPathLinks; i++) { struct pathLink_t* pL = &(p->pathLinks[i]); cJSON* dElemObj; // Device Element Object of the array cJSON_AddItemToArray(devicesArray, dElemObj = cJSON_CreateObject()); // Add the topologyId with the topologyuuid and contextId cJSON* tIdObj; cJSON_AddItemToObject(dElemObj, "topology_id", tIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(tIdObj, "contextId", cJSON_CreateString(pL->topologyId.contextId)); cJSON_AddItemToObject(tIdObj, "topology_uuid", cJSON_CreateString(pL->topologyId.topology_uuid)); // Add Device Id cJSON_AddItemToObject(dElemObj, "device_id", cJSON_CreateString(pL->aDeviceId)); // Add endpoint Id cJSON_AddItemToObject(dElemObj, "endpoint_uuid", cJSON_CreateString(pL->aEndPointId)); } // Add the sink endpoint cJSON* sinkEndPointIdObj; cJSON_AddItemToArray(devicesArray, sinkEndPointIdObj = cJSON_CreateObject()); // Add the topology Id Object containing the topology uuid and context uuid cJSON* sinkTopIdObj; cJSON_AddItemToObject(sinkEndPointIdObj, "topology_id", sinkTopIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(sinkTopIdObj, "contextId", cJSON_CreateString(oElem->service_endpoints_id[1].topology_id.contextId)); cJSON_AddItemToObject(sinkTopIdObj, "topology_uuid", cJSON_CreateString(oElem->service_endpoints_id[1].topology_id.topology_uuid)); // Add the device Id (uuid) cJSON_AddItemToObject(sinkEndPointIdObj, "device_id", cJSON_CreateString(oElem->service_endpoints_id[1].device_uuid)); // Add the endpoint Id (uuid) cJSON_AddItemToObject(sinkEndPointIdObj, "endpoint_uuid", cJSON_CreateString(oElem->service_endpoints_id[1].endpoint_uuid)); return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -354,7 +425,9 @@ void rapi_response_json_contents (char *body, gint *length, struct compRouteOutp cJSON_AddItemToObject(pathCostObj, "cost-algorithm", cJSON_CreateString(algorithm)); // Add the links add_comp_path_link_json(pathObj, p); //add_comp_path_link_json(pathObj, p); // Add deviceId, endpointId add_comp_path_deviceId_endpointId_json(pathObj, p, oElem); } } Loading Loading @@ -869,7 +942,7 @@ void parsing_json_deviceList_array(cJSON* deviceArray) { void parse_json_link_endpoints_array(cJSON *endPointsLinkObj, struct link_t* l) { for (gint i = 0; i < cJSON_GetArraySize(endPointsLinkObj); i++) { l->numLinkEndPointIds; l->numLinkEndPointIds++; struct link_endpointId_t* endPointLink = &(l->linkEndPointId[i]); cJSON* item = cJSON_GetArrayItem(endPointsLinkObj, i); Loading Loading @@ -1000,6 +1073,79 @@ void parsing_json_linkList_array(cJSON* linkListArray) { return; } /////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c * @brief Function used to generate the reverse (unidirecitonal) link from those being learnt * from the received context * * @author Ricardo Martínez <ricardo.martinez@cttc.es> * @date 2022 */ //////////////////////////////////////////////////////////////////////////////////////// void generate_reverse_linkList() { DEBUG_PC("Starting the Creation of the Reverse Links [current: %d]", linkList->numLinks); gint numLinks = linkList->numLinks; for (gint i = 0; i < numLinks; i++) { struct link_t* refLink = &(linkList->links[i]); struct link_t* newLink = &(linkList->links[numLinks + i]); linkList->numLinks++; // Copy the linkId + appending "_rev" duplicate_string(newLink->linkId, refLink->linkId); strcat(newLink->linkId, "_rev"); //DEBUG_PC("refLink: %s // newLink: %s", refLink->linkId, newLink->linkId); // Assumption: p2p links. The newLink endpoints are the reversed ones form the reference Link (refLink) // i.e., refLink A->B, then newLink B->A #if 0 if (refLink->numLinkEndPointIds != 2) { DEBUG_PC("To construct the new Link from ref, 2 EndPoints are a MUST"); exit(-1); } #endif //DEBUG_PC("Number of Endpoints in Link: %d", refLink->numLinkEndPointIds); for (gint j = refLink->numLinkEndPointIds - 1, m = 0; j >= 0; j--, m++) { struct link_endpointId_t* refEndPId = &(refLink->linkEndPointId[j]); struct link_endpointId_t* newEndPId = &(newLink->linkEndPointId[m]); // Duplicate the topologyId information, i.e., contextId and topology_uuid duplicate_string(newEndPId->topology_id.contextId, refEndPId->topology_id.contextId); duplicate_string(newEndPId->topology_id.topology_uuid, refEndPId->topology_id.topology_uuid); //duplicate the deviceId and endPoint_uuid duplicate_string(newEndPId->deviceId, refEndPId->deviceId); duplicate_string(newEndPId->endPointId, refEndPId->endPointId); //DEBUG_PC("refLink Endpoint[%d]: %s(%s)", j, refEndPId->deviceId, refEndPId->endPointId); //DEBUG_PC("newLink Endpoint[%d]: %s(%s)", m, newEndPId->deviceId, newEndPId->endPointId); newLink->numLinkEndPointIds++; } // duplicate forwarding direction newLink->forwarding_direction = refLink->forwarding_direction; // duplicate capacity attributes memcpy(&newLink->potential_capacity.value, &refLink->potential_capacity.value, sizeof(gdouble)); newLink->potential_capacity.unit = refLink->potential_capacity.unit; memcpy(&newLink->available_capacity.value, &refLink->available_capacity.value, sizeof(gdouble)); newLink->available_capacity.unit = refLink->available_capacity.unit; // duplicate cost characteristics memcpy(&newLink->cost_characteristics.cost_value, &refLink->cost_characteristics.cost_value, sizeof(gdouble)); memcpy(&newLink->cost_characteristics.cost_algorithm, &refLink->cost_characteristics.cost_algorithm, sizeof(gdouble)); duplicate_string(newLink->cost_characteristics.cost_name, refLink->cost_characteristics.cost_name); // duplicate latency characteristics memcpy(&newLink->latency_characteristics.fixed_latency, &refLink->latency_characteristics.fixed_latency, sizeof(gdouble)); } DEBUG_PC("Terminating Reverse Links [total: %d]", linkList->numLinks); return; } /////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -1047,6 +1193,10 @@ void parsing_json_obj_pathComp_request(cJSON * root, GIOChannel * source) cJSON* linkListArray = cJSON_GetObjectItem(root, "linkList"); if (cJSON_IsArray(linkListArray)) { parsing_json_linkList_array(linkListArray); // In the context information, if solely the list of links are passed for a single direction, // the reverse direction MUST be created sythetically generate_reverse_linkList(); } return; } Loading src/pathcomp/backend/pathComp_ksp.c +3 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ DEBUG_PC("NO PATH FOUND %s[%s] ---> %s[%s]", iEp->device_uuid, iEp->endpoint_uuid, eEp->device_uuid, eEp->endpoint_uuid); comp_route_connection_issue_handler(path, s); g_free(mapNodes); g_free(predecessors); return; } // Construct the path from the computed predecessors Loading @@ -332,6 +333,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ memcpy(&p->availCap, &dst_map->avaiBandwidth, sizeof(dst_map->avaiBandwidth)); memcpy(&p->delay, &dst_map->latency, sizeof(mapNodes->map[indexDest].latency)); DEBUG_PC ("Computed Path Avail Bw: %f, Path Cost: %f, latency: %f", p->availCap, p->cost, p->delay); print_path(p); // If 1st SP satisfies the requirements from the req, STOP gboolean feasibleRoute = check_computed_path_feasability(s, p); Loading @@ -341,6 +343,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ path->numPaths++; // Copy the serviceId DEBUG_PC("contextId: %s", s->serviceId.contextId); copy_service_id(&path->serviceId, &s->serviceId); // copy the service endpoints, in general, there will be 2 (point-to-point network connectivity services) Loading src/pathcomp/backend/pathComp_tools.c +23 −5 Original line number Diff line number Diff line Loading @@ -132,8 +132,12 @@ void print_path_t(struct path_t* p) { for (gint k = 0; k < p->numPathLinks; k++) { DEBUG_PC("Link: %s", p->pathLinks[k].linkId); for (gint l = 0; l < p->pathLinks[k].numLinkTopologies; l++) { DEBUG_PC("topologyId: %s", p->pathLinks[k].linkTopologies[l].topologyId); DEBUG_PC("end Link [%d] TopologyId: %s", l, p->pathLinks[k].linkTopologies[l].topologyId); } DEBUG_PC(" ContextId: %s", p->pathLinks[k].topologyId.contextId); DEBUG_PC(" TopologyUUid: %s", p->pathLinks[k].topologyId.topology_uuid); DEBUG_PC(" aDeviceId: %s", p->pathLinks[k].aDeviceId); DEBUG_PC(" aEndpointId: %s", p->pathLinks[k].aEndPointId); } return; } Loading Loading @@ -624,6 +628,15 @@ void duplicate_path_t(struct compRouteOutputItem_t* a, struct path_t* b) struct routeElement_t* rE = &(a->routeElement[k]); struct pathLink_t* pL = &(b->pathLinks[k]); // copy the aDeviceId and aEndpointId, zDeviceId and zEndPointId duplicate_string(pL->aDeviceId, rE->aNodeId.nodeId); duplicate_string(pL->zDeviceId, rE->zNodeId.nodeId); duplicate_string(pL->aEndPointId, rE->aEndPointId); duplicate_string(pL->zEndPointId, rE->zEndPointId); duplicate_string(pL->topologyId.topology_uuid, rE->aTopologyId); duplicate_string(pL->topologyId.contextId, rE->contextId); //copy the linkId duplicate_string(pL->linkId, rE->linkId); pL->numLinkTopologies++; Loading Loading @@ -760,6 +773,7 @@ void build_path (struct compRouteOutputItem_t *p, struct pred_t *predecessors, s duplicate_string(p->routeElement[k].linkId, e->linkId); duplicate_string(p->routeElement[k].aTopologyId, e->aTopologyId); duplicate_string(p->routeElement[k].zTopologyId, e->zTopologyId); duplicate_string(p->routeElement[k].contextId, s->serviceId.contextId); p->numRouteElements++; // Get the destination device Id of the network connectivity service Loading @@ -782,6 +796,10 @@ void build_path (struct compRouteOutputItem_t *p, struct pred_t *predecessors, s duplicate_string(p->routeElement[k].linkId, e->linkId); duplicate_string(p->routeElement[k].aTopologyId, e->aTopologyId); duplicate_string(p->routeElement[k].zTopologyId, e->zTopologyId); duplicate_string(p->routeElement[k].contextId, s->serviceId.contextId); // copy the contextId //duplicate_string(p->routeElement[k].contextId, s->service_endpoints_id[0].topology_id.contextId); } g_free(e); g_free(v); g_free(pathCons); //DEBUG_PC ("Path is constructed"); Loading Loading @@ -2110,7 +2128,7 @@ struct targetNodes_t* add_targeted_vertex_in_graph_context(struct vertices_t* v, */ ///////////////////////////////////////////////////////////////////////////////////////// struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) { DEBUG_PC("devId: %s ePId: %s", devId, endPointUuid); //DEBUG_PC("devId: %s ePId: %s", devId, endPointUuid); for (gint i = 0; i < deviceList->numDevices; i++) { struct device_t* d = &(deviceList->devices[i]); if (strcmp(d->deviceId, devId) != 0) { Loading @@ -2119,7 +2137,7 @@ struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) // Iterate over the endpoints tied to the deviceId for (gint j = 0; j < d->numEndPoints; j++) { struct endPoint_t* eP = &(d->endPoints[j]); DEBUG_PC("looked endPointId: %s", eP->endPointId.endpoint_uuid); //DEBUG_PC("looked endPointId: %s", eP->endPointId.endpoint_uuid); if (strcmp(eP->endPointId.endpoint_uuid, endPointUuid) == 0) { return eP; } Loading @@ -2141,7 +2159,7 @@ struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) */ ///////////////////////////////////////////////////////////////////////////////////////// void add_edge_in_targetedVertice_set(struct targetNodes_t* w, struct link_t* l) { DEBUG_PC("\t targetedVertex: %s", w->tVertice.nodeId); //DEBUG_PC("\t targetedVertex: %s", w->tVertice.nodeId); w->numEdges++; struct edges_t* e = &(w->edges[w->numEdges - 1]); // Copy the link Id UUID Loading src/pathcomp/backend/pathComp_tools.h +10 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,13 @@ struct linkTopology_t { struct pathLink_t { gchar linkId[UUID_CHAR_LENGTH]; // link id UUID in char format gchar aDeviceId[UUID_CHAR_LENGTH]; gchar zDeviceId[UUID_CHAR_LENGTH]; gchar aEndPointId[UUID_CHAR_LENGTH]; 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 gint numLinkTopologies; }; Loading @@ -436,6 +443,9 @@ struct routeElement_t { gchar aTopologyId[UUID_CHAR_LENGTH]; gchar zTopologyId[UUID_CHAR_LENGTH]; // contextId gchar contextId[UUID_CHAR_LENGTH]; }; struct compRouteOutputItem_t { Loading src/pathcomp/backend/test/pc-req.json 0 → 100644 +1230 −0 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
src/pathcomp/backend/pathComp_RESTapi.c +152 −2 Original line number Diff line number Diff line Loading @@ -210,6 +210,77 @@ void rapi_add_date_header (char *date) return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c * @brief Function used to add DeviceId and EndpointId forming the computed path * * @param pathObj * @param p * * @author Ricardo Martínez <ricardo.martinez@cttc.es> * @date 2022 */ ///////////////////////////////////////////////////////////////////////////////////////// void add_comp_path_deviceId_endpointId_json(cJSON* pathObj, struct path_t* p, struct compRouteOutput_t* oElem) { g_assert(p); g_assert(pathObj); // add array for the devideId and endpointIds cJSON* devicesArray = cJSON_CreateArray(); cJSON_AddItemToObject(pathObj, "devices", devicesArray); // Add the source endpoint cJSON* sEndPointIdObj; cJSON_AddItemToArray(devicesArray, sEndPointIdObj = cJSON_CreateObject()); // Add the topology Id Object containing the topology uuid and context uuid cJSON* stopIdObj; cJSON_AddItemToObject(sEndPointIdObj, "topology_id", stopIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(stopIdObj, "contextId", cJSON_CreateString(oElem->service_endpoints_id[0].topology_id.contextId)); cJSON_AddItemToObject(stopIdObj, "topology_uuid", cJSON_CreateString(oElem->service_endpoints_id[0].topology_id.topology_uuid)); // Add the device Id (uuid) cJSON_AddItemToObject(sEndPointIdObj, "device_id", cJSON_CreateString(oElem->service_endpoints_id[0].device_uuid)); // Add the endpoint Id (uuid) cJSON_AddItemToObject(sEndPointIdObj, "endpoint_uuid", cJSON_CreateString(oElem->service_endpoints_id[0].endpoint_uuid)); for (gint i = 0; i < p->numPathLinks; i++) { struct pathLink_t* pL = &(p->pathLinks[i]); cJSON* dElemObj; // Device Element Object of the array cJSON_AddItemToArray(devicesArray, dElemObj = cJSON_CreateObject()); // Add the topologyId with the topologyuuid and contextId cJSON* tIdObj; cJSON_AddItemToObject(dElemObj, "topology_id", tIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(tIdObj, "contextId", cJSON_CreateString(pL->topologyId.contextId)); cJSON_AddItemToObject(tIdObj, "topology_uuid", cJSON_CreateString(pL->topologyId.topology_uuid)); // Add Device Id cJSON_AddItemToObject(dElemObj, "device_id", cJSON_CreateString(pL->aDeviceId)); // Add endpoint Id cJSON_AddItemToObject(dElemObj, "endpoint_uuid", cJSON_CreateString(pL->aEndPointId)); } // Add the sink endpoint cJSON* sinkEndPointIdObj; cJSON_AddItemToArray(devicesArray, sinkEndPointIdObj = cJSON_CreateObject()); // Add the topology Id Object containing the topology uuid and context uuid cJSON* sinkTopIdObj; cJSON_AddItemToObject(sinkEndPointIdObj, "topology_id", sinkTopIdObj = cJSON_CreateObject()); cJSON_AddItemToObject(sinkTopIdObj, "contextId", cJSON_CreateString(oElem->service_endpoints_id[1].topology_id.contextId)); cJSON_AddItemToObject(sinkTopIdObj, "topology_uuid", cJSON_CreateString(oElem->service_endpoints_id[1].topology_id.topology_uuid)); // Add the device Id (uuid) cJSON_AddItemToObject(sinkEndPointIdObj, "device_id", cJSON_CreateString(oElem->service_endpoints_id[1].device_uuid)); // Add the endpoint Id (uuid) cJSON_AddItemToObject(sinkEndPointIdObj, "endpoint_uuid", cJSON_CreateString(oElem->service_endpoints_id[1].endpoint_uuid)); return; } //////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -354,7 +425,9 @@ void rapi_response_json_contents (char *body, gint *length, struct compRouteOutp cJSON_AddItemToObject(pathCostObj, "cost-algorithm", cJSON_CreateString(algorithm)); // Add the links add_comp_path_link_json(pathObj, p); //add_comp_path_link_json(pathObj, p); // Add deviceId, endpointId add_comp_path_deviceId_endpointId_json(pathObj, p, oElem); } } Loading Loading @@ -869,7 +942,7 @@ void parsing_json_deviceList_array(cJSON* deviceArray) { void parse_json_link_endpoints_array(cJSON *endPointsLinkObj, struct link_t* l) { for (gint i = 0; i < cJSON_GetArraySize(endPointsLinkObj); i++) { l->numLinkEndPointIds; l->numLinkEndPointIds++; struct link_endpointId_t* endPointLink = &(l->linkEndPointId[i]); cJSON* item = cJSON_GetArrayItem(endPointsLinkObj, i); Loading Loading @@ -1000,6 +1073,79 @@ void parsing_json_linkList_array(cJSON* linkListArray) { return; } /////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c * @brief Function used to generate the reverse (unidirecitonal) link from those being learnt * from the received context * * @author Ricardo Martínez <ricardo.martinez@cttc.es> * @date 2022 */ //////////////////////////////////////////////////////////////////////////////////////// void generate_reverse_linkList() { DEBUG_PC("Starting the Creation of the Reverse Links [current: %d]", linkList->numLinks); gint numLinks = linkList->numLinks; for (gint i = 0; i < numLinks; i++) { struct link_t* refLink = &(linkList->links[i]); struct link_t* newLink = &(linkList->links[numLinks + i]); linkList->numLinks++; // Copy the linkId + appending "_rev" duplicate_string(newLink->linkId, refLink->linkId); strcat(newLink->linkId, "_rev"); //DEBUG_PC("refLink: %s // newLink: %s", refLink->linkId, newLink->linkId); // Assumption: p2p links. The newLink endpoints are the reversed ones form the reference Link (refLink) // i.e., refLink A->B, then newLink B->A #if 0 if (refLink->numLinkEndPointIds != 2) { DEBUG_PC("To construct the new Link from ref, 2 EndPoints are a MUST"); exit(-1); } #endif //DEBUG_PC("Number of Endpoints in Link: %d", refLink->numLinkEndPointIds); for (gint j = refLink->numLinkEndPointIds - 1, m = 0; j >= 0; j--, m++) { struct link_endpointId_t* refEndPId = &(refLink->linkEndPointId[j]); struct link_endpointId_t* newEndPId = &(newLink->linkEndPointId[m]); // Duplicate the topologyId information, i.e., contextId and topology_uuid duplicate_string(newEndPId->topology_id.contextId, refEndPId->topology_id.contextId); duplicate_string(newEndPId->topology_id.topology_uuid, refEndPId->topology_id.topology_uuid); //duplicate the deviceId and endPoint_uuid duplicate_string(newEndPId->deviceId, refEndPId->deviceId); duplicate_string(newEndPId->endPointId, refEndPId->endPointId); //DEBUG_PC("refLink Endpoint[%d]: %s(%s)", j, refEndPId->deviceId, refEndPId->endPointId); //DEBUG_PC("newLink Endpoint[%d]: %s(%s)", m, newEndPId->deviceId, newEndPId->endPointId); newLink->numLinkEndPointIds++; } // duplicate forwarding direction newLink->forwarding_direction = refLink->forwarding_direction; // duplicate capacity attributes memcpy(&newLink->potential_capacity.value, &refLink->potential_capacity.value, sizeof(gdouble)); newLink->potential_capacity.unit = refLink->potential_capacity.unit; memcpy(&newLink->available_capacity.value, &refLink->available_capacity.value, sizeof(gdouble)); newLink->available_capacity.unit = refLink->available_capacity.unit; // duplicate cost characteristics memcpy(&newLink->cost_characteristics.cost_value, &refLink->cost_characteristics.cost_value, sizeof(gdouble)); memcpy(&newLink->cost_characteristics.cost_algorithm, &refLink->cost_characteristics.cost_algorithm, sizeof(gdouble)); duplicate_string(newLink->cost_characteristics.cost_name, refLink->cost_characteristics.cost_name); // duplicate latency characteristics memcpy(&newLink->latency_characteristics.fixed_latency, &refLink->latency_characteristics.fixed_latency, sizeof(gdouble)); } DEBUG_PC("Terminating Reverse Links [total: %d]", linkList->numLinks); return; } /////////////////////////////////////////////////////////////////////////////////////// /** * @file pathComp_RESTapi.c Loading Loading @@ -1047,6 +1193,10 @@ void parsing_json_obj_pathComp_request(cJSON * root, GIOChannel * source) cJSON* linkListArray = cJSON_GetObjectItem(root, "linkList"); if (cJSON_IsArray(linkListArray)) { parsing_json_linkList_array(linkListArray); // In the context information, if solely the list of links are passed for a single direction, // the reverse direction MUST be created sythetically generate_reverse_linkList(); } return; } Loading
src/pathcomp/backend/pathComp_ksp.c +3 −0 Original line number Diff line number Diff line Loading @@ -317,6 +317,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ DEBUG_PC("NO PATH FOUND %s[%s] ---> %s[%s]", iEp->device_uuid, iEp->endpoint_uuid, eEp->device_uuid, eEp->endpoint_uuid); comp_route_connection_issue_handler(path, s); g_free(mapNodes); g_free(predecessors); return; } // Construct the path from the computed predecessors Loading @@ -332,6 +333,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ memcpy(&p->availCap, &dst_map->avaiBandwidth, sizeof(dst_map->avaiBandwidth)); memcpy(&p->delay, &dst_map->latency, sizeof(mapNodes->map[indexDest].latency)); DEBUG_PC ("Computed Path Avail Bw: %f, Path Cost: %f, latency: %f", p->availCap, p->cost, p->delay); print_path(p); // If 1st SP satisfies the requirements from the req, STOP gboolean feasibleRoute = check_computed_path_feasability(s, p); Loading @@ -341,6 +343,7 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_ path->numPaths++; // Copy the serviceId DEBUG_PC("contextId: %s", s->serviceId.contextId); copy_service_id(&path->serviceId, &s->serviceId); // copy the service endpoints, in general, there will be 2 (point-to-point network connectivity services) Loading
src/pathcomp/backend/pathComp_tools.c +23 −5 Original line number Diff line number Diff line Loading @@ -132,8 +132,12 @@ void print_path_t(struct path_t* p) { for (gint k = 0; k < p->numPathLinks; k++) { DEBUG_PC("Link: %s", p->pathLinks[k].linkId); for (gint l = 0; l < p->pathLinks[k].numLinkTopologies; l++) { DEBUG_PC("topologyId: %s", p->pathLinks[k].linkTopologies[l].topologyId); DEBUG_PC("end Link [%d] TopologyId: %s", l, p->pathLinks[k].linkTopologies[l].topologyId); } DEBUG_PC(" ContextId: %s", p->pathLinks[k].topologyId.contextId); DEBUG_PC(" TopologyUUid: %s", p->pathLinks[k].topologyId.topology_uuid); DEBUG_PC(" aDeviceId: %s", p->pathLinks[k].aDeviceId); DEBUG_PC(" aEndpointId: %s", p->pathLinks[k].aEndPointId); } return; } Loading Loading @@ -624,6 +628,15 @@ void duplicate_path_t(struct compRouteOutputItem_t* a, struct path_t* b) struct routeElement_t* rE = &(a->routeElement[k]); struct pathLink_t* pL = &(b->pathLinks[k]); // copy the aDeviceId and aEndpointId, zDeviceId and zEndPointId duplicate_string(pL->aDeviceId, rE->aNodeId.nodeId); duplicate_string(pL->zDeviceId, rE->zNodeId.nodeId); duplicate_string(pL->aEndPointId, rE->aEndPointId); duplicate_string(pL->zEndPointId, rE->zEndPointId); duplicate_string(pL->topologyId.topology_uuid, rE->aTopologyId); duplicate_string(pL->topologyId.contextId, rE->contextId); //copy the linkId duplicate_string(pL->linkId, rE->linkId); pL->numLinkTopologies++; Loading Loading @@ -760,6 +773,7 @@ void build_path (struct compRouteOutputItem_t *p, struct pred_t *predecessors, s duplicate_string(p->routeElement[k].linkId, e->linkId); duplicate_string(p->routeElement[k].aTopologyId, e->aTopologyId); duplicate_string(p->routeElement[k].zTopologyId, e->zTopologyId); duplicate_string(p->routeElement[k].contextId, s->serviceId.contextId); p->numRouteElements++; // Get the destination device Id of the network connectivity service Loading @@ -782,6 +796,10 @@ void build_path (struct compRouteOutputItem_t *p, struct pred_t *predecessors, s duplicate_string(p->routeElement[k].linkId, e->linkId); duplicate_string(p->routeElement[k].aTopologyId, e->aTopologyId); duplicate_string(p->routeElement[k].zTopologyId, e->zTopologyId); duplicate_string(p->routeElement[k].contextId, s->serviceId.contextId); // copy the contextId //duplicate_string(p->routeElement[k].contextId, s->service_endpoints_id[0].topology_id.contextId); } g_free(e); g_free(v); g_free(pathCons); //DEBUG_PC ("Path is constructed"); Loading Loading @@ -2110,7 +2128,7 @@ struct targetNodes_t* add_targeted_vertex_in_graph_context(struct vertices_t* v, */ ///////////////////////////////////////////////////////////////////////////////////////// struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) { DEBUG_PC("devId: %s ePId: %s", devId, endPointUuid); //DEBUG_PC("devId: %s ePId: %s", devId, endPointUuid); for (gint i = 0; i < deviceList->numDevices; i++) { struct device_t* d = &(deviceList->devices[i]); if (strcmp(d->deviceId, devId) != 0) { Loading @@ -2119,7 +2137,7 @@ struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) // Iterate over the endpoints tied to the deviceId for (gint j = 0; j < d->numEndPoints; j++) { struct endPoint_t* eP = &(d->endPoints[j]); DEBUG_PC("looked endPointId: %s", eP->endPointId.endpoint_uuid); //DEBUG_PC("looked endPointId: %s", eP->endPointId.endpoint_uuid); if (strcmp(eP->endPointId.endpoint_uuid, endPointUuid) == 0) { return eP; } Loading @@ -2141,7 +2159,7 @@ struct endPoint_t* find_device_tied_endpoint(gchar* devId, gchar* endPointUuid) */ ///////////////////////////////////////////////////////////////////////////////////////// void add_edge_in_targetedVertice_set(struct targetNodes_t* w, struct link_t* l) { DEBUG_PC("\t targetedVertex: %s", w->tVertice.nodeId); //DEBUG_PC("\t targetedVertex: %s", w->tVertice.nodeId); w->numEdges++; struct edges_t* e = &(w->edges[w->numEdges - 1]); // Copy the link Id UUID Loading
src/pathcomp/backend/pathComp_tools.h +10 −0 Original line number Diff line number Diff line Loading @@ -413,6 +413,13 @@ struct linkTopology_t { struct pathLink_t { gchar linkId[UUID_CHAR_LENGTH]; // link id UUID in char format gchar aDeviceId[UUID_CHAR_LENGTH]; gchar zDeviceId[UUID_CHAR_LENGTH]; gchar aEndPointId[UUID_CHAR_LENGTH]; 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 gint numLinkTopologies; }; Loading @@ -436,6 +443,9 @@ struct routeElement_t { gchar aTopologyId[UUID_CHAR_LENGTH]; gchar zTopologyId[UUID_CHAR_LENGTH]; // contextId gchar contextId[UUID_CHAR_LENGTH]; }; struct compRouteOutputItem_t { Loading
src/pathcomp/backend/test/pc-req.json 0 → 100644 +1230 −0 File added.Preview size limit exceeded, changes collapsed. Show changes