update descriptor-packages build process
Change-Id: I937d0897a051b655f9de87f49a88610a37c9297e
Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
diff --git a/descriptor-packages/nsd/Makefile b/descriptor-packages/nsd/Makefile
new file mode 100644
index 0000000..fdd2045
--- /dev/null
+++ b/descriptor-packages/nsd/Makefile
@@ -0,0 +1,18 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+SUBDIRS = $(wildcard */)
+TOPDIR ?= ../
+include $(TOPDIR)/mk/dirs.mk
diff --git a/descriptor-packages/nsd/VyOS_ns/Makefile b/descriptor-packages/nsd/VyOS_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/VyOS_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/VyOS_ns/src/VyOS_nsd.yaml b/descriptor-packages/nsd/VyOS_ns/src/VyOS_nsd.yaml
new file mode 100644
index 0000000..4b833fe
--- /dev/null
+++ b/descriptor-packages/nsd/VyOS_ns/src/VyOS_nsd.yaml
@@ -0,0 +1,50 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: VyOS
+ name: VyOS
+ short-name: VyOS
+ description: VyOS NS Example NS
+ logo: osm_2x.png
+ constituent-vnfd:
+ - member-vnf-index: '1'
+ vnfd-id-ref: VyOS
+ vld:
+ - id: data
+ name: data
+ short-name: data
+ type: ELAN
+ vim-network-name: net-corp
+ provider-network:
+ overlay-type: VLAN
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: eth1
+ vnfd-id-ref: VyOS
+ - id: management
+ name: management
+ short-name: management
+ type: ELAN
+ vim-network-name: net-mgmtOS
+ provider-network:
+ overlay-type: VLAN
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: eth0
+ vnfd-id-ref: VyOS
+ service-primitive:
+ - name: Config VyOS
+ vnf-primitive-group:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: VyOS
+ vnfd-name: VyOS
+ primitive:
+ - index: '1'
+ name: config
+ - name: ping
+ vnf-primitive-group:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: VyOS
+ vnfd-name: VyOS
+ primitive:
+ - index: '1'
+ name: ping
diff --git a/descriptor-packages/nsd/VyOS_ns/src/icons/osm_2x.png b/descriptor-packages/nsd/VyOS_ns/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/VyOS_ns/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/cirros_2vnf_ns/Makefile b/descriptor-packages/nsd/cirros_2vnf_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_2vnf_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/cirros_2vnf_ns/src/cirros_2vnf_nsd.yaml b/descriptor-packages/nsd/cirros_2vnf_ns/src/cirros_2vnf_nsd.yaml
new file mode 100644
index 0000000..ed9433f
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_2vnf_ns/src/cirros_2vnf_nsd.yaml
@@ -0,0 +1,44 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: cirros_2vnf_nsd
+ name: cirros_2vnf_ns
+ short-name: cirros_2vnf_ns
+ 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: cirros_vnfd
+ - member-vnf-index: 2
+ vnfd-id-ref: cirros_vnfd
+
+
+ vld:
+ # Networks for the VNFs
+ - id: cirros_2vnf_nsd_vld1
+ name: cirros_2vnf_nsd_vld1
+ short-name: cirros_2vnf_nsd_vld1
+ type: ELAN
+ # vim-network-name: <update>
+ # provider-network:
+ # overlay-type: VLAN
+ # segmentation_id: <update>
+ vnfd-connection-point-ref:
+ # Specify the constituent VNFs
+ # member-vnf-index-ref - entry from constituent vnf
+ # vnfd-id-ref - VNFD id
+ # vnfd-connection-point-ref - connection point name in the VNFD
+ - nsd:member-vnf-index-ref: 1
+ nsd:vnfd-id-ref: cirros_vnfd
+ nsd:vnfd-connection-point-ref: eth0
+ - nsd:member-vnf-index-ref: 2
+ nsd:vnfd-id-ref: cirros_vnfd
+ nsd:vnfd-connection-point-ref: eth0
diff --git a/descriptor-packages/nsd/cirros_2vnf_ns/src/icons/osm_2x.png b/descriptor-packages/nsd/cirros_2vnf_ns/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_2vnf_ns/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/cirros_ns/Makefile b/descriptor-packages/nsd/cirros_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/cirros_ns/src/cirros_nsd.yaml b/descriptor-packages/nsd/cirros_ns/src/cirros_nsd.yaml
new file mode 100644
index 0000000..9ec4e27
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_ns/src/cirros_nsd.yaml
@@ -0,0 +1,49 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: cirros_nsd
+ name: cirros_ns
+ short-name: cirros_ns
+ 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: 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
+ name: cirros_nsd_vld1
+ type: ELAN
+ # vim-network-name: <update>
+ # provider-network:
+ # overlay-type: VLAN
+ # segmentation_id: <update>
+ vnfd-connection-point-ref:
+ # Specify the constituent VNFs
+ # member-vnf-index-ref - entry from constituent vnf
+ # vnfd-id-ref - VNFD id
+ # vnfd-connection-point-ref - connection point name in the VNFD
+ - nsd:member-vnf-index-ref: 1
+ nsd:vnfd-id-ref: cirros_vnfd
+ # NOTE: Validate the entry below
+ nsd:vnfd-connection-point-ref: eth0
diff --git a/descriptor-packages/nsd/cirros_ns/src/icons/osm_2x.png b/descriptor-packages/nsd/cirros_ns/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/cirros_ns/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/ims_allin1_corpa/Makefile b/descriptor-packages/nsd/ims_allin1_corpa/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ims_allin1_corpa/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ims_allin1_corpa/src/IMS-corpA__nsd.yaml b/descriptor-packages/nsd/ims_allin1_corpa/src/IMS-corpA__nsd.yaml
new file mode 100644
index 0000000..cc613b3
--- /dev/null
+++ b/descriptor-packages/nsd/ims_allin1_corpa/src/IMS-corpA__nsd.yaml
@@ -0,0 +1,60 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: IMS-corpA
+ name: IMS-corpA
+ short-name: IMS-corpA
+ description: All in one Clearwater IMS for corporation A in MWC16
+ logo: osm_2x.png
+ constituent-vnfd:
+ - member-vnf-index: '1'
+ vnfd-id-ref: IMS-ALLIN1_2p
+ vld:
+ - id: data
+ name: data
+ short-name: data
+ type: ELAN
+ vim-network-name: net-corp:108
+ provider-network:
+ overlay-type: VLAN
+ physical-network: net-corp
+ segmentation_id: '108'
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: eth0
+ vnfd-id-ref: IMS-ALLIN1_2p
+ - id: management
+ name: management
+ short-name: management
+ type: ELAN
+ vim-network-name: net-mgmtOS
+ provider-network:
+ overlay-type: VLAN
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: eth1
+ vnfd-id-ref: IMS-ALLIN1_2p
+ service-primitive:
+ - name: Update Domain
+ vnf-primitive-group:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: IMS-ALLIN1_2p
+ vnfd-name: cwims_vnfd
+ primitive:
+ - index: '1'
+ name: config
+ - name: Add User
+ vnf-primitive-group:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: IMS-ALLIN1_2p
+ vnfd-name: cwims_vnfd
+ primitive:
+ - index: '1'
+ name: create-update-user
+ - name: Delete User
+ vnf-primitive-group:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: IMS-ALLIN1_2p
+ vnfd-name: cwims_vnfd
+ primitive:
+ - index: '1'
+ name: delete-user
diff --git a/descriptor-packages/nsd/ims_allin1_corpa/src/icons/osm_2x.png b/descriptor-packages/nsd/ims_allin1_corpa/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/ims_allin1_corpa/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/ims_allin1_corpa/src/vnf_config/IMS-ALLIN1_2p__1.yaml b/descriptor-packages/nsd/ims_allin1_corpa/src/vnf_config/IMS-ALLIN1_2p__1.yaml
new file mode 100644
index 0000000..33c5ef9
--- /dev/null
+++ b/descriptor-packages/nsd/ims_allin1_corpa/src/vnf_config/IMS-ALLIN1_2p__1.yaml
@@ -0,0 +1,4 @@
+initial_config_primitive:
+- name: config
+ parameter:
+ proxied_ip: <rw_mgmt_ip>
diff --git a/descriptor-packages/nsd/ping_pong_ns/Makefile b/descriptor-packages/nsd/ping_pong_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ping_pong_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ping_pong_ns/src/icons/rift_logo.png b/descriptor-packages/nsd/ping_pong_ns/src/icons/rift_logo.png
new file mode 100644
index 0000000..09b47c7
--- /dev/null
+++ b/descriptor-packages/nsd/ping_pong_ns/src/icons/rift_logo.png
Binary files differ
diff --git a/descriptor-packages/nsd/ping_pong_ns/src/ping_pong_nsd.yaml b/descriptor-packages/nsd/ping_pong_ns/src/ping_pong_nsd.yaml
new file mode 100644
index 0000000..268504c
--- /dev/null
+++ b/descriptor-packages/nsd/ping_pong_ns/src/ping_pong_nsd.yaml
@@ -0,0 +1,102 @@
+#
+# Copyright 2016 RIFT.io Inc
+#
+# 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.
+#
+#
+
+nsd:nsd-catalog:
+ nsd:nsd:
+ - nsd:id: rift_ping_pong_ns
+ nsd:logo: rift_logo.png
+ nsd:name: ping_pong_ns
+ nsd:short-name: ping_pong_ns
+ nsd:vendor: RIFT.io
+ nsd:version: '1.1'
+ nsd:description: RIFT.io sample ping pong network service
+ nsd:constituent-vnfd:
+ - nsd:member-vnf-index: '1'
+ nsd:vnfd-id-ref: rift_ping_vnf
+ - nsd:member-vnf-index: '2'
+ nsd:vnfd-id-ref: rift_pong_vnf
+ nsd:initial-config-primitive:
+ - nsd:name: start traffic
+ 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:
+ - nsd:xpath: /nsd:nsd-catalog/nsd:nsd/nsd:vendor
+ nsd:ip-profiles:
+ - nsd:description: Inter VNF Link
+ nsd:ip-profile-params:
+ nsd:gateway-address: 31.31.31.210
+ nsd:ip-version: ipv4
+ nsd:subnet-address: 31.31.31.0/24
+ nsd:dhcp-params:
+ nsd:count: 200
+ nsd:start-address: 31.31.31.2
+ nsd:name: InterVNFLink
+ nsd:placement-groups:
+ - nsd:member-vnfd:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-id-ref: rift_ping_vnf
+ - nsd:member-vnf-index-ref: '2'
+ nsd:vnfd-id-ref: rift_pong_vnf
+ nsd:name: Orcus
+ nsd:requirement: Place this VM on the Kuiper belt object Orcus
+ nsd:strategy: COLOCATION
+ - nsd:member-vnfd:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-id-ref: rift_ping_vnf
+ - nsd:member-vnf-index-ref: '2'
+ nsd:vnfd-id-ref: rift_pong_vnf
+ nsd:name: Quaoar
+ nsd:requirement: Place this VM on the Kuiper belt object Quaoar
+ nsd:strategy: COLOCATION
+ nsd:vld:
+ - nsd:id: mgmt_vl
+ nsd:description: Management VL
+ nsd:name: mgmt_vl
+ nsd:short-name: mgmt_vl
+ nsd:type: ELAN
+ nsd:vendor: RIFT.io
+ nsd:version: '1.0'
+ nsd:mgmt-network: 'true'
+ nsd:vnfd-connection-point-ref:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-connection-point-ref: ping_vnfd/cp0
+ nsd:vnfd-id-ref: rift_ping_vnf
+ - nsd:member-vnf-index-ref: '2'
+ nsd:vnfd-connection-point-ref: pong_vnfd/cp0
+ nsd:vnfd-id-ref: rift_pong_vnf
+ - nsd:id: ping_pong_vl1
+ nsd:description: Data VL
+ nsd:ip-profile-ref: InterVNFLink
+ nsd:name: data_vl
+ nsd:short-name: data_vl
+ nsd:type: ELAN
+ nsd:vendor: RIFT.io
+ nsd:version: '1.0'
+ nsd:vnfd-connection-point-ref:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-connection-point-ref: ping_vnfd/cp1
+ nsd:vnfd-id-ref: rift_ping_vnf
+ - nsd:member-vnf-index-ref: '2'
+ nsd:vnfd-connection-point-ref: pong_vnfd/cp1
+ nsd:vnfd-id-ref: rift_pong_vnf
diff --git a/descriptor-packages/nsd/ping_pong_ns/src/scripts/start_traffic.py b/descriptor-packages/nsd/ping_pong_ns/src/scripts/start_traffic.py
new file mode 100755
index 0000000..87c309f
--- /dev/null
+++ b/descriptor-packages/nsd/ping_pong_ns/src/scripts/start_traffic.py
@@ -0,0 +1,223 @@
+#!/usr/bin/env python3
+
+############################################################################
+# Copyright 2016 RIFT.IO Inc #
+# #
+# 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. #
+############################################################################
+
+
+import argparse
+import logging
+import paramiko
+import os
+import subprocess
+import sys
+import time
+
+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://127.0.0.1:' \
+ '{mgmt_port}/api/v1/{vnf_type}/{url}'
+
+ # 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))
+
+ def get_cp_ip(cp_name):
+ for cp in vnfr['connection_point']:
+ if cp['name'].endswith(cp_name):
+ return cp['ip_address']
+
+ # Check if it is pong vnf
+ if 'pong_vnf' in vnfr['name']:
+ vnf_type = 'pong'
+ mgmt_ip = vnfr['mgmt_ip_address']
+ port = vnfr['mgmt_port']
+ service_ip = get_cp_ip('cp1')
+
+ max_tries = 60
+ tries = 0
+ while tries < max_tries:
+ rc = setup_service(mgmt_ip, port, vnf_type)
+ tries += 1
+ if rc != 0:
+ logger.error("Setup service for pong failed ({}): {}".
+ format(tries, rc))
+ if rc != 7:
+ 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
+
+ # Add a delay to provide pong port to come up
+ time.sleep(1)
+
+ # Enable ping service next
+ for index, vnfr in yaml_cfg['vnfr'].items():
+ logger.debug("VNFR {}: {}".format(index, vnfr))
+
+ # Check if it is pong vnf
+ if 'ping_vnf' in vnfr['name']:
+ vnf_type = 'ping'
+ mgmt_ip = vnfr['mgmt_ip_address']
+ port = vnfr['mgmt_port']
+ if service_ip is None:
+ logger.error("Did not find pong ip!!")
+ return 1
+
+ max_tries = 30
+ tries = 0
+ while tries < max_tries:
+ rc = setup_service(mgmt_ip, port, vnf_type)
+ tries += 1
+ if rc != 0:
+ logger.error("Setup service for ping failed ({}): {}".
+ format(tries, rc))
+ if rc != 7:
+ 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))
+
+ return rc
+
+
+def main(argv=sys.argv[1:]):
+ try:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("yaml_cfg_file", type=argparse.FileType('r'))
+ parser.add_argument("-q", "--quiet", dest="verbose", action="store_false")
+ args = parser.parse_args()
+
+ run_dir = os.path.join(os.environ['RIFT_INSTALL'], "var/run/rift")
+ if not os.path.exists(run_dir):
+ os.makedirs(run_dir)
+ log_file = "{}/ping_pong_start_traffic-{}.log".format(run_dir, time.strftime("%Y%m%d%H%M%S"))
+
+ # logging.basicConfig(filename=log_file, level=logging.DEBUG)
+ logger = logging.getLogger('ping-pong-start-traffic')
+ logger.setLevel(logging.DEBUG)
+
+ fh = logging.FileHandler(log_file)
+ fh.setLevel(logging.DEBUG)
+
+ ch = logging.StreamHandler()
+ if args.verbose:
+ ch.setLevel(logging.DEBUG)
+ else:
+ ch.setLevel(logging.INFO)
+
+ # create formatter and add it to the handlers
+ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+ fh.setFormatter(formatter)
+ ch.setFormatter(formatter)
+ logger.addHandler(fh)
+ logger.addHandler(ch)
+
+ except Exception as e:
+ logger.exception("Exception in {}: {}".format(__file__, e))
+ sys.exit(1)
+
+ try:
+ logger.debug("Input file: {}".format(args.yaml_cfg_file.name))
+ yaml_str = args.yaml_cfg_file.read()
+ yaml_cfg = yaml.load(yaml_str)
+ logger.debug("Input YAML: {}".format(yaml_cfg))
+
+ rc = start_traffic(yaml_cfg, logger)
+ logger.info("Return code: {}".format(rc))
+ sys.exit(rc)
+
+ except Exception as e:
+ logger.exception("Exception in {}: {}".format(__file__, e))
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
diff --git a/descriptor-packages/nsd/ref1_ns/Makefile b/descriptor-packages/nsd/ref1_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ref1_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ref1_ns/src/ref1_nsd.yaml b/descriptor-packages/nsd/ref1_ns/src/ref1_nsd.yaml
new file mode 100644
index 0000000..465537c
--- /dev/null
+++ b/descriptor-packages/nsd/ref1_ns/src/ref1_nsd.yaml
@@ -0,0 +1,39 @@
+nsd:nsd-catalog:
+ nsd:
+ - constituent-vnfd:
+ - member-vnf-index: '1'
+ start-by-default: 'true'
+ vnfd-id-ref: Ref_Vnf_11
+ - member-vnf-index: '2'
+ vnfd-id-ref: Ref_Vnf_21
+ description: Reference NS 1
+ id: Ref_NS_1
+ name: Ref_NS_1
+ vendor: ETSI
+ vld:
+ - description: Mgmt VL
+ id: 54c04
+ name: VL1
+ short-name: VL1
+ type: ELAN
+ vendor: ETSI
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: Ref_Vnf_11
+ vnfd-connection-point-ref: mgmt0
+ - member-vnf-index-ref: '2'
+ vnfd-id-ref: Ref_Vnf_21
+ vnfd-connection-point-ref: mgmt
+ - description: Data VL
+ id: 54c03
+ name: VL2
+ short-name: VL2
+ type: ELAN
+ vendor: ETSI
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: west
+ vnfd-id-ref: Ref_Vnf_11
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: data
+ vnfd-id-ref: Ref_Vnf_21
diff --git a/descriptor-packages/nsd/ref2_ns/Makefile b/descriptor-packages/nsd/ref2_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ref2_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ref2_ns/src/ref2_nsd.yaml b/descriptor-packages/nsd/ref2_ns/src/ref2_nsd.yaml
new file mode 100644
index 0000000..281fdee
--- /dev/null
+++ b/descriptor-packages/nsd/ref2_ns/src/ref2_nsd.yaml
@@ -0,0 +1,40 @@
+nsd:nsd-catalog:
+ nsd:
+ - constituent-vnfd:
+ - member-vnf-index: '1'
+ vnfd-id-ref: Ref_Vnf_12
+ - member-vnf-index: '2'
+ vnfd-id-ref: Ref_Vnf_22
+ description: Reference NS2
+ id: Ref_NS_2
+ name: Ref_NS_2
+ vendor: ETSI
+ vld:
+ - id: '97465'
+ name: VL1
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: mgmt0
+ vnfd-id-ref: Ref_Vnf_12
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: mgmt
+ vnfd-id-ref: Ref_Vnf_22
+ - id: f66e6
+ name: VL2
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: east
+ vnfd-id-ref: Ref_Vnf_12
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: east
+ vnfd-id-ref: Ref_Vnf_22
+ - id: b72e9
+ name: VL3
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: west
+ vnfd-id-ref: Ref_Vnf_12
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: west
+ vnfd-id-ref: Ref_Vnf_22
+
diff --git a/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/Makefile b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/icons/osm_2x.png b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/ubuntu_cirros_multidisk_nsd.yaml b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/ubuntu_cirros_multidisk_nsd.yaml
new file mode 100644
index 0000000..cbbe6a2
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_cirros_multidisk_ns/src/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/descriptor-packages/nsd/ubuntu_xenial_ns/Makefile b/descriptor-packages/nsd/ubuntu_xenial_ns/Makefile
new file mode 100644
index 0000000..c5f5f69
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_xenial_ns/Makefile
@@ -0,0 +1,20 @@
+#
+# Copyright 2017 Sandvine
+#
+# 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.
+#
+
+DESCRIPTORS_TOPDIR ?= ../..
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
diff --git a/descriptor-packages/nsd/ubuntu_xenial_ns/src/icons/osm_2x.png b/descriptor-packages/nsd/ubuntu_xenial_ns/src/icons/osm_2x.png
new file mode 100644
index 0000000..62012d2
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_xenial_ns/src/icons/osm_2x.png
Binary files differ
diff --git a/descriptor-packages/nsd/ubuntu_xenial_ns/src/ubuntu_xenial_nsd.yaml b/descriptor-packages/nsd/ubuntu_xenial_ns/src/ubuntu_xenial_nsd.yaml
new file mode 100644
index 0000000..7f91d43
--- /dev/null
+++ b/descriptor-packages/nsd/ubuntu_xenial_ns/src/ubuntu_xenial_nsd.yaml
@@ -0,0 +1,40 @@
+nsd:nsd-catalog:
+ nsd:
+ - id: ubuntu_xenial_nsd
+ name: ubuntu_xenial_ns
+ short-name: ubuntu_xenial_ns
+ 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_xenial_vnfd
+
+ vld:
+ # Networks for the VNFs
+ - id: ubuntu_xenial_nsd_vld1
+ name: management
+ short-name: management
+ type: ELAN
+ vim-network-name: net-mgmtOS
+ # vim-network-name: <update>
+ # provider-network:
+ # overlay-type: VLAN
+ # segmentation_id: <update>
+ vnfd-connection-point-ref:
+ # Specify the constituent VNFs
+ # member-vnf-index-ref - entry from constituent vnf
+ # vnfd-id-ref - VNFD id
+ # vnfd-connection-point-ref - connection point name in the VNFD
+ - nsd:member-vnf-index-ref: 1
+ nsd:vnfd-id-ref: ubuntu_xenial_vnfd
+ # NOTE: Validate the entry below
+ nsd:vnfd-connection-point-ref: eth0