{"id":1851,"date":"2023-09-26T14:20:40","date_gmt":"2023-09-26T14:20:40","guid":{"rendered":"https:\/\/community.5gasp.eu\/?page_id=1851"},"modified":"2023-09-26T14:20:41","modified_gmt":"2023-09-26T14:20:41","slug":"from-a-helm-chart-to-cnf-tutorial","status":"publish","type":"page","link":"https:\/\/community.5gasp.eu\/index.php\/from-a-helm-chart-to-cnf-tutorial\/","title":{"rendered":"From a Helm Chart to CNF tutorial"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is a CNF?<\/h2>\n\n\n\n<p>A Cloud-native Network Function (CNF) is a software-based network function designed to operate in cloud-native environments, such as Kubernetes clusters or container orchestration platforms. CNFs are a fundamental component of modern telecommunications and networking systems, enabling greater flexibility, scalability, and agility compared to traditional hardware-based network functions.<\/p>\n\n\n\n<p>Key Characteristics of CNFs:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Software-Defined &#8211; CNFs are entirely software-defined, which means they are implemented as software applications or microservices rather than relying on dedicated hardware.<\/li>\n\n\n\n<li>Containerization &#8211; CNFs are often containerized, allowing them to run in lightweight, isolated containers that can be easily orchestrated and scaled using container orchestration tools like Kubernetes.<\/li>\n\n\n\n<li>Scalability &#8211; CNFs can be dynamically scaled up or down to meet varying network traffic demands, ensuring efficient resource utilization.<\/li>\n\n\n\n<li>Microservices Architecture &#8211; CNFs are typically designed using a microservices architecture, where individual functions are decoupled and can be independently developed, deployed, and scaled.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How does a CNF work in the context of OSM?<\/h2>\n\n\n\n<p>In the context of Open Source MANO (OSM), a CNF works as part of a larger network service orchestration and management framework. Here&#8217;s how a CNF typically works within the OSM framework:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Descriptor Creation &#8211; Network service providers or administrators define the network service requirements using OSM descriptors. These descriptors describe the service&#8217;s topology, including CNFs, virtual links, and other resources.<\/li>\n\n\n\n<li>Onboarding CNFs &#8211; CNFs, packaged as container images, are onboarded into the OSM platform. The onboarding process involves registering the CNF images and creating the necessary descriptors that define how these CNFs should be deployed and configured.<\/li>\n\n\n\n<li>Descriptor Instantiation &#8211; When a network service is requested, OSM uses the descriptors to instantiate the service. This involves deploying CNFs as containers in the cloud-native infrastructure (e.g., Kubernetes clusters) according to the specifications defined in the descriptors.<\/li>\n\n\n\n<li>Service Orchestration &#8211; OSM orchestrates the CNFs and other network resources, ensuring that the CNFs are properly configured and connected to form the desired network service. OSM handles aspects like scaling, load balancing, and network connectivity.<\/li>\n\n\n\n<li>Lifecycle Management &#8211; OSM manages the entire lifecycle of CNFs within the network service. This includes:<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Instantiation &#8211; Deploying CNFs when a service is created.<\/li>\n\n\n\n<li>Scaling &#8211; Automatically adjusting the number of CNF instances based on demand.<\/li>\n\n\n\n<li>Monitoring &#8211; Collecting performance metrics and logs from CNFs.<\/li>\n\n\n\n<li>Healing &#8211; Automatically recovering from CNF failures by restarting or replacing instances.<\/li>\n\n\n\n<li>Termination &#8211; Gracefully decommissioning CNFs when they are no longer needed.<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Service Assurance and Scaling &#8211; OSM continuously monitors the CNFs and the network service&#8217;s performance. If traffic patterns change or issues arise, OSM can trigger the scaling of CNFs to accommodate increased traffic or to maintain service quality.<\/li>\n\n\n\n<li>Service Termination &#8211; When a network service is no longer required, OSM handles the termination of CNFs and associated resources. This ensures efficient resource utilization.<\/li>\n<\/ul>\n\n\n\n<p>Overall, a CNF in the context of OSM benefits from the orchestration, management, and scaling capabilities provided by the OSM platform. This integration simplifies the deployment and lifecycle management of CNFs within network services and contributes to the flexibility and agility of modern networking systems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Packing your Helm Chart<\/h2>\n\n\n\n<p>For this tutorial, we will use a custom Helm Chart with the NEF Emulator. It should be mentioned that you should only use this Chart, in an development environment. For instance, no volumes are being used, which makes the stored data volatile.<br>First, lets encapsulate the Helm Chart in <code>.tgz<\/code> archive. For this intent, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ helm package nef-emulator\nSuccessfully packaged chart and saved it to: \/home\/user\/from-helm-chart-to-cnf-tutorial\/nef-emulator-0.1.0.tgz<\/code><\/pre>\n\n\n\n<p>Now you should be able to see the package <code>nef-emulator-0.1.0.tgz<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls | grep nef-emulator-0.1.0.tgz\nnef-emulator-0.1.0.tgz<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Updating your VNF Artifact<\/h2>\n\n\n\n<p>For this tutorial, we will not rely on Helm Chart Repositories. Instead, we will indicate on the VNF Descriptor to use a local helm chart artifact. The following excerpt of code has been tailored for OSM 13 versions or lower. Concerning OSM 14, to the best of our knowledge, it is not possible to onboard a VNF Artifact that containing a local Helm Chart Artifact.<br>Introduce this excerpt of code on your VNFD (<code>.\/vnf\/vnfd.yaml<\/code>), below the <code>id<\/code> key, with the same level of identation. Make sure to replace, the <code>id<\/code> of your k8s_cluster, by the one you are using on OSM. On the other hand, the value of the <code>helm-chart<\/code> key, must match the name of the Helm Chart artifact to be used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  k8s-cluster:\n    nets:\n    - id: mgmtnet\n  kdu:\n  - name: nef-emulator\n    helm-chart: \"nef-emulator-0.1.0.tgz\"\n    helm-version: v3<\/code><\/pre>\n\n\n\n<p>Now, we shall place the Helm Chart archive inside the VNF Artifact. To do so, first we must create a directory with the name <code>helm-chart-v3s<\/code>. This will instruct OSM too look for a local helm chart, with the name indicated on the VNFD:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd vnf\n$ mkdir helm-chart-v3s\n$ cp ..\/nef-emulator-0.1.0.tgz .\/helm-chart-v3s\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Updating your NSD<\/h2>\n\n\n\n<p>Regarding your NSD, you will only require to update the <code>vim-network-name<\/code> (<code>.\/ns\/nsd.yaml<\/code>), to match the one you are using on your OSM instance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>virtual-link-desc:\n    -   id: mgmtnet\n        mgmt-network: 'true'\n        vim-network-name: new_5gasp   <\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">NFV Artifacts Onboarding and Instantiation<\/h1>\n\n\n\n<p>Carrying on, we can now onboard into OSM the VNF and NSD packages created:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm nfpkg-create vnf\n$ osm nspkg-create ns<\/code><\/pre>\n\n\n\n<p>To instantiate the CNF, you may simply use the following command. Make sure to replace the VIM account to match the one used in your osm<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm ns-create --ns_name cnf-tutorial --nsd_name nef_emulator_nsd --vim_account &lt;your_vim_account&gt;<\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Checking the status of the CNF<\/h1>\n\n\n\n<p>To check if the CNF&#8217;s services have been created with success, you shall enter inside your Kubernetes Cluster and check if there are any pods related to the NEF Emulator. For that, execute the following command, inside the Cluster&#8217;s Machine:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ kubectl get pods -A | grep nef\n\n15d723ae-b926-4465-9e61-5d72729c06a4   nef-emulator-0-1-0-tgz-0096146112-db-0                       1\/1     Running   0 \n15d723ae-b926-4465-9e61-5d72729c06a4   nef-emulator-0-1-0-tgz-0096146112-mongo-0                    1\/1     Running   0 \n15d723ae-b926-4465-9e61-5d72729c06a4   nef-emulator-0-1-0-tgz-0096146112-report-69d5c46796-6ms2b    1\/1     Running   0 \n15d723ae-b926-4465-9e61-5d72729c06a4   nef-emulator-0-1-0-tgz-0096146112-backend-595fd4c777-74tfw   1\/1     Running   0 <\/code><\/pre>\n\n\n\n<h1 class=\"wp-block-heading\">Tutorial materials<\/h1>\n\n\n\n<p><a href=\"https:\/\/github.com\/5gasp\/tutorials\/tree\/master\/6-from_helm_chart_to_cnf\">GitHub repository<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a CNF? A Cloud-native Network Function (CNF) is a software-based network function designed to operate in cloud-native environments, such as Kubernetes clusters or container orchestration platforms. CNFs are a fundamental component of modern telecommunications and networking systems, enabling greater flexibility, scalability, and agility compared to traditional hardware-based network [\u2026]<\/p>\n","protected":false},"author":30,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"pg_page_styles":[],"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-1851","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/comments?post=1851"}],"version-history":[{"count":1,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1851\/revisions"}],"predecessor-version":[{"id":1855,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/1851\/revisions\/1855"}],"wp:attachment":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/media?parent=1851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}