Research on Service Function Chain Embedding and Migration Algorithm for UAV IoT

: This paper addresses the challenge of managing service function chaining (SFC) in an unmanned aerial vehicle (UAV) IoT, a dynamic network that integrates UAVs and IoT devices for various scenarios. To enhance the service quality and user experience of the UAV IoT, network functions must be flexibly configured and adjusted based on varying service demands and network situations. This paper presents a model for calculating benefits and an agile algorithm for embedding and migrating SFC based on particle swarm optimization (PSO). The model takes into account multiple factors such as SFC quality, resource utilization, and migration cost. It aims to maximize the SFC benefit and minimize the migration times. The algorithm leverages PSO’s global search and fast convergence to identify the optimal or near-optimal SFC placement and update it when the network state changes. Simulation experiments demonstrate that the proposed method improves network resource efficiency and outperforms existing methods. This paper presents a new idea and method for managing SFC in UAV IoT.


Introduction 1.Background and Research Motivation
With the rapid development of wireless communication technology, unmanned aerial vehicles (UAVs), as flexible, efficient, and low-cost air platforms, have become widely utilized in civil, military, commercial, and other fields [1].UAVs can be equipped with a variety of IoT devices, such as sensors, cameras, and GPS modules, forming an airborne IoT system that provides a range of services to users on the ground, including monitoring, communication, and sensing [2].However, the dynamic, heterogeneous, and distributed nature of UAV networks brings significant challenges for network management and optimization.In order to enhance the service quality and user experience of UAV networks, it is essential to flexibly configure and adjust the network functions to meet various business requirements and network conditions [3].
Network virtualization is a technology that implements multiple virtual networks on the same physical network to improve the utilization, flexibility, and innovation of network resources [4].Network virtualization enables the software and programmability of network functions, reduces network costs and complexity, and improves the delivery speed and quality of network services.By employing network virtualization technology, network functions can be virtualized into VNFs (virtualized network functions), which can be deployed at various layers of the UAV network to achieve quick configuration, adjustment, and migration of network functions.This enhances the performance, reliability, and security of the UAV network [5].
Based on VNFs and software-defined networking (SDN) technologies, service function chaining (SFC) connects network functions in a specific sequence to achieve flexible orchestration and scheduling of network functions, adapting to different service scenarios and network states, as shown in Figure 1.Because of its network characteristics, which combine UAVs and IoT devices, it can support a variety of complex business scenarios, such as emergency rescue, intelligent transportation, and smart agriculture [5].These service scenarios have diverse network requirements, such as high bandwidth, low latency, and high reliability.In order to meet these requirements, network functions need to be carefully controlled and optimized to achieve on-demand combination and customization of network functions [6].Therefore, the SFC has significant application value and research significance in UAV IoT.

Network Architecture and Challenges
The network architecture we used for the UAV IoT leverages SFC based on VNF and SDN technologies, as shown in Figure 1.This design enables a dynamic and flexible orchestration of network functions to cater to varying service scenarios and network states.
System Overview: A fundamental component of the architecture is a set of UAVs, each equipped with a common computing platform capable of hosting multiple virtual machines (VMS).These virtual machines provide a deployment environment for SFC services requested by terrestrial Industrial IoT equipment (IIE) to support the transmission of service data.
Network Resources: We consider the four most typical node resources provided by the UAV, namely, the computing resources (CPU), represented by the number of CPU cores; the memory resources (RAM), represented by the size of the cache space; the storage resources (DISK), represented by the size of the disk space; and the energy consumption resources (ENG), represented by the battery capacity on the UAV.Without loss of generality, we consider the most typical transmission bandwidth (BAND), that is, the maximum rate of data transmission between two UAVs.
Global Controller: Within the network's deployment domain, the global controller acts as a command and communications hub, coordinating the entire UAV network.It is responsible for policy implementation of SFC embedding and migration across UAVs.The controller can be deployed for ground stations or spaceborne platforms.
SFC Embedding Workflow: When the IIE sends an SFC setup request to the UAV network, the workflow starts.After receiving the request, the UAV relays the request to the VNF manager located in the global controller.According to the resource quantity and quality of service (QoS) requirements in the request, the VNF manager uses the embedded algorithm to divide node and link resources on the computing platform of each UAV and establish SFC in the UAV network.Then, SDN technology is used to configure network routing and manage the forwarding of service data.
Real-Time Monitoring and Adaptation: The global controller continuously monitors the performance of SFC on the network in real time.The SFC migration algorithm is triggered when the network topology changes and the link fails or the QoS fails to meet the SFC requirements.This process includes invalidating the existing VNFs, removing the existing VNFs, establishing a new VNFS, and then rerouting to complete the establishment of the new SFC.
The architecture is designed to provide a robust, adaptable, and efficient communication network for UAV IoT systems, capable of supporting complex IIE data transfers with high reliability and flexibility.The research in this paper is based on two observations in this network architecture: (1) SFC has life cycle characteristics and requires maintenance during operation.Its life cycle includes creation, embedding, operation, migration, and destruction.Due to the dynamic characteristics of the network, such as UAV movement, network topology changes, and resource fluctuations, system performance may deteriorate or services may even be interrupted.Therefore, real-time monitoring and maintenance of the SFC are essential to guarantee the availability and reliability of the SFC.(2) Due to the particularity of UAV energy consumption, load balancing should be considered in the embedding algorithm.If the SFC embedding algorithm does not consider the energy consumption resources of UAVs, it may lead to the premature depletion of UAVs' energy or an imbalance of energy consumption among UAVs, thus affecting the stability and sustainability of UAVs' dynamic network.
Based on the above observations, the challenge of this research is to design an SFC embedding algorithm deployed on a global controller.The algorithm can dynamically select the appropriate UAV as the SFC execution node according to the energy consumption resources and network status of the UAV, so as to achieve efficient SFC embedding and balance the energy consumption of the UAV.At the same time, in order to ensure the service continuity during the SFC life cycle, the algorithm can dynamically migrate SFC according to the real-time performance of SFC and the energy distribution of the UAVs.

Contributions
The main contributions of this paper are as follows:

•
Aiming to address the resource perception problem of SFC in UAV dynamic networks, a revenue calculation model based on SFC operation process monitoring is proposed.This model comprehensively considers the service quality, resource utilization, and migration cost of SFC.

•
An agile algorithm for embedding and migrating SFC based on particle swarm optimization (PSO) is proposed.It can quickly find the optimal or nearly optimal embedding scheme to meet the requirements of SFC and facilitate the agile migration of SFC when the network state changes.

•
A simulator and simulation environment based on MANO architecture has been developed.It is capable of simulating dynamic network topology, SFC operation processes, embedding, and migration processes.

•
The experimental results demonstrate that the proposed method outperforms the comparison algorithm in terms of SFC income, migration quality, and resource utilization, thus confirming the effectiveness and superiority of the proposed method.

Related Work
In this paper, from the perspective of network operators, we focus on the SFC embedding and migration problem of UAV dynamic network topology under the scenario of a large number of SFC service requests.This section will introduce some representative and high-quality related studies from recent years.

SFC Embedding
The software implementation of VNFs provides the flexibility for service providers to deploy SFC in the existing networks.Therefore, a critical issue to be solved is how to determine the deployment location of each VNF in the SFC, which is called the SFC embedding problem.
Beck et al. [7] took the lead in bringing this problem to researchers' attention and proposed a universal virtual network framework that embedded multiple virtual networks onto the base network.On this basis, a heuristic algorithm is used to coordinate the embedding of VNF chains with the goal of minimizing bandwidth utilization [8].However, the framework is oriented to the large-capacity server of the computing center and cannot be directly applied to the UAV computing platform.With the goal of minimizing the total deployment cost, Tomassilli et al. [9] designed an optimal algorithm based on tree topology to optimally place VNFs when meeting all SFC requirements of the stream.Sallam et al. [10] expressed the maximum flow problem constrained by SFC as the fractional multi-commodity flow problem and then solved it.Jin et al. [11] expressed the VNF chain deployment problem as mixed-integer linear programming (MILP) to minimize total resource consumption in the context of computing service deployment on the edge service area.However, due to their dependence on prior knowledge and high computational complexity, these offline methods are difficult to apply to online placement scenarios.
In recent years, some researchers have turned their attention to hybrid SFC embedding problems, such as bidirectional SFC based on real-world business needs.Zheng et al. [12] define a new problem for minimum delay hybrid SFC embedding (ML-HSFCE) and propose an optimal hybrid SFC embedding algorithm (Opt-HSFCE).They extended this work in [13], proposing the first 2-approximation algorithm to jointly optimize the processes of h-SFC construction and embedding, which is called Eulerian-circuit-based hybrid SFP optimization (EC-HSFP).Dimolitsas et al. [14] proposed a distributed VNF embedding method (DVNE) to embed two SFC round-trips with the goal of minimizing round-trip latency.The problem of hybrid SFC embedding focuses on the service delay after the completion of embedding, and the service delay in these studies is mainly described by the hop number in the middle of the node, which does not accord with the fact that a large amount of delay also exists in the virtual resource scheduling on each computing platform.

SFC Migration
The embedding of SFC in ground infrastructure has been widely studied, but the research progress on the embedding of SFC in a platform with high mobility, such as a UAV network, is relatively slow.Although Vidal et al. [15] has built a UAV network test platform supporting SFC to verify its effectiveness, its highly dynamic and changing topology poses challenges to the real-time migration effect of SFC services.
Carpio et al. [16] investigated the problem of optimal placement of hybrid SFC from an Internet service provider (ISP) perspective and proposed a two-stage optimization process to analyze the performance impact of replication and migration of VNF.They extended the work using a traffic forecasting approach [17] to reduce migration costs.Rui et al. [18] modeled the SFC as a Petri net model and obtained reliability evaluation results related to execution time.Then, a VNF migration strategy with reliability as the optimization objective and cost as a consideration was designed.While the above study noted the importance of SFC migration on cloud computing platforms, it focused more on migrating SFC to accommodate the dynamic changes in services traffic, which is different from the dynamic nature of deploying SFC on UAV networks.
Qin et al. [3] described the application scenario of SFC for vehicle-assisted or UAVassisted edge computing, studied the SFC migration problem in dynamic networks with long-term cost budget constraints, and used the Lyapunov optimization method to solve it.In the same scenario, Bai et al. [19] used a quantitative modeling method based on semi-Markov process to study the potential impact of VNF migration time and network elasticity in SFC.In order to maximize the acceptance rate of service function chain requests (SFCRs) and reduce VNF migration and energy consumption as much as possible, Hu et al. [20] summarized the relevant factors such as node status, link status, energy consumption, migration node, and mapping success.Then, the VNF migration algorithm was designed using the actor-critic model, graph convolutional network, and LSTM network.
The optimization goal of these studies is to maximize the success rate of SFC embedding and improve the system benefits.However, considering that there is a life cycle of SFC, the revenue calculation of SFC cannot be determined only by whether it completes the embedding, and the supervision in its operation process is equally important, which is missing in the above research.

System Model
In this section, we describe the system model in five aspects, including the substrate network, the service function chain, the SFC embedding, the SFC latency, and the SFC revenue.Then, we formulate the problem as an integer programming model.The symbols used in this paper are summarized in Table 1.
Total latency, operation latency, remap and reroute latency of SFC System revenue of SFC f ∈ F 1 Boutin et al. [13] defines the latency matrix for servers.

Substrate Network Model
The base network is represented as an infrastructure by an undirected graph G S = (N S , L S ), with network nodes denoted as N S = {n 1 S , . . ., n i S , . . ., n S }, and n S ∈ N S for each physical node.Due to topological dynamics, we define L S as an adjacency matrix, unlike the typical definition of links in graphs, and each element in the matrix is determined by a function of time t.Thus, there is a set of physical links L S (t) = {l The physical node serves as a server to provide resources for the deployment of SFC, utilizing the function C S ( * ) to describe the maximum resource capacity, and the function C S ′ ( * , t) to describe the remaining resources at time t.In this paper, we consider four types of physical node resources: CPU, RAM, DISK, and ENG.Therefore, for node n S ∈ N S , its resource capacity is Different from other researchers' definitions of network node resources, this paper includes energy consumption resources.It considers UAVs as deployment platforms for physical nodes, with their batteries providing limited power.This is distinct from CPU, RAM, DISK, and other occupation-release resources, as energy consumption is one-time.The resource for a physical link is the transmission bandwidth (BAND).For link l S ∈ L S , its maximum resource capacity is C S (l S ) = {C BAND S (l S )}.As with node resources, SFC in the network will continue to occupy part of the transmission bandwidth between UAVs, so we need to pay attention to the remaining situation of link resources in real time, so as to facilitate the embedding of the new SFC and realize the full utilization of link resources.The remaining resource at time The deployment of VNF on physical nodes requires latency for creation and task queues.
We refer to the "Wait-Time Matrix" proposed by Boutin et al. [21] to describe the time that must be waited to request resources from the computing platform on the UAV.We consider that the DISK resources of a node are determined by the total size of the embedded functional software, which is pre-installed on the platform, while the different SFC only activates the software on demand, and the activation time is very short.What really affects the VNF operation time is the number of CPU cores applied for the SFC and the cache of service data.Therefore, the time waiting matrix is determined by the index of CPU resources and RAM resources, a consideration consistent with Boutin et al. [21] 's cluster design for the Microsoft cloud computing platform.The difference is that the table is designed as the index of the remaining resources of the node.For the sake of generality, we set the index granularity to 1 resource unit.The more remaining resources, the shorter the waiting time, and the tighter the remaining resources, the longer the scheduling time of the resources required to complete the task.We define a latency matrix for servers in each physical node as W S (n S ).The matrix is indexed by the current CPU resources and the remaining amount of RAM resources of the node, that is, ).The value indexed in the table represents the latency required for VNF preparation on the server when requesting resources.

Service Function Chain Model
We define the set of SFCs to be processed as F .For an SFC f ∈ F , we utilize the directed graph G f = (N f , L f ) to represent the virtual network structure of the service function chain.In this structure, the VNF virtual node is denoted as }, and for each virtual node, there exists n f ∈ N f .To align with the physical links in the base network, virtual links are defined using the adjacency matrix L f .In other words, f denotes the link between virtual node n i f and virtual node n j f .Of which: The advantage of using an adjacency matrix to define a network function chain is that it provides convenience for extending subsequent service functions.Schneider et al. [22] has proposed that the virtual network embedding with complex functions may not always exhibit a perfect chain structure.In some cases, bidirectional networks containing loops may be necessary to support complex applications, such as optimizing network video transmission and inserting advertisements, thereby achieving the network slicing effect.
SFC construction involves requesting resources from the base network to sequentially build VNF virtual nodes and connect them through virtual links.We use the function C f ( * ) to describe the amount of resources that SFC f ∈ F applies to the base network.The resources utilized are the four types available in the substrate network.For a virtual node n f ∈ N f , the allocated resources are denoted as The purpose of the virtual link is to request transmission bandwidth from the base link.Therefore, for the virtual link l f ∈ L f , the requested resource occupation applied for is [23] point out that the SFC for achieving complete wireless access functionality for the industrial Internet of things should include a wireless access node WAP f and industrial Internet of things equipment I IE f , as shown in Figure 1.In this paper, we assume that all UAV nodes have wireless access functions to enable random access of Internet of things equipment.The functions and configurations of these two nodes do not vary across different SFCs, which is not the focus of this paper.Therefore, they will not be discussed further.
When a user requests resources from the network, the network controller must specify the duration for which the resources will be occupied.This allows the network controller to determine when to release the occupied resources and reallocate them to other users, thereby improving the efficiency of network resource utilization.In order to implement this function, the arrival time of SFC is defined as t a f , and the service duration, which is the life cycle of SFC, is defined as t d f .Therefore, the end time of service can be calculated as t e f = t a f − t d f .This paper focuses on the transmission latency LA f in the quality of service (QoS) requirements that users submit to the network.It should be noted that in SFC resource allocation, the energy consumption resource C ENG f (n f ) of virtual node n f is interrelated with other resources, and its magnitude should not be specified from the user's perspective.Su et al. [24] highlight that in the actual operation of VNFs, CPU energy consumption accounts for a larger share compared to RAM and DISK.We used Su et al.'s assumption [24] (i.e., the mapping relationship between energy consumption resources, CPU, and running time in the resources applied by virtual node When SFC arrives at t = t a f , the controller anticipates the future energy consumption of the virtual node based on this, and then selects the appropriate deployment location.

SFC Embedding Model
For SFC f ∈ F , at time t, the mapping indication of a virtual node to a physical node is defined as the mapping of virtual node n i f to physical node n j S .The mapping indication that defines the virtual link to the physical link is represented as Since the resources provided by physical nodes are limited, the total resources occupied by VNFs running on them must not exceed the upper limit of available resources.Therefore, the mapping of virtual nodes needs to satisfy the following constraint relations: Similarly, because the transmission bandwidth of the physical links between UAVs is limited, the requested bandwidth of the virtual link of SFC f mapped to a physical link cannot be greater than the remaining bandwidth.Therefore, the mapping of virtual links must meet the following constraint: We do not consider the scenario where a VNF virtual node in SFC f can be deployed and operated concurrently on multiple physical facilities, that is, the virtual node cannot be mapped to multiple physical nodes.Therefore, there is the following constraint: Considering the dynamic nature of network topology, the prerequisite for successful virtual link mapping is the existence of physical links in the base network.Therefore, there is the following constraint: At the same time, we refer to wang et al. [25], using a flow model approach to ensure that the virtual links mapped from SFC f to the base network traverse the VNF virtual nodes in a specified order.We represent the set of incoming and outgoing links of physical node n S ∈ N S as I(n S ) and O(n S ), respectively.Additionally, n f (l d f ) and n f (l s f ) represent the destination and source VNF of virtual link l f ∈ L f , respectively.According to the flow model, all the outgoing traffic from nodes should be equal to the incoming traffic, and this constraint exists only for the virtual nodes and links to which SFC is mapped.Therefore, the constraint can be expressed as: 3.4.SFC Latency Model

Operation Latency
We analyzed the transmission delay of an SFC and discovered that the propagation delay and transmission delay are significantly influenced by the size of the data packet.This size is closely related to the SFC's service type and is also affected by the client and server's sending and receiving mechanisms, which are designed by the user and not taken into account by the operator.As an infrastructure leasing service, the primary concern should be the scheduling latency of running VNFs on each physical node.We provided the model for server latency in physical nodes with the "Wait-Time Matrix" at the end of Section 3.1.Considering that multiple VNFs in the SFC are running in parallel to process the service data flow at time t, the delay bottleneck may occur in one of the VNFs.This can be expressed as: Mapping can only be completed if the SFC's runtime latency meets its QoS requirements.Therefore, there are the following constraints:

Remap Latency
When a virtual node mapping needs to be migrated from one physical node to another, the delay primarily arises from requesting resources from the server and retransmitting cached data.We use the indicator vector m n f (t) to determine the migration relation of the mapping of virtual node n f at time t.The calculation method is (t) represents the vector composed of the mapping relation of virtual node n f and all physical nodes N S at time t, and the symbol ⊕ represents the exclusive OR operation between two vectors.The resulting migration delay can be calculated as follows: where ||m n f (t)|| 0 represents the 0-norm of m n f (t), which is the count of non-zero elements in the vector, and determines the number of physical nodes involved in the migration process.C RAM f (n f ) represents the amount of buffered data that needs to be retransmitted to recover the state of virtual node n f , and with virtual node n f as the destination.

Reroute Latency
We believe that embedding SFC into the virtual network relies on the OpenFlow table delivery mechanism of SDN to establish virtual links.Therefore, it is necessary to sequentially modify the routing tables of physical nodes to facilitate the forwarding of service traffic in SFC.The process of distributing the flow table contributes to the rerouting delay.We utilize the indicator vector m l f (t) to determine the migration relation of the mapping of the virtual link l f at time t.The calculation method is , where y l f ,L S f (t) represents the vector composed of the mapping relation of the virtual link l f and all physical links L S at time t, and the symbol ⊕ represents the exclusive OR operation between the two vectors.The resulting migration delay can be calculated as follows: The expression ||m l f (t)|| 0 represents the 0-norm of m l f (t), which is the count of nonzero elements in the vector.It is used to calculate the number of physical links involved in the migration process.t 0 represents the latency of modifying the routing table needed to modify a mapped physical link.
In summary, the total delay required for SFC service transmission is:

SFC Revenue Model
In contrast to other research studies, this paper utilizes the revenue per unit time method.This method is based on observing the dynamic service mode of SFC.SFC adjusts the mapping scheme in real time based on the network topology during operation, leading to temporary network fluctuations and a potential inability to maintain the service according to the original QoS requirements.Therefore, it is not appropriate to base revenue solely on the success of the embedding.In this paper, we employ a lenient decision method to calculate the revenue during the migration process.This means that there may be QoS nonconformity during the migration process, but it is essential to ensure that the QoS requirements can be satisfied after migration.By setting the QoS violation device gain to 0, we can suppress the behavior of frequently performing migration that affects SFC traffic transmission.The unit revenue earned at a given time can be calculated as follows: where µ represents the resource price per node, and η represents the resource price per link.σ(t) is an indicator variable used to indicate whether the SFC violates QoS requirements at time t, that is: Let us discuss this expression in the context of different situations: Case 1: When migration does not occur at time t, the migration indicator variables m n f (t) and m l f (t) are both zero vectors, and the total delay ψ f (t) is solely the waiting delay ψ 0 f (t) of the migrated SFC in the regular operation of the base network.Since the SFC has been embedded, the delay must satisfy the constraint condition that is less than the QoS requirement LA f (i.e., σ(t) = 1), so the revenue is calculated normally.
Case 2: When migration occurs at time t, the migration indicator variables m n f (t) and m l f (t) are not zero vectors.The total delay ψ f (t) at this time includes the remapping delay, the waiting delay of the SFC operation, and the rerouting delay in the migration process.It is necessary to determine whether the delay is less than the QoS delay requirement LA f .The result is σ(t) = 1 if the requirement is met, and the payoff is calculated normally; it is σ(t) = 0 if the requirement is not met, in which case the payoff is 0.
As a result, the unified expression for income calculation before and after SFC migration is achieved.When SFC completes its service life cycle, revenue settlement occurs: It should be noted that this definition also differs from the definition of SFC revenue in other studies.We calculate the revenue of SFC throughout its entire life cycle, rather than just completing the embedding process.If the SFC fails to map after migration due to an operation taking place during migration (i.e., if the SFC ends abnormally), it will be recorded as 0 along with the revenue before migration.This is designed from the perspective that incomplete traffic transmissions will be meaningless.We also hope that the designed algorithm will be integrated into SFC and that the integrity of its traffic will be guaranteed, rather than executing multiple broken traffic transmissions to generate revenue.
During the continuous operation of the network, we prioritize the long-term average revenue of operators:

Problem Formulation
The aim of this paper is to maximize the long-term average return for operators.Problem 1 can be expressed as follows: (1) − (15) It should be noted that this is a non-traditional integer programming problem with a time-dependent objective function that needs to be solved quickly, requiring the algorithm to perform well online.At the same time, the decision variables in this problem are discrete 0 and 1 variables related to time, and the constraint conditions are complex and change over time, making this problem strongly discrete and dynamic.

Hardness Analysis
The challenge of solving problem 1 mainly arises from its extensive solution space.This can be analyzed as follows: the solution space size of node mapping is From the perspective of the online algorithm, only one SFC embedding at a time is considered, simplifying the problem to the knapsack problem with a solution space of However, the complexity of the problem is further increased by introducing the interaction between time and multiple knapsacks.Rost et al. [26] has proposed that the problem of virtual network embeddings is abstracted as a graph mapping problem and specified using the 3SAT model.The NP-completeness of SFC mapping in a static topology has been proven.Considering the complex constraints, such as dynamic topology and delay, the problem remains NP-hard and non-approximable.

Particle Swarm Optimization for SFC Embedding
Inspired by the regularity of bird flocks' foraging behavior, James Kennedy and Russell Eberhart developed a simplified algorithm model [27], which eventually evolved into particle swarm optimization (PSO) after years of refinement.In order to fully utilize the particle swarm optimization algorithm's ability to search for function extrema in a continuous domain, we consider the probability of mapping a virtual node to each base network node in SFC as the position variable of a particle.Therefore, the dimension of each particle is D = |N f | × |N S |, and the position of the i-th particle is: The range of particle positions is given by x i,d ∈ [0, 1], and the velocity of the i-th particle is: We define the mapping relationship between the particle's position and the node when SFC is embedded as: That is, for the virtual node n i f , we will extract the probability vector x n i f , * f representing the mapping from particles to physical nodes, and select the position with the highest probability to execute the embedding action.
The optimal position sought by the i-th particle in the PSO algorithm (i.e., the individual optimal solution) is: The population searches for the optimal position, which is the global optimal solution: The fitness value of the optimal position searched by the i-th particle (i.e., the optimization function f p ) is defined as: That is to say, if embedding the i-th particle according to its position violates the constraint and results in embedding failure, the fitness value is set to the maximum value.If the embedding is successful, the fitness value is calculated based on the revenue generated by the embedding scheme.Note that we do not directly use Equation ( 13) as the fitness function because we believe that there is a distinction between the success of the embedding and the transient nature of the QoS violation.There may be a situation where embedding is successful, but the delay in the process of embedding SFC and migration exceeds the QoS requirement.Equation ( 13) directly calculates this part of the benefit as 0, but further exploration should be encouraged in the PSO algorithm.We calculate the difference between the delay caused by the current mapping and the QoS delay requirement.Then, we combine this with the benefit to incentivize particles to move towards positions in the solution space where the SFC delay is minimized.The lowest fitness value among all particles is taken as the global optimal fitness value f g .
The velocity update formula for the i-th particle is: The position update formula is: Where N represents the number of particles, K represents the number of iterations, and omega is inertia weight.Additionally, c 1 and c 2 are learning factors, while r 1 (k) and r 2 (k) are random numbers within a specific interval used to enhance the randomness of the search.
The complete flow of the algorithm is shown in Algorithm 1.We give the steps of the proposed algorithm in detail, and we believe that it provides an effective method to solve the problem of online SFC embedding and migration.The computational complexity of a particle swarm optimization algorithm can usually be expressed as O(NDK), where D is the particle dimension, which in our problem is calculated as N f N S .Meanwhile, the Djikstra algorithm was used to perform routing and link mapping between two VNFs, whose complexity is O(N 2 S ).Therefore, the complexity of the algorithm proposed in this paper is O(NN f N S K + N f N 2 S ). for all each dimension d do 3: Randomly initialize the particle position x i,d in the range [0,1]; 4: Randomly initialize the particle velocity v i,d in the range [0,1]; Select the smallest historical optimal fitness value among all particles as the global optimal fitness value p k gbest ; 16: for all each particle i do 17: Calculate velocity according to the Equation ( Update particle position according to the Equation ( iter = iter + 1; 21: end while 22: if the fitness f p is the limiting value In f then 23: Convert the global optimum fitness particle position x i to a node embedding scheme X f with Equation (20); 26: Solve the shortest path between embedded nodes with Dijkstra algorithm, and the link embedding scheme Y f is obtained; 27:

. Analysis of Convergence of Algorithm
We conduct a dynamic analysis of the particle's trajectory during the algorithm iteration, and the velocity update is expressed as: Position updates are indicated by: Let Thus, the updates for velocity and position can be rewritten as: x(k The matrix form can be expressed as: According to the hypothesis in [28], the position corresponding to the current optimal fitness value of the particle is the global optimal position, and it has become a fixed value p pbest (k) = p gbest (k) = p in the long-term iteration.In this case, the dynamics model of PSO is rewritten as: where T is the velocity vector of the particle during iteration.
T are the position vectors of particles in the iterative process.
The parameters in the original formula are expressed in matrix form as follows: We can think of this particle as a dynamic system whose coefficient matrix is: The stability criterion of the system (i.e., ensuring that the eigenvalues of the coefficient matrix A(k) are less than 1) is used for analysis.Find the eigenvalues of the block matrix A(k), that is, solve the equation det(sI , the equation can be rewritten as: The characteristic roots are , respectively, under the condition |s| < 1.
The conditions for stable convergence are: where u(k) = −φ(k) + ω + 1.The equation can be solved as follows: Our particle swarm optimization algorithm uses the parameters that satisfy this condition to ensure the stability of convergence.Although the parameter selection conditions that make the algorithm in this paper converge can be analyzed from the above content, an important decision of whether the particle swarm converges still depends on the fitness function with Equation (23).The fitness function determines the movement direction of the particle and affects the process of particle searching for the optimal solution, while the design of learning factors and weights ensures the asymptotic stability of the particle adjustment process.The complexity of the fitness function lies in its discreteness.Although we make the particle variables continuous by mapping probabilities, the function values are still discrete, and the direct reason for this is the discrete network structure.We have not yet solved how to prove the discreteness of the algorithm directly from the fitness function, but only hope that the embedding strategy of SFC under the learning factors and weights of PSO is not so sloppy.

Simulation Model
In order to validate the effectiveness and performance of the proposed resource-aware SFC embedding and migration algorithm for UAV dynamic networks, we developed a simulation framework for SFC embedding based on MANO architecture using Python 3.9 (https://gitee.com/WangXi_Chn/mini_sfc,accessed on 3 February 2024), with reference to [29], as shown in Figure 2.  Designed and proposed by the European Telecommunications Standards Institute (ETSI), the MANO architecture provides a well-defined framework for NFV that is particularly adept at handling the intricate dependencies and operational dynamics of network services.The MANO architecture's ability to interface with various virtual network functional infrastructure (VNFI) domains makes it better suited for the heterogeneous environment of UAV IoT, where interoperability and integration with different network elements and services is critical.We designed the simulation model of SFC embedding and migration algorithm with reference to MANO architecture, so that it has certain standardization, reproducibility, and replicability.

Initialization
The simulation framework mainly comprises the following components: • The initialization model is used to configure and schedule events in simulation scenarios, initialize all NFV-MANO modules, and make preparations for the simulation.

•
The virtual network function orchestrator (VNFO) model is used to orchestrate and manage the SFC.This includes tasks such as creating, embedding, migrating, and destroying the SFC, as well as calculating the revenue model of the SFC and optimizing the objective function through a solver.

•
The virtual network function forwarding graph (VNFFG) model describes the topology, functional requirements, and quality of service of the SFC, as well as the life cycle status of the SFC, including creation, embedding, running, migration, and destruction.

•
The NFV Scave model is used to monitor and maintain SFC, which involves collecting and analyzing SFC operating status, performance indicators, energy consumption, and resources.It also includes making judgments and executing SFC migration trigger conditions.
The simulation framework utilizes a discrete event-driven approach, meaning it advances the simulation clock and processes events based on their occurrence time and type.Events are primarily categorized into endogenous events and exogenous events.Endogenous events are those caused by state changes resulting from internal activities of the system, such as the creation, embedding, migration, and destruction of SFC, while exogenous events are those caused by external factors affecting the system, such as the movement, communication, and energy consumption of UAVs.The timing and nature of events are determined by the relevant probability distribution or rules, and the processing of events is carried out using the corresponding model or algorithm.The execution flow of the simulation framework is depicted in Figure 3.

Impact of Topological Change
To assess the algorithm's performance in a UAV network with dynamic topological changes, we introduced various topological change events at different times in the base network during the operation process.We then compared and observed the completion rate of SFC, total revenue, and long-term average revenue during the experiment.The result is depicted in Figure 5.Given that the number of network topology changes during operation falls within the range of 10 to 50, the experiment is repeated 5 times.In Figure 5a, it can be seen that the PSO-based embedding algorithm has a significantly higher SFC completion rate than the baseline algorithm by approximately 50%.It is also less affected by the severity of topological changes, whereas the greedy algorithm and random algorithm are only 37% and 10%. Figure 5b,c demonstrate that the PSO algorithm also outperforms the two baseline algorithms in terms of the total and long-term average benefits of the running process.However, as the complexity of the topology changes increases, the income situation of PSO gradually deteriorates to the level of the greedy algorithm.This demonstrates that although SFC can maintain a high completion rate and provide an embedding scheme that meets the constraint conditions under the action of the PSO algorithm, the frequent rerouting and remapping delays in the migration process prevent it from obtaining benefits normally.

Impact of Workload
To investigate the influence of service load on the SFC embedding algorithm, we varied the SFC arrival rates for our experiments, and the results are depicted in the figure.Figure 6a illustrates the completion of the SFC as the service load gradually increases.It is evident that the PSO algorithm can maintain a stable level, while the greedy algorithm and random algorithm gradually deteriorate.This gap gradually expands with an increase in load.This phenomenon can also be observed in the total returns and long-term average returns depicted in Figure 6b,c.This result demonstrates that the PSO algorithm is capable of thoroughly exploring the solution space of the problem and offering a viable placement or migration plan, even when there are more SFC services in the network and fewer remaining resources.This also exemplifies its resource-aware ability.It should be noted that under optimal conditions, the arrival rate of SFC ultimately impacts the fluctuation of resource occupancy in the network.Hence, apart from the embedding algorithm, the bottleneck also lies in the distribution of network resources, which can result in significant random errors in experimental outcomes.

Impact on Volume of Services
In the experiment, we are investigating the network's capacity by using different amounts of SFC.Specifically, we gradually increase the amount of network resources requested to explore the network's ultimate capacity.Leased resources, such as CPU, RAM, and DISK, have recyclable characteristics that result in minimal impact on the increase in the number of SFCs when the arrival rate and life cycle remain unchanged.As a result, revenue increases steadily over time.However, for consumable resources such as ENG, once the energy is depleted, the network will no longer be able to provide resources for any SFCs.As shown in Figure 7a, as the number of SFCs increases, the PSO algorithm gradually reaches the bottleneck of network resources, and the completion rate approaches that of the greedy algorithm.It can also be calculated that the maximum number of SFCs that can provide resources in the network is approximately 30.It can also be observed from the total and long-term returns in Figure 7b,c that the yield curve reaches its limit when energy resources are near exhaustion.

Discussion and Future Work
This paper has presented an in-depth examination of the embedding and migration of service function chaining (SFC) within a dynamic network topology, specifically a UAV network.The study focused on the comprehensive process of calculating the benefits of SFC, from its deployment to maintenance throughout its lifecycle, with the long-term average benefit as the optimization goal.The problem was formulated as an integer programming problem and addressed with a proposed SFC embedding algorithm based on the particle swarm optimization (PSO) algorithm.This algorithm provides an SFC embedding and migration scheme with reduced time costs.Experimental results demonstrated the algorithm's ability to achieve network resource perception by leveraging the exploratory capabilities of particles, thereby efficiently utilizing network resources across varying loads, from low to high.
However, we acknowledges the limitation of the local optimal solution bottleneck of the PSO algorithm as a heuristic algorithm.Moreover, the performance of optimized deployment under given simulation settings is not presented in this paper and then compared with the used algorithm to reflect the degree of optimality of algorithm.This is mainly because using the existing network modeling methods in dynamic scenarios, it is extremely complicated to solve the optimal deployment scheme, and this complexity is mainly related to the sequential decisions brought by considering the time factor.As far as we know, the solution of the optimal SFC embedding mode in a dynamic network environment has not been studied in the existing research.In fact, our verification experiment on network resource consumption can also demonstrate the optimality of this algorithm to a certain extent, because at the end of the simulation, the battery resource utilization rate of the UAV swarm has reached about 80%, and it is already very difficult to further deploy SFC to the network under the constraint of energy consumption.We do not yet have an offline algorithm that can tell us what the ideal limit of resource utilization is.In our recent research, modeling dynamic networks using a time extend graph (TEG) combined with maximum flow theory is a possible way to achieve this goal, which is one of our future research plans.
Future research is recommended to propose an online algorithm with similar agility but improved exploration performance, further optimizing the utilization of network resources in conjunction with the statistical law of SFC service arrival and SFC context.This approach will enable progress towards the global optimal solution.Intelligent algorithms, such as those represented by deep reinforcement learning, may be one of the potential solutions to this challenge.This study's findings and proposed algorithm have significant implications for the field of dynamic network topology, particularly in the context of UAV networks.
Author Contributions: Conceptualization, X.W.; methodology, X.W. and S.S.; validation, S.S.; writing-original, X.W.; writing-review and editing, S.S. and C.W. All authors have read and agreed to the published version of the manuscript.

Figure 1 .
Figure 1.Deployment of VNFs on the UAV IoT to enable network slicing and support the SFC.

Figure 2 .
Figure 2. SFC embedding and migration simulation framework based on MANO.

Figure 5 .
Figure 5.Comparison of SFC algorithm embedding performance under different frequencies of topological changes: (a) comparison of SFC completion rates; (b) comparison of total system revenue; (c) comparison of long-term average revenue.

Figure 6 .
Figure 6.Comparison of SFC algorithm embedding performance under different arrival rates of SFCs: (a) comparison of SFC completion rates; (b) comparison of total system revenue; (c) comparison of long-term average revenue.

Figure 7 .
Figure 7.Comparison of SFC algorithm embedding performance under different volumes of SFCs: (a) comparison of SFC completion rates; (b) comparison of total system revenue; (c) comparison of long-term average revenue.

Table 1 .
Notation and definitions.
j S at time t Y f (t)Set of mapping indication between virtual link in SFC f and physical link at time t y gbest , p 2,gbest , . . ., p D,gbest ] Particle Swarm Optimization Algorithm for SFC Embedding Input: Current substrate network G S = (N S , L S ); Current SFC request f ; Dimension of particle position dim; Max iterations maxIter; Number of particles pop.Output: SFC embedding scheme node mapping X f and link mapping Y f , f lag indicating whether embedding succeeds.
Algorithm 1 1: for all each particle i do 2: