### :school: TEEP 2024_RT LAB_ORAN DPDK #### :book: Technology Background :::success List the essential information of this chapter. 1. Networking Programming - API and DB 2. Wireshark and Tshark 3. Networking Programming - iPerf 4. Networking Programming - Ping 5. 5G Core - The study of 5G Core 6. 5G Core - The Installation of 5G Core(free5gc) 7. 5G Core - The Testing of 5G Core(E2E test) 8. 5G ORAN - The study of ORAN 9. 5G ORAN - The Installation of 5G ORAN 10. 5G ORAN - The Testing of 5G ORAN ::: --- ## 1. Networking Programming - API and DB ### 1.1 API (Application Programming Interface) #### What Are API's? APIs, or application programming interfaces, are sets of tools, definitions, and protocols that enable the integration of application software and services. They allow products and services to communicate with each other without the need for constant development of new connectivity infrastructure. APIs can be private, partnered, or public, with benefits such as creating new revenue streams, expanding brand reach, and fostering innovation through external development. Two significant types of APIs are SOAP (Simple Object Access Protocol) and REST (Representational State Transfer). SOAP standardizes message formats and requests, serving as a protocol specification for communication between applications in different environments and programming languages. On the other hand, REST is an architectural style, relying on six guiding principles to offer a simpler and more flexible approach. Due to their simplicity and flexibility, RESTful APIs are gaining popularity and are often preferred over SOAP in the growing landscape of web APIs. ![image](https://hackmd.io/_uploads/Sy_bE_SYp.png) #### Why We Need to API ? APIs play a crucial role in facilitating the integration of data, applications, and devices within an IT organization, enabling seamless communication and collaboration among various technologies. The inefficiencies and financial losses incurred due to incompatible technologies can be mitigated through effective API usage, especially when combined with distributed integration and containers. Agile integration, as an architectural approach to integration platforms, prioritizes a compact IT footprint, high scalability, and availability, as well as clearly defined, reusable, and well-managed endpoints. In essence, the future of interconnected systems should not only support collaboration between teams and technologies but actively encourage it. With the increasing pace of technological change, agile integration is seen as the optimal strategy to facilitate business transformation. ![image](https://hackmd.io/_uploads/rklXK-dHYp.png) #### API for Telco Telecom APIs, also known as network APIs for telcos, serve as standardized interfaces connecting user-facing applications with complex 4G or 5G networks. These APIs enable developers to access and control network resources, facilitating the creation of advanced applications and services with features like low-latency connectivity and quality of service. They act as protocols and tools, bridging the digital world with telecommunication infrastructure for seamless integration and enhanced functionalities. The Telecom API market has experienced significant growth, driven by factors such as digital transformation, increased mobile penetration, the IoT revolution, and the desire to enhance customer experience. Key players in the market include Twilio, Nexmo (Vonage), Plivo, and Tropo (Cisco). Trends shaping the future of the Telecom API market include 5G integration, the rise of edge computing, a focus on security and privacy, and the increasing role of artificial intelligence in communication systems. #### API Monetize Networks Network APIs play a crucial role in developing applications that generate revenue on networks. Examples include: 1. **mMTC/IoT Applications:** The use of device-specific Network APIs is essential for developing applications that interact with sensors and machines in Internet of Things (IoT) environments. 2. **Low-latency Applications:** Developers can use network APIs like Quality On Demand and device-specific APIs to create applications with minimal latency, particularly beneficial in scenarios involving edge computing. 3. **Network Slicing:** Network APIs enable the creation and management of network slices, allowing specific applications and services to operate within virtual network segments. #### Elements in an URI APIs * Connection Protocol: This denotes the communication protocol (e.g., HTTP, HTTPS, or TCP) that dictates how data will be transmitted between the client and server. Common protocols include HTTP, HTTPS, and FTP. * Host Name: This section contains the name of the hosting server, such as Google or Facebook, identifying the API's location. The domain name specifies the server hosting the resource (e.g., www.example.com in https://www.example.com/index.html). * Endpoint Type: It is useful to specify whether the endpoint is an API endpoint or another type, aiding in categorization. * Version: Incorporating a version in the API design is crucial for seamless updates. For example, transitioning from V1 to V2 ensures uninterrupted services reliant on the API during changes. * Base Path: Positioned after the version, the base path indicates the service's name the client intends to access, creating a structured hierarchy. This path outlines the resource's location on the server (e.g., /index.html in https://www.example.com/index.html). * Query: Following the base path, queries are added using "?" instead of "/", allowing the inclusion of parameters for the endpoint. This permits dynamic customization of requests, enhancing API flexibility. Query parameters, like q=example and limit=10 in https://www.example.com/search?q=example&limit=10, convey additional information to the server. * Fragment Identifier: The fragment identifier, introduced by a # character, specifies a particular section of the resource. For instance, in https://www.example.com/index.html#sectionX, the fragment identifier is sectionX. #### 1.2 DB (Database) 1. Database define A database is a systematically organized collection of structured information, known as data, usually stored electronically within a computer system. It is typically managed and controlled by a database management system (DBMS). The combination of data, DBMS, and associated applications is collectively referred to as a database system, often abbreviated to just "database." In common types of databases employed today, data is typically organized in rows and columns across a series of tables. This tabular structure enhances the efficiency of processing and querying data. It facilitates easy access, management, modification, updating, control, and organization of the stored information. Structured Query Language (SQL) is widely used in most databases for writing and querying data, providing a standardized and efficient means of interacting with the database. ![image](https://hackmd.io/_uploads/HJeCUurta.png) 2. Types of databases There are many different types of databases. The best database for a specific organization depends on how the organization intends to use the data. * Relational databases Relational databases became dominant in the 1980s. Items in a relational database are organized as a set of tables with columns and rows. Relational database technology provides the most efficient and flexible way to access structured information. * Object-oriented databases Information in an object-oriented database is represented in the form of objects, as in object-oriented programming. * Distributed databases A distributed database consists of two or more files located in different sites. The database may be stored on multiple computers, located in the same physical location, or scattered over different networks. * Data warehouses A central repository for data, a data warehouse is a type of database specifically designed for fast query and analysis. * NoSQL databases A NoSQL, or nonrelational database, allows unstructured and semistructured data to be stored and manipulated (in contrast to a relational database, which defines how all data inserted into the database must be composed). NoSQL databases grew popular as web applications became more common and more complex. * Graph databases A graph database stores data in terms of entities and the relationships between entities. OLTP databases. An OLTP database is a speedy, analytic database designed for large numbers of transactions performed by multiple users. These are only a few of the several dozen types of databases in use today. Other, less common databases are tailored to very specific scientific, financial, or other functions. In addition to the different database types, changes in technology development approaches and dramatic advances such as the cloud and automation are propelling databases in entirely new directions. Some of the latest databases include * Open source databases An open source database system is one whose source code is open source; such databases could be SQL or NoSQL databases. * Cloud databases A cloud database is a collection of data, either structured or unstructured, that resides on a private, public, or hybrid cloud computing platform. There are two types of cloud database models: traditional and database as a service (DBaaS). With DBaaS, administrative tasks and maintenance are performed by a service provider. * Multimodel database Multimodel databases combine different types of database models into a single, integrated back end. This means they can accommodate various data types. * Document/JSON database Designed for storing, retrieving, and managing document-oriented information, document databases are a modern way to store data in JSON format rather than rows and columns. * Self-driving databases The newest and most groundbreaking type of database, self-driving databases (also known as autonomous databases) are cloud-based and use machine learning to automate database tuning, security, backups, updates, and other routine management tasks traditionally performed by database administrators. 3. Connection between API and DB ![image](https://hackmd.io/_uploads/ry6U5_BtT.png) APIs and databases are integral components of contemporary software systems. APIs, or Application Programming Interfaces, facilitate communication between different software elements, while databases store and manage data. APIs often act as intermediaries to enable the retrieval and manipulation of data stored in databases by various applications. When a client application sends a request to an API, the API server processes the request and retrieves the necessary data from the database. The API then sends the data back to the client application in a format easily consumable by the application. This collaborative process ensures a seamless experience for end users. For example, in a mobile application for e-commerce, a user's search query prompts the mobile app to send a request to the API server, which retrieves relevant data from the database and presents it to the user. In the realm of APIs and databases, functions like CRUD (Create, Read, Update, Delete) and HTTP functions play a crucial role in interacting with data. CRUD functions are fundamental for database applications, representing the key operations of creating, reading, updating, and deleting data. In web-based REST APIs, these CRUD functions align with HTTP methods, such as GET, POST, DELETE, PUT, and PATCH. Each CRUD function and its corresponding HTTP method have specific roles in managing and manipulating data within the database. Here is a brief description of each CRUD function and its corresponding HTTP method: * Create: This function is used to create a new resource in the database. In HTTP, the POST method is used to create a new resource. For example, when a user submits a form on a website, the data from that form needs to be stored in a database. This involves creating a new record in the database. * Read: This function is used to retrieve an existing resource from the database. In HTTP, the GET method is used to retrieve data from a resource. For example, when a user wants to view their account information on a website, the application needs to be able to retrieve that information from the database. * Update: This function is used to modify an existing resource in the database. In HTTP, the PUT method is used to update an existing resource, while the PATCH method is used to update a part of an existing resource. For example, when a user wants to update their account information on a website, the application needs to be able to modify the corresponding record in the database. * Delete: This function is used to remove an existing resource from the database. In HTTP, the DELETE method is used to delete a resource. For example, when a user wants to delete their account information on a website, the application needs to be able to remove the corresponding record from the database. ![image](https://hackmd.io/_uploads/SyuFcdSYa.png) Network programming is a specialized area of programming that involves creating code or programs to facilitate communication between computers or external devices over a network, such as the internet. It plays a crucial role in enabling communication between diverse software components, including client applications, APIs, and databases. APIs act as intermediaries to streamline the exchange of data between different software components. In this context, when a client application sends a request to an API, the API server processes the request, retrieves the necessary data from a database, and then sends the data back to the client application in a format that is easily consumable. TCP/IP (Transmission Control Protocol/Internet Protocol) and UDP/IP (User Datagram Protocol/Internet Protocol) are two prominent protocols for network communication. TCP/IP is a connection-oriented protocol that ensures reliable, ordered, and error-checked delivery of data between applications. In contrast, UDP/IP is a connectionless protocol that provides less reliable, unordered, and unacknowledged delivery of data. Other widely used protocols in network programming include HTTP (Hypertext Transfer Protocol), HTTPS (Hypertext Transfer Protocol Secure), and MQTT (Message Queuing Telemetry Transport). Two programming interfaces commonly employed in network programming are TLI (Transport Layer Interface) and Socket API. TLI offers a high-level interface to network protocols like TCP/IP and UDP/IP, providing a more abstracted approach. On the other hand, Socket API is a low-level interface that grants direct access to the underlying network protocols, offering more control but with increased complexity. In summary, network programming is indispensable for constructing modern software systems that heavily rely on APIs and databases. It facilitates seamless communication between software components over a network and supports the retrieval and manipulation of data stored in databases by various applications. --- ### 2. Wireshark and Tshark #### 2.1 Wireshark Wireshark functions as both a sniffer and a packet analyzer. A sniffer serves as a measurement tool, allowing us to inspect the content flowing through a network cable or the airwaves in the case of a wireless network. Essentially, it reveals the data observed by our network card. However, Wireshark goes beyond mere display of binary streams (comprising ones and zeroes) that the network card perceives. It operates as a comprehensive packet analyzer, presenting meaningful information about the frames it encounters. As an open-source and freely available tool, Wireshark is widely employed for the examination of network traffic. The utility of Wireshark extends to various scenarios, such as troubleshooting network issues. For instance, if connectivity problems arise between two computers, Wireshark can be instrumental in comprehending the underlying network dynamics. Additionally, Wireshark proves beneficial for programmers. For example, when developing a chat program between two clients, if issues arise, Wireshark can be utilized to inspect the transmitted data and gain insights into potential problems. **How to Download and Install Wireshark ?** Start by downloading Wireshark from its official website: https://www.wireshark.org/#download Follow the instructions on the installer and you should be good to go. **How to Sniff Traffic with Wireshark** Launch Wireshark, and start by sniffing some data. For that, you can hit `Ctrl+K` (PC) or `Cmd+K` (Mac) to get the `Capture Options` window. Notice that you can reach this window in other ways. You can go to `Capture->Options`. Alternatively, you can click the `Capture Options` icon. I encourage you to use keyboard shortcuts and get comfortable with them right from the start, as they'll allow you to save time and work more efficiently. So, again, I’ve used `Ctrl+K (or Cmd+K)` and got this screen: ![image](https://hackmd.io/_uploads/S1YXFkBFa.png) Here we can see a list of interfaces, and I happen to have quite a few. Which one is relevant? If you’re not sure at this point, you can look at the Traffic column, and see which interfaces currently have traffic. Here we can see that `Wi-Fi` has got traffic going through it, as the line is high. Select the relevant network interface, and then hit Enter, or click the button Start. Let Wireshark sniff the network for a bit, and then stop the sniff using Ctrl+E / Cmd+E. Again, this can be achieved in other ways – such as going to Capture->Stop or clicking the Stop icon. Consider the different sections: ![image](https://hackmd.io/_uploads/HyPFqJHKp.png) The section marked in red includes Wireshark’s menu, with all kinds of interesting options. The main toolbar is marked in blue, providing quick access to some items from the menu. Next, marked in green, is the display filter. We will get back to it shortly, as this is one of the most important features of Wireshark. #### 2.2 Tshark Tshark is a command-line-based protocol analyzer tool used to capture and analyze network traffic from a live network. This can be used as a substitute for Wireshark if you enjoy working on a black screen. This guide is for beginners who want to start analyzing protocols and use some basic commands of tshark. Here, I am listing some basic commands with example usage that help capture and analyze the network traffic. **Installation on Linux-based OS** You can install tshark just typing the below command for installation: `sudo apt-get install tshark` **Usage of tshark command** 1. All tshark commands displayed on your machine If the user wants to see the different options available with tshark, just type the below command. Remember to use sudo while using tshark. `sudo tshark -h` ![image](https://hackmd.io/_uploads/HkEgaJBFp.png) 2. Capture network traffic with tshark by providing an interface Just type the interface name in from of -i option to display traffic dedicated to a specific interface. This option displays the clean output of a single interface. `sudo tshark -i <interface>` ![image](https://hackmd.io/_uploads/B1dfpyStp.png) 3. Capture network packets and copy them in file traffic-capture.pcap By using -w options, the user can easily copy all output of tshark tool into a single file of format pcap. `tshark -i <interface> -w <file-name>.pcap` 4. Read captured packets with tshark by providing input pcap file By using option -r with tshark, the user can read saved pcap file easily. `tshark -r <file-name>.pcap` 5. Capture packets and copy traffic into .pcap file for the particular duration If user wants to capture network traffic from the live network for a specific period of time, just use -a option. The below command helps you to capture traffic for a particular duration. `tshark -i <interface> -a duration:<time>` Note: `<time> `is in seconds 6. Check the version of tshark Just check the version of tshark tool by using the -v options `tshark -v` 7. Capture the specific number of packets tshark tool provides flexibility to the user to display the specific number of captured packets. `tshark -c <number> -i <interface>` 8. List out all the interfaces available to capture the network traffic If you have a doubt about the number of available interfaces, use -D option. `tshark -D` ![image](https://hackmd.io/_uploads/ryYT21rt6.png) 9. Capture only specific protocol network packets The below example shows how you can filter specific protocols while displaying the results of the tool tshark. `tshark -i <interface> -f "<protocol>"` Note: `<protocol>` may be tcp, udp, dns etc. ![image](https://hackmd.io/_uploads/rklj3kStp.png) --- ### 3. Networking Programming - iPerf #### What is iPerf? iPerf is a simple, free, cross-platform and commonly-used tool for network performance measurement and testing. It supports several protocols (TCP, UDP, SCTP with IPv4 and IPv6) and parameters. iPerf is available for multiple operating systems such as Linux or Windows. It is used by network administrators and engineers to diagnose network issues, optimize performance, and conduct network experiments. iPerf is also used in performance testing and benchmarking of network devices. Moreover, iPerf can be simply used for network stress testing. For this purpose users should choose the UDP protocol, because TCP automatically carries out rate-limiting to adapt to the available bandwidth. To do it correctly, the user must choose a bandwidth far above what the connection can handle. For example, if a user wants to stress a 10 Mbps connection, they should send about 100 Mbps traffic (using -b parameter). #### iPerf usage It is possible to automate network bandwidth measurements using iPerf. In my personal opinion, Python is one of the best choices for this purpose. If we want to use iPerf2 we can use pyperf2 (keep in mind this is 0.2 version) or build a script which runs iPerf script from the command line and collect the output (in this case -y parameter could be useful - report as a comma-separated values). For iPerf3, a Python module is available here. It is still in its initial version but can be useful for simple measurements. If you want to explore this topic, please check this post about automating bandwidth testing. iPerf could be used to saturate high speed links, but we must bear in mind that iPerf needs a lot of resources like CPU and memory. Theoretically, iPerf could be used to test links up to 100Gbps, but at such high values a better idea is to use professional, dedicated traffic generators. Moreover, achieving this high network speed often requires the use of specialized hardware and network configurations, such as link aggregation (LAG). #### iPerf - the usefull options ![image](https://hackmd.io/_uploads/BJia6_BK6.png) #### Pros and cons of iPerf 1. iPerf pros * Supports most popular protocols like TCP, UDP and SCTP. It can be used to test e.g. bandwidth, latency or packet loss. * iPerf is cross-platform - can be used on Linux, Windows, MacOS, Android, x86, ARM and different network devices. * iPerf has a simple command-line interface that allows users to quickly start testing their network. * It is free - anyone can download iPerf and use it to test their own topology. * It is open-source - anyone can clone and optimize it. * iPerf is pre-installed on selected systems and devices, for example on TrueNAS. 3. iPerf cons * Poor community support. * Existing bugs are not addressed and fixed. * We have to monitor resources to ensure that reported values are correct and that no throttling occurs. * Resources should be manually assigned to prevent concurrency between iPerf and other tasks performed by the OS. * iPerf has no option to generate reports. Users have to use additional tools to generate reports - currently there are no available valuable tools worth recommending, so the best way is to do it by oneself. * Using iPerf requires basic networking knowledge from the user which could be challenging for some. * iPerf does not provide many configuration options to set up packets and to control how packets should be sent. * iPerf3 is not backward compatible with iPerf2. * iPerf needs a lot of resources when generating high volumes of traffic. CPU power and memory will be very loaded. CPU isolation is good to avoid given that iPerf will share CPU with other tasks on the server, but still we have to monitor resources and tweak the operating system to get maximum performance - e.g. set the governor in performance mode. #### iPerf Use Case --- ### 4. Networking Programming - Ping #### Definitions The /usr/sbin/ping command sends an Internet Control Message Protocol (ICMP) ECHO_REQUEST to obtain an ICMP ECHO_RESPONSE from a host or gateway. The ping command is useful for: * Determining the status of the network and various foreign hosts. * Tracking and isolating hardware and software problems. * Testing, measuring, and managing networks. If the host is operational and on the network, it responds to the echo. Each echo request contains an Internet Protocol (IP) and ICMP header, followed by a ping PID and a timeval structure, and enough bytes to fill out the packet. The default is to continuously send echo requests until an Interrupt is received (Ctrl-C). The ping command sends one datagram per second and prints one line of output for every response received. The ping command calculates round-trip times and packet loss statistics, and displays a brief summary on completion. The ping command completes when the program times out or on receipt of a SIGINT signal. The Host parameter is either a valid host name or Internet address. By default, the ping command will continue to send echo requests to the display until an Interrupt is received (Ctrl-C). The Interrupt key can be changed by using the stty command. Because of the load that continuous echo requests can place on the system, repeated requests should be used primarily for problem isolation. #### Ping Flags | Items | Descriptions | | ------------ | ------------ | | -c Count | Specifies the number of echo requests, as indicated by the Count variable, to be sent (and received). | | -w timeout | This option works only with the -c option. It causes ping to wait for a maximum of 'timeout' seconds for a reply (after sending the last packet). | | -d | Starts socket-level debugging. | | -D |This option causes a hex dump to standard output of ICMP ECHO_REPLY packets. | | -f |Specifies flood-ping option. The -f flag "floods" or outputs packets as fast as they come back or one hundred times per second, whichever is more. For every ECHO_REQUEST sent, a . (period) is printed, while for every ECHO_REPLY received, a backspace is printed. This provides a rapid display of how many packets are being dropped. Only the root user may use this option. “Note: This can be very hard on a network and should be used with caution. Flood pinging is only permitted by the root user. The -f flag is incompatible with the -i Wait flag.” | | -I a.b.c.d |Specifies that the interface specified by a.b.c.d is to be used for outgoing IPv4 multicasts. The -I flag is an uppercase i. | | -o interface |Specifies that interface is to be used for outgoing IPv6 multicasts. The interface is specified in the form 'en0', 'tr0' etc. | | -i Wait | Waits the number of seconds specified by the Wait variable between the sending of each packet. The default is to wait for one second between each packet. This option is incompatible with the -f flag. | | -L |Disables local loopback for multicast pings. | | -l Preload |Sends the number of packets specified by the Preload variable as fast as possible before falling into normal mode of behavior (one per second). The -l flag is a lowercase l. | | -n |Specifies numeric output only. No attempt is made to look up symbolic names for host addresses. | | -p Pattern |Specifies up to 16 'pad' bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For example, -p ff fills the packet with all 1's. | | -q |Specifies quiet output. Nothing is displayed except the summary lines at startup time and when finished. | | -r |Bypasses the routing tables and sends directly to a host on an attached network. If the Host is not on a directly connected network, the ping command generates an error message. This option can be used to ping a local host through an interface that no longer has a route through it. | | -R |Specifies record route option. The -R flag includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. “Note: The IP header is only large enough for nine such routes. Also, many hosts and gateways ignore this option.” | |-a addr_family|Maps the destination address of the ICMP packets to IPv6 format if addr_family is equal to "inet6". | |-s PacketSize |Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. | |-S hostname/IP addr|Uses the IP address as the source address in outgoing ping packets. On hosts with more than one IP address, the -S flag can be used to force the source address to be something other than the IP address of the interface on which the packet is sent. If the IP address is not one of the machine's interface addresses, an error is returned and nothing is sent. | |-T ttl |Specifies that the time-to-live for a multicast packet is ttl seconds. | |-v |Requests verbose output, which lists ICMP packets that are received in addition to echo responses. | #### Ping Parameters | Items | Descriptions | | -------- | -------- | | PacketSize|Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. This parameter is included for compatibility with previous versions of the ping command. | |Count |Specifies the number of echo requests to be sent (and received). This parameter is included for compatibility with previous versions of the ping command. | #### Examples ### 5. 5G Core - The study of 5G Core ### 6. 5G Core - The Installation of 5G Core(free5gc) ### 7. 5G Core - The Testing of 5G Core(E2E test) ### 8. 5G ORAN - The study of ORAN ### 9. 5G ORAN - The Installation of 5G ORAN ### 10. 5G ORAN - The Testing of 5G ORAN