1: Create moving_average, sliding_window, and thresholds global tables in memory. 2: While receiving application id and throughput from Application Director Do 3: Compute moving average of the latest five received throughput and save them in the moving_average table 4: If next moving average is ready Then 5: Estimate Delay and Throughput out of moving average. 6: Store the estimated QoS values along with application id in the sliding_window table 7: End If 8: If next window of the ten estimated QoS values is ready Then 9: Set forecasted_qos = Linear regression of ten estimated QoS in tn + m. 10: End If 11: If slice state of application id is NOT READY Then 12: Calculate QoS values for scale-up and scale-down thresholds based on forecasted QoS 13: Store thresholds in the thresholds table along with application id. 14: Spawn a new thread to call the function Get_New_Slice() with the estimated scale-up QoS values and application’s reliability from the application-slice mapping table as parameters. 15: Else If slice state of application id is READY Then 16: If forecasted_qos > 0 Then 17: Retrieve corresponding scale_up and scale_down thresholds from the thresholds table 18: If forecasted_qos ≥ scale_up threshold Or forecasted_qos < scale-down threshold Then 19: Notify Application Director by sending EXECUTING_SCALABILITY notification to it. 20: Recalculate scalability thresholds based on forecasted QoS and update the thresholds table. 21: Spawn a new thread to call the function Trigger-Scalability() with recalculated scale-up QoS values and IP address of slice as parameters. 22: End If 23: Else If forecasted_qos ≤ 0 Then 24: Spawn a new thread to call the function Release_Slice() with IP address of slice as parameter. 25: End If 26: End If 27: End While 28: Function Get_New_Slice (arguments: QoS values) 29: Invoke Slice Manager to get a new network slice including QoS values as parameters. 30: After “success” notification from Slice Manager, notify Application Director by sending GOT_NEW_SLICE notification to it. 31: End Function 32: Function Trigger_Scalability (arguments: QoS values, IP address) 33: Invoke Slice Manager to execute scalability with QoS values and IP address as parameters. 34: After “success” notification from Slice Manager, notify Application Director by sending FINISHED_SCALABILITY notification to it. 35: End Function 36: Function Release_Slice (arguments: IP address) 37: Invoke Slice Manager to delete a slice with its IP address as parameter. 38: After “success” notification from Slice Manager, delete the corresponding entries from the global tables of application-slice mapping, moving_average, sliding_window, and thresholds. 39: End Function |