Add Heat templates and scripts for vLBMS 81/37481/2
authorMarco Platania <platania@research.att.com>
Wed, 21 Mar 2018 14:11:32 +0000 (10:11 -0400)
committerMarco Platania <platania@research.att.com>
Wed, 21 Mar 2018 16:58:22 +0000 (16:58 +0000)
- Heat templates that install the vLBMS components
- Installation scripts that install and configure the VNF components

Change-Id: Ie1911a67b830d5543c96174fb915afd30d8daf0c
Issue-ID: INT-447
Signed-off-by: Marco Platania <platania@research.att.com>
25 files changed:
heat/vLBMS/MANIFEST.json [new file with mode: 0644]
heat/vLBMS/base_vlb.env [new file with mode: 0644]
heat/vLBMS/base_vlb.yaml [new file with mode: 0644]
heat/vLBMS/dnsscaling.env [new file with mode: 0644]
heat/vLBMS/dnsscaling.yaml [new file with mode: 0644]
vnfs/vLBMS/scripts/add_dns.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/db_dnsdemo_onap_org [new file with mode: 0644]
vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org [new file with mode: 0644]
vnfs/vLBMS/scripts/named.conf.local [new file with mode: 0644]
vnfs/vLBMS/scripts/named.conf.options [new file with mode: 0644]
vnfs/vLBMS/scripts/properties.conf [new file with mode: 0644]
vnfs/vLBMS/scripts/remove_dns.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/run_health.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/run_health_vdns.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/run_streams.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/set_gre_tunnel.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_dns_init.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_dns_install.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_lb_init.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_lb_install.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_packetgen_init.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/v_packetgen_install.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/vdns.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/vlb.sh [new file with mode: 0644]
vnfs/vLBMS/scripts/vpacketgen.sh [new file with mode: 0644]

diff --git a/heat/vLBMS/MANIFEST.json b/heat/vLBMS/MANIFEST.json
new file mode 100644 (file)
index 0000000..b22a67f
--- /dev/null
@@ -0,0 +1,28 @@
+{
+    "name": "virtualLoadBalancer",
+    "description": "",
+    "data": [
+        {
+            "file": "base_vlb.yaml",
+            "type": "HEAT",
+            "isBase": "true",
+            "data": [
+                {
+                    "file": "base_vlb.env",
+                    "type": "HEAT_ENV"
+                }
+            ]
+        },
+        {
+            "file": "dnsscaling.yaml",
+            "type": "HEAT",
+            "isBase": "false",
+            "data": [
+                {
+                    "file": "dnsscaling.env",
+                    "type": "HEAT_ENV"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/heat/vLBMS/base_vlb.env b/heat/vLBMS/base_vlb.env
new file mode 100644 (file)
index 0000000..a965888
--- /dev/null
@@ -0,0 +1,35 @@
+parameters:
+  vlb_image_name: PUT THE IMAGE NAME HERE
+  vlb_flavor_name: PUT THE FLAVOR NAME HERE
+  public_net_id: PUT THE NETWORK ID HERE
+  vlb_private_net_id: zdfw1lb01_private
+  pktgen_private_net_id: zdfw1pktgen01_private
+  onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
+  onap_private_subnet_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
+  vlb_private_net_cidr: 192.168.10.0/24
+  pktgen_private_net_cidr: 192.168.9.0/24
+  onap_private_net_cidr: PUT THE ONAP NETWORK CIDR HERE
+  vlb_private_ip_0: 192.168.10.111
+  vlb_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VLB
+  vlb_private_ip_2: 192.168.9.111
+  vdns_private_ip_0: 192.168.10.211
+  vdns_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VDNS
+  vpg_private_ip_0: 192.168.9.110
+  vpg_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VPKTGEN
+  vip: 192.168.9.112
+  gre_ipaddr: 192.168.10.112
+  pg_int: 192.168.9.109
+  vlb_name_0: zdfw1lb01lb01
+  vdns_name_0: zdfw1lb01dns01
+  vpg_name_0: zdfw1lb01pg01
+  vnf_id: vLoadBalancer_demo_app
+  vf_module_id: vLoadBalancer
+  dcae_collector_ip: PUT THE ADDRESS OF THE DCAE COLLECTOR HERE
+  dcae_collector_port: 8080
+  repo_url_blob: https://nexus.onap.org/content/sites/raw
+  repo_url_artifacts: https://nexus.onap.org/content/groups/staging
+  demo_artifacts_version: 1.2.0
+  install_script_version: 1.2.0-SNAPSHOT
+  key_name: vlb_key
+  pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN
+  cloud_env: PUT openstack OR backspace HERE
diff --git a/heat/vLBMS/base_vlb.yaml b/heat/vLBMS/base_vlb.yaml
new file mode 100644 (file)
index 0000000..e0f71ff
--- /dev/null
@@ -0,0 +1,432 @@
+##########################################################################
+#
+#==================LICENSE_START==========================================
+# 
+#
+# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#==================LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+##########################################################################
+
+heat_template_version: 2013-05-23
+
+description: Heat template to deploy vLoadBalancer/vDNS demo app for ONAP
+
+##############
+#            #
+# PARAMETERS #
+#            #
+##############
+
+parameters:
+  vlb_image_name:
+    type: string
+    label: Image name or ID
+    description: Image to be used for compute instance
+  vlb_flavor_name:
+    type: string
+    label: Flavor
+    description: Type of instance (flavor) to be used
+  public_net_id:
+    type: string
+    label: Public network name or ID
+    description: Public network that enables remote connection to VNF
+  vlb_private_net_id:
+    type: string
+    label: vLoadBalancer private network name or ID
+    description: Private network that connects vLoadBalancer with vDNSs
+  pktgen_private_net_id:
+    type: string
+    label: vPacketGen private network name or ID
+    description: Private network that connects vLoadBalancer with vPacketGen
+  onap_private_net_id:
+    type: string
+    label: ECOMP management network name or ID
+    description: Private network that connects ONAP component and the VNF
+  onap_private_subnet_id:
+    type: string
+    label: ECOMP management sub-network name or ID
+    description: Private sub-network that connects ONAP component and the VNF
+  vlb_private_net_cidr:
+    type: string
+    label: vLoadBalancer private network CIDR
+    description: The CIDR of the vLoadBalancer private network
+  pktgen_private_net_cidr:
+    type: string
+    label: vPacketGen private network CIDR
+    description: The CIDR of the vPacketGen private network
+  onap_private_net_cidr:
+    type: string
+    label: ONAP private network CIDR
+    description: The CIDR of the protected private network
+  vlb_private_ip_0:
+    type: string
+    label: vLoadBalancer private IP address towards the private network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
+  vlb_private_ip_1:
+    type: string
+    label: vLoadBalancer private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
+  vlb_private_ip_2:
+    type: string
+    label: vLoadBalancer private IP address towards the vPacketGen network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with vPacketGen
+  vdns_private_ip_0:
+    type: string
+    label: vDNS private IP address towards the private network
+    description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
+  vdns_private_ip_1:
+    type: string
+    label: vDNS private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vDNS to communicate with ONAP components
+  vpg_private_ip_0:
+    type: string
+    label: vPacketGen private IP address towards the vPacketGen private network
+    description: Private IP address that is assigned to the vPacketGen to communicate with the vLoadBalancer
+  vpg_private_ip_1:
+    type: string
+    label: vPacketGen private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vPacketGen to communicate with ONAP components
+  vip:
+    type: string
+    label: Virtual Private IP of the vLoadBalancer
+    description: Virtual Private IP that is assigned to the vLoadBalancer's VPP layer
+  gre_ipaddr:
+    type: string
+    label: IP Address of the GRE tunnel
+    description: IP address assigned to the GRE tunnel on the vLoadBalancer
+  pg_int:
+    type: string
+    label: IP Address of the output vPacketGen interface
+    description: IP address assigned to the output interface of the vPacketGen's VPP layer
+  vlb_name_0:
+    type: string
+    label: vLoadBalancer name
+    description: Name of the vLoadBalancer
+  vdns_name_0:
+    type: string
+    label: vDNS name
+    description: Name of the vDNS
+  vpg_name_0:
+    type: string
+    label: vPKTGEN name
+    description: Name of the vPKTGEN
+  vnf_id:
+    type: string
+    label: VNF ID
+    description: The VNF ID is provided by ONAP
+  vf_module_id:
+    type: string
+    label: vFirewall module ID
+    description: The vLoadBalancer Module ID is provided by ONAP
+  dcae_collector_ip:
+    type: string
+    label: DCAE collector IP address
+    description: IP address of the DCAE collector
+  dcae_collector_port:
+    type: string
+    label: DCAE collector port
+    description: Port of the DCAE collector
+  key_name:
+    type: string
+    label: Key pair name
+    description: Public/Private key pair name
+  pub_key:
+    type: string
+    label: Public key
+    description: Public key to be installed on the compute instance
+  repo_url_blob:
+    type: string
+    label: Repository URL
+    description: URL of the repository that hosts the demo packages
+  repo_url_artifacts:
+    type: string
+    label: Repository URL
+    description: URL of the repository that hosts the demo packages
+  demo_artifacts_version:
+    type: string
+    label: Artifacts version used in demo vnfs
+    description: Artifacts (jar, tar.gz) version used in demo vnfs
+  install_script_version:
+    type: string
+    label: Installation script version number
+    description: Version number of the scripts that install the vFW demo app
+  cloud_env:
+    type: string
+    label: Cloud environment
+    description: Cloud environment (e.g., openstack, rackspace)
+
+#############
+#           #
+# RESOURCES #
+#           #
+#############
+
+resources:
+
+  random-str:
+    type: OS::Heat::RandomString
+    properties:
+      length: 4
+
+  my_keypair:
+    type: OS::Nova::KeyPair
+    properties:
+      name: 
+        str_replace:
+          template: base_rand
+          params:
+            base: { get_param: key_name }
+            rand: { get_resource: random-str }  
+      public_key: { get_param: pub_key }
+      save_private_key: false
+
+  vlb_private_network:
+    type: OS::Neutron::Net
+    properties:
+      name: { get_param: vlb_private_net_id }
+
+  vlb_private_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { get_param: vlb_private_net_id }
+      network_id: { get_resource: vlb_private_network }
+      cidr: { get_param: vlb_private_net_cidr }
+
+  pktgen_private_network:
+    type: OS::Neutron::Net
+    properties:
+      name: { get_param: pktgen_private_net_id }
+
+  pktgen_private_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { get_param: pktgen_private_net_id }
+      network_id: { get_resource: pktgen_private_network }
+      cidr: { get_param: pktgen_private_net_cidr }
+
+  vlb_private_0_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: vlb_private_network }
+      fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
+
+  vlb_private_1_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: onap_private_net_id }
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
+
+  vlb_private_2_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: pktgen_private_network }
+      fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vlb_private_ip_2 }}]
+
+  vlb_0:
+    type: OS::Nova::Server
+    properties:
+      image: { get_param: vlb_image_name }
+      flavor: { get_param: vlb_flavor_name }
+      name: { get_param: vlb_name_0 }
+      key_name: { get_resource: my_keypair }
+      networks:
+        - network: { get_param: public_net_id }
+        - port: { get_resource: vlb_private_0_port }
+        - port: { get_resource: vlb_private_1_port }
+        - port: { get_resource: vlb_private_2_port }
+      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __dcae_collector_ip__: { get_param: dcae_collector_ip }
+            __dcae_collector_port__: { get_param: dcae_collector_port }
+            __ip_to_dns_net__: { get_param: vlb_private_ip_0 }
+            __ip_to_pktgen_net__: { get_param: vlb_private_ip_2 }
+            __oam_vpktgen_ip__: { get_param: vpg_private_ip_1 }
+            __vip__: { get_param: vip }
+            __gre_ipaddr__: { get_param: gre_ipaddr }
+            __pktgen_ipaddr__: { get_param: vpg_private_ip_0 }
+            __oam_private_ipaddr__: { get_param: vlb_private_ip_1 }
+            __repo_url_blob__: { get_param: repo_url_blob }
+            __repo_url_artifacts__: { get_param: repo_url_artifacts }
+            __demo_artifacts_version__: { get_param: demo_artifacts_version }
+            __install_script_version__: { get_param: install_script_version }
+            __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
+            __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
+            __pktgen_mac__: { get_attr: [vpg_private_0_port, mac_address] }
+            __cloud_env__: { get_param: cloud_env }
+          template: |
+            #!/bin/bash
+
+            # Create configuration files
+            mkdir /opt/config
+            echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
+            echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
+            echo "__ip_to_dns_net__" > /opt/config/ip_to_dns_net.txt
+            echo "__ip_to_pktgen_net__" > /opt/config/ip_to_pktgen_net.txt
+            echo "__oam_vpktgen_ip__" > /opt/config/oam_vpktgen_ip.txt
+            echo "__vip__" > /opt/config/vip.txt
+            echo "__gre_ipaddr__" > /opt/config/gre_ipaddr.txt
+            echo "__pktgen_ipaddr__" > /opt/config/pktgen_ipaddr.txt
+            echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
+            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
+            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
+            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+            echo "__install_script_version__" > /opt/config/install_script_version.txt
+            echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
+            echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
+            echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
+            echo "__pktgen_mac__" > /opt/config/pktgen_mac.txt
+            echo "__cloud_env__" > /opt/config/cloud_env.txt
+
+            # Download and run install script
+            curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_lb_install.sh -o /opt/v_lb_install.sh
+            cd /opt
+            chmod +x v_lb_install.sh
+            ./v_lb_install.sh
+
+
+  vdns_private_0_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: vlb_private_network }
+      fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
+
+  vdns_private_1_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: onap_private_net_id }
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
+
+  vdns_0:
+    type: OS::Nova::Server
+    properties:
+      image: { get_param: vlb_image_name }
+      flavor: { get_param: vlb_flavor_name }
+      name: { get_param: vdns_name_0 }
+      key_name: { get_resource: my_keypair }
+      networks:
+        - network: { get_param: public_net_id }
+        - port: { get_resource: vdns_private_0_port }
+        - port: { get_resource: vdns_private_1_port }
+      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __lb_oam_int__: { get_param: vlb_private_ip_1 }
+            __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
+            __lb_public_ipaddr__: { get_attr: [vlb_0, networks, { get_param: public_net_id }, 0]}
+            __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
+            __oam_private_ipaddr__: { get_param: vdns_private_ip_1 }
+            __repo_url_blob__: { get_param: repo_url_blob }
+            __repo_url_artifacts__: { get_param: repo_url_artifacts }
+            __demo_artifacts_version__: { get_param: demo_artifacts_version }
+            __install_script_version__: { get_param: install_script_version }
+            __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
+            __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __cloud_env__: { get_param: cloud_env }
+          template: |
+            #!/bin/bash
+
+            # Create configuration files
+            mkdir /opt/config
+            echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
+            echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
+            echo "__lb_public_ipaddr__" > /opt/config/lb_public_ipaddr.txt
+            echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
+            echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
+            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
+            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
+            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+            echo "__install_script_version__" > /opt/config/install_script_version.txt
+            echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
+            echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
+            echo "__cloud_env__" > /opt/config/cloud_env.txt
+
+            # Download and run install script
+            curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
+            cd /opt
+            chmod +x v_dns_install.sh
+            ./v_dns_install.sh
+
+
+  vpg_private_0_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: pktgen_private_network }
+      fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]
+
+  vpg_private_1_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: onap_private_net_id }
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}]
+
+  vpg_0:
+    type: OS::Nova::Server
+    properties:
+      image: { get_param: vlb_image_name }
+      flavor: { get_param: vlb_flavor_name }
+      name: { get_param: vpg_name_0 }
+      key_name: { get_resource: my_keypair }
+      networks:
+        - network: { get_param: public_net_id }
+        - port: { get_resource: vpg_private_0_port }
+        - port: { get_resource: vpg_private_1_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __repo_url_blob__: { get_param: repo_url_blob }
+            __repo_url_artifacts__: { get_param: repo_url_artifacts }
+            __local_private_ipaddr__: { get_param: vpg_private_ip_0 }
+            __oam_private_ipaddr__: { get_param: vpg_private_ip_1 }
+            __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
+            __vlb_ipaddr__: { get_param: vlb_private_ip_2 }
+            __demo_artifacts_version__: { get_param: demo_artifacts_version }
+            __install_script_version__: { get_param: install_script_version }
+            __pg_int__: { get_param: pg_int }
+            __vlb_mac__: { get_attr: [vlb_private_2_port, mac_address] }
+            __cloud_env__: { get_param: cloud_env }
+          template: |
+            #!/bin/bash
+
+            # Create configuration files
+            mkdir /opt/config
+            echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
+            echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
+            echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
+            echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
+            echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
+            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
+            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
+            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+            echo "__install_script_version__" > /opt/config/install_script_version.txt
+            echo "__pg_int__" > /opt/config/pg_int.txt
+            echo "__vlb_mac__" > /opt/config/vlb_mac.txt
+            echo "__cloud_env__" > /opt/config/cloud_env.txt
+
+            # Download and run install script
+            curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh
+            cd /opt
+            chmod +x v_packetgen_install.sh
+            ./v_packetgen_install.sh
\ No newline at end of file
diff --git a/heat/vLBMS/dnsscaling.env b/heat/vLBMS/dnsscaling.env
new file mode 100644 (file)
index 0000000..7c4eb65
--- /dev/null
@@ -0,0 +1,24 @@
+parameters:
+  vlb_image_name: PUT THE IMAGE NAME HERE
+  vlb_flavor_name: PUT THE FLAVOR NAME HERE
+  public_net_id: PUT THE NETWORK ID HERE
+  vlb_private_net_id: zdfw1lb01_private
+  onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
+  onap_private_subnet_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
+  vlb_private_net_cidr: 192.168.10.0/24
+  onap_private_net_cidr: PUT THE ONAP NETWORK CIDR HERE
+  vlb_public_ip: PUT THE PUBLIC IP OF THE LOAD BALANCER HERE
+  vlb_private_ip_0: 192.168.10.111
+  vlb_private_ip_1: PUT THE PRIVATE ADDRESS OF THE VLB IN THE ONAP NETWORK SPACE HERE
+  vdns_private_ip_0: 192.168.10.212
+  vdns_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VDNS
+  vdns_name_0: zdfw1lb01dns02
+  vnf_id: vLoadBalancer_demo_app
+  vf_module_id: vLoadBalancer
+  repo_url_blob: https://nexus.onap.org/content/sites/raw
+  repo_url_artifacts: https://nexus.onap.org/content/groups/staging
+  demo_artifacts_version: 1.2.0
+  install_script_version: 1.2.0-SNAPSHOT
+  key_name: vlb_key_scaling
+  pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN
+  cloud_env: PUT openstack OR backspace HERE
\ No newline at end of file
diff --git a/heat/vLBMS/dnsscaling.yaml b/heat/vLBMS/dnsscaling.yaml
new file mode 100644 (file)
index 0000000..47aa372
--- /dev/null
@@ -0,0 +1,216 @@
+##########################################################################
+#
+#==================LICENSE_START==========================================
+# 
+#
+# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#==================LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+##########################################################################
+
+heat_template_version: 2013-05-23
+
+description: Heat template to deploy a vDNS for ONAP (scaling-up scenario)
+
+##############
+#            #
+# PARAMETERS #
+#            #
+##############
+
+parameters:
+  vlb_image_name:
+    type: string
+    label: Image name or ID
+    description: Image to be used for compute instance
+  vlb_flavor_name:
+    type: string
+    label: Flavor
+    description: Type of instance (flavor) to be used
+  public_net_id:
+    type: string
+    label: Public network name or ID
+    description: Public network that enables remote connection to VNF
+  vlb_private_net_id:
+    type: string
+    label: vLoadBalancer private network name or ID
+    description: Private network that connects vLoadBalancer with vDNSs
+  onap_private_net_id:
+    type: string
+    label: ONAP management network name or ID
+    description: Private network that connects ONAP component and the VNF
+  onap_private_subnet_id:
+    type: string
+    label: ONAP management sub-network name or ID
+    description: Private sub-network that connects ONAP component and the VNF
+  vlb_private_net_cidr:
+    type: string
+    label: vLoadBalancer private network CIDR
+    description: The CIDR of the vLoadBalancer private network
+  onap_private_net_cidr:
+    type: string
+    label: ONAP private network CIDR
+    description: The CIDR of the protected private network
+  vlb_public_ip:
+    type: string
+    label: vLoadBalancer public IP address
+    description: Public IP address of the vLoadBalancer
+  vlb_private_ip_0:
+    type: string
+    label: vLoadBalancer private IP address towards the private network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
+  vlb_private_ip_1:
+    type: string
+    label: vLoadBalancer private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
+  vdns_private_ip_0:
+    type: string
+    label: vDNS private IP address towards the private network
+    description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
+  vdns_private_ip_1:
+    type: string
+    label: vDNS private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vDNS to communicate with ONAP components
+  vdns_name_0:
+    type: string
+    label: vDNS name
+    description: Name of the vDNS
+  vnf_id:
+    type: string
+    label: VNF ID
+    description: The VNF ID is provided by ONAP
+  vf_module_id:
+    type: string
+    label: vFirewall module ID
+    description: The vLoadBalancer Module ID is provided by ONAP
+  key_name:
+    type: string
+    label: Key pair name
+    description: Public/Private key pair name
+  pub_key:
+    type: string
+    label: Public key
+    description: Public key to be installed on the compute instance
+  repo_url_blob:
+    type: string
+    label: Repository URL
+    description: URL of the repository that hosts the demo packages
+  repo_url_artifacts:
+    type: string
+    label: Repository URL
+    description: URL of the repository that hosts the demo packages
+  install_script_version:
+    type: string
+    label: Installation script version number
+    description: Version number of the scripts that install the vFW demo app
+  demo_artifacts_version:
+    type: string
+    label: Artifacts version used in demo vnfs
+    description: Artifacts (jar, tar.gz) version used in demo vnfs
+  cloud_env:
+    type: string
+    label: Cloud environment
+    description: Cloud environment (e.g., openstack, rackspace)
+
+#############
+#           #
+# RESOURCES #
+#           #
+#############
+
+resources:
+
+  random-str:
+    type: OS::Heat::RandomString
+    properties:
+      length: 4
+
+  my_keypair:
+    type: OS::Nova::KeyPair
+    properties:
+      name:
+        str_replace:
+          template: base_rand
+          params:
+            base: { get_param: key_name }
+            rand: { get_resource: random-str }
+      public_key: { get_param: pub_key }
+      save_private_key: false
+
+  vdns_2_private_0_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: vlb_private_net_id }
+      fixed_ips: [{"subnet": { get_param: vlb_private_net_id }, "ip_address": { get_param: vdns_private_ip_0 }}]
+
+  vdns_2_private_1_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: onap_private_net_id }
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
+
+  vdns_2:
+    type: OS::Nova::Server
+    properties:
+      image: { get_param: vlb_image_name }
+      flavor: { get_param: vlb_flavor_name }
+      name: { get_param: vdns_name_0 }
+      key_name: { get_resource: my_keypair }
+      networks:
+        - network: { get_param: public_net_id }
+        - port: { get_resource: vdns_2_private_0_port }
+        - port: { get_resource: vdns_2_private_1_port }
+      metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __lb_oam_int__: { get_param: vlb_private_ip_1 }
+            __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
+            __lb_public_ipaddr__: { get_param: vlb_public_ip }
+            __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
+            __oam_private_ipaddr__: { get_param: vdns_private_ip_1 }
+            __repo_url_blob__: { get_param: repo_url_blob }
+            __repo_url_artifacts__: { get_param: repo_url_artifacts }
+            __demo_artifacts_version__: { get_param: demo_artifacts_version }
+            __install_script_version__: { get_param: install_script_version }
+            __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
+            __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __cloud_env__: { get_param: cloud_env }
+          template: |
+            #!/bin/bash
+
+            # Create configuration files
+            mkdir /opt/config
+            echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
+            echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
+            echo "__lb_public_ipaddr__" > /opt/config/lb_public_ipaddr.txt
+            echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
+            echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
+            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
+            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
+            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+            echo "__install_script_version__" > /opt/config/install_script_version.txt
+            echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
+            echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
+            echo "__cloud_env__" > /opt/config/cloud_env.txt
+
+            # Download and run install script
+            curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
+            cd /opt
+            chmod +x v_dns_install.sh
+            ./v_dns_install.sh
\ No newline at end of file
diff --git a/vnfs/vLBMS/scripts/add_dns.sh b/vnfs/vLBMS/scripts/add_dns.sh
new file mode 100644 (file)
index 0000000..6397763
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+  echo "Usage: ./add_dns.sh [remote DNS server]"
+  exit
+fi
+
+DNS_IPADDR=$1
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt)
+
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR
+GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR)
+vppctl set int ip address $GRE $GRE_IPADDR"/32"
+vppctl set int state $GRE up
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/evel/evel-library/code/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS+1
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLBMS/scripts/db_dnsdemo_onap_org b/vnfs/vLBMS/scripts/db_dnsdemo_onap_org
new file mode 100644 (file)
index 0000000..45da816
--- /dev/null
@@ -0,0 +1,24 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL    604800
+@       IN      SOA     dnsdemo.onap.org. admin.dnsdemo.onap.org. (
+                              3         ; Serial
+                         604800         ; Refresh
+                          86400         ; Retry
+                        2419200         ; Expire
+                         604800 )       ; Negative Cache TTL
+; name servers - NS records
+    IN      NS      dnsdemo.onap.org.
+; name servers - A records
+dnsdemo.onap.org.                IN      A       10.0.100.100
+host1.dnsdemo.onap.org.          IN      A       10.0.100.101
+host2.dnsdemo.onap.org.          IN      A       10.0.100.102
+host3.dnsdemo.onap.org.          IN      A       10.0.100.103
+host4.dnsdemo.onap.org.          IN      A       10.0.100.104
+host5.dnsdemo.onap.org.          IN      A       10.0.100.105
+host6.dnsdemo.onap.org.          IN      A       10.0.100.106
+host7.dnsdemo.onap.org.          IN      A       10.0.100.107
+host8.dnsdemo.onap.org.          IN      A       10.0.100.108
+host9.dnsdemo.onap.org.          IN      A       10.0.100.109
+host10.dnsdemo.onap.org.         IN      A       10.0.100.110
diff --git a/vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org b/vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org
new file mode 100644 (file)
index 0000000..631614a
--- /dev/null
@@ -0,0 +1,24 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL    604800
+@       IN      SOA     dnsdemo.openecomp.org. admin.dnsdemo.openecomp.org. (
+                              3         ; Serial
+                         604800         ; Refresh
+                          86400         ; Retry
+                        2419200         ; Expire
+                         604800 )       ; Negative Cache TTL
+; name servers - NS records
+    IN      NS      dnsdemo.openecomp.org.
+; name servers - A records
+dnsdemo.openecomp.org.                IN      A       10.0.100.100
+host1.dnsdemo.openecomp.org.          IN      A       10.0.100.101
+host2.dnsdemo.openecomp.org.          IN      A       10.0.100.102
+host3.dnsdemo.openecomp.org.          IN      A       10.0.100.103
+host4.dnsdemo.openecomp.org.          IN      A       10.0.100.104
+host5.dnsdemo.openecomp.org.          IN      A       10.0.100.105
+host6.dnsdemo.openecomp.org.          IN      A       10.0.100.106
+host7.dnsdemo.openecomp.org.          IN      A       10.0.100.107
+host8.dnsdemo.openecomp.org.          IN      A       10.0.100.108
+host9.dnsdemo.openecomp.org.          IN      A       10.0.100.109
+host10.dnsdemo.openecomp.org.         IN      A       10.0.100.110
diff --git a/vnfs/vLBMS/scripts/named.conf.local b/vnfs/vLBMS/scripts/named.conf.local
new file mode 100644 (file)
index 0000000..94f8ad2
--- /dev/null
@@ -0,0 +1,12 @@
+//
+// Do any local configuration here
+//
+
+// Consider adding the 1918 zones here, if they are not used in your
+// organization
+//include "/etc/bind/zones.rfc1918";
+
+zone "dnsdemo.onap.org" {
+        type master;
+        file "/etc/bind/zones/db.dnsdemo.onap.org"; # zone file path
+};
diff --git a/vnfs/vLBMS/scripts/named.conf.options b/vnfs/vLBMS/scripts/named.conf.options
new file mode 100644 (file)
index 0000000..1daa65c
--- /dev/null
@@ -0,0 +1,39 @@
+acl "trusted" {
+        x.x.x.x;
+};
+options {
+        directory "/var/cache/bind";
+
+        recursion no;                  # enables recursive queries
+        allow-recursion { trusted; };  # allows recursive queries from "trusted” clients i.e. LB only
+        listen-on { x.x.x.x; };                # ns1 IP address - listen on this address only
+        allow-transfer { none; };      # disable zone transfers by default
+
+        forwarders {
+                8.8.8.8;
+                8.8.4.4;
+        };
+
+
+        // If there is a firewall between you and nameservers you want
+        // to talk to, you may need to fix the firewall to allow multiple
+        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113
+
+        // If your ISP provided one or more IP addresses for stable
+        // nameservers, you probably want to use them as forwarders.
+        // Uncomment the following block, and insert the addresses replacing
+        // the all-0's placeholder.
+
+        // forwarders {
+        //      0.0.0.0;
+        // };
+
+        //========================================================================
+        // If BIND logs error messages about the root key being expired,
+        // you will need to update your keys.  See https://www.isc.org/bind-keys
+        //========================================================================
+        dnssec-validation auto;
+
+        auth-nxdomain no;              # conform to RFC1035
+        listen-on-v6 { any; };
+};
diff --git a/vnfs/vLBMS/scripts/properties.conf b/vnfs/vLBMS/scripts/properties.conf
new file mode 100644 (file)
index 0000000..03c5469
--- /dev/null
@@ -0,0 +1,4 @@
+script=/opt/run_health.sh
+output=status.txt
+vnfc=vLB
+primary=true
diff --git a/vnfs/vLBMS/scripts/remove_dns.sh b/vnfs/vLBMS/scripts/remove_dns.sh
new file mode 100644 (file)
index 0000000..1f6c656
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+  echo "Usage: ./remove_dns.sh [remote DNS server]"
+  exit
+fi
+
+DNS_IPADDR=$1
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR del
+vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR del
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/evel/evel-library/code/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS-1
+if [[ $CURR_DNS -lt 0 ]]
+then
+  CURR_DNS=0
+fi
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLBMS/scripts/run_health.sh b/vnfs/vLBMS/scripts/run_health.sh
new file mode 100644 (file)
index 0000000..ed3b042
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+SERVICE=$(cat /opt/config/service.txt)
+
+PID=$(pgrep $SERVICE)
+if [[ -z $PID ]]; then
+  echo "unhealthy" > status.txt
+else
+  echo "healthy" > status.txt
+fi
diff --git a/vnfs/vLBMS/scripts/run_health_vdns.sh b/vnfs/vLBMS/scripts/run_health_vdns.sh
new file mode 100644 (file)
index 0000000..8851fa9
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+PID=$(service bind9 status | grep active)
+if [[ -z $PID ]]; then
+  echo "unhealthy" > status.txt
+else
+  echo "healthy" > status.txt
+fi
diff --git a/vnfs/vLBMS/scripts/run_streams.sh b/vnfs/vLBMS/scripts/run_streams.sh
new file mode 100644 (file)
index 0000000..86f97b2
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#Disable all the running streams
+vppctl packet-gen disable
+
+#Initial configuration: run only two streams
+vppctl packet-gen enable-stream dns1
+vppctl packet-gen enable-stream dns2
+
+sleep 180
+
+#Rehash port numbers and re-run five streams every minute
+while true; do
+       vppctl packet-gen disable
+       vppctl pac del dns1
+       vppctl pac del dns2
+       vppctl pac del dns3
+       vppctl pac del dns4
+       vppctl pac del dns5
+
+       #Update destination (vLB) IP
+       VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+       IPADDR1=$(cat /opt/config/local_private_ipaddr.txt)
+       sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+       sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+       sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+       sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+       sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+
+       #Update source ports (make them random)
+       sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+       sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+       sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+       sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+       sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+
+       vppctl exec /opt/dns_streams/stream_dns1
+       vppctl exec /opt/dns_streams/stream_dns2
+       vppctl exec /opt/dns_streams/stream_dns3
+       vppctl exec /opt/dns_streams/stream_dns4
+       vppctl exec /opt/dns_streams/stream_dns5
+
+       #Resume stream execution
+       vppctl packet-gen enable-stream dns1
+       vppctl packet-gen enable-stream dns2
+       vppctl packet-gen enable-stream dns3
+       vppctl packet-gen enable-stream dns4
+       vppctl packet-gen enable-stream dns5
+
+       sleep 60
+done
diff --git a/vnfs/vLBMS/scripts/set_gre_tunnel.sh b/vnfs/vLBMS/scripts/set_gre_tunnel.sh
new file mode 100644 (file)
index 0000000..186a00d
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+LB_PUBLIC_IP=$(cat /opt/config/lb_public_ipaddr.txt)
+LB_PRIVATE_IP=$(cat /opt/config/lb_private_ipaddr.txt)
+MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+
+sed -i "s/x.x.x.x/"$LB_PUBLIC_IP"/g" /etc/bind/named.conf.options
+
+ip tunnel add gre123 mode gre remote $LB_PRIVATE_IP local $MY_PRIVATE_IP ttl 255
+ip link set gre123 up
+ip addr add $LB_PUBLIC_IP"/32" dev gre123
+route add default dev gre123
+ifconfig eth0 down
+
+service bind9 restart
diff --git a/vnfs/vLBMS/scripts/v_dns_init.sh b/vnfs/vLBMS/scripts/v_dns_init.sh
new file mode 100644 (file)
index 0000000..f891eb6
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+./set_gre_tunnel.sh
diff --git a/vnfs/vLBMS/scripts/v_dns_install.sh b/vnfs/vLBMS/scripts/v_dns_install.sh
new file mode 100644 (file)
index 0000000..38860e8
--- /dev/null
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+       # Number of args to shift, 255..255, first non-255 byte, zeroes
+       set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+       [ $1 -gt 1 ] && shift $1 || shift
+       echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+       # Allow remote login as root
+       mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+       cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+       MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+       IP=$(cat /opt/config/local_private_ipaddr.txt)
+       BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
+       IP=$(cat /opt/config/oam_private_ipaddr.txt)
+       BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth2" >> /etc/network/interfaces
+       echo "iface eth2 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates maven
+sleep 1
+
+# Download vDNS demo code for DNS Server
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_dns_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vdns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/set_gre_tunnel.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health_vdns.sh -O /opt/run_health.sh
+
+sed -i 's/primary=.*/primary=false/g' /opt/config/properties.conf
+sed -i 's/vnfc=.*/vnfc=vDNS/g' /opt/config/properties.conf
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+rm vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+chmod +x v_dns_init.sh
+chmod +x vdns.sh
+chmod +x set_gre_tunnel.sh
+
+# Download Bind config files
+cd /opt/config
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/db_dnsdemo_onap_org
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/named.conf.options
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/named.conf.local
+
+echo "bind9" > service.txt
+
+# Configure Bind
+modprobe ip_gre
+mkdir /etc/bind/zones
+sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
+mv db_dnsdemo_onap_org /etc/bind/zones/db.dnsdemo.onap.org
+mv named.conf.options /etc/bind/
+mv named.conf.local /etc/bind/
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vdns.sh /etc/init.d
+update-rc.d vdns.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+       sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+       grub-mkconfig -o /boot/grub/grub.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
+./v_dns_init.sh
diff --git a/vnfs/vLBMS/scripts/v_lb_init.sh b/vnfs/vLBMS/scripts/v_lb_init.sh
new file mode 100644 (file)
index 0000000..072d3ae
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Start VPP
+systemctl start vpp
+sleep 1
+
+# Compute the network CIDR from the Netmask
+mask2cidr() {
+    nbits=0
+    IFS=.
+    for dec in $1 ; do
+        case $dec in
+            255) let nbits+=8;;
+            254) let nbits+=7;;
+            252) let nbits+=6;;
+            248) let nbits+=5;;
+            240) let nbits+=4;;
+            224) let nbits+=3;;
+            192) let nbits+=2;;
+            128) let nbits+=1;;
+            0);;
+            *) echo "Error: $dec is not recognized"; exit 1
+        esac
+    done
+    echo "$nbits"
+}
+
+IPADDR1_MASK=$(ifconfig eth3 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
+IPADDR2_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR2_CIDR=$(mask2cidr $IPADDR2_MASK)
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth3 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+IPADDR2=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth3 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+HWADDR2=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+PKTGEN_IPADDR=$(cat /opt/config/pktgen_ipaddr.txt)
+PKTGEN_MAC=$(cat /opt/config/pktgen_mac.txt)
+VIP=$(cat /opt/config/vip.txt)
+
+ifconfig eth3 down
+ifconfig eth3 hw ether $FAKE_HWADDR1
+ip addr flush dev eth3
+ifconfig eth3 up
+vppctl tap connect tappub hwaddr $HWADDR1
+vppctl set int ip address tap-0 $VIP"/"$IPADDR1_CIDR
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tappub
+brctl addif br0 eth3
+ifconfig br0 up
+
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR2
+ip addr flush dev eth1
+ifconfig eth1 up
+vppctl tap connect tap111 hwaddr $HWADDR2
+vppctl set int ip address tap-1 $IPADDR2"/"$IPADDR2_CIDR
+vppctl set int state tap-1 up
+brctl addbr br1
+brctl addif br1 tap111
+brctl addif br1 eth1
+ifconfig br1 up
+sleep 1
+
+vppctl lb conf ip4-src-address $IPADDR2
+vppctl lb vip $IPADDR1"/32" encap gre4
+sleep 1
+
+vppctl set ip arp proxy $IPADDR1" - "$IPADDR1
+vppctl set interface proxy-arp tap-0 enable
+vppctl set ip arp tap-0 $PKTGEN_IPADDR $PKTGEN_MAC
+
+# Start Honeycomb and VES client
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+
+cd /opt/VES/evel/evel-library/code/VESreporting/
+echo 0 > active_dns.txt
+./go-client.sh &>/dev/null &disown
diff --git a/vnfs/vLBMS/scripts/v_lb_install.sh b/vnfs/vLBMS/scripts/v_lb_install.sh
new file mode 100644 (file)
index 0000000..afcb081
--- /dev/null
@@ -0,0 +1,127 @@
+#/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+       # Number of args to shift, 255..255, first non-255 byte, zeroes
+       set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+       [ $1 -gt 1 ] && shift $1 || shift
+       echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+       # Allow remote login as root
+       mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+       cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+       MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+       IP=$(cat /opt/config/ip_to_dns_net.txt)
+       BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
+       IP=$(cat /opt/config/oam_private_ipaddr.txt)
+       BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth2" >> /etc/network/interfaces
+       echo "iface eth2 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
+       IP=$(cat /opt/config/ip_to_pktgen_net.txt)
+       BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth3" >> /etc/network/interfaces
+       echo "iface eth3 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y make gcc wget openjdk-8-jdk bridge-utils libcurl4-openssl-dev apt-transport-https ca-certificates maven
+sleep 1
+
+# Download vLB demo code for load balancer
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_lb_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vlb.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/add_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/remove_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health.sh
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/ves5/ves/$DEMO_ARTIFACTS_VERSION/ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/ves5/ves_vlb_reporting/$DEMO_ARTIFACTS_VERSION/ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+
+tar -zmxvf ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv ves-$DEMO_ARTIFACTS_VERSION VES
+tar -zmxvf ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION VESreporting_vLB
+mv VESreporting_vLB /opt/VES/evel/evel-library/code/VESreporting
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+rm *.tar.gz
+
+chmod +x v_lb_init.sh
+chmod +x vlb.sh
+chmod +x /opt/VES/evel/evel-library/code/VESreporting/go-client.sh
+chmod +x add_dns.sh
+chmod +x remove_dns.sh
+
+echo "vpp" > config/service.txt
+
+# Install VPP
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
+rm /etc/apt/sources.list.d/99fd.io.list
+echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
+apt-get update
+apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
+sleep 1
+
+# Install VES
+cd /opt/VES/evel/evel-library/bldjobs/
+make clean
+make
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vlb.sh /etc/init.d
+update-rc.d vlb.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+       sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+       grub-mkconfig -o /boot/grub/grub.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
+./v_lb_init.sh
diff --git a/vnfs/vLBMS/scripts/v_packetgen_init.sh b/vnfs/vLBMS/scripts/v_packetgen_init.sh
new file mode 100644 (file)
index 0000000..30707f0
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+# Start VPP
+systemctl start vpp
+sleep 1
+
+# Compute the network CIDR from the Netmask
+mask2cidr() {
+    nbits=0
+    IFS=.
+    for dec in $1 ; do
+        case $dec in
+            255) let nbits+=8;;
+            254) let nbits+=7;;
+            252) let nbits+=6;;
+            248) let nbits+=5;;
+            240) let nbits+=4;;
+            224) let nbits+=3;;
+            192) let nbits+=2;;
+            128) let nbits+=1;;
+            0);;
+            *) echo "Error: $dec is not recognized"; exit 1
+        esac
+    done
+    echo "$nbits"
+}
+
+IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+VLB_MAC=$(cat /opt/config/vlb_mac.txt)
+GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR1
+ip addr flush dev eth1
+ifconfig eth1 up
+vppctl tap connect tap111 hwaddr $HWADDR1
+vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tap111
+brctl addif br0 eth1
+ifconfig br0 up
+vppctl ip route add 0.0.0.0/0 via $GW
+sleep 1
+
+# Set br0 with public IP and valid MAC so that Linux will have public network access
+ifconfig br0 hw ether $HWADDR1
+ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
+route add default gw $GW
+sleep 1
+vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
+
+# Install packet streams
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
+
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
+sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
+
+vppctl exec /opt/dns_streams/stream_dns1
+vppctl exec /opt/dns_streams/stream_dns2
+vppctl exec /opt/dns_streams/stream_dns3
+vppctl exec /opt/dns_streams/stream_dns4
+vppctl exec /opt/dns_streams/stream_dns5
+vppctl exec /opt/dns_streams/stream_dns6
+vppctl exec /opt/dns_streams/stream_dns7
+vppctl exec /opt/dns_streams/stream_dns8
+vppctl exec /opt/dns_streams/stream_dns9
+vppctl exec /opt/dns_streams/stream_dns10
+
+vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR
+sleep 1
+
+# Start Honeycomb and enable traffic flows
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+
+chmod +x run_streams_dns.sh
+./run_streams_dns.sh &>/dev/null &disown
diff --git a/vnfs/vLBMS/scripts/v_packetgen_install.sh b/vnfs/vLBMS/scripts/v_packetgen_install.sh
new file mode 100644 (file)
index 0000000..2f13fef
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+       # Number of args to shift, 255..255, first non-255 byte, zeroes
+       set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+       [ $1 -gt 1 ] && shift $1 || shift
+       echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+       # Allow remote login as root
+       mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+       cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+       MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+       IP=$(cat /opt/config/local_private_ipaddr.txt)
+       BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
+       IP=$(cat /opt/config/oam_private_ipaddr.txt)
+       BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth2" >> /etc/network/interfaces
+       echo "iface eth2 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y make wget openjdk-8-jdk gcc libcurl4-openssl-dev python-pip bridge-utils apt-transport-https ca-certificates maven
+pip install jsonschema
+
+# Download vFirewall demo code for packet generator
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vpacketgen.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health.sh
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/vlb/vlb_dns_streams/$DEMO_ARTIFACTS_VERSION/vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz 
+
+sed -i 's/primary=.*/primary=false/g' /opt/config/properties.conf
+sed -i 's/vnfc=.*/vnfc=vPacketGen/g' /opt/config/properties.conf
+
+tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv vlb_dns_streams-$DEMO_ARTIFACTS_VERSION dns_streams
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+rm *.tar.gz
+chmod +x v_packetgen_init.sh
+chmod +x vpacketgen.sh
+chmod +x run_streams_dns.sh
+
+echo "vpp" > config/service.txt
+
+# Install VPP
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
+rm /etc/apt/sources.list.d/99fd.io.list
+echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
+apt-get update
+apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vpacketgen.sh /etc/init.d
+update-rc.d vpacketgen.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+       sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+       grub-mkconfig -o /boot/grub/grub.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
+./v_packetgen_init.sh
diff --git a/vnfs/vLBMS/scripts/vdns.sh b/vnfs/vLBMS/scripts/vdns.sh
new file mode 100644 (file)
index 0000000..e3f6f11
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start daemon at boot time
+# Description:       Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_dns_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+    cat "$pid_file"
+}
+
+is_running() {
+    [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+    start)
+    if is_running; then
+        echo "Already started"
+    else
+        echo "Starting $name"
+        cd "$dir"
+        if [ -z "$user" ]; then
+            sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        else
+            sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        fi
+        echo $! > "$pid_file"
+        if ! is_running; then
+            echo "Unable to start, see $stdout_log and $stderr_log"
+            exit 1
+        fi
+    fi
+    ;;
+    stop)
+    if is_running; then
+        echo -n "Stopping $name.."
+        kill `get_pid`
+        for i in {1..10}
+        do
+            if ! is_running; then
+                break
+            fi
+
+            echo -n "."
+            sleep 1
+        done
+        echo
+
+        if is_running; then
+            echo "Not stopped; may still be shutting down or shutdown may have failed"
+            exit 1
+        else
+            echo "Stopped"
+            if [ -f "$pid_file" ]; then
+                rm "$pid_file"
+            fi
+        fi
+    else
+        echo "Not running"
+    fi
+    ;;
+    restart)
+    $0 stop
+    if is_running; then
+        echo "Unable to stop, will not attempt to start"
+        exit 1
+    fi
+    $0 start
+    ;;
+    status)
+    if is_running; then
+        echo "Running"
+    else
+        echo "Stopped"
+        exit 1
+    fi
+    ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/vnfs/vLBMS/scripts/vlb.sh b/vnfs/vLBMS/scripts/vlb.sh
new file mode 100644 (file)
index 0000000..5ab6c40
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start daemon at boot time
+# Description:       Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_lb_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+    cat "$pid_file"
+}
+
+is_running() {
+    [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+    start)
+    if is_running; then
+        echo "Already started"
+    else
+        echo "Starting $name"
+        cd "$dir"
+        if [ -z "$user" ]; then
+            sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        else
+            sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        fi
+        echo $! > "$pid_file"
+        if ! is_running; then
+            echo "Unable to start, see $stdout_log and $stderr_log"
+            exit 1
+        fi
+    fi
+    ;;
+    stop)
+    if is_running; then
+        echo -n "Stopping $name.."
+        kill `get_pid`
+        for i in {1..10}
+        do
+            if ! is_running; then
+                break
+            fi
+
+            echo -n "."
+            sleep 1
+        done
+        echo
+
+        if is_running; then
+            echo "Not stopped; may still be shutting down or shutdown may have failed"
+            exit 1
+        else
+            echo "Stopped"
+            if [ -f "$pid_file" ]; then
+                rm "$pid_file"
+            fi
+        fi
+    else
+        echo "Not running"
+    fi
+    ;;
+    restart)
+    $0 stop
+    if is_running; then
+        echo "Unable to stop, will not attempt to start"
+        exit 1
+    fi
+    $0 start
+    ;;
+    status)
+    if is_running; then
+        echo "Running"
+    else
+        echo "Stopped"
+        exit 1
+    fi
+    ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/vnfs/vLBMS/scripts/vpacketgen.sh b/vnfs/vLBMS/scripts/vpacketgen.sh
new file mode 100644 (file)
index 0000000..1d00fd9
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start daemon at boot time
+# Description:       Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_packetgen_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+    cat "$pid_file"
+}
+
+is_running() {
+    [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+    start)
+    if is_running; then
+        echo "Already started"
+    else
+        echo "Starting $name"
+        cd "$dir"
+        if [ -z "$user" ]; then
+            sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        else
+            sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+        fi
+        echo $! > "$pid_file"
+        if ! is_running; then
+            echo "Unable to start, see $stdout_log and $stderr_log"
+            exit 1
+        fi
+    fi
+    ;;
+    stop)
+    if is_running; then
+        echo -n "Stopping $name.."
+        kill `get_pid`
+        for i in {1..10}
+        do
+            if ! is_running; then
+                break
+            fi
+
+            echo -n "."
+            sleep 1
+        done
+        echo
+
+        if is_running; then
+            echo "Not stopped; may still be shutting down or shutdown may have failed"
+            exit 1
+        else
+            echo "Stopped"
+            if [ -f "$pid_file" ]; then
+                rm "$pid_file"
+            fi
+        fi
+    else
+        echo "Not running"
+    fi
+    ;;
+    restart)
+    $0 stop
+    if is_running; then
+        echo "Unable to stop, will not attempt to start"
+        exit 1
+    fi
+    $0 start
+    ;;
+    status)
+    if is_running; then
+        echo "Running"
+    else
+        echo "Stopped"
+        exit 1
+    fi
+    ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+    ;;
+esac
+
+exit 0
+