Skip to content
Snippets Groups Projects
Commit c39b0232 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/pathcomp-component-backend' into 'develop'

PathComp_Backend: Resource Context Improvement and Support of Energy Aware Routing Alg.

See merge request !76
parents ca74ba7d 148ceb15
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!76PathComp_Backend: Resource Context Improvement and Support of Energy Aware Routing Alg.
......@@ -30,16 +30,16 @@ coverage: CFLAGS += -O0 -ggdb -g -DDEBUG -fprofile-arcs -ftest-coverage -DGCOV
coverage: LDFLAGS += -g -lgcov --coverage -fprofile-arcs -ftest-coverage -DGCOV
coverage: pathComp-cvr
pathComp: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o
gcc -o pathComp pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o \
pathComp: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o
gcc -o pathComp pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o \
-L/usr/lib/x86_64-linux-gnu/ -lglib-2.0 -luuid $(LDFLAGS) $(LDLIBS)
pathComp-dbg: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o
gcc -o pathComp-dbg pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o \
pathComp-dbg: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o
gcc -o pathComp-dbg pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o \
-L/usr/lib/x86_64-linux-gnu/ -lglib-2.0 -luuid $(LDFLAGS) $(LDLIBS)
pathComp-cvr: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o
gcc -o pathComp-cvr pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_RESTapi.o \
pathComp-cvr: pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o
gcc -o pathComp-cvr pathComp.o pathComp_log.o pathComp_cjson.o pathComp_tools.o pathComp_ksp.o pathComp_sp.o pathComp_ear.o pathComp_RESTapi.o \
-L/usr/lib/x86_64-linux-gnu/ -lglib-2.0 -luuid $(LDFLAGS) $(LDLIBS)
pathComp_log.o: pathComp_log.h pathComp_log.c
......@@ -56,8 +56,11 @@ pathComp_ksp.o: pathComp_log.h pathComp_tools.h pathComp_ksp.h pathComp_ksp.c
pathComp_sp.o: pathComp_log.h pathComp_tools.h pathComp_sp.h pathComp_sp.c
$(CC) $(CFLAGS) -c pathComp_sp.c -o pathComp_sp.o
pathComp_ear.o: pathComp_log.h pathComp_tools.h pathComp_ear.h pathComp_ear.c
$(CC) $(CFLAGS) -c pathComp_ear.c -o pathComp_ear.o
pathComp_RESTapi.o: pathComp_tools.h pathComp_log.h pathComp_cjson.h pathComp_ksp.h pathComp_sp.h pathComp_RESTapi.h pathComp_RESTapi.c
pathComp_RESTapi.o: pathComp_tools.h pathComp_log.h pathComp_cjson.h pathComp_ksp.h pathComp_sp.h pathComp_ear.h pathComp_RESTapi.h pathComp_RESTapi.c
$(CC) $(CFLAGS) -c pathComp_RESTapi.c -o pathComp_RESTapi.o
pathComp.o: pathComp_log.h pathComp_RESTapi.h pathComp.c pathComp.h
......
......@@ -48,10 +48,8 @@ void my_gcov_handler(int signum)
// External Variables
FILE *logfile = NULL;
// PATH COMP IP address API Client
struct in_addr pathComp_IpAddr;
// REST API ENABLED
int RESTAPI_ENABLED = 0;
......
This diff is collapsed.
......@@ -48,8 +48,7 @@
// List of tcp clients connected to PATH COMP
#define PATH_COMP_CLIENT_TYPE 1000
struct pathComp_client
{
struct pathComp_client {
/** IO Channel from client. */
GIOChannel *channel;
......
/*
* Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <glib.h>
#include <sys/time.h>
#include <ctype.h>
#include <strings.h>
#include <time.h>
#include <math.h>
#include <fcntl.h>
#include "pathComp_log.h"
#include "pathComp_tools.h"
#include "pathComp_ear.h"
// Global Variables
GList* contextSet;
////////////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ear.c
* @brief Iterates over the list of network connectivity service requests
* to compute their own paths fulfilling the constraints and minimizing the
* total consume energy (power)
*
* @param outputList
*
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
void ear_comp_services(struct compRouteOutputList_t* oPathList, gint activeFlag) {
g_assert(oPathList);
// Check at least there is a service to be processed
if (g_list_length(serviceList) == 0) {
DEBUG_PC("serviceList is Empty...");
return;
}
gint i = 0;
DEBUG_PC("[EAR]----- Starting the Energy Aware Routing Computation ------");
DEBUG_PC("[EAR]----- Over Context %s Devices and Links", activeFlag ? "Active" : "All");
for (GList* listnode = g_list_first(serviceList);
listnode;
listnode = g_list_next(listnode), i++) {
struct service_t* service = (struct service_t*)(listnode->data);
DEBUG_PC("[EAR] Triggering Computation ServiceId: %s [ContextId: %s]", service->serviceId.service_uuid, service->serviceId.contextId);
struct compRouteOutput_t* pathService = &(oPathList->compRouteConnection[i]);
DEBUG_PC("Number of pathService[%d]->paths: %d", i, pathService->numPaths);
// check endpoints of the service are different (PE devices/nodes are different)
if (same_src_dst_pe_nodeid(service) == 0) {
DEBUG_PC("[EAR] PEs are the same... no path computation");
comp_route_connection_issue_handler(pathService, service);
oPathList->numCompRouteConnList++;
continue;
}
struct graph_t* g = get_graph_by_contextId(contextSet, service->serviceId.contextId);
if (g == NULL) {
DEBUG_PC("[EAR] contextId: %s NOT in the ContextSet ... then NO graph", service->serviceId.contextId);
comp_route_connection_issue_handler(pathService, service);
oPathList->numCompRouteConnList++;
continue;
}
alg_comp(service, pathService, g, ENERGY_EFFICIENT_ARGUMENT);
oPathList->numCompRouteConnList++;
// for each network connectivity service, a single computed path (out of the KCSP) is retuned
// If path is found, then the selected resources must be pre-assigned into the context information
if (pathService->noPathIssue == NO_PATH_CONS_ISSUE) {
continue;
}
struct path_t* path = &(pathService->paths[pathService->numPaths - 1]);
allocate_graph_resources(path, service, g);
allocate_graph_reverse_resources(path, service, g);
print_graph(g);
}
return;
}
////////////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ear.c
* @brief Tries to route all the services over the active devices and links. If not all
* these services can be routed, then it is tried to route them through the whole context
* including both active and slept/power off devices and links
*
* @param oList
*
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
////////////////////////////////////////////////////////////////////////////////////////
void ear_comp(struct compRouteOutputList_t* oList) {
g_assert(oList);
DEBUG_PC("Number of services to be processed: %d", g_list_length(serviceList));
// Make a copy of oList to be derived from the active devices and links
struct compRouteOutputList_t* oListTmp = create_route_list();
duplicate_route_list(oListTmp, oList);
print_path_connection_list(oListTmp);
// 1st - try to accommodate all the requested service over the active device and links
gint activeContext = 1;
// Create the context for the active devicesand links
DEBUG_PC("=========================== Building the Active ContextSet =================================");
contextSet = NULL;
build_contextSet_active(&contextSet);
//print_contextSet(contextSet);
ear_comp_services(oListTmp, activeContext);
gint numSuccessPaths = 0;
// Check the number of succesfully computed paths, i.e., without path issues
for (gint i = 0; i < oListTmp->numCompRouteConnList; i++) {
struct compRouteOutput_t* ro = &(oListTmp->compRouteConnection[i]);
DEBUG_PC("Number of paths: %d for oListTmp[%d]", ro->numPaths, i);
if (ro->noPathIssue == 0) {
numSuccessPaths++;
}
}
if (numSuccessPaths == oListTmp->numCompRouteConnList) {
duplicate_route_list(oList, oListTmp);
g_free(oListTmp);
return;
}
// 2nd - If not all the services have been accommodated, use the whole device and links
// Create the context for all the devices and links
// Remove the previous Context subject to active devices and links
g_list_free_full(g_steal_pointer(&contextSet), (GDestroyNotify)destroy_context);
contextSet = NULL;
DEBUG_PC("====================== Building the whole ContextSet =====================================");
build_contextSet(&contextSet);
//print_contextSet(contextSet);
activeContext = 0; // Active flag is not SET
ear_comp_services(oList, activeContext);
return;
}
////////////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ear.c
* @brief handles the path computation for energy aware routing
*
* @param compRouteOutput
*
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
gint pathComp_ear_alg(struct compRouteOutputList_t* routeConnList) {
g_assert(routeConnList);
print_path_connection_list(routeConnList);
gint numSuccesPathComp = 0, numPathCompIntents = 0;
DEBUG_PC("================================================================");
DEBUG_PC("=========================== EAR =========================");
DEBUG_PC("================================================================");
// increase the number of Path Comp. Intents
numPathCompIntents++;
gint http_code = HTTP_CODE_OK;
// timestamp t0
struct timeval t0;
gettimeofday(&t0, NULL);
// Initialize and create the contextSet
//contextSet = NULL;
//build_contextSet(contextSet);
//print_contextSet(contextSet);
#if 1
//Triggering the path computation for each specific network connectivity service
ear_comp(routeConnList);
// -- timestamp t1
struct timeval t1, delta;
gettimeofday(&t1, NULL);
delta.tv_sec = t1.tv_sec - t0.tv_sec;
delta.tv_usec = t1.tv_usec - t0.tv_usec;
delta = tv_adjust(delta);
numSuccesPathComp++;
update_stats_path_comp(routeConnList, delta, numSuccesPathComp, numPathCompIntents);
print_path_connection_list(routeConnList);
#endif
g_list_free_full(g_steal_pointer(&contextSet), (GDestroyNotify)destroy_context);
return http_code;
}
\ No newline at end of file
/*
* Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _PATHCOMP_EAR_H
#define _PATHCOMP_EAR_H
#include <glib.h>
#include <glib/gstdio.h>
#include <glib-2.0/glib/gtypes.h>
// Prototype of external declaration of functions
gint pathComp_ear_alg(struct compRouteOutputList_t*);
#endif
\ No newline at end of file
......@@ -36,401 +36,7 @@
#include "pathComp_ksp.h"
// Global Variables
struct map_nodes_t *mapNodes;
struct graph_t *graph;
struct contextSet_t* contextSet;
///////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ksp.c
* @brief Dijkstra algorithm
*
* @param srcMapIndex
* @param dstMapIndex
* @param g
* @param s
* @param SN
* @param RP
*
* @author Ricardo Martínez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
void sp_comp(gint srcMapIndex, gint dstMapIndex, struct graph_t* g, struct service_t* s,
struct nodes_t* SN, struct compRouteOutputItem_t* RP) {
g_assert(s);
g_assert(g);
// Set params into mapNodes related to the source nodes of the request
mapNodes->map[srcMapIndex].distance = 0.0;
mapNodes->map[srcMapIndex].latency = 0.0;
mapNodes->map[srcMapIndex].avaiBandwidth = 0.0;
// Initialize the set Q and S
GList* S = NULL, * Q = NULL;
gint indexVertice = -1;
// Add the source into the Q
struct nodeItem_t* nodeItem = g_malloc0(sizeof(struct nodeItem_t));
if (nodeItem == NULL) {
DEBUG_PC("memory allocation failed\n");
exit(-1);
}
// initialize some nodeItem attributes
nodeItem->distance = 0.0;
nodeItem->latency = 0.0;
duplicate_node_id(&mapNodes->map[srcMapIndex].verticeId, &nodeItem->node);
Q = g_list_insert_sorted(Q, nodeItem, sort_by_distance);
// Check whether there is spurNode (SN) and rootPath (RP)
if (SN != NULL && RP != NULL) {
struct routeElement_t* re;
for (gint j = 0; j < RP->numRouteElements; j++)
{
// Get the source and target Nodes of the routeElement within the rootPath
re = &RP->routeElement[j];
DEBUG_PC ("root Link: aNodeId: %s (%s) --> zNodeiId: %s (%s)", re->aNodeId.nodeId, re->aEndPointId, re->zNodeId.nodeId, re->zEndPointId);
// if ingress of the root link (aNodeId) is the spurNode, then stops
if (compare_node_id(&re->aNodeId, SN) == 0)
{
DEBUG_PC ("root Link: aNodeId: %s and spurNode: %s -- stop exploring the rootPath (RP)", re->aNodeId.nodeId, SN->nodeId);
break;
}
// Extract from Q
GList* listnode = g_list_first(Q);
struct nodeItem_t* node = (struct nodeItem_t*)(listnode->data);
Q = g_list_remove(Q, node);
//DEBUG_RL_RA ("Exploring node %s", node->node.nodeId);
indexVertice = graph_vertice_lookup(node->node.nodeId, g);
g_assert(indexVertice >= 0);
// Get the indexTargetedVertice
gint indexTVertice = -1;
indexTVertice = graph_targeted_vertice_lookup(indexVertice, re->zNodeId.nodeId, g);
gint done = check_link(node, indexVertice, indexTVertice, g, s, &S, &Q, mapNodes);
(void)done;
// Add to the S list
S = g_list_append(S, node);
}
// Check that the first node in Q set is SpurNode, otherwise something went wrong ...
if (compare_node_id(&re->aNodeId, SN) != 0) {
//DEBUG_PC ("root Link: aNodeId: %s is NOT the spurNode: %s -- something wrong", re->aNodeId.nodeId, SN->nodeId);
g_list_free_full(S, g_free);
g_list_free_full(Q, g_free);
return;
}
}
while (g_list_length(Q) > 0) {
//Extract from Q set
GList* listnode = g_list_first(Q);
struct nodeItem_t* node = (struct nodeItem_t*)(listnode->data);
Q = g_list_remove(Q, node);
DEBUG_PC ("Q length: %d", g_list_length (Q));
DEBUG_PC ("DeviceId: %s", node->node.nodeId);
// visit all the links from u within the graph
indexVertice = graph_vertice_lookup(node->node.nodeId, g);
g_assert(indexVertice >= 0);
// Check the targeted vertices from u
for (gint i = 0; i < g->vertices[indexVertice].numTargetedVertices; i++) {
gint done = check_link(node, indexVertice, i, g, s, &S, &Q, mapNodes);
(void)done;
}
// Add node into the S Set
S = g_list_append(S, node);
//DEBUG_PC ("S length: %d", g_list_length (S));
}
g_list_free_full(S, g_free);
g_list_free_full(Q, g_free);
return;
}
///////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ksp.c
* @brief KSP computation using Dijkstra algorithm
*
* @param pred
* @param g
* @param s
* @param SN
* @param RP
*
* @author Ricardo Martínez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
gint ksp_comp(struct pred_t* pred, struct graph_t* g, struct service_t* s,
struct nodes_t *SN, struct compRouteOutputItem_t *RP) {
g_assert(pred);
g_assert(g);
g_assert(s);
// Check the both ingress src and dst endpoints are in the graph
gint srcMapIndex = get_map_index_by_nodeId(s->service_endpoints_id[0].device_uuid, mapNodes);
if (srcMapIndex == -1) {
DEBUG_PC("ingress DeviceId: %s NOT in the graph", s->service_endpoints_id[0].device_uuid);
return -1;
}
gint dstMapIndex = get_map_index_by_nodeId(s->service_endpoints_id[1].device_uuid, mapNodes);
if (dstMapIndex == -1) {
DEBUG_PC("egress DeviceId: %s NOT in the graph", s->service_endpoints_id[1].device_uuid);
return -1;
}
// Compute the shortest path route
sp_comp(srcMapIndex, dstMapIndex, g, s, SN, RP);
// Check that a feasible solution in term of latency and bandwidth is found
gint map_dstIndex = get_map_index_by_nodeId(s->service_endpoints_id[1].device_uuid, mapNodes);
struct map_t* dest_map = &mapNodes->map[map_dstIndex];
if (!(dest_map->distance < INFINITY_COST)) {
DEBUG_PC("destination: %s NOT reachable", s->service_endpoints_id[1].device_uuid);
return -1;
}
DEBUG_PC("AvailBw @ %s is %f", dest_map->verticeId.nodeId, dest_map->avaiBandwidth);
// Check that the computed available bandwidth is larger than 0.0
if (dest_map->avaiBandwidth <= (gfloat)0.0) {
DEBUG_PC("dst: %s NOT REACHABLE", s->service_endpoints_id[1].device_uuid);
return -1;
}
DEBUG_PC("dst: %s REACHABLE", s->service_endpoints_id[1].device_uuid);
// Handle predecessors
build_predecessors(pred, s, mapNodes);
return 1;
}
////////////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_ksp.c
* @brief K-CSPF algorithm execution (YEN algorithm)
*
* @param s
* @param path
* @param g
*
* @author Ricardo Martínez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_t *g) {
g_assert(s);
g_assert(path);
g_assert(g);
// create map of devices/nodes to handle the path computation using the context
mapNodes = create_map_node();
build_map_node(mapNodes, g);
// predecessors to store the computed path
struct pred_t* predecessors = create_predecessors();
struct service_endpoints_id_t* iEp = &(s->service_endpoints_id[0]);
struct service_endpoints_id_t* eEp = &(s->service_endpoints_id[1]);
// Compute the 1st KSP path
gint done = ksp_comp (predecessors, g, s, NULL, NULL);
if (done == -1) {
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
struct compRouteOutputItem_t* p = create_path_item();
//print_predecessors(predecessors);
build_path(p, predecessors, s);
//DEBUG_PC ("Path is constructed");
gint indexDest = get_map_index_by_nodeId(eEp->device_uuid, mapNodes);
struct map_t* dst_map = &mapNodes->map[indexDest];
// Get the delay and cost
memcpy(&p->cost, &dst_map->distance, sizeof(gdouble));
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);
if (feasibleRoute == TRUE) {
DEBUG_PC("1st K-CSPF FEASIBLE, STOP!");
print_path (p);
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)
for (gint i = 0; i < s->num_service_endpoints_id; i++) {
struct service_endpoints_id_t* iEp = &(s->service_endpoints_id[i]);
struct service_endpoints_id_t* oEp = &(path->service_endpoints_id[i]);
copy_service_endpoint_id(oEp, iEp);
}
path->num_service_endpoints_id = s->num_service_endpoints_id;
// Copy the computed path
struct path_t* targetedPath = &(path->paths[path->numPaths - 1]);
duplicate_path_t(p, targetedPath);
print_path_t (targetedPath);
g_free(predecessors);
g_free(p);
g_free(mapNodes);
return;
}
DEBUG_PC("1st CSPF COMPUTATION IS NOT FEASIBLE --> TRIGGER K COMPUTATIONS");
// Create A and B sets of paths to handle the YEN algorithm
struct path_set_t* A = create_path_set();
struct path_set_t* B = create_path_set();
// Add the previously 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++) {
DEBUG_PC("------------ kth (%d) ---------------------", k);
struct compRouteOutputItem_t* p = create_path_item();
duplicate_path(&A->paths[k - 1], p);
// The spurNode ranges from near-end node of the first link to the near-end of the last link forming the kth path
gint i = 0;
struct compRouteOutputItem_t* rootPath = create_path_item();
for (i = 0; i < p->numRouteElements; i++) {
struct nodes_t* spurNode = create_node();
struct nodes_t* nextSpurNode = create_node();
struct routeElement_t* re = &(p->routeElement[i]);
// Create predecessors to store the computed path
struct pred_t* predecessors = create_predecessors();
// Clear previous mapNodes, i.e. create it again
g_free(mapNodes);
mapNodes = create_map_node();
build_map_node(mapNodes, g);
struct nodes_t* n = &re->aNodeId;
duplicate_node_id(n, spurNode);
n = &re->zNodeId;
duplicate_node_id(n, nextSpurNode);
DEBUG_PC("spurNode: %s --> nextSpurNode: %s", spurNode->nodeId, nextSpurNode->nodeId);
// rootPath contains a set of links of A[k-1] from the source Node till the SpurNode -> NextSpurNode
// Example: A[k-1] = {L1, L2, L3, L4}, i.e. " Node_a -- L1 --> Node_b -- L2 --> Node_c -- L3 --> Node_d -- L4 --> Node_e "
// E.g., for the ith iteration if the spurNode = Node_c and NextSpurNode = Node_d; then rootPath = {L1, L2, L3}
add_routeElement_path_back(re, rootPath);
DEBUG_PC("rootPath:");
print_path(rootPath);
// For all existing and computed paths p in A check if from the source to the NextSpurNode
// the set of links matches with those contained in the rootPath
// If YES, remove from the auxiliary graph the next link in p from NextSpurNode
// Otherwise do nothing
struct graph_t* gAux = create_graph();
// Baseline graph
//build_graph (gAux);
duplicate_graph(g, gAux);
// Modified graph
modify_targeted_graph(gAux, A, rootPath, spurNode);
// Trigger the computation of the path from src to dst constrained to traverse all the links from src
// to spurNode contained into rootPath over the resulting graph
if (ksp_comp(predecessors, gAux, s, spurNode, rootPath) == -1) {
DEBUG_PC("FAILED SP from %s via spurNode: %s to %s", iEp->device_uuid, spurNode->nodeId, eEp->device_uuid);
g_free(nextSpurNode);
g_free(spurNode);
g_free(gAux);
g_free(predecessors);
continue;
}
DEBUG_PC("SUCCESFUL SP from %s via spurNode: %s to %s", iEp->device_uuid, spurNode->nodeId, eEp->device_uuid);
// Create the node list from the predecessors
struct compRouteOutputItem_t* newKpath = create_path_item();
build_path(newKpath, predecessors, s);
DEBUG_PC("new K (for k: %d) Path is built", k);
gint indexDest = get_map_index_by_nodeId(eEp->device_uuid, mapNodes);
struct map_t* dst_map = &mapNodes->map[indexDest];
memcpy(&newKpath->cost, &dst_map->distance, sizeof(gdouble));
memcpy(&newKpath->availCap, &dst_map->avaiBandwidth, sizeof(dst_map->avaiBandwidth));
memcpy(&newKpath->delay, &dst_map->latency, sizeof(mapNodes->map[indexDest].latency));
DEBUG_PC("New PATH (@ kth: %d) ADDED to B[%d] - {Path Cost: %f, e2e latency: %f, bw: %f ", k, B->numPaths, newKpath->cost, newKpath->delay, newKpath->availCap);
// Add the computed kth SP to the heap B
duplicate_path(newKpath, &B->paths[B->numPaths]);
B->numPaths++;
DEBUG_PC("Number of B paths: %d", B->numPaths);
g_free(newKpath);
g_free(nextSpurNode);
g_free(spurNode);
g_free(gAux);
g_free(predecessors);
}
// If B is empty then stops
if (B->numPaths == 0) {
DEBUG_PC("B does not have any path ... the stops kth computation");
break;
}
// Sort the potential paths contained in B by cost and latency and available bandwidth
sort_path_set(B);
// Add the lowest path into A[k]
DEBUG_PC("-------------------------------------------------------------");
DEBUG_PC("To Add SP from B[0] to A[%d] --- Path Cost: %f, e2e Latency: %f", A->numPaths, B->paths[0].cost, B->paths[0].delay);
duplicate_path(&B->paths[0], &A->paths[A->numPaths]);
A->numPaths++;
DEBUG_PC("A Set size: %d", A->numPaths);
DEBUG_PC("-------------------------------------------------------------");
// Remove/pòp front element from the path set B (i.e. remove B[0])
pop_front_path_set(B);
DEBUG_PC("B Set Size: %d", B->numPaths);
}
// Copy the serviceId
copy_service_id(&path->serviceId, &s->serviceId);
// copy the service endpoints, in general, there will be 2 (point-to-point network connectivity services)
for (gint m = 0; m < s->num_service_endpoints_id; m++) {
struct service_endpoints_id_t* iEp = &(s->service_endpoints_id[m]);
struct service_endpoints_id_t* oEp = &(path->service_endpoints_id[m]);
copy_service_endpoint_id(oEp, iEp);
}
for (gint ksp = 1; ksp < A->numPaths; ksp++){
if (ksp >= MAX_KSP_VALUE) {
DEBUG_PC("Number Requested paths (%d) REACHED - STOP", ksp);
break;
}
gdouble feasibleRoute = check_computed_path_feasability(s, &A->paths[ksp]);
if (feasibleRoute == TRUE) {
DEBUG_PC("A[k-th%d] available: %f, pathCost: %f; latency: %f", ksp, A->paths[ksp].availCap, A->paths[ksp].cost, A->paths[ksp].delay);
struct compRouteOutputItem_t* pathaux = &A->paths[ksp];
path->numPaths++;
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);
// No paths found --> Issue
DEBUG_PC("K-SP failed!!!");
comp_route_connection_issue_handler(path, s);
return;
}
GList* contextSet;
////////////////////////////////////////////////////////////////////////////////////////
/**
......@@ -446,14 +52,20 @@ void alg_comp(struct service_t* s, struct compRouteOutput_t* path, struct graph_
/////////////////////////////////////////////////////////////////////////////////////////
void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) {
g_assert(outputList);
g_assert(contextSet);
g_assert(serviceList);
// Check at least there is a service to be processed
if (g_list_length(serviceList) == 0) {
DEBUG_PC("serviceList is Empty...");
return;
}
DEBUG_PC("----- Starting the KSP Computation ------");
// Iterate over the list of requested network connectivity services
for (gint i = 0; i < serviceList->numServiceList; i++) {
struct service_t* service = &(serviceList->services[i]);
gint i = 0;
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]);
......@@ -472,13 +84,12 @@ void ksp_alg_execution_services(struct compRouteOutputList_t* outputList) {
outputList->numCompRouteConnList++;
continue;
}
alg_comp(service, pathService, g);
alg_comp(service, pathService, g, NO_OPTIMIZATION_ARGUMENT); // last parameter 0 is related to an optimization computation argument
outputList->numCompRouteConnList++;
// for each network connectivity service, a single computed path (out of the KCSP) is retuned
// for each network connectivity service, a single computed path (out of the KSP) is retuned
// If path is found, then the selected resources must be pre-assigned into the context information
if (pathService->noPathIssue == NO_PATH_CONS_ISSUE)
{
if (pathService->noPathIssue == NO_PATH_CONS_ISSUE) {
continue;
}
struct path_t* path = &(pathService->paths[pathService->numPaths - 1]);
......@@ -517,9 +128,9 @@ gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList)
gettimeofday(&t0, NULL);
// Allocate memory for the context
contextSet = create_contextSet();
contextSet = NULL;
// Build up the contextSet (>= 1)
build_contextSet(contextSet);
build_contextSet(&contextSet);
print_contextSet(contextSet);
#if 1
//Triggering the path computation for each specific network connectivity service
......@@ -537,6 +148,6 @@ gint pathComp_ksp_alg(struct compRouteOutputList_t * routeConnList)
print_path_connection_list(routeConnList);
#endif
g_free(contextSet);
g_list_free_full(g_steal_pointer(&contextSet), (GDestroyNotify)destroy_context);
return http_code;
}
\ No newline at end of file
......@@ -36,74 +36,7 @@
#include "pathComp_sp.h"
// Global Variables
struct map_nodes_t* mapNodes;
struct graph_t* graph;
struct contextSet_t* contextSet;
///////////////////////////////////////////////////////////////////////////////////
/**
* @file pathComp_sp.c
* @brief Excecution Dijkstra algorithm
*
* @param srcMapIndex
* @param dstMapIndex
* @param g
* @param s
*
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
void dijkstra(gint srcMapIndex, gint dstMapIndex, struct graph_t* g, struct service_t* s) {
g_assert(s);
g_assert(g);
// Set params into mapNodes related to the source nodes of the request
mapNodes->map[srcMapIndex].distance = 0.0;
mapNodes->map[srcMapIndex].latency = 0.0;
mapNodes->map[srcMapIndex].avaiBandwidth = 0.0;
// Initialize the set Q and S
GList* S = NULL, *Q = NULL;
gint indexVertice = -1;
// Add the source into the Q
struct nodeItem_t* nodeItem = g_malloc0(sizeof(struct nodeItem_t));
if (nodeItem == NULL) {
DEBUG_PC("memory allocation failed\n");
exit(-1);
}
// initialize some nodeItem attributes
nodeItem->distance = 0.0;
nodeItem->latency = 0.0;
duplicate_node_id(&mapNodes->map[srcMapIndex].verticeId, &nodeItem->node);
Q = g_list_insert_sorted(Q, nodeItem, sort_by_distance);
while (g_list_length(Q) > 0) {
//Extract from Q set
GList* listnode = g_list_first(Q);
struct nodeItem_t* node = (struct nodeItem_t*)(listnode->data);
Q = g_list_remove(Q, node);
DEBUG_PC("Q length: %d", g_list_length(Q));
DEBUG_PC("DeviceId: %s", node->node.nodeId);
// visit all the links from u within the graph
indexVertice = graph_vertice_lookup(node->node.nodeId, g);
g_assert(indexVertice >= 0);
// Check the targeted vertices from u
for (gint i = 0; i < g->vertices[indexVertice].numTargetedVertices; i++) {
gint done = check_link(node, indexVertice, i, g, s, &S, &Q, mapNodes);
(void)done;
}
// Add node into the S Set
S = g_list_append(S, node);
//DEBUG_PC ("S length: %d", g_list_length (S));
}
g_list_free_full(S, g_free);
g_list_free_full(Q, g_free);
return;
}
GList* contextSet;
///////////////////////////////////////////////////////////////////////////////////
/**
......@@ -113,12 +46,13 @@ void dijkstra(gint srcMapIndex, gint dstMapIndex, struct graph_t* g, struct serv
* @param pred
* @param g
* @param s
* @param mapNodes
*
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
gint computation(struct pred_t* pred, struct graph_t* g, struct service_t* s) {
gint computation(struct pred_t* pred, struct graph_t* g, struct service_t* s, struct map_nodes_t* mapNodes) {
g_assert(pred);
g_assert(g);
g_assert(s);
......@@ -137,7 +71,7 @@ gint computation(struct pred_t* pred, struct graph_t* g, struct service_t* s) {
}
// Compute the shortest path
dijkstra(srcMapIndex, dstMapIndex, g, s);
dijkstra(srcMapIndex, dstMapIndex, g, s, mapNodes, NULL, NULL, 0x00000000);
// Check that a feasible solution in term of latency and bandwidth is found
gint map_dstIndex = get_map_index_by_nodeId(s->service_endpoints_id[1].device_uuid, mapNodes);
......@@ -179,7 +113,7 @@ void computation_shortest_path(struct service_t* s, struct compRouteOutput_t* pa
g_assert(g);
// create map of devices / nodes to handle the path computation using the context
mapNodes = create_map_node();
struct map_nodes_t *mapNodes = create_map_node();
build_map_node(mapNodes, g);
// predecessors to store the computed path
......@@ -189,7 +123,7 @@ void computation_shortest_path(struct service_t* s, struct compRouteOutput_t* pa
struct service_endpoints_id_t* eEp = &(s->service_endpoints_id[1]);
// SP computation
gint done = computation(predecessors, g, s);
gint done = computation(predecessors, g, s, mapNodes);
if (done == -1) {
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);
......@@ -204,11 +138,8 @@ void computation_shortest_path(struct service_t* s, struct compRouteOutput_t* pa
//DEBUG_PC ("Path is constructed");
gint indexDest = get_map_index_by_nodeId(eEp->device_uuid, mapNodes);
struct map_t* dst_map = &mapNodes->map[indexDest];
// Get the delay and cost
memcpy(&p->cost, &dst_map->distance, sizeof(gdouble));
memcpy(&p->availCap, &dst_map->avaiBandwidth, sizeof(dst_map->avaiBandwidth));
memcpy(&p->delay, &dst_map->latency, sizeof(mapNodes->map[indexDest].latency));
struct map_t* dst_map = &mapNodes->map[indexDest];
set_path_attributes(p, dst_map);
DEBUG_PC("Computed Path Avail Bw: %f, Path Cost: %f, latency: %f", p->availCap, p->cost, p->delay);
print_path(p);
......@@ -239,10 +170,8 @@ void computation_shortest_path(struct service_t* s, struct compRouteOutput_t* pa
g_free(mapNodes);
return;
}
DEBUG_PC("SP FAILED!!!");
comp_route_connection_issue_handler(path, s);
return;
}
......@@ -257,16 +186,21 @@ void computation_shortest_path(struct service_t* s, struct compRouteOutput_t* pa
* @author Ricardo Mart�nez <ricardo.martinez@cttc.es>
* @date 2022
*/
void sp_execution_services(struct compRouteOutputList_t* oPathList)
{
g_assert(oPathList);
g_assert(contextSet);
g_assert(serviceList);
void sp_execution_services(struct compRouteOutputList_t* oPathList) {
g_assert(oPathList);
// Check at least there is a service to be processed
if (g_list_length(serviceList) == 0) {
DEBUG_PC("Lengtg requested serviceList is Empty...");
return;
}
DEBUG_PC("----- Starting the SP Computation ------");
for (gint i = 0; i < serviceList->numServiceList; i++) {
struct service_t* service = &(serviceList->services[i]);
gint i = 0;
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 = &(oPathList->compRouteConnection[i]);
......@@ -314,10 +248,8 @@ void sp_execution_services(struct compRouteOutputList_t* oPathList)
* @date 2022
*/
/////////////////////////////////////////////////////////////////////////////////////////
gint pathComp_sp_alg(struct compRouteOutputList_t* routeConnList)
{
gint pathComp_sp_alg(struct compRouteOutputList_t* routeConnList) {
g_assert(routeConnList);
gint numSuccesPathComp = 0, numPathCompIntents = 0;
DEBUG_PC("================================================================");
......@@ -332,9 +264,9 @@ gint pathComp_sp_alg(struct compRouteOutputList_t* routeConnList)
gettimeofday(&t0, NULL);
// Allocate memory for the context
contextSet = create_contextSet();
contextSet = NULL;
// Build up the contextSet (>= 1)
build_contextSet(contextSet);
build_contextSet(&contextSet);
print_contextSet(contextSet);
#if 1
//Triggering the path computation for each specific network connectivity service
......@@ -352,7 +284,7 @@ gint pathComp_sp_alg(struct compRouteOutputList_t* routeConnList)
print_path_connection_list(routeConnList);
#endif
g_free(contextSet);
g_list_free_full(g_steal_pointer(&contextSet), (GDestroyNotify)destroy_context);
return http_code;
}
......
This diff is collapsed.
......@@ -23,12 +23,17 @@
#include <uuid/uuid.h>
// External variables
extern struct map_nodes_t* mapNodes;
extern struct graph_t* graph;
extern struct contextSet_t* contextSet;
extern struct linkList_t* linkList;
extern struct deviceList_t* deviceList;
extern struct serviceList_t* serviceList;
extern GList* contextSet;
extern GList* linkList;
extern GList* deviceList;
extern GList* serviceList;
extern GList* activeServList;
//////////////////////////////////////////////////////////
// Optimization computation argument
//////////////////////////////////////////////////////////
#define NO_OPTIMIZATION_ARGUMENT 0x00000000
#define ENERGY_EFFICIENT_ARGUMENT 0x00000001
#define INFINITY_COST 0xFFFFFFFF
#define MAX_NUM_PRED 100
......@@ -54,8 +59,9 @@ struct nodes_t {
struct nodeItem_t {
struct nodes_t node;
gdouble distance;
gdouble latency;
gdouble distance; // traversed distance
gdouble latency; // incured latency
gdouble power; //consumed power
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -80,7 +86,8 @@ struct edges_t {
gdouble totalCap, availCap;
gdouble cost;
gdouble delay;
gdouble delay;
gdouble energy;
// inter-domain local and remote Ids
gchar interDomain_localId[MAX_INTER_DOMAIN_PLUG_IN_SIZE];
......@@ -107,7 +114,8 @@ struct map_t {
struct edges_t predecessor;
gdouble distance;
gdouble avaiBandwidth;
gdouble latency;
gdouble latency;
gdouble power;
};
#define MAX_MAP_NODE_SIZE 100
......@@ -131,6 +139,7 @@ struct vertices_t {
struct targetNodes_t targetedVertices[MAX_NUM_VERTICES];
gint numTargetedVertices;
struct nodes_t verticeId;
gdouble power_idle; // power idle of the device (due to the fans, etc.)
};
struct graph_t {
......@@ -147,15 +156,6 @@ struct context_t {
struct graph_t g;
};
////////////////////////////////////////////////////
// Structure for the Set of Contexts
///////////////////////////////////////////////////
#define MAX_NUMBER_CONTEXT 1 // 100 # LGR: reduced from 100 to 1 to divide by 100 the memory used
struct contextSet_t {
struct context_t contextList[MAX_NUMBER_CONTEXT];
gint num_context_set;
};
#define MAX_ALG_ID_LENGTH 10
////////////////////////////////////////////////////
// External Variables
......@@ -241,6 +241,8 @@ struct endPoint_t {
struct capacity_t available_capacity;
// inter-domain identifiers
struct inter_domain_plug_in_t inter_domain_plug_in;
gfloat energyConsumption; // in nJ/bit
gint operational_status; // 0 Undefined, 1 Disabled, 2 Enabled
};
///////////////////////////////////////////////////////////////////
......@@ -249,25 +251,15 @@ struct endPoint_t {
#define MAX_DEV_TYPE_SIZE 128
#define MAX_DEV_ENDPOINT_LENGTH 50 // 10 # LGR: controllers might have large number of endpoints
struct device_t {
gdouble power_idle; // power idle (baseline) of the switch in Watts
gint operational_status; // 0 - Undefined, 1 - Disabled, 2 - Enabled
gchar deviceId[UUID_CHAR_LENGTH]; // device ID using UUID (128 bits)
gchar deviceType[MAX_DEV_TYPE_SIZE]; // Specifies the device type
// define the endpoints attached to the device
gint numEndPoints;
struct endPoint_t endPoints[MAX_DEV_ENDPOINT_LENGTH];
};
///////////////////////////////////////////////////////////////////
// Structure for the device List
///////////////////////////////////////////////////////////////////
#define MAX_NUM_DEVICE 200
struct deviceList_t {
// device information
gint numDevices;
struct device_t devices[MAX_NUM_DEVICE];
};
///////////////////////////////////////////////////////////////////
// Structure for the link EndPoint Id
///////////////////////////////////////////////////////////////////
......@@ -294,6 +286,13 @@ struct latency_characteristics_t {
gdouble fixed_latency;
};
///////////////////////////////////////////////////////////////////
// Structure for the latency characteristics of the link
///////////////////////////////////////////////////////////////////
struct power_characteristics_t {
gdouble power;
};
///////////////////////////////////////////////////////////////////
// Structure for the link
///////////////////////////////////////////////////////////////////
......@@ -304,10 +303,10 @@ struct latency_characteristics_t {
#define LINK_FORWARDING_DIRECTION_UNKNOWN 2
struct link_t {
gchar linkId[UUID_CHAR_LENGTH]; // link Id using UUID (128 bits)
//gdouble energy_link; // in nJ/bit
//gint operational_status; // 0 Undefined, 1 Disabled, 2 Enabled
gint numLinkEndPointIds;
struct link_endpointId_t linkEndPointId[MAX_NUM_LINK_ENDPOINT_IDS];
guint forwarding_direction;
struct capacity_t potential_capacity;
struct capacity_t available_capacity;
......@@ -315,15 +314,6 @@ struct link_t {
struct latency_characteristics_t latency_characteristics;
};
///////////////////////////////////////////////////////////////////
// Structure for the link List
///////////////////////////////////////////////////////////////////
#define MAX_NUM_LIST 2000
struct linkList_t {
gint numLinks;
struct link_t links[MAX_NUM_LIST];
};
////////////////////////////////////////////////////
// Structure for service Identifier
///////////////////////////////////////////////////
......@@ -365,12 +355,10 @@ struct constraint_t {
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;
struct serviceId_t serviceId;
guint service_type; // unknown, l2nm, l3nm, tapi
// endpoints of the network connectivity service, assumed p2p
......@@ -403,10 +391,27 @@ struct path_constraints_t {
////////////////////////////////////////////////////
// Structure for the handling the service requests
///////////////////////////////////////////////////
#define MAX_SERVICE_LIST 100
struct serviceList_t {
struct service_t services[MAX_SERVICE_LIST];
gint numServiceList;
//#define MAX_SERVICE_LIST 100
//struct serviceList_t {
// struct service_t services[MAX_SERVICE_LIST];
// gint numServiceList;
//};
////////////////////////////////////////////////////
// Structure for the handling the active services
///////////////////////////////////////////////////
struct activeServPath_t {
struct topology_id_t topology_id;
gchar deviceId[UUID_CHAR_LENGTH];
gchar endPointId[UUID_CHAR_LENGTH];
};
struct activeService_t {
struct serviceId_t serviceId;
guint service_type; // unknown, l2nm, l3nm, tapi
struct service_endpoints_id_t service_endpoints_id[MAX_NUM_SERVICE_ENPOINTS_ID];
guint num_service_endpoints_id;
GList* activeServPath;
};
////////////////////////////////////////////////////////////////////////////////////////////
......@@ -425,7 +430,6 @@ 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
gint numLinkTopologies;
};
......@@ -454,13 +458,13 @@ struct routeElement_t {
gchar contextId[UUID_CHAR_LENGTH];
};
struct compRouteOutputItem_t {
// Potential(total) and available capacity
struct compRouteOutputItem_t {
gint unit;
gdouble totalCap, availCap;
gdouble cost;
gdouble delay;
gdouble power;
struct routeElement_t routeElement[MAX_ROUTE_ELEMENTS];
gint numRouteElements;
......@@ -477,6 +481,7 @@ struct path_t {
struct capacity_t path_capacity;
struct latency_characteristics_t path_latency;
struct cost_characteristics_t path_cost;
struct power_characteristics_t path_power;
struct pathLink_t pathLinks[MAX_NUM_PATH_LINKS];
guint numPathLinks;
......@@ -484,18 +489,14 @@ struct path_t {
#define NO_PATH_CONS_ISSUE 1 // No path due to a constraint issue
#define MAX_NUM_COMPUTED_PATHS 10
struct compRouteOutput_t
{
struct compRouteOutput_t {
// object describing the service identifier: serviceId and contextId
struct serviceId_t serviceId;
// array describing the service endpoints ids
struct service_endpoints_id_t service_endpoints_id[MAX_NUM_SERVICE_ENPOINTS_ID];
guint num_service_endpoints_id;
struct path_t paths[MAX_NUM_COMPUTED_PATHS];
gint numPaths;
gint numPaths;
// if the transport connectivity service cannot be computed, this value is set to 0 determining the constraints were not fulfilled
gint noPathIssue;
};
......@@ -504,8 +505,7 @@ struct compRouteOutput_t
// Structure to handle the response list with all the computed network connectivity services
////////////////////////////////////////////////////////////////////////////////////////////
#define MAX_COMP_CONN_LIST 100
struct compRouteOutputList_t
{
struct compRouteOutputList_t {
struct compRouteOutput_t compRouteConnection[MAX_COMP_CONN_LIST];
gint numCompRouteConnList;
......@@ -526,6 +526,7 @@ struct compRouteOutputList_t
// Prototype of external declaration of functions
void print_path (struct compRouteOutputItem_t *);
void print_path_t(struct path_t*);
struct path_t* create_path();
void duplicate_string(gchar *, gchar *);
......@@ -533,7 +534,7 @@ gchar* get_uuid_char(uuid_t);
void copy_service_id(struct serviceId_t*, struct serviceId_t *);
void copy_service_endpoint_id(struct service_endpoints_id_t *, struct service_endpoints_id_t *);
struct graph_t* get_graph_by_contextId(struct contextSet_t *, gchar *);
struct graph_t* get_graph_by_contextId(GList*, gchar *);
struct pred_t * create_predecessors ();
struct edges_t* create_edge();
......@@ -561,31 +562,29 @@ gint graph_targeted_vertice_add (gint, gchar *, struct graph_t *);
void remove_edge_from_graph (struct graph_t *, struct edges_t *);
struct path_set_t * create_path_set ();
void sort_path_set (struct path_set_t *);
void sort_path_set (struct path_set_t *, guint);
void pop_front_path_set (struct path_set_t *);
void remove_path_set(struct path_set_t*);
void build_map_node(struct map_nodes_t *, struct graph_t *);
struct compRouteOutputList_t * create_route_list();
void duplicate_route_list(struct compRouteOutputList_t *, struct compRouteOutputList_t *);
struct compRouteOutputItem_t * create_path_item ();
void add_routeElement_path_back (struct routeElement_t *, struct compRouteOutputItem_t *);
gboolean matching_path_rootPath (struct compRouteOutputItem_t *, struct compRouteOutputItem_t *, struct nodes_t *, struct edges_t *);
void modify_targeted_graph (struct graph_t *, struct path_set_t *, struct compRouteOutputItem_t *, struct nodes_t *);
gint find_nodeId (gconstpointer, gconstpointer);
gint check_link (struct nodeItem_t *, gint, gint, struct graph_t *, struct service_t *, GList **, GList **, struct map_nodes_t *);
gint check_link (struct nodeItem_t *, gint, gint, struct graph_t *, struct service_t *, GList **, GList **, struct map_nodes_t *, guint arg);
gboolean check_computed_path_feasability (struct service_t *, struct compRouteOutputItem_t * );
gint sort_by_distance (gconstpointer, gconstpointer);
gint sort_by_energy(gconstpointer, gconstpointer);
struct graph_t * create_graph ();
struct map_nodes_t * create_map_node ();
struct service_t * get_service_for_computed_path(gchar *);
struct deviceList_t* create_device_list();
struct linkList_t* create_link_list();
struct serviceList_t* create_service_list();
void print_service_type(guint);
void print_link_port_direction(guint);
void print_termination_direction(guint);
......@@ -593,9 +592,9 @@ void print_termination_state(guint);
void print_capacity_unit(guint);
void print_link_forwarding_direction(guint);
struct contextSet_t* create_contextSet();
void build_contextSet(struct contextSet_t *);
void print_contextSet(struct contextSet_t *);
void build_contextSet(GList **);
void build_contextSet_active(GList **);
void print_contextSet(GList *);
gint same_src_dst_pe_nodeid (struct service_t *);
void comp_route_connection_issue_handler (struct compRouteOutput_t *, struct service_t *);
......@@ -610,4 +609,12 @@ struct timeval tv_adjust(struct timeval);
void print_path_connection_list(struct compRouteOutputList_t*);
void update_stats_path_comp(struct compRouteOutputList_t*, struct timeval, gint, gint);
void destroy_active_service(struct activeService_t*);
void destroy_requested_service(struct service_t*);
void destroy_device(struct device_t*);
void destroy_link(struct link_t*);
void destroy_context(struct context_t*);
void dijkstra(gint, gint, struct graph_t*, struct service_t*, struct map_nodes_t*, struct nodes_t*, struct compRouteOutputItem_t*, guint);
void set_path_attributes(struct compRouteOutputItem_t*, struct map_t*);
void alg_comp(struct service_t*, struct compRouteOutput_t*, struct graph_t*, guint);
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment