Merge "FlowNAC updated descriptors (plugtest): Fixed Makefile"
diff --git a/Makefile b/Makefile
index d0bc848..793f30c 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,24 @@
#
BUILD_DIR = build
-NSDS := gw_corpa_ns ims_allin1_corpa mwc16_gen_ns mwc16_pe_ns VyOS_ns cirros_ns cirros_2vnf_ns ubuntu_xenial_ns ping_pong_ns knt_flownac_ns knt_flownac-us_ns sandvine_pts_ns ref1_ns ref2_ns
+NSDS := \
+ gw_corpa_ns \
+ ims_allin1_corpa \
+ mwc16_gen_ns \
+ mwc16_pe_ns \
+ VyOS_ns \
+ cirros_ns \
+ cirros_2vnf_ns \
+ ubuntu_xenial_ns \
+ ping_pong_ns \
+ knt_flownac_ns \
+ knt_flownac-us_ns \
+ sandvine_pts_ns \
+ sonussbc_ns \
+ ref1_ns \
+ ref2_ns \
+ ubuntu_cirros_multidisk_ns
+
NSD_SRC_DIR := src/nsd
NSD_BUILD_DIR := $(BUILD_DIR)/nsd
@@ -27,7 +44,30 @@
NSD_PKGS := $(addsuffix .tar.gz, $(NSDS))
NSD_BUILD_PKGS := $(addprefix $(NSD_BUILD_DIR)_pkgs/, $(NSD_PKGS))
-VNFDS := 6wind_vnf gw_corpa_pe1_vnf gw_corpa_pe2_vnf ims_allin1_2p_vnf tidgen_mwc16_vnf VyOS_vnf cirros_vnf ubuntu_xenial_vnf ping_vnf pong_vnf knt_fnc_vnf knt_fne_vnf knt_fnu_vnf knt_fnd_vnf sandvine_pts_vnf ref11_vnf ref21_vnf ref12_vnf ref22_vnf
+VNFDS := \
+ 6wind_vnf \
+ gw_corpa_pe1_vnf \
+ gw_corpa_pe2_vnf \
+ ims_allin1_2p_vnf \
+ tidgen_mwc16_vnf \
+ VyOS_vnf \
+ cirros_vnf \
+ ubuntu_xenial_vnf \
+ ping_vnf \
+ pong_vnf \
+ knt_fnc_vnf \
+ knt_fne_vnf \
+ knt_fnu_vnf \
+ knt_fnd_vnf \
+ sandvine_pts_vnf \
+ sonus_sbc_vnf \
+ sonus_test_vnf \
+ ref11_vnf \
+ ref21_vnf \
+ ref12_vnf \
+ ref22_vnf \
+ ubuntu_cirros_multidisk_vnf
+
VNFD_SRC_DIR := src/vnfd
VNFD_BUILD_DIR := $(BUILD_DIR)/vnfd
diff --git a/src/nsd/cirros_2vnf_ns/cirros_2vnf_nsd.yaml b/src/nsd/cirros_2vnf_ns/cirros_2vnf_nsd.yaml
index f090875..ed9433f 100644
--- a/src/nsd/cirros_2vnf_ns/cirros_2vnf_nsd.yaml
+++ b/src/nsd/cirros_2vnf_ns/cirros_2vnf_nsd.yaml
@@ -1,8 +1,8 @@
nsd:nsd-catalog:
nsd:
- id: cirros_2vnf_nsd
- name: cirros_2vnf_nsd
- short-name: cirros_2vnf_nsd
+ name: cirros_2vnf_ns
+ short-name: cirros_2vnf_ns
description: Generated by OSM pacakage generator
vendor: OSM
version: '1.0'
diff --git a/src/nsd/cirros_ns/cirros_nsd.yaml b/src/nsd/cirros_ns/cirros_nsd.yaml
index 364d368..9ec4e27 100644
--- a/src/nsd/cirros_ns/cirros_nsd.yaml
+++ b/src/nsd/cirros_ns/cirros_nsd.yaml
@@ -1,8 +1,8 @@
nsd:nsd-catalog:
nsd:
- id: cirros_nsd
- name: cirros_nsd
- short-name: cirros_nsd
+ name: cirros_ns
+ short-name: cirros_ns
description: Generated by OSM pacakage generator
vendor: OSM
version: '1.0'
@@ -17,7 +17,18 @@
# Multiple constituent VNFDs can be specified
- member-vnf-index: 1
vnfd-id-ref: cirros_vnfd
-
+ scaling-group-descriptor:
+ - name: "scaling_cirros"
+ vnfd-member:
+ - count: 1
+ member-vnf-index-ref: 1
+ min-instance-count: 0
+ max-instance-count: 10
+ scaling-policy:
+ - scaling-type: "manual"
+ cooldown-time: 10
+ threshold-time: 10
+ name: manual_scale
vld:
# Networks for the VNFs
- id: cirros_nsd_vld1
diff --git a/src/nsd/ping_pong_ns/ping_pong_nsd.yaml b/src/nsd/ping_pong_ns/ping_pong_nsd.yaml
index 0791576..268504c 100644
--- a/src/nsd/ping_pong_ns/ping_pong_nsd.yaml
+++ b/src/nsd/ping_pong_ns/ping_pong_nsd.yaml
@@ -22,7 +22,7 @@
nsd:name: ping_pong_ns
nsd:short-name: ping_pong_ns
nsd:vendor: RIFT.io
- nsd:version: '1.0'
+ nsd:version: '1.1'
nsd:description: RIFT.io sample ping pong network service
nsd:constituent-vnfd:
- nsd:member-vnf-index: '1'
@@ -34,6 +34,10 @@
nsd:parameter:
- nsd:name: port
nsd:value: 5555
+ - nsd:name: ssh-username
+ nsd:value: fedora
+ - nsd:name: ssh-password
+ nsd:value: fedora
nsd:seq: '1'
nsd:user-defined-script: start_traffic.py
nsd:input-parameter-xpath:
@@ -67,7 +71,6 @@
nsd:strategy: COLOCATION
nsd:vld:
- nsd:id: mgmt_vl
- nsd:vim-network-name: mgmt
nsd:description: Management VL
nsd:name: mgmt_vl
nsd:short-name: mgmt_vl
diff --git a/src/nsd/ping_pong_ns/scripts/start_traffic.py b/src/nsd/ping_pong_ns/scripts/start_traffic.py
index f98bece..87c309f 100755
--- a/src/nsd/ping_pong_ns/scripts/start_traffic.py
+++ b/src/nsd/ping_pong_ns/scripts/start_traffic.py
@@ -19,6 +19,7 @@
import argparse
import logging
+import paramiko
import os
import subprocess
import sys
@@ -27,55 +28,71 @@
import yaml
+def ssh(cmd, host, user, password):
+ """ Run an arbitrary command over SSH. """
+
+ client = paramiko.SSHClient()
+ client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+
+ client.connect(host, port=22, username=user, password=password)
+
+ stdin, stdout, stderr = client.exec_command(cmd, get_pty=True)
+ retcode = stdout.channel.recv_exit_status()
+ client.close()
+
+ return (
+ retcode,
+ stdout.read().decode('utf-8').strip(),
+ stderr.read().decode('utf-8').strip()
+ )
+
+
def start_traffic(yaml_cfg, logger):
'''Use curl and set admin status to enable on pong and ping vnfs'''
curl_fmt = 'curl -D /dev/stdout -H "Accept: application/vnd.yang.data' \
'+xml" -H "Content-Type: application/vnd.yang.data+json" ' \
- '-X POST -d "{{ {data} }}" http://{mgmt_ip}:' \
+ '-X POST -d "{{ {data} }}" http://127.0.0.1:' \
'{mgmt_port}/api/v1/{vnf_type}/{url}'
- def setup_service(mgmt_ip, port, vnf_type, service_ip, service_port):
- data = '\\"ip\\":\\"{}\\", \\"port\\":5555'.format(service_ip)
- curl_cmd = curl_fmt.format(
- mgmt_ip=mgmt_ip,
- mgmt_port=port,
- vnf_type=vnf_type,
- data=data,
- url='server'
- )
-
- logger.debug("Executing cmd: %s", curl_cmd)
- proc = subprocess.run(curl_cmd, shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
-
- logger.debug("Process: {}".format(proc))
-
- return proc.returncode
-
- def enable_service(mgmt_ip, port, vnf_type):
- curl_cmd = curl_fmt.format(
- mgmt_ip=mgmt_ip,
- mgmt_port=port,
- vnf_type=vnf_type,
- data='\\"enable\\":true',
- url='adminstatus/state'
- )
-
- logger.debug("Executing cmd: %s", curl_cmd)
- proc = subprocess.run(curl_cmd, shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
-
- logger.debug("Process: {}".format(proc))
-
- return proc.returncode
+ # Get userid and password for the VNF
+ user = yaml_cfg['parameter']['ssh-username']
+ passwd = yaml_cfg['parameter']['ssh-password']
# Get port from user parameter
service_port = yaml_cfg['parameter']['port']
service_ip = None
+
+ def exec_cmd(vnf_type, mgmt_ip, port, url, data):
+ curl_cmd = curl_fmt.format(
+ mgmt_port=port,
+ vnf_type=vnf_type,
+ data=data,
+ url=url
+ )
+
+ logger.debug("Executing cmd: %s", curl_cmd)
+ rc, out, err = ssh(curl_cmd, mgmt_ip, user, passwd)
+
+ if rc != 0:
+ logger.error("cmd={}, rc={}, stderr={}, stdout={}".
+ format(curl_cmd, rc, err, out))
+ else:
+ logger.debug("cmd={}, rc={}, stderr={}, stdout={}".
+ format(curl_cmd, rc, err, out))
+
+ return rc
+
+ def setup_service(mgmt_ip, port, vnf_type):
+ data = '\\"ip\\":\\"{}\\", \\"port\\":5555'.format(service_ip)
+ return exec_cmd(vnf_type, mgmt_ip, port, 'server', data)
+
+ def enable_service(mgmt_ip, port, vnf_type):
+ data='\\"enable\\":true'
+ url='adminstatus/state'
+ return exec_cmd(vnf_type, mgmt_ip, port, url, data)
+
# Enable pong service first
for index, vnfr in yaml_cfg['vnfr'].items():
logger.debug("VNFR {}: {}".format(index, vnfr))
@@ -95,7 +112,7 @@
max_tries = 60
tries = 0
while tries < max_tries:
- rc = setup_service(mgmt_ip, port, vnf_type, service_ip, service_port)
+ rc = setup_service(mgmt_ip, port, vnf_type)
tries += 1
if rc != 0:
logger.error("Setup service for pong failed ({}): {}".
@@ -104,13 +121,14 @@
return rc
else:
time.sleep(1) # Sleep for 1 seconds
+ else:
+ break
rc = enable_service(mgmt_ip, port, vnf_type)
if rc != 0:
logger.error("Enable service for pong failed: {}".
format(rc))
return rc
- break
# Add a delay to provide pong port to come up
time.sleep(1)
@@ -131,7 +149,7 @@
max_tries = 30
tries = 0
while tries < max_tries:
- rc = setup_service(mgmt_ip, port, vnf_type, service_ip, service_port)
+ rc = setup_service(mgmt_ip, port, vnf_type)
tries += 1
if rc != 0:
logger.error("Setup service for ping failed ({}): {}".
@@ -140,12 +158,13 @@
return rc
else:
time.sleep(1) # Sleep for 1 seconds
+ else:
+ break
rc = enable_service(mgmt_ip, port, vnf_type)
if rc != 0:
logger.error("Enable service for ping failed: {}".
format(rc))
- break
return rc
diff --git a/src/nsd/ubuntu_cirros_multidisk_ns/icons/osm_2x.png b/src/nsd/ubuntu_cirros_multidisk_ns/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/src/nsd/ubuntu_cirros_multidisk_ns/icons/osm_2x.png
Binary files differ
diff --git a/src/nsd/ubuntu_cirros_multidisk_ns/ubuntu_cirros_multidisk_nsd.yaml b/src/nsd/ubuntu_cirros_multidisk_ns/ubuntu_cirros_multidisk_nsd.yaml
new file mode 100644
index 0000000..cbbe6a2
--- /dev/null
+++ b/src/nsd/ubuntu_cirros_multidisk_ns/ubuntu_cirros_multidisk_nsd.yaml
@@ -0,0 +1,32 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: ubuntu_cirros_multidisk_nsd
+ name: ubuntu_cirros_multidisk_nsd
+ short-name: ubuntu_cirros_multidisk_nsd
+ description: Generated by OSM pacakage generator
+ vendor: OSM
+ version: '1.0'
+
+ # Place the logo as png in icons directory and provide the name here
+ logo: osm_2x.png
+
+ # Specify the VNFDs that are part of this NSD
+ constituent-vnfd:
+ # The member-vnf-index needs to be unique, starting from 1
+ # vnfd-id-ref is the id of the VNFD
+ # Multiple constituent VNFDs can be specified
+ - member-vnf-index: 1
+ vnfd-id-ref: ubuntu_cirros_multidisk_vnfd
+
+ vld:
+ # Networks for the VNFs
+ - id: ubuntu_cirros_multidisk_nsd_vld1
+ name: management
+ short-name: management
+ type: ELAN
+ vnfd-connection-point-ref:
+ # Specify the constituent VNFs
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: ubuntu_cirros_multidisk_vnfd
+ # NOTE: Validate the entry below
+ vnfd-connection-point-ref: eth0
diff --git a/src/nsd/ubuntu_xenial_ns/ubuntu_xenial_nsd.yaml b/src/nsd/ubuntu_xenial_ns/ubuntu_xenial_nsd.yaml
index daf84bd..7f91d43 100644
--- a/src/nsd/ubuntu_xenial_ns/ubuntu_xenial_nsd.yaml
+++ b/src/nsd/ubuntu_xenial_ns/ubuntu_xenial_nsd.yaml
@@ -1,8 +1,8 @@
nsd:nsd-catalog:
nsd:
- id: ubuntu_xenial_nsd
- name: ubuntu_xenial_nsd
- short-name: ubuntu_xenial_nsd
+ name: ubuntu_xenial_ns
+ short-name: ubuntu_xenial_ns
description: Generated by OSM pacakage generator
vendor: OSM
version: '1.0'
diff --git a/src/vnfd/cirros_vnf/cirros_vnfd.yaml b/src/vnfd/cirros_vnf/cirros_vnfd.yaml
index b7cb036..e643b38 100644
--- a/src/vnfd/cirros_vnf/cirros_vnfd.yaml
+++ b/src/vnfd/cirros_vnf/cirros_vnfd.yaml
@@ -1,9 +1,9 @@
vnfd:vnfd-catalog:
vnfd:
- id: cirros_vnfd
- name: cirros_vnfd
- short-name: cirros_vnfd
- description: Generated by OSM pacakage generator
+ name: cirros_vnf
+ short-name: cirros_vnf
+ description: Simple VNF example with a cirros
vendor: OSM
version: '1.0'
@@ -22,13 +22,15 @@
count: 1
# Flavour of the VM to be instantiated for the VDU
+ # flavor below can fit into m1.micro
vm-flavor:
vcpu-count: 1
- memory-mb: 512
- storage-gb: 1
+ memory-mb: 256
+ storage-gb: 2
- # Image including the full path
- image: '/mnt/powervault/virtualization/osm/CirrOS/cirros-0.3.4-x86_64-disk.img'
+ # Image/checksum or image including the full path
+ image: 'CirrOS 0.3.4 64-bit'
+ #checksum:
external-interface:
# Specify the external interfaces
diff --git a/src/vnfd/ping_vnf/cloud_init/ping_cloud_init.cfg b/src/vnfd/ping_vnf/cloud_init/ping_cloud_init.cfg
new file mode 100644
index 0000000..81a13ed
--- /dev/null
+++ b/src/vnfd/ping_vnf/cloud_init/ping_cloud_init.cfg
@@ -0,0 +1,4 @@
+#cloud-config
+password: fedora
+chpasswd: { expire: False }
+ssh_pwauth: True
diff --git a/src/vnfd/ping_vnf/ping_vnfd.yaml b/src/vnfd/ping_vnf/ping_vnfd.yaml
index 44f09ab..60f00cf 100644
--- a/src/vnfd/ping_vnf/ping_vnfd.yaml
+++ b/src/vnfd/ping_vnf/ping_vnfd.yaml
@@ -22,7 +22,7 @@
short-name: ping_vnf
logo: rift_logo.png
vendor: RIFT.io
- version: '1.0'
+ version: '1.1'
description: This is an example RIFT.ware VNF
connection-point:
- name: ping_vnfd/cp0
@@ -59,7 +59,6 @@
vnfd-connection-point-ref: ping_vnfd/cp1
id: iovdu_0
image: Fedora-x86_64-20-20131211.1-sda-ping.qcow2
- image-checksum: a6ffaa77f949a9e4ebb082c6147187cf
name: iovdu_0
vm-flavor:
memory-mb: '512'
diff --git a/src/vnfd/pong_vnf/cloud_init/pong_cloud_init.cfg b/src/vnfd/pong_vnf/cloud_init/pong_cloud_init.cfg
new file mode 100644
index 0000000..81a13ed
--- /dev/null
+++ b/src/vnfd/pong_vnf/cloud_init/pong_cloud_init.cfg
@@ -0,0 +1,4 @@
+#cloud-config
+password: fedora
+chpasswd: { expire: False }
+ssh_pwauth: True
diff --git a/src/vnfd/pong_vnf/pong_vnfd.yaml b/src/vnfd/pong_vnf/pong_vnfd.yaml
index fb7c53c..b6bc9a1 100644
--- a/src/vnfd/pong_vnf/pong_vnfd.yaml
+++ b/src/vnfd/pong_vnf/pong_vnfd.yaml
@@ -22,7 +22,7 @@
short-name: pong_vnf
logo: rift_logo.png
vendor: RIFT.io
- version: '1.0'
+ version: '1.1'
description: This is an example RIFT.ware VNF
connection-point:
- name: pong_vnfd/cp0
@@ -59,7 +59,6 @@
vnfd-connection-point-ref: pong_vnfd/cp1
id: iovdu_0
image: Fedora-x86_64-20-20131211.1-sda-pong.qcow2
- image-checksum: 977484d95575f80ef8399c9cf1d45ebd
name: iovdu_0
vm-flavor:
memory-mb: '512'
diff --git a/src/vnfd/ubuntu_cirros_multidisk_vnf/cloud_init/cloud_init.cfg b/src/vnfd/ubuntu_cirros_multidisk_vnf/cloud_init/cloud_init.cfg
new file mode 100644
index 0000000..d1c2188
--- /dev/null
+++ b/src/vnfd/ubuntu_cirros_multidisk_vnf/cloud_init/cloud_init.cfg
@@ -0,0 +1,5 @@
+#cloud-config
+password: ubuntu
+chpasswd: { expire: False }
+ssh_pwauth: True
+
diff --git a/src/vnfd/ubuntu_cirros_multidisk_vnf/ubuntu_cirros_multidisk_vnfd.yaml b/src/vnfd/ubuntu_cirros_multidisk_vnf/ubuntu_cirros_multidisk_vnfd.yaml
new file mode 100644
index 0000000..da037b1
--- /dev/null
+++ b/src/vnfd/ubuntu_cirros_multidisk_vnf/ubuntu_cirros_multidisk_vnfd.yaml
@@ -0,0 +1,53 @@
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: ubuntu_cirros_multidisk_vnfd
+ name: ubuntu_cirros_multidisk_vnfd
+ short-name: ubuntu_cirros_multidisk_vnfd
+ description: Generated by OSM pacakage generator
+ vendor: OSM
+ version: '1.0'
+
+ # Management interface
+ mgmt-interface:
+ vdu-id: ubuntu_cirros_multidisk_vnfd-VM
+
+ # Atleast one VDU need to be specified
+ vdu:
+ - id: ubuntu_cirros_multidisk_vnfd-VM
+ name: ubuntu_cirros_multidisk_vnfd-VM
+ description: ubuntu_cirros_multidisk_vnfd-VM
+ count: 1
+
+ # Flavour of the VM to be instantiated for the VDU
+ vm-flavor:
+ vcpu-count: 2
+ memory-mb: 4096
+ storage-gb: 10
+
+ # User-data injection
+ cloud-init-file: cloud_init.cfg
+
+ external-interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ virtual-interface:
+ type: OM-MGMT
+ vnfd-connection-point-ref: eth0
+ # Specify the volume
+ # There can be multiple interfaces defined
+ volumes:
+ - name: vda
+ device-type: disk
+ image: UbuntuXenial
+ image-checksum: 4a293322f18827af81a9450e3792947c
+ size: 10
+ - name: vdb
+ device-type: disk
+ image: cirros-0.3.4-x86_64-disk.img
+ image-checksum: ee1eca47dc88f4879d8a229cc70a07c6
+ size: 8
+
+ connection-point:
+ - name: eth0
+ type: VPORT
diff --git a/src/vnfd/ubuntu_xenial_vnf/cloud_init/cloud_init.cfg b/src/vnfd/ubuntu_xenial_vnf/cloud_init/cloud_init.cfg
new file mode 100644
index 0000000..d1c2188
--- /dev/null
+++ b/src/vnfd/ubuntu_xenial_vnf/cloud_init/cloud_init.cfg
@@ -0,0 +1,5 @@
+#cloud-config
+password: ubuntu
+chpasswd: { expire: False }
+ssh_pwauth: True
+
diff --git a/src/vnfd/ubuntu_xenial_vnf/ubuntu_xenial_vnfd.yaml b/src/vnfd/ubuntu_xenial_vnf/ubuntu_xenial_vnfd.yaml
index 908dcb0..ee6a3ac 100644
--- a/src/vnfd/ubuntu_xenial_vnf/ubuntu_xenial_vnfd.yaml
+++ b/src/vnfd/ubuntu_xenial_vnf/ubuntu_xenial_vnfd.yaml
@@ -1,8 +1,8 @@
vnfd:vnfd-catalog:
vnfd:
- id: ubuntu_xenial_vnfd
- name: ubuntu_xenial_vnfd
- short-name: ubuntu_xenial_vnfd
+ name: ubuntu_xenial_vnf
+ short-name: ubuntu_xenial_vnf
description: Generated by OSM pacakage generator
vendor: OSM
version: '1.0'
@@ -30,6 +30,9 @@
# Image including the full path
image: '/mnt/powervault/virtualization/vnfs/demos/ubuntu/ubuntu-16.04.img'
+ # User-data injection
+ cloud-init-file: cloud_init.cfg
+
external-interface:
# Specify the external interfaces
# There can be multiple interfaces defined