{"id":2003,"date":"2024-03-06T10:21:53","date_gmt":"2024-03-06T10:21:53","guid":{"rendered":"https:\/\/community.5gasp.eu\/?page_id=2003"},"modified":"2024-03-06T10:22:25","modified_gmt":"2024-03-06T10:22:25","slug":"how-to-develop-your-cnf-and-orchestrate-it-through-osm","status":"publish","type":"page","link":"https:\/\/community.5gasp.eu\/index.php\/how-to-develop-your-cnf-and-orchestrate-it-through-osm\/","title":{"rendered":"How to develop your CNF and orchestrate it through OSM"},"content":{"rendered":"\n<div style=\"height:44px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Basic Architecture<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open Source MANO (OSM \u2013 version 10.0.3)<\/li>\n\n\n\n<li>Existing Kubernetes cluster (or check <strong>More reading<\/strong>, at the end, on how to setup a new cluster)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>OSM requirements<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2CPUs<\/li>\n\n\n\n<li>6GB RAM (8 recommended)<\/li>\n\n\n\n<li>40GB Disk space<\/li>\n\n\n\n<li>Single interface with internet access<\/li>\n\n\n\n<li>Ubuntu 20.04 (64-bit)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Installing OSM<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ wget https:\/\/osm-download.etsi.org\/ftp\/osm-10.0-ten\/install_osm.sh\n$ chmod +x install_osm.sh\n$ .\/install_osm.sh\n$ .\/install_osm.sh --k8s_monitor (install OSM with an add-on to monitor the Kubernetes cluster)<\/code><\/pre>\n\n\n\n<p>Check the installation in the browser by accessing your host IP (by default user and password are admin).<\/p>\n\n\n\n<p>If you need to install the latest version of OSM, you can always find the updated page on OSM official <a href=\"https:\/\/osm.etsi.org\/docs\/user-guide\/latest\/03-installing-osm.html\">Installing OSM page<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Adding a \u201cdummy\u201d VIM account<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm vim-create --name dummy_k8s_vim --user admin --password admin \\\n--auth_url http:\/\/127.0.0.1\/dummy --tenant admin --account_type dummy<\/code><\/pre>\n\n\n\n<p>It is also possible to add the \u201cdummy\u201d VIM through the OSM GUI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Dashboard > Project > VIM Accounts > New VIM<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Creating the CNF<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Create CNF package<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mkdir tutorial_knf\n$ cd tutorial_knf\n$ touch tutorial_vnfd.yaml<\/code><\/pre>\n\n\n\n<p>These commands create the base package for our CNF. We are defining the <strong>directory<\/strong> and descriptor <strong>file<\/strong>. Since <strong>osm package-create vnf<\/strong> creates a lot of boilerplate specific to VNFs and doesn\u2019t have the option to create a CNF, we will be creating it manually.<\/p>\n\n\n\n<p>Inside the descriptor file you should paste the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vnfd:\r\n  description: A basic KNF descriptor with one KDU\r\n  df:\r\n  - id: default-df\r\n  ext-cpd:\r\n  - id: mgmt-ext\r\n    k8s-cluster-net: mgmtnet\r\n  id: tutorial_knf\r\n  k8s-cluster:\r\n    nets:\r\n    - id: mgmtnet\r\n  kdu:\r\n  - name: nginx\r\n    helm-chart: nginx\r\n  mgmt-cp: mgmt-ext\r\n  product-name: tutorial_knf\r\n  version: '1.0'\r<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Change the CNF descriptor (VNFD)<\/strong><\/h3>\n\n\n\n<p>You can find the descriptor in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tutorial_knf\/tutorial_vnfd.yaml<\/code><\/pre>\n\n\n\n<p>We will start by changing the basic info to our descriptor:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00a0\u00a0description: A basic KNF descriptor with one KDU\n  id: tutorial_knf\n\u00a0\u00a0product-name: tutorial_knf\n\u00a0\u00a0version: '1.0'<\/code><\/pre>\n\n\n\n<p>As you can see, we are defining an <strong>id<\/strong>, <strong>description<\/strong>, <strong>product name<\/strong> and <strong>version<\/strong>.<\/p>\n\n\n\n<p>Next, we want to edit our <strong>kdu<\/strong> and <strong>helm chart<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  kdu:\r\n  - name: nginx\r\n    helm-chart: bitnami\/nginx<\/code><\/pre>\n\n\n\n<p>The <strong>helm-chart<\/strong> includes the Helm chart <strong>repo name<\/strong> in its name, it is explained below (Add K8s Helm Chart Repository).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Validate and Upload the CNF package<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm nfpkg-create tutorial_knf<\/code><\/pre>\n\n\n\n<p>This command validates and uploads the package to OSM. Make sure you input the correct CNF directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Add K8s Helm Chart Repository<\/strong><\/h3>\n\n\n\n<p>In order for the helm chart defined in the kdu to be found, the helm chart repository where the helm chart exists needs to be added to OSM. In this specific case, for NGINX, the Bitnami Helm chart repository will be added.<\/p>\n\n\n\n<p>The name (<strong>bitnami<\/strong> in the following command) is also the repo name used in the kdu.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm repo-add --type helm-chart --description \"Bitnami Helm chart repository\" <strong>bitnami<\/strong> https:\/\/charts.bitnami.com\/bitnami<\/code><\/pre>\n\n\n\n<p>It is also possible to add the K8s Repository through the OSM GUI:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Dashboard > Project > K8s > K8s Repos > Add K8s Repository<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Alternative &#8211; Add Helm chart to the CNF package<\/strong><\/h3>\n\n\n\n<p>Although not very well documented, the Helm chart can also be added inside the CNF directory and packaged together.<\/p>\n\n\n\n<p>Inside the <strong>tutorial_knf<\/strong> directory you need to create a new directory <strong>helm-chart-v3s<\/strong> and put the chart(s) inside this directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ tree tutorial_knf\ntutorial_knf\n\u251c\u2500\u2500 helm-chart-v3s\n\u2502 \u00a0 \u2514\u2500\u2500 nginx\n\u2502 \u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 Chart.yam\n\u2502 \u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 README.md\n\u2502 \u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 charts\n\u2502 \u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 templates\n\u2502 \u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 values.yaml\n\u2514\u2500\u2500 tutorial_vnfd.yaml<\/code><\/pre>\n\n\n\n<p>Keep in mind that charts inside the <strong>helm-chart-v3s<\/strong> directory don\u2019t need to specify the repo name in the kdu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00a0\u00a0kdu:\n\u00a0\u00a0- name: nginx\n\u00a0\u00a0\u00a0\u00a0helm-chart: <strong>nginx<\/strong><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Creating the NS<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Create NS packages<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm package-create ns tutorial<\/code><\/pre>\n\n\n\n<p>This command creates the base package for our NS.<\/p>\n\n\n\n<p>We are defining the <strong>directory<\/strong>, package <strong>type<\/strong> and package <strong>name<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Change the NS descriptor (NSD)<\/strong><\/h3>\n\n\n\n<p>You can find the descriptor in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tutorial_ns\/tutorial_nsd.yaml<\/code><\/pre>\n\n\n\n<p>We will start by changing the basic info to our descriptor:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nsd:\n  nsd:\n\u00a0\u00a0- id: tutorial_ns\n\u00a0\u00a0\u00a0\u00a0name: tutorial_ns\n\u00a0\u00a0\u00a0\u00a0description: A basic NS with a single KNF\n\u00a0\u00a0\u00a0\u00a0version: '1.0'<\/code><\/pre>\n\n\n\n<p>As you can see, we are defining an <strong>id<\/strong>, <strong>name<\/strong>, <strong>description<\/strong> and <strong>version<\/strong>.<\/p>\n\n\n\n<p>Then, edit the <strong>Virtual Link<\/strong>. The id needs to be the same as the one created.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00a0\u00a0\u00a0\u00a0virtual-link-desc:\n    - id: mgmtnet\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mgmt-network: true<\/code><\/pre>\n\n\n\n<p>Next, we need to connect the NS to our CNF created before:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    vnfd-id:\n\u00a0\u00a0\u00a0\u00a0- tutorial_knf<\/code><\/pre>\n\n\n\n<p>Make sure that the <strong>id<\/strong> is <strong>the same<\/strong> as the CNF.<\/p>\n\n\n\n<p>Next, we need to establish the connections between the CNF and the VIM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    df:\r\n    - id: default-df\r\n      vnf-profile:\r\n      - id: \"1\"\r\n        vnfd-id: tutorial_knf\r\n        virtual-link-connectivity:\r\n        - virtual-link-profile-id: mgmtnet\r\n          constituent-cpd-id:\r\n          - constituent-base-element-id: \"1\"\r\n            constituent-cpd-id: mgmt-ext<\/code><\/pre>\n\n\n\n<p>Notice that the <strong>constituent-cpd-id<\/strong> is the same as the <strong>external connection point (ext-cpd)<\/strong> defined in the <strong>CNF descriptor<\/strong>. Also, <strong>vnfd-id<\/strong> is being repeated in <strong>vnf-profile<\/strong>, be sure to change it.<\/p>\n\n\n\n<p>Also, the <strong>virtual-link-profile-id<\/strong> has to be the same as the one created.Although it is not necessary to, the <strong>vnf-profile<\/strong> &#8211; <strong>id<\/strong> and <strong>constituent-base-element-id<\/strong> can be changed to a more meaningful name. Just be sure to be the same.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Validate and Upload the NS package<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm nspkg-create tutorial_ns<\/code><\/pre>\n\n\n\n<p>This command validates and uploads the package to OSM. Make sure you input the correct NS directory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>NS instantiation<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ osm ns-create --ns_name tutorial_ns --nsd_name tutorial_ns --vim_account <strong>dummy_k8s_vim<\/strong><\/code><\/pre>\n\n\n\n<p>This command creates the instance of the network service. Notice that the <strong>&#8211;nsd_name<\/strong> option has to be the name of the ns package. In our case, the VIM account is called <strong>dummy_k8s_vim<\/strong>. Make sure that you input <strong>your Dummy VIM account<\/strong>.<\/p>\n\n\n\n<p>If all goes accordingly, you should be able to see in the OSM interface that your NS instance is running and active.<\/p>\n\n\n\n<p>You can also check if your instance is running in the Kubernetes cluster.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>More reading<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Old, but still relevant, the official KNF Onboarding Walkthrough &#8211; <a href=\"https:\/\/osm.etsi.org\/docs\/vnf-onboarding-guidelines\/07-knfwalkthrough.html\">https:\/\/osm.etsi.org\/docs\/vnf-onboarding-guidelines\/07-knfwalkthrough.html<\/a><\/li>\n\n\n\n<li>Hackfest Magma descriptors as examples &#8211; <a href=\"https:\/\/osm.etsi.org\/gitlab\/vnf-onboarding\/osm-packages\/-\/tree\/master\/magma\">https:\/\/osm.etsi.org\/gitlab\/vnf-onboarding\/osm-packages\/-\/tree\/master\/magma<\/a><\/li>\n\n\n\n<li>Orchestrating a CNF in OSM video (<a href=\"https:\/\/www.youtube.com\/watch?v=sc_S8zlUI2U\">https:\/\/www.youtube.com\/watch?v=sc_S8zlUI2U<\/a>) and presentation (<a href=\"https:\/\/osm-download.etsi.org\/ftp\/osm-7.0-seven\/OSM9-hackfest\/presentations\/OSM%239%20Hackfest%20-%20HD2.2%20Orchestrating%20a%20CNF%20in%20OSM%20-%20Magma%20Orch.pdf\">https:\/\/osm-download.etsi.org\/ftp\/osm-7.0-seven\/OSM9-hackfest\/presentations\/OSM%239%20Hackfest%20-%20HD2.2%20Orchestrating%20a%20CNF%20in%20OSM%20-%20Magma%20Orch.pdf<\/a>)<\/li>\n\n\n\n<li>Kubernetes installation and requirements &#8211; <a href=\"https:\/\/osm.etsi.org\/docs\/user-guide\/latest\/15-k8s-installation.html\">https:\/\/osm.etsi.org\/docs\/user-guide\/latest\/15-k8s-installation.html<\/a><\/li>\n\n\n\n<li>More tutorials from <strong>5GASP Community Portal<\/strong> &#8211; <a href=\"https:\/\/community.5gasp.eu\/index.php\/netappcommunity-knowledge-center\/\">https:\/\/community.5gasp.eu\/index.php\/netappcommunity-knowledge-center\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Basic Architecture OSM requirements Installing OSM Check the installation in the browser by accessing your host IP (by default user and password are admin). If you need to install the latest version of OSM, you can always find the updated page on OSM official Installing OSM page. Adding a \u201cdummy\u201d [\u2026]<\/p>\n","protected":false},"author":1,"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-2003","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/2003","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/comments?post=2003"}],"version-history":[{"count":2,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/2003\/revisions"}],"predecessor-version":[{"id":2005,"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/pages\/2003\/revisions\/2005"}],"wp:attachment":[{"href":"https:\/\/community.5gasp.eu\/index.php\/wp-json\/wp\/v2\/media?parent=2003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}