From 49d71a9c52bcb4ae234d3f3babff0a304c3a3e9b Mon Sep 17 00:00:00 2001 From: Gulsum Atici <gulsum.atici@canonical.com> Date: Fri, 14 Oct 2022 01:20:17 +0300 Subject: [PATCH] Adding powerdns scripts --- .../2.1-KNF/powerdns-scripts/1-git-clone.sh | 6 ++ .../powerdns-scripts/10-delete-zone.sh | 26 ++++++++ .../2.1-KNF/powerdns-scripts/11-scale-out.sh | 27 ++++++++ .../2.1-KNF/powerdns-scripts/12-scale-in.sh | 18 +++++ .../powerdns-scripts/2-add-helm-repo.sh | 10 +++ .../2.1-KNF/powerdns-scripts/3-build-charm.sh | 22 +++++++ .../powerdns-scripts/4-onboard-packages.sh | 14 ++++ .../powerdns-scripts/5-instantiate-ns.sh | 23 +++++++ .../5.1-setting-dns-server.sh | 18 +++++ .../powerdns-scripts/6-add-zone-action.sh | 29 ++++++++ .../powerdns-scripts/7-add-domain-action.sh | 51 ++++++++++++++ .../powerdns-scripts/8-test-dns-record.sh | 40 +++++++++++ .../powerdns-scripts/9-delete-domain.sh | 39 +++++++++++ Hackfest_Demos/OSM-MR13/powerdns/README.md | 66 +++++++++++-------- 14 files changed, 360 insertions(+), 29 deletions(-) create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/1-git-clone.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/10-delete-zone.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/11-scale-out.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/12-scale-in.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/2-add-helm-repo.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/3-build-charm.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/4-onboard-packages.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5-instantiate-ns.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5.1-setting-dns-server.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/6-add-zone-action.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/7-add-domain-action.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/8-test-dns-record.sh create mode 100644 Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/9-delete-domain.sh diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/1-git-clone.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/1-git-clone.sh new file mode 100644 index 00000000..cc5d3963 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/1-git-clone.sh @@ -0,0 +1,6 @@ +#!/bin/bash +echo "========================================================================" +echo "Downloading OSM packages" +echo "========================================================================" + +git clone --recurse-submodules -j8 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/10-delete-zone.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/10-delete-zone.sh new file mode 100644 index 00000000..d301a404 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/10-delete-zone.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +read -p "Enter ZONE:" ZONE + +if [[ -z "$ZONE" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered ZONE %s " "$ZONE" + ls -l +fi +echo "========================================================================" +echo "Deleting Zone" +echo "========================================================================" + +DEL_ZONE_OP_ID=`osm ns-action --action_name delete-zone --vnf_name $KDU_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE}" $PDNS_NS_NAME` +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" + +osm ns-op-show $DEL_ZONE_OP_ID + + +echo "========================================================================" +echo "Check the action status using osm ns-op-show $DEL_ZONE_OP_ID" +echo "========================================================================" \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/11-scale-out.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/11-scale-out.sh new file mode 100644 index 00000000..4946f65c --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/11-scale-out.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +read -p "Enter replicaCount number to scale as number greater than 1:" NUM + +if [[ -z "$NUM" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered ZONE %s " "$NUM" + ls -l +fi + +echo "========================================================================" +echo "Scaling out" +echo "========================================================================" + +SCALE_OUT_OP_ID=`osm ns-action --action_name upgrade --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'replicaCount':$NUM,}" $PDNS_NS_NAME` + +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" +osm ns-op-show $PDNS_NS_NAME --literal | yq .operationState + +echo "========================================================================" +echo "Showing replicaCount number" +echo "========================================================================" +osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/12-scale-in.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/12-scale-in.sh new file mode 100644 index 00000000..ccd19e87 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/12-scale-in.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +echo "========================================================================" +echo "Rolling back" +echo "========================================================================" + +SCALE_IN_OP_ID=`osm ns-action --action_name rollback --vnf_name $VNF_NAME --kdu_name $KDU_NAME $PDNS_NS_NAME` + +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" + +osm ns-op-show $SCALE_IN_OP_ID --literal | yq .operationState + +echo "========================================================================" +echo "Showing replicaCount number" +echo "========================================================================" +osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/2-add-helm-repo.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/2-add-helm-repo.sh new file mode 100644 index 00000000..7ac1b198 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/2-add-helm-repo.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "========================================================================" +echo "Adding Helm Repository" +echo "========================================================================" +osm repo-add --type helm-chart --description "Repository for Powerdns helm Chart" osm-helm https://gatici.github.io/helm-repo/ +echo "========================================================================" +echo "Listing Helm Repository" +echo "========================================================================" +osm helm-repo list \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/3-build-charm.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/3-build-charm.sh new file mode 100644 index 00000000..c2cedb49 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/3-build-charm.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "========================================================================" +echo "Install charmcraft" +echo "========================================================================" +sudo snap install charmcraft --classic +pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/ops/ + +if [ ! -d powerdns-operator ] ; then + echo "It does not look like we are in osm-packages, exiting" + exit 1 +fi +echo "========================================================================" +echo "Packing charm" +echo "========================================================================" +push powerdns-operator +charmcraft pack +echo "========================================================================" +echo "Copying charm under VNFD/charms folder" +echo "========================================================================" +cp powerdns-operator_ubuntu-20.04-amd64.charm osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/ +popd; popd diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/4-onboard-packages.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/4-onboard-packages.sh new file mode 100644 index 00000000..d9cacee7 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/4-onboard-packages.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "========================================================================" +echo "Upload VNFD" +echo "========================================================================" +pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/ +osm nfpkg-create powerdns_knf + +echo "========================================================================" +echo "Upload NSD" +echo "========================================================================" +osm nspkg-create powerdns_ns +popd + diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5-instantiate-ns.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5-instantiate-ns.sh new file mode 100644 index 00000000..0ace89e6 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5-instantiate-ns.sh @@ -0,0 +1,23 @@ +#!/bin/bash +echo "========================================================================" +echo "Setting env variables" +echo "========================================================================" + +export VNF_NAME=powerdns +export KDU_NAME=powerdns +export PDNS_NS_NAME=powerdns_ns + +echo "========================================================================" +echo "Deploying NS" +echo "========================================================================" + +export PDNS_NS_ID=`osm ns-create --ns_name $PDNS_NS_NAME --nsd_name powerdns_ns --vim_account openstack --config "{vld: [ {name: mgmtnet, vim-network-name: $K8S_NET}]}"` + +echo "========================================================================" +echo "NS_NAME: $PDNS_NS_NAME" +echo "NS_ID: $PDNS_NS_NAME deployed" +echo "========================================================================" + +echo "========================================================================" +echo "Check NS status using osm ns-list, osm ns-show $PDNS_NS_ID" +echo "========================================================================" \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5.1-setting-dns-server.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5.1-setting-dns-server.sh new file mode 100644 index 00000000..eb5275d3 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/5.1-setting-dns-server.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +VNF_ID=`osm vnf-list --ns $PDNS_NS_NAME | grep powerdns | awk '{print $2}'` + +echo "========================================================================" +echo "VNF ID $VNF_ID" +echo "========================================================================" + +export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | contains("udp")) | .external_ip' | tr -d ' '-` + +echo "========================================================================" +echo "DNS IP $DNS_IP" +echo "========================================================================" + +echo "========================================================================" +echo "Setting DNS Server in your machine" +echo "========================================================================" +echo "nameserver ${DNS_IP}" | tee -a /etc/resolv.conf \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/6-add-zone-action.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/6-add-zone-action.sh new file mode 100644 index 00000000..4eb141cf --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/6-add-zone-action.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +read -p "Enter ZONE:" ZONE + +# Check if string is empty using -z. For more 'help test' +if [[ -z "$ZONE" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered ZONE %s " "$ZONE" + ls -l +fi + +echo "========================================================================" +echo "Adding zone" +echo "========================================================================" + +ADD_ZONE_OP_ID=`osm ns-action --action_name add-zone --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{"zone_name": $ZONE}" $PDNS_NS_NAME` + +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" + +# Check operation status +osm ns-op-show $ADD_ZONE_OP_ID + +echo "========================================================================" +echo "Check action status using osm ns-show $ADD_ZONE_OP_ID" +echo "========================================================================" diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/7-add-domain-action.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/7-add-domain-action.sh new file mode 100644 index 00000000..48c5e889 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/7-add-domain-action.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +read -p "Enter ZONE:" ZONE + +if [[ -z "$ZONE" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered ZONE %s " "$ZONE" + ls -l +fi + + + +read -p "Enter DOMAIN:" DOMAIN +if [[ -z "$DOMAIN" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered DOMAIN %s " "$DOMAIN" + ls -l +fi + + +read -p "Enter IP:" IP +if [[ -z "$IP" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered IP %s " "$IP" + ls -l +fi + +echo "========================================================================" +echo "Adding domain" +echo "========================================================================" + +ADD_DOMAIN_OP_ID=`osm ns-action --action_name add-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN, 'ip': $IP}" $PDNS_NS_NAME` + +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" +osm ns-op-show $ADD_DOMAIN_OP_ID + +echo "========================================================================" +echo "Check action status using osm ns-show $ADD_DOMAIN_OP_ID" +echo "========================================================================" + +echo "========================================================================" +echo "Get the list of all operations using osm ns-op-list $PDNS_NS_ID" +echo "========================================================================" \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/8-test-dns-record.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/8-test-dns-record.sh new file mode 100644 index 00000000..d24197aa --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/8-test-dns-record.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +VNF_ID=`osm vnf-list --ns $PDNS_NS_NAME | grep powerdns | awk '{print $2}'` + +echo "========================================================================" +echo "VNF ID $VNF_ID" +echo "========================================================================" + +export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | contains("udp")) | .external_ip' | tr -d ' '-` + +echo "========================================================================" +echo "DNS IP $DNS_IP" +echo "========================================================================" + +echo "========================================================================" +echo "Setting DNS Server in your machine" +echo "========================================================================" +echo "nameserver ${DNS_IP}" | tee -a /etc/resolv.conf + +read -p "Enter DNS RECORD:" RECORD +if [[ -z "$RECORD" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered RECORD %s " "$RECORD" + ls -l +fi + + +echo "========================================================================" +echo "Testing record" +echo "========================================================================" + +# Sample record: "test.example.org" +dig @${DNS_IP} $RECORD + + +echo "========================================================================" +echo "Testing the record using dig @${DNS_IP} $RECORD" +echo "========================================================================" \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/9-delete-domain.sh b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/9-delete-domain.sh new file mode 100644 index 00000000..b29818b3 --- /dev/null +++ b/Hackfest_Demos/OSM-MR13/2.1-KNF/powerdns-scripts/9-delete-domain.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +read -p "Enter ZONE:" ZONE + +if [[ -z "$ZONE" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered ZONE %s " "$ZONE" + ls -l +fi + + +read -p "Enter DOMAIN:" DOMAIN +if [[ -z "$DOMAIN" ]]; then + printf '%s\n' "No input entered" + exit 1 +else + printf "You entered DOMAIN %s " "$DOMAIN" + ls -l +fi + + +echo "========================================================================" +echo "Deleting Domain" +echo "========================================================================" + +# Delete Domain +DEL_DOM_OP_ID=`osm ns-action --action_name delete-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN}" $PDNS_NS_NAME` + +echo "========================================================================" +echo "Showing action status" +echo "========================================================================" + +osm ns-op-show $DEL_DOM_OP_ID + +echo "========================================================================" +echo "Check the action status using osm ns-op-show $DEL_DOM_OP_ID" +echo "========================================================================" \ No newline at end of file diff --git a/Hackfest_Demos/OSM-MR13/powerdns/README.md b/Hackfest_Demos/OSM-MR13/powerdns/README.md index cee66c11..48422977 100644 --- a/Hackfest_Demos/OSM-MR13/powerdns/README.md +++ b/Hackfest_Demos/OSM-MR13/powerdns/README.md @@ -9,15 +9,14 @@ There is one NS that connects the VNF to a mgmt network ## Download Packages ```bash -git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git -cd osm-packages/Hackfest_Demos/OSM-MR13/powerdns +git clone --recurse-submodules -j8 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git ``` ## Create the VIM Account ```bash # This is dummy vim account -export VIM_ACCOUNT=k8s-vim +export VIM_ACCOUNT=openstack osm vim-create --name $VIM_ACCOUNT \ --account_type dummy \ --user dummy \ @@ -30,12 +29,13 @@ osm vim-create --name $VIM_ACCOUNT \ ```bash # kubeconfig.yaml exists in the HOME directory -export k8s_net=<K8s cluster network> # osm-ext +export K8S_NET=osm-ext # osm-ext +export K8S_CLUSTER=hackfest osm k8scluster-add --creds ~/kubeconfig.yaml \ - --vim k8s-vim \ - --k8s-nets "{k8s_net: $k8s_net}" \ + --vim openstack \ + --k8s-nets "{k8s_net: $K8S_NET}" \ --version 1.24 \ - k8s-cluster + $K8S_CLUSTER ``` ## Add Helm Repository @@ -49,11 +49,11 @@ osm repo-add --type helm-chart --description "Repository for Powerdns helm Chart ```bash # Install charmcraft sudo snap install charmcraft --classic -pushd powerdns_knf/charms/ops/powerdns-operator +pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/ops/powerdns-operator # Pack charm charmcraft pack # Copy charm under VNFD/charms folder -cp powerdns-operator_ubuntu-20.04-amd64.charm ../../ +cp powerdns-operator_ubuntu-20.04-amd64.charm osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/ popd ``` @@ -63,15 +63,18 @@ popd export VNF_NAME=powerdns export KDU_NAME=powerdns # Define the NS name -export NS_NAME=<ns name> +export PDNS_NS_NAME=powerdns_ns ``` ```bash +pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/ osm nfpkg-create powerdns_knf osm nspkg-create powerdns_ns -osm ns-create --ns_name $NS_NAME --nsd_name powerdns_ns --vim_account $VIM_ACCOUNT --config "{vld: [ {name: mgmtnet, vim-network-name: $k8s_net}]}" +popd +export PDNS_NS_ID=`osm ns-create --ns_name $PDNS_NS_NAME --nsd_name powerdns_ns --vim_account openstack --config "{vld: [ {name: mgmtnet, vim-network-name: $K8S_NET}]}"` # Check NS status -osm ns list +osm ns-list +osm ns-show $PDNS_NS_ID ``` ## Test Day2 Actions: add-zone, add-domain @@ -79,54 +82,59 @@ osm ns list ```bash # Add Zone Action # Define zone such as "example.org." -ZONE=<zone> -OP_ID=`osm ns-action --action_name add-zone --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{"zone_name": $ZONE}" $NS_NAME` +ZONE=osm.magma.com. +ADD_ZONE_OP_ID=`osm ns-action --action_name add-zone --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{"zone_name": $ZONE}" $PDNS_NS_NAME` # Check operation status -osm ns-op-show $OP_ID +osm ns-op-show $ADD_ZONE_OP_ID # Add Domain Action # Define domain such as "test." +# Use the domain names and ip addresses which are required for Magma Orchestrator DOMAIN=<domain> # Define ip such as "192.168.2.32" IP=<ip> -OP_ID=`osm ns-action --action_name add-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN, 'ip': $IP}" $NS_NAME` +ADD_DOMAIN_OP_ID=`osm ns-action --action_name add-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN, 'ip': $IP}" $PDNS_NS_NAME` # Check operation status -osm ns-op-show $OP_ID +osm ns-op-show $ADD_DOMAIN_OP_ID +# Get the list of all operations +osm ns-op-list $PDNS_NS_ID ``` ## Testing PowerDNS server ```bash -VNF_ID=`osm vnf-list --ns $NS_NAME | grep powerdns | awk '{print $2}'` -export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | endswith("-tcp")) | .external_ip' | tr -d \"[]' '` +VNF_ID=`osm vnf-list --ns $PDNS_NS_NAME | grep powerdns | awk '{print $2}'` +export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | contains("udp")) | .external_ip' | tr -d ' '-` +# Setting DNS Server in your machine +echo "nameserver ${DNS_IP}" | tee -a /etc/resolv.conf RECORD=<domain><zone> # Sample record: "test.example.org" -dig @${DNS_IP} +tcp $RECORD +dig @${DNS_IP} $RECORD ``` ## Test Day2 Actions: delete-domain, delete-zone ```bash # Delete Domain -OP_ID=`osm ns-action --action_name delete-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN}" $NS_NAME` -osm ns-op-show $OP_ID -dig @${DNS_IP} +tcp ${RECORD} +DEL_DOM_OP_ID=`osm ns-action --action_name delete-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN}" $PDNS_NS_NAME` +osm ns-op-show $DEL_DOM_OP_ID +dig @${DNS_IP} ${RECORD} # Delete Zone -OP_ID=`osm ns-action --action_name delete-zone --vnf_name $KDU_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE}" $NS_NAME` -osm ns-op-show $OP_ID +DEL_ZONE_OP_ID=`osm ns-action --action_name delete-zone --vnf_name $KDU_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE}" $PDNS_NS_NAME` +osm ns-op-show $DEL_ZONE_OP_ID ``` ## Upgrade Operation: Scale Out ```bash -OP_ID=`osm ns-action --action_name upgrade --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'replicaCount':'3',}" $NS_NAME` -osm ns-op-show $OP_ID --literal | yq .operationState +SCALE_OUT_OP_ID=`osm ns-action --action_name upgrade --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'replicaCount':'3',}" $PDNS_NS_NAME` +osm ns-op-show $PDNS_NS_NAME --literal | yq .operationState osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount ``` ## Rollback Operation: Scale In ```bash -OP_ID=`osm ns-action --action_name rollback --vnf_name $VNF_NAME --kdu_name $KDU_NAME $NS_NAME` -osm ns-op-show $OP_ID --literal | yq .operationState +SCALE_IN_OP_ID=`osm ns-action --action_name rollback --vnf_name $VNF_NAME --kdu_name $KDU_NAME $PDNS_NS_NAME` +osm ns-op-show $SCALE_IN_OP_ID --literal | yq .operationState osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount ``` -- GitLab