From 3a1140244a7e961ba5ed9bbc9315373a2b13bb23 Mon Sep 17 00:00:00 2001
From: palsus <subhankar.pal@altran.com>
Date: Tue, 2 Mar 2021 18:08:49 +0100
Subject: [PATCH] wiki webserver package for osm-mr-10 hackfest

---
 .../wiki_webserver_autoscale_nsd.yaml         |  33 ++++
 .../cloud_init/.DS_Store                      | Bin 0 -> 6148 bytes
 .../cloud_init/cloud_init_apache              |   5 +
 .../cloud_init/cloud_init_haproxy             |   5 +
 .../wiki_webserver_autoscale_vnfd.yaml        | 158 ++++++++++++++++++
 5 files changed, 201 insertions(+)
 create mode 100644 wiki_webserver_autoscale_nsd/wiki_webserver_autoscale_nsd.yaml
 create mode 100644 wiki_webserver_autoscale_vnfd/cloud_init/.DS_Store
 create mode 100644 wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_apache
 create mode 100644 wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_haproxy
 create mode 100644 wiki_webserver_autoscale_vnfd/wiki_webserver_autoscale_vnfd.yaml

diff --git a/wiki_webserver_autoscale_nsd/wiki_webserver_autoscale_nsd.yaml b/wiki_webserver_autoscale_nsd/wiki_webserver_autoscale_nsd.yaml
new file mode 100644
index 00000000..995235dd
--- /dev/null
+++ b/wiki_webserver_autoscale_nsd/wiki_webserver_autoscale_nsd.yaml
@@ -0,0 +1,33 @@
+nsd:
+    nsd:
+    -   description: Scaling wiki web server with load balancer NS
+        designer: Altran
+        df:
+        -   id: default-df
+            vnf-profile:
+            -   id: '1'
+                virtual-link-connectivity:
+                -   constituent-cpd-id:
+                    -   constituent-base-element-id: '1'
+                        constituent-cpd-id: haproxy_mgmt-ext
+                    -   constituent-base-element-id: '1'
+                        constituent-cpd-id: apache_mgmt-ext
+                    virtual-link-profile-id: mgmt_vld
+                -   constituent-cpd-id:
+                    -   constituent-base-element-id: '1'
+                        constituent-cpd-id: haproxy_public-ext
+                    virtual-link-profile-id: public_vld
+                vnfd-id: wiki_webserver_autoscale_vnf
+        id: wiki_webserver_autoscale_ns
+        name: wiki_webserver_autoscale_ns
+        version: '1.0'
+        virtual-link-desc:
+        -   id: mgmt_vld
+            mgmt-network: 'true'
+            vim-network-name: mgntnet
+        -   id: public_vld
+            mgmt-network: 'true'
+            vim-network-name: osm-ext
+        vnfd-id:
+        - wiki_webserver_autoscale_vnf
+
diff --git a/wiki_webserver_autoscale_vnfd/cloud_init/.DS_Store b/wiki_webserver_autoscale_vnfd/cloud_init/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6
GIT binary patch
literal 6148
zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3
zem<@ulZcFPQ@L2!n>{z**<q8>++&mCkOWA81W14cNZ<zv;LbK1Poaz?KmsK2CSc!(
z0ynLxE!0092;Krf2c+FF_Fe*7ECH>lEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ
zLs35+`xjp>T0<F0fCPF1$Cyrb|F7^5{eNG?83~ZUUlGt@xh*qZDeu<Z%US-OSsOPv
j)R!Z4KLME7ReXlK;d!wEw5GODWMKRea10D2@KpjYNUI8I

literal 0
HcmV?d00001

diff --git a/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_apache b/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_apache
new file mode 100644
index 00000000..d1e288b1
--- /dev/null
+++ b/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_apache
@@ -0,0 +1,5 @@
+#cloud-config
+hostname: apachevdu
+password: osm2018
+chpasswd: { expire: False }
+ssh_pwauth: True
\ No newline at end of file
diff --git a/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_haproxy b/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_haproxy
new file mode 100644
index 00000000..458cd9a6
--- /dev/null
+++ b/wiki_webserver_autoscale_vnfd/cloud_init/cloud_init_haproxy
@@ -0,0 +1,5 @@
+#cloud-config
+hostname: haproxyvdu
+password: osm2018
+chpasswd: { expire: False }
+ssh_pwauth: True
diff --git a/wiki_webserver_autoscale_vnfd/wiki_webserver_autoscale_vnfd.yaml b/wiki_webserver_autoscale_vnfd/wiki_webserver_autoscale_vnfd.yaml
new file mode 100644
index 00000000..7f10921e
--- /dev/null
+++ b/wiki_webserver_autoscale_vnfd/wiki_webserver_autoscale_vnfd.yaml
@@ -0,0 +1,158 @@
+vnfd:
+    description: Scaling wiki web server with load balancer and metrics
+    df:
+    -   id: default-df
+        instantiation-level:
+        -   id: default-instantiation-level
+            vdu-level:
+            -   number-of-instances: 1
+                vdu-id: haproxy_vdu
+            -   number-of-instances: 1
+                vdu-id: apache_vdu
+        scaling-aspect:
+        -   aspect-delta-details:
+                deltas:
+                -   id: apache_vdu_autoscale-delta
+                    vdu-delta:
+                    -   id: apache_vdu
+                        number-of-instances: 1
+            id: apache_vdu_autoscale
+            max-scale-level: 10
+            name: apache_vdu_autoscale
+            scaling-policy:
+            -   cooldown-time: 180
+                name: apache_cpu_util_above_threshold
+                scaling-criteria:
+                -   name: apache_cpu_util_above_threshold
+                    scale-in-relational-operation: LT
+                    scale-in-threshold: 20
+                    scale-out-relational-operation: GT
+                    scale-out-threshold: 80
+                    vnf-monitoring-param-ref: apache_vnf_cpu_util
+                scaling-type: automatic
+                threshold-time: 10
+        vdu-profile:
+        -   id: haproxy_vdu
+            min-number-of-instances: 1
+        -   id: apache_vdu
+            max-number-of-instances: 11
+            min-number-of-instances: 1
+        virtual-link-profile:
+        -   flavour: ''
+            id: internal_services
+            virtual-link-protocol-data:
+                l3-protocol-data:
+                    cidr: 192.168.30.0/24
+                    description: Services Subnet
+                    dhcp-enabled: true
+                    gateway-ip: 192.168.30.1
+                    ip-version: ipv4
+                    name: internal_services-l3-protocol-data
+    ext-cpd:
+    -   id: haproxy_public-ext
+        int-cpd:
+            cpd: haproxy_vdu_eth1-int
+            vdu-id: haproxy_vdu
+    -   id: haproxy_mgmt-ext
+        int-cpd:
+            cpd: haproxy_vdu_eth0-int
+            vdu-id: haproxy_vdu
+    -   id: apache_mgmt-ext
+        int-cpd:
+            cpd: apache_vdu_eth0-int
+            vdu-id: apache_vdu
+    id: wiki_webserver_autoscale_vnf
+    int-virtual-link-desc:
+    -   id: internal_services
+    mgmt-cp: haproxy_mgmt-ext
+    product-name: wiki_webserver_autoscale_vnf
+    provider: Altran
+    sw-image-desc:
+    -   id: haproxy_ubuntu
+        image: haproxy_ubuntu
+        name: haproxy_ubuntu
+    -   id: apache_ubuntu
+        image: apache_ubuntu
+        name: apache_ubuntu
+    vdu:
+    -   cloud-init-file: cloud_init_haproxy
+        description: haproxy_vdu
+        id: haproxy_vdu
+        int-cpd:
+        -   id: haproxy_vdu_eth1-int
+            virtual-network-interface-requirement:
+            -   name: haproxy_vdu_eth1
+                position: 1
+                virtual-interface:
+                    type: VIRTIO
+        -   id: haproxy_vdu_eth0-int
+            virtual-network-interface-requirement:
+            -   name: haproxy_vdu_eth0
+                position: 2
+                virtual-interface:
+                    type: VIRTIO
+        -   id: haproxy_vdu_eth2-int
+            int-virtual-link-desc: internal_services
+            virtual-network-interface-requirement:
+            -   name: haproxy_vdu_eth2
+                position: 3
+                virtual-interface:
+                    type: VIRTIO
+        name: haproxy_vdu
+        sw-image-desc: haproxy_ubuntu
+        virtual-compute-desc: haproxy_vdu-compute
+        virtual-storage-desc:
+        - haproxy_vdu-storage
+    -   cloud-init-file: cloud_init_apache
+        description: apache_vdu
+        id: apache_vdu
+        int-cpd:
+        -   id: apache_vdu_eth0-int
+            virtual-network-interface-requirement:
+            -   name: apache_vdu_eth0
+                position: 1
+                virtual-interface:
+                    type: VIRTIO
+        -   id: apache_vdu_eth1-int
+            int-virtual-link-desc: internal_services
+            virtual-network-interface-requirement:
+            -   name: apache_vdu_eth1
+                position: 2
+                virtual-interface:
+                    type: VIRTIO
+        monitoring-parameter:
+        -   id: apache_vnf_cpu_util
+            name: apache_vnf_cpu_util
+            performance-metric: cpu_utilization
+        -   id: apache_vnf_memory_util
+            name: apache_vnf_memory_util
+            performance-metric: average_memory_utilization
+        -   id: apache_vnf_packets_sent
+            name: apache_vnf_packets_sent
+            performance-metric: packets_sent
+        -   id: apache_vnf_packets_received
+            name: apache_vnf_packets_received
+            performance-metric: packets_received
+        name: apache_vdu
+        sw-image-desc: apache_ubuntu
+        virtual-compute-desc: apache_vdu-compute
+        virtual-storage-desc:
+        - apache_vdu-storage
+    version: '2.1'
+    virtual-compute-desc:
+    -   id: haproxy_vdu-compute
+        virtual-cpu:
+            num-virtual-cpu: 4
+        virtual-memory:
+            size: 4.0
+    -   id: apache_vdu-compute
+        virtual-cpu:
+            num-virtual-cpu: 1
+        virtual-memory:
+            size: 1.0
+    virtual-storage-desc:
+    -   id: haproxy_vdu-storage
+        size-of-storage: 10
+    -   id: apache_vdu-storage
+        size-of-storage: 10
+
-- 
GitLab