## 4 Proposed Architecture
### Implementation Phase
First, the VPP_Interface algorithm is checked, then the VppMPLSTunnelInterface, and finally the VPP_Neighbor. The ABMeta, util, and VPP_Neighbor items need to be imported into the VPP_Interface algorithm. The ABC item is used to establish infrastructure in Python to define abstract base algorithms (ABCs). ABMeta is also used to define and create ABC. In the util item, it is necessary to activate the util algorithm to establish the test structure in vpp. The algorithm VPP_Interface creates vpp interfaces and related subjects. There are many properties defined in this algorithm, but the ones required for the VPLS service can include assigning index interfaces, selecting names for interfaces, and activating MPLS on the VPP interface. VppMPLSTunnelInterface itself imports the following: from vpp_ip_route import VppRoutePath and from VPP_Interface import VppInterface. The last item is the VPP_Neighbor algorithm. This algorithm is required to establish VPP_Interface. In Algorithm 4, we have the function of finding neighbors. It should be noted that this section works with inet_pton, net_ntop, AF_INET, and AF_INET6 sockets. Here, the VppMPLSTunnelInterface code is as follows:```
1:{CreateMPLStunnelinterface}
2:def_init_(self, test, paths, is_multicast=0, is_l2=0):
3:self_sw_if_index = 0; {Creatingmpls tunnels with paths, multicast and is_l2 parameters}
4:super(VppMPLSTunnelInterface,self)_init_(test)
5:self_test = test
6:self_t_paths = paths
7:self.is_multicast = is_multicast
8:self.is_l2 = is_l2
9:def add_vpp_config(self):
10:self_sw_if_index = 0 xffffffff
```

**Algorithm 4** VppMPLSTSTunnelInterface (VppInterface):

In (b) process, by calling the vpp_ip_route algorithm, the routing is carried out. Before defining this function, the following rules must be satisfied:

```
1:{comment:# from vnet / vnet / mpls / mpls_types.h}
2:MPLS_IETF_MAX_LABEL = 0 xffff
3:MPLS_LABEL_INVALLID = MPLS_IETF_MAX_LABEL + 1
```

This section sets the maximum label to 0 xffff and determines the value of the MPLS label. An important part of VPLS performance will depend on this, as the important VppMplsRoute function is defined in vpp_ip_route. In Algorithm 5, the local label, EOS bit, and table ID are set. If the EOS bit is equal to one, this means that we will not have multiple labels. The route-finding function in line 10 is also defined. ```
1:{comment:MPLSRoute/LSP}
2:def_init_(self, test, local_label, eos_bit, paths, table_id=0, is_multicast=0):
3:self_test = test
4:self.paths = paths
5:self.local_label = local_label
6:self.eos_bit = eos_bit
7:self.table_id = table_id
8:self.is_multicast = is_multicast
9:def find_route(test, ip_addr, len, table_id=0, inet=AF_INET)
```

**Algorithm 5** VppMplsRoute(VppObject):

In process (c), the Bridge-domain section is applied using the vpp_papi_provider algorithm. All the APIs required for the users are available in this algorithm. Regarding VPLS, it is necessary to create or remove Bridge-domain interfaces. In this section, applying the sw_interface_set_l2_bridge configuration is sufficient. (d) Packages are taken from the customer interface. The physical address and IP addresses of the packages should also be written in the configuration. (e) Packet encapsulation: After section (d), the bridge domain learns and sends each packet. This post will be in capsule form. Functions such as add_stream() and enable_capture() from vpp_pg_interface must be applied and called. Adding streams from packets to VPP is achieved by the add_stream(). The ability to capture from the packet-generator interfaces is enabled by enable_capture(). (f) Forwarding: According to the Capturing packages in the previous section, we can move forward packages based on learning by applying the get_capture command. This function from vpp_pg_interface receives capture packets. In the (g) and (h) sections, a stream of packets is sent in each direction. Finally, after the work is completed, the Bridge-domain interface can be disabled.