## 5 Proposed Model
### MTD-Based Secure Two-Way Routing
The formulation of L2 norm distance can be provided as:  
\[\mathrm{L2}_{\bar{\mathrm{jbest}}}=\sqrt{\sum_{i=1}^{n}\left(\mathrm{Nwe}_{ \bar{\mathrm{ji}}}-\mathrm{Nwe}_{\mathrm{best}}\right)^{2}},\,\mathrm{j}\in[1,n] \tag{32}\]  
\[\mathrm{L2}_{\mathrm{jworst}}=\sqrt{\sum_{i=1}^{n}\left(\mathrm{Nwe}_{\bar{ \mathrm{ji}}}-\mathrm{Nwe}_{\mathrm{worst}}\right)^{2}},\,\mathrm{j}\in[1,n] \tag{33}\]After that, the worst condition similarity is determined based on the formula provided below:  
\[\text{sim}_{\text{worst}}=\frac{\text{L2}_{\text{jworst}}}{\text{L2}_{\text{ jworst}}+\text{L2}_{\text{jbest}}},\;\text{sim}_{\text{worst}}\in[0,1],\;\text{j}\in[1,n] \tag{34}\]  
where \(\text{sim}_{\text{worst}}\) is the worst alternative similarity in which routes are categorized based on results from Equation (34) as:  
\[\text{sim}_{\text{worst}}=\left\{ \begin{aligned} & 0,\;\text{WorstRoute}\\ & 1,\;\text{BestRoute}\end{aligned} \right. \tag{35}\]  
Based on that, the optimal determined routes are ranked using the MCDM method. The table illustrates the optimal route ranking using the MCDM method. From the Table 1 provided below, the green shaded region denotes the best route, whereas the orange shaded region denotes the worst route based on the computation of proposed four route criteria. The two-way routing is enabled by the local gateway to the underlying WSN nodes and edge-assisted switches. However, the security of the proposed routing is achieved by a trust metric, which is not enough to cover the complete routing security to the SDWSN environment. For that, the proposed work adopts MTD, which alters the attack and detection surface in a random manner to confuse the attackers, thereby improving the attackers' cost. The first way of routing is performed in the infrastructure layer among the WSN nodes. In that, the intermediated attacks (i.e., MITM and eavesdropping attacks) are overcome by performing the encryption and decryption of routing packets using the Camelia Encryption Algorithm (CEA). The operations of CEA are the same as the work in [35]. Furthermore, the routing paths are randomly switched as the MTD countermeasure from the set of optimal ranked routing paths. By performing random route switching, the reconnaissance attacks in the infrastructure layer are mitigated. Figure 4 represents the CGAN-based MTD in the edge-assisted switch layer. The second way routing is performed is in the edge-assisted SDN switch layer among the SDN switches. Similar to the infrastructure layer, the routing information was encrypted and the routing path was switched randomly. In addition to that, to overcome the threats faced by the high potential reconnaissance attackers the proposed work utilizes a reconnaissance agent in the switch plane to monitor suspicious activities. The attackers tried to target the weak points of the switches and impose attacks. The suspicious activities include frequent visits to the network, unbounded network traffic, etc. From the suspicious activity, the current active edge-assisted SDN switches are idled and another set of switches are active to increase the attacker cost. The condition of active and idling SDN switches is decided by a deep learning algorithm named Cycle General Adversarial Networks (CGAN) based on the suspicious activity severity. The proposed CGAN is composed of discrimina