--- /dev/null
+nsd/*/build
+vnfd/*/build
#
-# Copyright 2016 RIFT.IO Inc
+# 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.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# Author(s): Austin Cormier
-# Creation Date: 2016/05/23
-#
-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 \
- sonussbc_ns \
- ref1_ns \
- ref2_ns \
- ubuntu_cirros_multidisk_ns
-
-NSD_SRC_DIR := src/nsd
-NSD_BUILD_DIR := $(BUILD_DIR)/nsd
-
-NSD_SRC_DIRS := $(addprefix $(NSD_SRC_DIR)/, $(NSDS))
-NSD_BUILD_DIRS := $(addprefix $(NSD_BUILD_DIR)/, $(NSDS))
-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 \
- 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
-
-VNFD_SRC_DIRS := $(addprefix $(VNFD_SRC_DIR)/, $(VNFDS))
-VNFD_BUILD_DIRS := $(addprefix $(VNFD_BUILD_DIR)/, $(VNFDS))
-VNFD_PKGS := $(addsuffix .tar.gz, $(VNFDS))
-VNFD_BUILD_PKGS := $(addprefix $(VNFD_BUILD_DIR)_pkgs/, $(VNFD_PKGS))
-
-IMS_GITHUB="https://github.com/Metaswitch/clearwater-juju.git"
-CHARM_REPO="https://osm.etsi.org/gerrit/osm/juju-charms.git"
-
-all: $(VNFD_BUILD_PKGS) ${NSD_BUILD_PKGS}
- echo $@
-
-clean:
- -@ $(RM) -rf $(BUILD_DIR)
-
-$(VNFD_BUILD_DIR)/%: $(VNFD_SRC_DIR)/%
- mkdir -p $(VNFD_BUILD_DIR)
- cp -rf $< $(VNFD_BUILD_DIR)
-
- src/gen_vnfd_pkg.sh $< $@
-
-$(BUILD_DIR)/clearwater-juju:
- mkdir -p $(BUILD_DIR)
- -cd $(BUILD_DIR) && (test -e clearwater-juju || git clone $(IMS_GITHUB))
-
-$(BUILD_DIR)/juju-charms:
- mkdir -p $(BUILD_DIR)
- -cd $(BUILD_DIR) && (test -e juju-charms || git clone $(CHARM_REPO))
- -cd $(BUILD_DIR)/juju-charms && make
-
-$(NSD_BUILD_DIR)/%: $(NSD_SRC_DIR)/%
- mkdir -p $(NSD_BUILD_DIR)
- cp -rf $< $(NSD_BUILD_DIR)
-
- src/gen_nsd_pkg.sh $< $@
-
-$(BUILD_DIR)/nsd_pkgs/%.tar.gz: $(NSD_BUILD_DIR)/%
- src/generate_descriptor_pkg.sh -d $(BUILD_DIR)/nsd_pkgs $<
-
-$(VNFD_BUILD_DIR)/ims_allin1_2p_vnf/charms/clearwater-aio-proxy: $(VNFD_BUILD_DIR)/ims_allin1_2p_vnf $(BUILD_DIR)/clearwater-juju
- # Copy the IMS Charm into the IMS vnf package directory before packaging
- cp -rf $(BUILD_DIR)/clearwater-juju/charms/trusty/clearwater-aio-proxy $(VNFD_BUILD_DIR)/ims_allin1_2p_vnf/charms
-
-$(VNFD_BUILD_DIR)/6wind_vnf/charms/vpe-router: $(VNFD_BUILD_DIR)/6wind_vnf $(BUILD_DIR)/juju-charms
- # Copy the PE Charm into the PE vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/vpe-router $(VNFD_BUILD_DIR)/6wind_vnf/charms
-
-$(VNFD_BUILD_DIR)/VyOS_vnf/charms/vyos-proxy: $(VNFD_BUILD_DIR)/VyOS_vnf $(BUILD_DIR)/juju-charms
- # Copy the PE Charm into the PE vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/vyos-proxy $(VNFD_BUILD_DIR)/VyOS_vnf/charms
-
-$(VNFD_BUILD_DIR)/ping_vnf/charms/pingpong: $(VNFD_BUILD_DIR)/ping_vnf $(BUILD_DIR)/juju-charms
- # Copy the pingpong Charm into the ping vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/pingpong $(VNFD_BUILD_DIR)/ping_vnf/charms
-
-$(VNFD_BUILD_DIR)/pong_vnf/charms/pingpong: $(VNFD_BUILD_DIR)/pong_vnf $(BUILD_DIR)/juju-charms
- # Copy the pingpong Charm into the pong vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/pingpong $(VNFD_BUILD_DIR)/pong_vnf/charms
-
-$(VNFD_BUILD_DIR)/knt_fnc_vnf/charms/flownac: $(VNFD_BUILD_DIR)/knt_fnc_vnf $(BUILD_DIR)/juju-charms
- # Copy the FlowNAC Charm into the FNC vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/flownac $(VNFD_BUILD_DIR)/knt_fnc_vnf/charms
-
-$(VNFD_BUILD_DIR)/knt_fne_vnf/charms/flownac: $(VNFD_BUILD_DIR)/knt_fne_vnf $(BUILD_DIR)/juju-charms
- # Copy the FlowNAC Charm into the FNE vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/flownac $(VNFD_BUILD_DIR)/knt_fne_vnf/charms
-
-$(VNFD_BUILD_DIR)/knt_fnd_vnf/charms/flownac: $(VNFD_BUILD_DIR)/knt_fnd_vnf $(BUILD_DIR)/juju-charms
- # Copy the FlowNAC Charm into the FND vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/flownac $(VNFD_BUILD_DIR)/knt_fnd_vnf/charms
-$(VNFD_BUILD_DIR)/knt_fnu_vnf/charms/flownac: $(VNFD_BUILD_DIR)/knt_fnu_vnf $(BUILD_DIR)/juju-charms
- # Copy the FlowNAC Charm into the FNU vnf package directory before packaging
- cp -rf $(BUILD_DIR)/juju-charms/builds/flownac $(VNFD_BUILD_DIR)/knt_fnu_vnf/charms
+SUBDIRS = vnfd nsd
-$(BUILD_DIR)/vnfd_pkgs/%.tar.gz: $(VNFD_BUILD_DIR)/% $(VNFD_BUILD_DIR)/ims_allin1_2p_vnf/charms/clearwater-aio-proxy $(VNFD_BUILD_DIR)/6wind_vnf/charms/vpe-router $(VNFD_BUILD_DIR)/VyOS_vnf/charms/vyos-proxy $(VNFD_BUILD_DIR)/ping_vnf/charms/pingpong $(VNFD_BUILD_DIR)/pong_vnf/charms/pingpong $(VNFD_BUILD_DIR)/knt_fnc_vnf/charms/flownac $(VNFD_BUILD_DIR)/knt_fne_vnf/charms/flownac $(VNFD_BUILD_DIR)/knt_fnd_vnf/charms/flownac $(VNFD_BUILD_DIR)/knt_fnu_vnf/charms/flownac
- src/generate_descriptor_pkg.sh -d $(BUILD_DIR)/vnfd_pkgs $<
+include mk/dirs.mk
--- /dev/null
+#
+# 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_CLEAN = $(addsuffix .clean, $(SUBDIRS))
+
+.PHONY: $(SUBDIRS) $(SUBDIRS_CLEAN) clean
+
+all: $(SUBDIRS)
+
+clean: $(SUBDIRS_CLEAN)
+
+$(SUBDIRS_CLEAN): %.clean:
+ @$(MAKE) --no-print-directory -C $* clean
+
+$(SUBDIRS):
+ @$(MAKE) --no-print-directory -C $@
--- /dev/null
+#
+# 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.
+
+TOPDIR=$(shell readlink -f .|sed -e 's/\/descriptor-packages\/.*//')
+
+BUILD_DIR := build
+TOOLS_DIR := $(TOPDIR)/descriptor-packages/tools
+PKG_BASE_NAME := $(shell basename $(shell pwd))
+PKG_NAME := $(addsuffix .tar.gz, $(PKG_BASE_NAME))
+
+CHARM_DIR := $(TOPDIR)/juju-charms
+CHARM_SRC_DIR := $(CHARM_DIR)/layers
+CHARM_DOCKER_TAG := charm-tools
+CHARM_BUILD_DIR := $(CHARM_DIR)/builds
+
+Q=@
+
+GEN_VNFD_PKG := $(TOOLS_DIR)/gen_vnfd_pkg.sh
+GEN_NSD_PKG := $(TOOLS_DIR)/gen_nsd_pkg.sh
+GEN_PKG := $(TOOLS_DIR)/generate_descriptor_pkg.sh
+BUILD_VNFD := $(shell readlink -f .|sed -e 's/\/.*descriptor-packages//' | grep vnfd)
+
+DEP_FILES = $(wildcard src/*)
+
+ifdef BUILD_VNFD
+$(BUILD_DIR)/$(PKG_BASE_NAME): src $(DEP_FILES)
+ $(Q)mkdir -p $@
+ $(Q)cp -rf $</. $@
+ $(Q)$(GEN_VNFD_PKG) $< $@
+else
+$(BUILD_DIR)/$(PKG_BASE_NAME): src $(DEP_FILES)
+ $(Q)mkdir -p $@
+ $(Q)cp -rf $</. $@
+ $(Q)$(GEN_NSD_PKG) $< $@
+endif
+
+ifdef VNFD_CHARM
+$(BUILD_DIR)/$(PKG_NAME): $(BUILD_DIR)/$(PKG_BASE_NAME) $(CHARM_BUILD_DIR)/$(VNFD_CHARM)
+ $(Q)echo "building $(PKG_BASE_NAME) with charm $(VNFD_CHARM)"
+ $(Q)cp -rf $(CHARM_BUILD_DIR)/$(VNFD_CHARM) $(BUILD_DIR)/$(PKG_BASE_NAME)/charms
+ $(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
+else
+$(BUILD_DIR)/$(PKG_NAME): $(BUILD_DIR)/$(PKG_BASE_NAME)
+ $(Q)echo "building $(PKG_BASE_NAME)"
+ $(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
+endif
+
+$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
+ $(Q)docker build -q -t $(CHARM_DOCKER_TAG) $(CHARM_DIR)/.
+ $(Q)docker run -u $$(id -u):$$(id -g) -v$(CHARM_DIR):$(CHARM_DIR) -w$(CHARM_DIR) $(CHARM_DOCKER_TAG) charm-build -o $(CHARM_DIR) $<
+
+clean:
+ $(Q)rm -rf $(BUILD_DIR)
+ $(Q)rm -rf $(CHARM_BUILD_DIR)
+
+.DEFAULT_GOAL := all
--- /dev/null
+#
+# 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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+initial_config_primitive:
+- name: config
+ parameter:
+ proxied_ip: <rw_mgmt_ip>
--- /dev/null
+#
+# 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)
--- /dev/null
+#
+# 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
--- /dev/null
+#!/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()
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
+
--- /dev/null
+#
+# 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)
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+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
+++ /dev/null
-#!/bin/bash
-#
-# 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.
-#
-# Author(s): Austin Cormier
-# Creation Date: 2016/05/23
-#
-
-# Generates a NSD descriptor package from a source directory
-# Usage:
-# gen_nsd_pkg.sh <pkg_src_dir> <pkg_dest_dir>
-
-set -o nounset
-
-if [ $# -ne 2 ]; then
- echo "Error: Must provide 2 parameters" >@2
- exit 1
-fi
-
-pkg_src_dir="$1"
-pkg_dest_dir="$2"
-
-if [ ! -e ${pkg_src_dir} ]; then
- echo "Error: ${pkg_src_dir} does not exist"
- exit 1
-fi
-
-if [ ! -e ${pkg_dest_dir} ]; then
- echo "Error: ${pkg_src_dir} does not exist"
- exit 1
-fi
-
-echo "Generating package in directory: ${pkg_dest_dir}"
-
-# Create any missing directories/files so each package has
-# a complete hierachy
-nsd_dirs=( ns_config vnf_config icons scripts )
-nsd_files=( README )
-
-nsd_dir="${pkg_src_dir}"
-echo $(pwd)
-
-mkdir -p "${pkg_dest_dir}"
-cp -rf ${nsd_dir}/* "${pkg_dest_dir}"
-for sub_dir in ${nsd_dirs[@]}; do
- dir_path=${pkg_dest_dir}/${sub_dir}
- mkdir -p ${dir_path}
-done
-
-for file in ${nsd_files[@]}; do
- file_path=${pkg_dest_dir}/${file}
- touch ${file_path}
-done
+++ /dev/null
-#!/bin/bash
-#
-# 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.
-#
-# Author(s): Austin Cormier
-# Creation Date: 2016/05/23
-#
-
-# Generates a NSD descriptor package from a source directory
-# Usage:
-# gen_vnfd_pkg.sh <pkg_src_dir> <pkg_dest_dir>
-
-set -o nounset
-
-if [ $# -ne 2 ]; then
- echo "Error: Must provide 2 parameters" >@2
- exit 1
-fi
-
-pkg_src_dir="$1"
-pkg_dest_dir="$2"
-
-if [ ! -e ${pkg_src_dir} ]; then
- echo "Error: ${pkg_src_dir} does not exist"
- exit 1
-fi
-
-if [ ! -e ${pkg_dest_dir} ]; then
- echo "Error: ${pkg_src_dir} does not exist"
- exit 1
-fi
-
-echo "Generating package in directory: ${pkg_dest_dir}"
-
-# Create any missing directories/files so each package has
-# a complete hierachy
-vnfd_dirs=( charms icons scripts images )
-vnfd_files=( README )
-
-vnfd_dir="${pkg_src_dir}"
-echo $(pwd)
-
-mkdir -p "${pkg_dest_dir}"
-cp -rf ${vnfd_dir}/* "${pkg_dest_dir}"
-for sub_dir in ${vnfd_dirs[@]}; do
- dir_path=${pkg_dest_dir}/${sub_dir}
- mkdir -p ${dir_path}
-done
-
-for file in ${vnfd_files[@]}; do
- file_path=${pkg_dest_dir}/${file}
- touch ${file_path}
-done
+++ /dev/null
-#!/bin/bash
-
-############################################################################
-# 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. #
-############################################################################
-
-#
-# This shell script is used to create a descriptor package
-# The main functions of this script include:
-# - Generate checksums.txt file
-# - Generate a tar.gz file
-# This script can be used to create the required folders for
-# a descriptor package and a template descriptor
-
-# Usage: generate_descriptor_pkg.sh <base-directory> <package-directory>
-
-# Descriptor names should be
-# - (nsd|vnfd).(yaml|yml|json|xml)
-# - *_(nsd|vnfd).(yaml|yml|json|xml)
-# - *_(nsd|vnfd)_*.(yaml|yml|json|xml)
-# - (nsd|vnfd)/*.(yaml|yml|json|xml)
-#
-
-SCRIPTNAME=`basename $0`
-
-# From https://osm.etsi.org/wikipub/index.php/Release_0_Data_Model_Details
-# Supported folders for VNFD
-# cloud_init - Rel 4.3, not yet part of OSM
-VNFD_FOLDERS=(images scripts icons charms cloud_init)
-
-# Supported folders for NSD
-# OSM document specifies (ns|vnf)-config folder, while Rel 4.3
-# is using (ns|vnf)_config.
-NSD_FOLDERS=(scripts icons ns_config vnf_config)
-
-# Other files allowed in the descriptor base directory
-ALLOWED_FILES=(README)
-
-DESC_TYPES=(vnfd nsd)
-DESC_EXTN=(yml yaml json xml)
-CHKSUM='checksums.txt'
-
-VERBOSE=false
-DRY_RUN=false
-CREATE=false
-RM="--remove-files"
-DEBUG=false
-
-ARCHIVE=false
-CREATE_NSD=false
-VENDOR='OSM'
-INTF_TYPE='VIRTIO'
-VCPU=2
-MEMORY=4096
-STORAGE=10
-INTERFACES=1
-
-function usage() {
- cat <<EOF
-Usage:
- $SCRIPTNAME [-t <type>] [-N] [-c] [base-directory] <package-name>
-
- -h|--help : show this message
-
- -t|--package-type <nsd|vnfd> : Descriptor package type
- is NSD or VNFD. Script will try to
- determine the type if not provided.
- Default is vnfd for create-folders.
-
- -d|--destination-dir <destination directory>: Directory to create the
- archived file.
- Default is base-directory
-
- -N|--no-remove-files : Do not remove the package files after creating
- archive
-
- Options specifc for create descriptor:
-
- -c|--create-folder : Create folder with the structure for the
- package type using the base-dir and package-dir
- and a descriptor template
-
- -a|--archive: Create package for the descriptor
-
- --nsd : Generate NSD descriptor package also.
-
- --vendor : Vendor name for descriptor. Default OSM
-
- --interface-type : Interface type [VIRTIO|SR-IOV|PCI-PASSTHROUGH|E1000]
- Default VIRTIO
-
- VM Flavour options:
-
- --vcpu : Virtual CPU count. Default 2
-
- --memory : Memory for VM in MB. Default 4096MB
-
- --storage : Storage size for VM in GB. Default 10GB
-
- VDU Parameters:
-
- --image : Location URI of the image
-
- --cloud-init-file : Cloud init file
-
- --cloud-init : Cloud init script. Will be ignored if
- cloud-init-file is specified
-
- --interfaces : Number of external interfaces in additon to OM-MGMT. Default 1.
-
- End of create descriptor specific options
-
- -v| --verbose : Generate progress details
-
- -n| --dry-run : Validate the package dir
-
- base-dir : Directory where the archive file or folders are created,
- if destination directory is not specified.
- Default is current directory
-
- package-name : The descriptor name (full path if base-dir not specified)
-EOF
-}
-
-CP_TYPE='VPORT'
-function get_cp_type() {
- case ${INTF_TYPE} in
- VIRTIO ) CP_TYPE='VPORT';;
- SR-IOV ) CP_TYPE='VPORT';;
- PCI-PASSTHROUGH ) CP_TYPE='VPORT';;
- OM-MGMT ) CP_TYPE='VPORT';;
- E1000 ) CP_TYPE='VPORT';;
- * ) echo "ERROR: Unknown interface type ${INTF_TYPE}"; exit 1;;
- esac
-}
-
-# Get pci number starting from 0x0a
-get_pci() {
- printf '%02x' $((10 + $1)) | tr '[:upper:]' '[:lower:]'
-}
-
-function write_readme() {
- dir=$1
- file=${dir}/README
- date=$(date)
-
- cat >$file <<EOF
-Descriptor created by OSM descriptor package generated
-Created on $date
-EOF
-
-}
-
-function write_vnfd_tmpl() {
- name=$(basename $1)
- desc_file="${name}.yaml"
-
- cat >$desc_file <<EOF
-vnfd:vnfd-catalog:
- vnfd:
- - id: ${name}
- name: ${name}
- short-name: ${name}
- description: Generated by OSM pacakage generator
- vendor: ${VENDOR}
- version: '1.0'
-
- # Place the logo as png in icons directory and provide the name here
- # logo: <update, optional>
-
- # Management interface
- mgmt-interface:
- vdu-id: ${name}-VM
-
- # Atleast one VDU need to be specified
- vdu:
- # Additional VDUs can be created by copying the
- # VDU descriptor below
- - id: ${name}-VM
- name: ${name}-VM
- description: ${name}-VM
- count: 1
-
- # Flavour of the VM to be instantiated for the VDU
- vm-flavor:
- vcpu-count: ${VCPU}
- memory-mb: ${MEMORY}
- storage-gb: ${STORAGE}
-
- # Image including the full path
- image: '${IMAGE}'
-
-EOF
-
- # Add the cloud init file or script
- if [[ -n ${CLOUD_INIT_FILE} ]]; then
- cif=$(basename ${CLOUD_INIT_FILE})
- cat >>$desc_file <<EOF
- # Cloud init file
- cloud-init-file: '${cif}'
-EOF
- elif [[ -n ${CLOUD_INIT} ]]; then
- cat >>$desc_file <<EOF
- # Cloud init to use
- cloud-init: '${CLOUD_INIT}'
-EOF
- fi
-
- # Add external interfaces
- cat >>$desc_file <<EOF
- external-interface:
- # Specify the external interfaces
- # There can be multiple interfaces defined
-EOF
-
- # Add mgmt interface
- cat >>$desc_file <<EOF
- - name: eth0
- virtual-interface:
- type: VIRTIO
- bandwidth: '0'
- vpci: '0000:00:0a.0'
- vnfd-connection-point-ref: eth0
-EOF
-
- # Add external interfaces
- for i in `seq 1 ${INTERFACES}`; do
- eth=$(($i))
- pci=$(get_pci $eth)
- cat >>$desc_file <<EOF
- - name: eth${eth}
- virtual-interface:
- type: ${INTF_TYPE}
- bandwidth: '0'
- vpci: '0000:00:${pci}.0'
- vnfd-connection-point-ref: eth${eth}
-EOF
- done
-
- # Add connection points
- cat >>$desc_file <<EOF
-
- connection-point:
-EOF
-
- for i in `seq 0 ${INTERFACES}`; do
- eth=$(($i))
- cat >>$desc_file <<EOF
- - name: eth${eth}
- type: ${CP_TYPE}
-EOF
- done
-
- cat >>$desc_file <<EOF
-
- # Uncomment and update below to enable juju
- # charm configuration for the VNF
- # vnf-configuration:
- # juju:
- # charm: <charm name>
- # service-primitive:
- # - name: config
- # parameter:
- # - name: <config parameter>
- # data-type: [STRING|INTEGER]
- # mandatory: [true|false]
- # default-value: <value>
- # - name: <action name>
- # parameter:
- # - name: <action parameter>
- # data-type: [STRING|INTEGER]
- # mandatory: [true|false]
- # default-value: <value>
- # initial-config-primitive:
- # - name: config
- # parameter:
- # - name: <config name>
- # value: <value>
- # - name: <action name>
- # parameter:
- # - name: <action parameter>
- # value: <value>
-EOF
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Created $desc_file"
- fi
-}
-
-function write_nsd_tmpl() {
- name=$(basename $1)
- vnfd=$2
- desc_file="${name}.yaml"
-
- cat >$desc_file <<EOF
-nsd:nsd-catalog:
- nsd:
- - id: ${name}
- name: ${name}
- short-name: ${name}
- description: Generated by OSM pacakage generator
- vendor: ${VENDOR}
- version: '1.0'
-
- # Place the logo as png in icons directory and provide the name here
- # logo: <update, optional>
-
- # 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: ${vnfd}
-
-EOF
-
- cat >>$desc_file <<EOF
- vld:
- # Networks for the VNFs
-EOF
-
- # Add management VLD
- cat >>$desc_file <<EOF
- - id: ${name}_vld0
- name: management
- short-name: management
- type: ELAN
- mgmt-network: 'true'
- # 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: ${vnfd}
- # NOTE: Validate the entry below
- nsd:vnfd-connection-point-ref: eth0
-EOF
-
- # Add rest of VLDs
- for i in `seq 1 ${INTERFACES}`; do
- eth=$(($i))
- cat >>$desc_file <<EOF
- - id: ${name}_vld${i}
- name: ${name}_vld${i}
- short-name: ${name}_vld${i}
- 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: ${vnfd}
- # NOTE: Validate the entry below
- nsd:vnfd-connection-point-ref: eth${eth}
-EOF
- done
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Created $desc_file"
- fi
-}
-
-function write_nsd_config_tmpl() {
- name=$(basename $1)
- cfg_file="ns_config/$name.yaml"
-
- cat >$cfg_file <<EOF
-
-EOF
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Created $cfg_file"
- fi
-}
-
-cur_dir=`pwd`
-
-# Check if the array contains a specific value
-# Taken from
-# http://stackoverflow.com/questions/3685970/check-if-an-array-contains-a-value
-function contains() {
- local n=$#
- local value=${!n}
- for ((i=1;i < $#;i++)); do
- if [ "${!i}" == "${value}" ]; then
- echo "y"
- return 0
- fi
- done
- echo "n"
- return 1
-}
-
-function check_type() {
- type=$1
- if [ $(contains "${DESC_TYPES[@]}" $type) == "y" ]; then
- TYPE=$type
- else
- echo "ERROR: Unknown descriptor type $type!" >&2
- exit 1
- fi
-}
-
-function get_expr(){
- # First argument is to specify if this is a negative match or not
- # Rest are filename expressions without extension
-
- local regex=" "
- local n=$#
- local neg="${1}"
- local first="true"
- for ((i=2;i <= $#;i++)); do
- for extn in "${DESC_EXTN[@]}"; do
- if [ $first == true ]; then
- if [ $neg == true ]; then
- subexpr='! -name'
- else
- subexpr='-name'
- fi
- first=false
- else
- if [ $neg == true ]; then
- subexpr=' -a ! -name'
- else
- subexpr=' -o -name'
- fi
- fi
-
- regex="$regex $subexpr ${!i}.$extn"
- done
- done
-
- echo "$regex"
-}
-
-function generate_package(){
- type=$1
- name="${2}_${type}"
- vnfd="${2}_vnfd" # Required for NSD
- dest_dir=$3
-
- dir="${dest_dir}/${name}"
-
- # Create the folders for the descriptor
- if [ $VERBOSE == true ]; then
- echo "INFO: Creating folders for $PKG in $dest_dir"
- fi
-
- # Remove any existing directory
- if [ -d $dir ]; then
- rm -rf $dir >/dev/null 2>&1
- fi
-
- mkdir -p $dir && cd $dir
- if [ $? -ne 0 ]; then
- rc=$?
- echo "ERROR: creating directory $dir ($rc)" >&2
- exit $rc
- fi
-
- if [ $type == 'nsd' ]; then
- folders=("${NSD_FOLDERS[@]}")
- else
- folders=("${VNFD_FOLDERS[@]}")
- fi
-
- for d in ${folders[@]}; do
- mkdir -p $dir/$d
- if [ $? -ne 0 ]; then
- rc=$?
- echo "ERROR: creating directory $dir/$d ($rc)" >&2
- exit $rc
- fi
- if [ $VERBOSE == true ]; then
- echo "Created folder $d in $dir"
- fi
- done
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Created folders for in $dir"
- fi
-
- # Write a descriptor template file
- if [ $type == 'vnfd' ]; then
-
- # Copy cloud init file to correct folder
- if [[ -n ${CLOUD_INIT_FILE} ]]; then
- if [[ -e ${CLOUD_INIT_FILE} ]]; then
- cp ${CLOUD_INIT_FILE} $dir/cloud_init
- else
- echo "ERROR: Unable to find cloud-init-file ${CLOUD_INIT_FILE}"
- exit 1
- fi
- fi
-
- write_vnfd_tmpl $dir
- else
- write_nsd_tmpl $dir $vnfd
- fi
-
- write_readme $dir
-
- if [ $ARCHIVE == true ]; then
- # Create archive of the package
- cd $dest_dir
- if [ $VERBOSE == true ]; then
- tar zcvf ${name}.tar.gz ${name}
- echo "Created package ${name}.tar.gz in $dest_dir"
- else
- tar zcvf ${name}.tar.gz ${name} >/dev/null 2>&1
- fi
-
- if [ $? -ne 0 ]; then
- echo "ERROR: Creating archive for ${name} in $dest_dir" >&2
- exit 1
- fi
-
- echo "$dest_dir/${name}.tar.gz" >&2
-
- if [ $RM == true ]; then
- rm -rf ${name}
- fi
- fi
-}
-
-OPTS=`getopt -o vhnt:d:caN --long verbose,dry-run,help,package-type:,destination-dir,create-folder,no-remove-files,archive,nsd,vendor:,interface-type:,vcpu:,memory:,storage:,image:,cloud-init-file:,cloud-init:,interfaces:,debug -n $SCRIPTNAME -- "$@"`
-
-if [ $? != 0 ] ; then
- echo "ERROR: Failed parsing options ($?)." >&2
- usage
- exit 1
-fi
-
-echo "$OPTS"
-eval set -- "$OPTS >/dev/null 2>&1"
-
-while true; do
- case "$1" in
- -v | --verbose ) VERBOSE=true; shift ;;
- -h | --help ) usage; exit 0; shift ;;
- -n | --dry-run ) DRY_RUN=true; shift ;;
- -t | --package-type ) check_type "$2"; shift; shift ;;
- -d | --destination-dir ) DEST_DIR=$2; shift; shift;;
- -c | --create-folder ) CREATE=true; shift;;
- -N | --no-remove-files ) RM=''; shift;;
- -a | --archive ) ARCHIVE=true; shift;;
- --nsd ) CREATE_NSD=true; shift;;
- --vendor ) VENDOR=$2; shift; shift;;
- --interface-type ) INTF_TYPE=$2; shift; shift;;
- --vcpu ) VCPU=$2; shift; shift;;
- --memory ) MEMORY=$2; shift; shift;;
- --storage ) STORAGE=$2; shift; shift;;
- --image ) IMAGE=$2; shift; shift;;
- --cloud-init ) CLOUD_INIT=$2; shift; shift;;
- --cloud-init-file ) CLOUD_INIT_FILE=$2; shift; shift;;
- --interfaces ) INTERFACES=$2; shift; shift;;
- --debug ) DEBUG=true; shift;;
- -- ) shift; break ;;
- * ) break ;;
- esac
-done
-
-if [ $DEBUG == true ]; then
- echo "INFO: Debugging ON"
- set -x
-fi
-
-if [ $VERBOSE == true ]; then
- echo "INFO: Descriptor type: $TYPE"
-fi
-
-# Dry run is to validate existing descriptor folders
-if [ $DRY_RUN == true ] && [ $CREATE == true ]; then
- echo "ERROR: Option dry-run with create-folders not supported!" >&2
- exit 1
-fi
-
-if [ $# -gt 1 ]; then
- BASE_DIR=$1
- PKG=$(basename $2)
-else
- BASE_DIR=$(dirname $1)
- PKG=$(basename $1)
-fi
-
-if [ $VERBOSE == true ]; then
- echo "INFO: Using base dir: $BASE_DIR"
-fi
-
-if [ $VERBOSE == true ]; then
- echo "INFO: Using package: $PKG"
-fi
-
-if [[ -z "$PKG" ]]; then
- echo "ERROR: Need to specify the package name" >&2
- usage >&2
- exit 1
-fi
-
-if [[ ! -d $BASE_DIR ]]; then
- if [ $CREATE == true ]; then
- mkdir -p $BASE_DIR
- if [ $? -ne 0 ]; then
- echo "ERROR: Unable to create base directory $BASE_DIR" >&2
- exit 1
- fi
- fi
-fi
-cd $BASE_DIR
-if [ $? -ne 0 ]; then
- echo "ERROR: Unable to change to base directory $BASE_DIR!" >&2
- exit 1
-fi
-
-# Get full base dir path
-BASE_DIR=`pwd`
-cd $cur_dir
-
-if [[ -z $DEST_DIR ]]; then
- DEST_DIR=$BASE_DIR # Default to base directory
-fi
-
-mkdir -p $DEST_DIR
-
-cd $DEST_DIR
-if [ $? -ne 0 ]; then
- echo "ERROR: Not able to access destination directory $DEST_DIR!" >&2
- exit 1
-fi
-
-# Get the full destination dir path
-DEST_DIR=`pwd`
-cd $cur_dir
-
-dir=${BASE_DIR}/${PKG}
-
-function add_chksum() {
- if [ $VERBOSE == true ]; then
- echo "INFO: Add file $1 to $CHKSUM"
- fi
-
- md5sum $1 >> $CHKSUM
-}
-
-if [ $CREATE == false ]; then
- if [ ! -d $dir ]; then
- echo "INFO: Package folder $dir not found!" >&2
- exit 1
- fi
-
- cd $dir
- if [ $? -ne 0 ]; then
- rc=$?
- echo "ERROR: changing directory to $dir ($rc)" >&2
- exit $rc
- fi
-
- # Remove checksum file, if present
- rm -f $CHKSUM
-
- # Check if the descriptor file is present
- if [[ -z $TYPE ]]; then
- # Desc type not specified, look for the desc file and guess the type
- # Required for backward compatibility
- for ty in ${DESC_TYPES[@]}; do
- re=$(get_expr false "$ty" "*_$ty" "*_${ty}_*")
- desc=$(find * -maxdepth 0 -type f $re 2>/dev/null)
-
- if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
- # Check the vnfd|nsd folder
- if [ ! -d $ty ]; then
- continue
- fi
- re=$(get_expr false "*")
- desc=$(find $ty/* -maxdepth 0 -type f $re 2>/dev/null)
- if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
- continue
- elif [ ${#desc[@]} -gt 1 ]; then
- echo "ERROR: Found multiple descriptor files: ${desc[@]}" >&2
- exit 1
- fi
- # Descriptor sub directory
- desc_sub_dir=$ty
- fi
-
- TYPE=$ty
- if [ $TYPE == 'nsd' ]; then
- folders=("${NSD_FOLDERS[@]}")
- else
- folders=("${VNFD_FOLDERS[@]}")
- fi
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Determined descriptor is of type $TYPE"
- fi
- break
- done
-
- if [[ -z $TYPE ]]; then
- echo "ERROR: Unable to determine the descriptor type!" >&2
- exit 1
- fi
- else
- if [ $TYPE == 'nsd' ]; then
- folders=("${NSD_FOLDERS[@]}")
- else
- folders=("${VNFD_FOLDERS[@]}")
- fi
-
- # Check for descriptor of type provided on command line
- re=$(get_expr false "$TYPE" "*_${TYPE}" "*_${TYPE}_*")
- desc=$(find * -maxdepth 0 -type f $re 2>/dev/null)
-
- if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
- # Check if it is under vnfd/nsd subdirectory
- # Backward compatibility support
- re=$(get_expr false "*")
- desc=$(find $TYPE/* -maxdepth 0 -type f $re 2>/dev/null)
- if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
- echo "ERROR: Did not find descriptor file of type $TYPE" \
- " in $dir" >&2
- exit 1
- fi
- desc_sub_dir=$ty
- fi
- fi
-
- if [ ${#desc[@]} -gt 1 ]; then
- echo "ERROR: Found multiple files of type $TYPE in $dir: $desc" >&2
- exit 1
- fi
-
- descriptor=${desc[0]}
-
- # Check if there are files not supported
- files=$(find * -maxdepth 0 -type f ! -name $descriptor 2>/dev/null)
-
- for f in ${files[@]}; do
- if [ $(contains "${ALLOWED_FILES[@]}" $f) == "n" ]; then
- echo "WARN: Unsupported file $f found"
- fi
- done
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Found descriptor package: ${desc_sub_dir} ${descriptor}"
- fi
-
- if [ $DRY_RUN == false ]; then
- add_chksum ${descriptor}
- fi
-
- # Check the folders are supported ones
- dirs=$( find * -maxdepth 0 -type d )
-
- for d in ${dirs[@]}; do
- if [ $(contains "${folders[@]}" $d) == "y" ]; then
- if [ $DRY_RUN == false ]; then
- find $d/* -type f 2>/dev/null|
- while read file; do
- add_chksum $file
- done
- fi
- elif [[ -z $desc_sub_dir ]] || [ $d != $desc_sub_dir ]; then
- echo "WARN: $d is not part of standard folders " \
- "for descriptor type $TYPE in $PKG"
- fi
- done
-
- if [ $VERBOSE == true ]; then
- echo "INFO: Creating archive for $PKG"
- fi
-
- cd $BASE_DIR
- if [ $DRY_RUN == false ]; then
- tar zcvf "$DEST_DIR/$PKG.tar.gz" "${PKG}" ${RM}
- if [ $? -ne 0 ]; then
- rc=$?
- echo "ERROR: creating archive for $PKG ($rc)" >&2
- exit $rc
- fi
- fi
-else
- # Create, default to VNFD if no type is defined
- if [[ -z $TYPE ]]; then
- TYPE=vnfd
- if [ $VERBOSE == true ]; then
- echo "WARNING: Defaulting to descriptor type $TYPE"
- fi
- fi
-
- if [ $TYPE == 'vnfd' ]; then
- if [[ -z $IMAGE ]]; then
- echo "ERROR: Image file need to be specified for VNF"
- exit 1
- fi
- generate_package vnfd $PKG $DEST_DIR
- fi
-
- if [ $TYPE == 'nsd' -o $CREATE_NSD == true ]; then
- generate_package nsd $PKG $DEST_DIR
- fi
-
-fi
-
-cd $cur_dir
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-initial_config_primitive:
-- name: config
- parameter:
- proxied_ip: <rw_mgmt_ip>
+++ /dev/null
-#
-# 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
+++ /dev/null
-#!/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()
+++ /dev/null
-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
+++ /dev/null
-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
-
+++ /dev/null
-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
+++ /dev/null
-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
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - id: VyOS
- name: VyOS
- short-name: VyOS
- description: VyOS Router
- logo: osm_2x.png
- mgmt-interface:
- vdu-id: VyOS-VM
- vnf-configuration:
- config-attributes:
- config-delay: '0'
- config-priority: '1'
- service-primitive:
- - name: config
- parameter:
- - name: user
- data-type: STRING
- mandatory: 'true'
- default-value: vyos
- - name: pass
- data-type: STRING
- mandatory: 'true'
- default-value: vyos
- - name: ping
- parameter:
- - name: destination
- data-type: STRING
- mandatory: 'true'
- - name: count
- data-type: INTEGER
- mandatory: 'false'
- default-value: 5
- initial-config-primitive:
- - name: config
- parameter:
- - name: hostname
- value: <rw_mgmt_ip>
- - name: pass
- value: vyos
- seq: '1'
- juju:
- charm: vyos-proxy
- connection-point:
- - name: eth0
- type: VPORT
- - name: eth1
- type: VPORT
- - name: eth2
- type: VPORT
- - name: eth3
- type: VPORT
- - name: eth4
- type: VPORT
- vdu:
- - id: VyOS-VM
- name: VyOS-VM
- description: VyOS-VM
- image: /mnt/powervault/virtualization/osm/VyOS/VyOS-1.1.7-signed-disk1.qcow2
- vm-flavor:
- memory-mb: '1024'
- storage-gb: '40'
- vcpu-count: '1'
- mgmt-vpci: 0000:00:0a.0
- external-interface:
- - name: eth0
- virtual-interface:
- bandwidth: '0'
- type: OM-MGMT
- vpci: 0000:00:0a.0
- vnfd-connection-point-ref: eth0
- - name: eth1
- virtual-interface:
- bandwidth: '0'
- type: VIRTIO
- vpci: 0000:00:0b.0
- vnfd-connection-point-ref: eth1
- - name: eth2
- virtual-interface:
- bandwidth: '0'
- type: VIRTIO
- vpci: 0000:00:0c.0
- vnfd-connection-point-ref: eth2
- - name: eth3
- virtual-interface:
- bandwidth: '0'
- type: VIRTIO
- vpci: 0000:00:0d.0
- vnfd-connection-point-ref: eth3
- - name: eth4
- virtual-interface:
- bandwidth: '0'
- type: VIRTIO
- vpci: 0000:00:0e.0
- vnfd-connection-point-ref: eth4
- guest-epa:
- cpu-pinning-policy: DEDICATED
- cpu-thread-pinning-policy: PREFER
- mempage-size: LARGE
- numa-node-policy:
- mem-policy: STRICT
- node:
- - id: '0'
- paired-threads:
- num-paired-threads: '1'
- node-cnt: '1'
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - id: cirros_vnfd
- name: cirros_vnf
- short-name: cirros_vnf
- description: Simple VNF example with a cirros
- vendor: OSM
- version: '1.0'
-
- # Place the logo as png in icons directory and provide the name here
- logo: cirros-64.png
-
- # Management interface
- mgmt-interface:
- vdu-id: cirros_vnfd-VM
-
- # Atleast one VDU need to be specified
- vdu:
- - id: cirros_vnfd-VM
- name: cirros_vnfd-VM
- description: cirros_vnfd-VM
- 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: 256
- storage-gb: 2
-
- # Image/checksum or image including the full path
- image: 'CirrOS 0.3.4 64-bit'
- #checksum:
-
- external-interface:
- # Specify the external interfaces
- # There can be multiple interfaces defined
- - name: eth0
- virtual-interface:
- type: OM-MGMT
- bandwidth: '0'
- vpci: 0000:00:0a.0
- vnfd-connection-point-ref: eth0
-
- connection-point:
- - name: eth0
- type: VPORT
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - id: IMS-ALLIN1_2p
- name: IMS-ALLIN1_2p
- short-name: IMS-ALLIN1_2p
- description: IMS-ALLIN1_2p
- logo: metaswitch_2x.png
- mgmt-interface:
- vdu-id: IMS-ALLIN1_2p-VM
- vnf-configuration:
- config-attributes:
- config-delay: '0'
- config-priority: '1'
- service-primitive:
- - name: config
- parameter:
- - name: home_domain
- data-type: STRING
- mandatory: 'true'
- default-value: ims.com
- - name: password
- data-type: string
- mandatory: 'true'
- default-value: cw-aio
- - name: create-update-user
- parameter:
- - name: number
- data-type: STRING
- mandatory: 'true'
- - name: password
- data-type: STRING
- mandatory: 'true'
- - name: delete-user
- parameter:
- - name: number
- data-type: STRING
- mandatory: 'true'
- initial-config-primitive:
- - name: config
- parameter:
- - name: proxied_ip
- value: <rw_mgmt_ip>
- seq: '1'
- juju:
- charm: clearwater-aio-proxy
- connection-point:
- - name: eth0
- type: VPORT
- - name: eth1
- type: VPORT
- vdu:
- - id: IMS-ALLIN1_2p-VM
- name: IMS-ALLIN1_2p-VM
- description: IMS-ALLIN1_2p-VM
- image: /mnt/powervault/virtualization/vnfs/demos/mwc2016/allin1.qcow2
- vm-flavor:
- memory-mb: '4096'
- storage-gb: '10'
- vcpu-count: '2'
- mgmt-vpci: 0000:00:0a.0
- external-interface:
- - name: eth0
- virtual-interface:
- bandwidth: '0'
- type: VIRTIO
- vpci: 0000:00:0a.0
- vnfd-connection-point-ref: eth0
- - name: eth1
- virtual-interface:
- bandwidth: '0'
- type: OM-MGMT
- vpci: 0000:00:0b.0
- vnfd-connection-point-ref: eth1
- guest-epa:
- cpu-pinning-policy: DEDICATED
- cpu-thread-pinning-policy: PREFER
- mempage-size: LARGE
- numa-node-policy:
- mem-policy: STRICT
- node:
- - id: '0'
- paired-threads:
- num-paired-threads: '1'
- node-cnt: '1'
+++ /dev/null
-#cloud-config
-password: fedora
-chpasswd: { expire: False }
-ssh_pwauth: True
+++ /dev/null
-#
-# 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.
-#
-#
-
-vnfd:vnfd-catalog:
- vnfd:vnfd:
- - id: rift_ping_vnf
- name: ping_vnf
- short-name: ping_vnf
- logo: rift_logo.png
- vendor: RIFT.io
- version: '1.1'
- description: This is an example RIFT.ware VNF
- connection-point:
- - name: ping_vnfd/cp0
- type: VPORT
- - name: ping_vnfd/cp1
- type: VPORT
- http-endpoint:
- - path: api/v1/ping/stats
- polling_interval_secs: '2'
- port: '18888'
- mgmt-interface:
- dashboard-params:
- path: api/v1/ping/stats
- port: '18888'
- port: '18888'
- vdu-id: iovdu_0
- placement-groups:
- - member-vdus:
- - member-vdu-ref: iovdu_0
- name: Eris
- requirement: Place this VM on the Kuiper belt object Eris
- strategy: COLOCATION
- vdu:
- - cloud-init-file: ping_cloud_init.cfg
- count: '1'
- external-interface:
- - name: eth0
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: ping_vnfd/cp0
- - name: eth1
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: ping_vnfd/cp1
- id: iovdu_0
- image: Fedora-x86_64-20-20131211.1-sda-ping.qcow2
- name: iovdu_0
- vm-flavor:
- memory-mb: '512'
- storage-gb: '4'
- vcpu-count: '1'
- vnf-configuration:
- config-attributes:
- config-delay: 10
- service-primitive:
- - name: start
- - name: stop
- - name: restart
- - name: config
- parameter:
- - data-type: STRING
- default-value: <rw_mgmt_ip>
- name: ssh-hostname
- - data-type: STRING
- default-value: fedora
- name: ssh-username
- - data-type: STRING
- default-value: fedora
- name: ssh-password
- - data-type: STRING
- name: ssh-private-key
- - data-type: STRING
- default-value: ping
- name: mode
- read-only: 'true'
- - name: set-server
- parameter:
- - data-type: STRING
- name: server-ip
- - data-type: INTEGER
- name: server-port
- - name: set-rate
- parameter:
- - data-type: INTEGER
- default-value: '5'
- name: rate
- - name: start-traffic
- - name: stop-traffic
- initial-config-primitive:
- - name: config
- parameter:
- - name: ssh-hostname
- value: <rw_mgmt_ip>
- - name: ssh-username
- value: fedora
- - name: ssh-password
- value: fedora
- - name: mode
- value: ping
- seq: '1'
- - name: start
- seq: '2'
- juju:
- charm: pingpong
+++ /dev/null
-#cloud-config
-password: fedora
-chpasswd: { expire: False }
-ssh_pwauth: True
+++ /dev/null
-#
-# 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.
-#
-#
-
-vnfd:vnfd-catalog:
- vnfd:
- - id: rift_pong_vnf
- name: pong_vnf
- short-name: pong_vnf
- logo: rift_logo.png
- vendor: RIFT.io
- version: '1.1'
- description: This is an example RIFT.ware VNF
- connection-point:
- - name: pong_vnfd/cp0
- type: VPORT
- - name: pong_vnfd/cp1
- type: VPORT
- http-endpoint:
- - path: api/v1/pong/stats
- polling_interval_secs: '2'
- port: '18889'
- mgmt-interface:
- dashboard-params:
- path: api/v1/pong/stats
- port: '18889'
- port: '18889'
- vdu-id: iovdu_0
- placement-groups:
- - member-vdus:
- - member-vdu-ref: iovdu_0
- name: Weywot
- requirement: Place this VM on the Kuiper belt object Weywot
- strategy: COLOCATION
- vdu:
- - cloud-init-file: pong_cloud_init.cfg
- count: '1'
- external-interface:
- - name: eth0
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: pong_vnfd/cp0
- - name: eth1
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: pong_vnfd/cp1
- id: iovdu_0
- image: Fedora-x86_64-20-20131211.1-sda-pong.qcow2
- name: iovdu_0
- vm-flavor:
- memory-mb: '512'
- storage-gb: '4'
- vcpu-count: '1'
- vnf-configuration:
- config-attributes:
- config-delay: 10
- service-primitive:
- - name: start
- - name: stop
- - name: restart
- - name: config
- parameter:
- - data-type: STRING
- default-value: <rw_mgmt_ip>
- name: ssh-hostname
- - data-type: STRING
- default-value: fedora
- name: ssh-username
- - data-type: STRING
- default-value: fedora
- name: ssh-password
- - data-type: STRING
- name: ssh-private-key
- - data-type: STRING
- default-value: pong
- name: mode
- read-only: 'true'
- - name: set-server
- parameter:
- - data-type: STRING
- name: server-ip
- - data-type: INTEGER
- name: server-port
- - name: start-traffic
- - name: stop-traffic
- initial-config-primitive:
- - name: config
- parameter:
- - name: ssh-hostname
- value: <rw_mgmt_ip>
- - name: ssh-username
- value: fedora
- - name: ssh-password
- value: fedora
- - name: mode
- value: pong
- seq: '1'
- - name: start
- seq: '2'
- juju:
- charm: pingpong
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - connection-point:
- - name: mgmt0
- type: VPORT
- - name: west
- type: VPORT
- description: A simple VNF descriptor w/ VM1 and VM2
- id: Ref_Vnf_11
- name: Ref_VNF_11
- short-name: Ref_VNF_11
- internal-vld:
- - description: Internal VL
- id: VL12
- name: VL12
- short-name: VL12
- type: ELAN
- vendor: ETSI
- internal-connection-point:
- - id-ref: 'iface11'
- - id-ref: 'iface21'
- vdu:
- - external-interface:
- - name: iface10
- virtual-interface:
- type: OM-MGMT
- vnfd-connection-point-ref: mgmt0
- internal-interface:
- - name: iface11
- virtual-interface:
- type: VIRTIO
- vdu-internal-connection-point-ref: iface11
- internal-connection-point:
- - name: iface11
- id: iface11
- type: VPORT
- id: Ref_VM1
- image: ref_vm1.qcow2
- name: Ref_VM1
- vm-flavor:
- memory-mb: '2048'
- storage-gb: '8'
- vcpu-count: '2'
- - external-interface:
- - name: iface22
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: west
- internal-interface:
- - name: iface21
- virtual-interface:
- type: VIRTIO
- vdu-internal-connection-point-ref: iface21
- internal-connection-point:
- - name: iface21
- id: iface21
- type: VPORT
- id: Ref_VM2
- image: ref_vm2.qcow2
- name: Ref_VM2
- vm-flavor:
- memory-mb: '4096'
- storage-gb: '16'
- vcpu-count: '2'
- vendor: ETSI
- version: '1.0'
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - connection-point:
- - name: mgmt0
- type: VPORT
- - name: west
- type: VPORT
- - name: east
- type: VPORT
- description: A simple VNF descriptor w/ two VDU
- id: Ref_Vnf_12
- name: Ref_Vnf_12
- short-name: Ref_Vnf_12
- internal-vld:
- - description: Internal VL
- id: VL34
- name: VL34
- short-name: VL34
- type: ELAN
- vendor: ETSI
- internal-connection-point:
- - id-ref: 'iface31'
- - id-ref: 'iface41'
- vdu:
- - description: Middlepoint
- external-interface:
- - name: iface30
- virtual-interface:
- type: OM-MGMT
- vnfd-connection-point-ref: mgmt0
- guest-epa:
- cpu-pinning-policy: DEDICATED
- mempage-size: "LARGE"
- id: a3a2f
- image: ref_vm3.qcow2
- internal-connection-point:
- - id: iface31
- name: iface31
- type: VPORT
- internal-interface:
- - name: iface31
- vdu-internal-connection-point-ref: iface31
- virtual-interface:
- type: VIRTIO
- name: Ref_VM3
- vm-flavor:
- memory-mb: '2048'
- storage-gb: '8'
- vcpu-count: '2'
- - external-interface:
- - name: iface42
- virtual-interface:
- type: PCI-PASSTHROUGH
- vnfd-connection-point-ref: west
- - name: iface43
- virtual-interface:
- type: SR-IOV
- vnfd-connection-point-ref: east
- guest-epa:
- cpu-pinning-policy: DEDICATED
- id: e526e
- internal-connection-point:
- - id: iface41
- name: iface41
- type: VPORT
- name: Ref_VM4
- internal-interface:
- - name: iface41
- vdu-internal-connection-point-ref: iface41
- virtual-interface:
- type: VIRTIO
- vendor: ETSI
- version: '1.0'
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - connection-point:
- - name: mgmt
- type: VPORT
- - name: data
- type: VPORT
- description: A simple VNF descriptor w/ one VDU
- id: Ref_Vnf_21
- name: Ref_Vnf_21
- short-name: Ref_Vnf_21
- vdu:
- - external-interface:
- - name: iface50
- virtual-interface:
- type: OM-MGMT
- vnfd-connection-point-ref: mgmt
- - name: iface51
- virtual-interface:
- type: VIRTIO
- vnfd-connection-point-ref: data
- id: ref_vm21
- image: ref_vm21.qcow2
- name: Ref_VM_5
- vm-flavor:
- memory-mb: '1024'
- storage-gb: '16'
- vcpu-count: '1'
- vendor: ETSI
- version: '1.0'
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - connection-point:
- - name: mgmt
- type: VPORT
- - name: west
- type: VPORT
- - name: east
- type: VPORT
- description: A simple VNF descriptor w/ one VDU
- id: Ref_Vnf_22
- name: Ref_VNF_22
- short-name: Ref_VNF_22
- vdu:
- - external-interface:
- - name: iface60
- virtual-interface:
- type: OM-MGMT
- vnfd-connection-point-ref: mgmt
- - name: iface61
- virtual-interface:
- type: PCI-PASSTHROUGH
- vnfd-connection-point-ref: west
- - name: iface62
- virtual-interface:
- type: SR-IOV
- vnfd-connection-point-ref: east
- id: abd6831e-f811-4580-9aad-1de9c6424180
- image: ref_vm22.qcow2
- name: Ref_VM6
- guest-epa:
- cpu-pinning-policy: DEDICATED
- mempage-size: "LARGE"
- vm-flavor:
- memory-mb: '1024'
- storage-gb: '16'
- vcpu-count: '1'
- vendor: ETSI
- version: '1.0'
+++ /dev/null
-#cloud-config
-password: ubuntu
-chpasswd: { expire: False }
-ssh_pwauth: True
-
+++ /dev/null
-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
+++ /dev/null
-#cloud-config
-password: ubuntu
-chpasswd: { expire: False }
-ssh_pwauth: True
-
+++ /dev/null
-vnfd:vnfd-catalog:
- vnfd:
- - id: ubuntu_xenial_vnfd
- name: ubuntu_xenial_vnf
- short-name: ubuntu_xenial_vnf
- 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: ubuntu-logo14.png
-
- # Management interface
- mgmt-interface:
- vdu-id: ubuntu_xenial_vnfd-VM
-
- # Atleast one VDU need to be specified
- vdu:
- - id: ubuntu_xenial_vnfd-VM
- name: ubuntu_xenial_vnfd-VM
- description: ubuntu_xenial_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
-
- # 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
- - name: eth0
- virtual-interface:
- type: OM-MGMT
- bandwidth: '0'
- vpci: 0000:00:0a.0
- vnfd-connection-point-ref: eth0
-
- connection-point:
- - name: eth0
- type: VPORT
--- /dev/null
+#!/bin/bash
+#
+# 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.
+#
+# Author(s): Austin Cormier
+# Creation Date: 2016/05/23
+#
+
+# Generates a NSD descriptor package from a source directory
+# Usage:
+# gen_nsd_pkg.sh <pkg_src_dir> <pkg_dest_dir>
+
+set -o nounset
+
+if [ $# -ne 2 ]; then
+ echo "Error: Must provide 2 parameters" >@2
+ exit 1
+fi
+
+pkg_src_dir="$1"
+pkg_dest_dir="$2"
+
+if [ ! -e ${pkg_src_dir} ]; then
+ echo "Error: ${pkg_src_dir} does not exist"
+ exit 1
+fi
+
+if [ ! -e ${pkg_dest_dir} ]; then
+ echo "Error: ${pkg_src_dir} does not exist"
+ exit 1
+fi
+
+#echo "Generating package in directory: ${pkg_dest_dir}"
+
+# Create any missing directories/files so each package has
+# a complete hierachy
+nsd_dirs=( ns_config vnf_config icons scripts )
+nsd_files=( README )
+
+nsd_dir="${pkg_src_dir}"
+#echo $(pwd)
+
+mkdir -p "${pkg_dest_dir}"
+cp -rf ${nsd_dir}/* "${pkg_dest_dir}"
+for sub_dir in ${nsd_dirs[@]}; do
+ dir_path=${pkg_dest_dir}/${sub_dir}
+ mkdir -p ${dir_path}
+done
+
+for file in ${nsd_files[@]}; do
+ file_path=${pkg_dest_dir}/${file}
+ touch ${file_path}
+done
--- /dev/null
+#!/bin/bash
+#
+# 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.
+#
+# Author(s): Austin Cormier
+# Creation Date: 2016/05/23
+#
+
+# Generates a NSD descriptor package from a source directory
+# Usage:
+# gen_vnfd_pkg.sh <pkg_src_dir> <pkg_dest_dir>
+
+set -o nounset
+
+if [ $# -ne 2 ]; then
+ echo "Error: Must provide 2 parameters" >@2
+ exit 1
+fi
+
+pkg_src_dir="$1"
+pkg_dest_dir="$2"
+
+if [ ! -e ${pkg_src_dir} ]; then
+ echo "Error: ${pkg_src_dir} does not exist"
+ exit 1
+fi
+
+if [ ! -e ${pkg_dest_dir} ]; then
+ echo "Error: ${pkg_src_dir} does not exist"
+ exit 1
+fi
+
+#echo "Generating package in directory: ${pkg_dest_dir}"
+
+# Create any missing directories/files so each package has
+# a complete hierachy
+vnfd_dirs=( charms icons scripts images )
+vnfd_files=( README )
+
+vnfd_dir="${pkg_src_dir}"
+#echo $(pwd)
+
+mkdir -p "${pkg_dest_dir}"
+cp -rf ${vnfd_dir}/* "${pkg_dest_dir}"
+for sub_dir in ${vnfd_dirs[@]}; do
+ dir_path=${pkg_dest_dir}/${sub_dir}
+ mkdir -p ${dir_path}
+done
+
+for file in ${vnfd_files[@]}; do
+ file_path=${pkg_dest_dir}/${file}
+ touch ${file_path}
+done
--- /dev/null
+#!/bin/bash
+
+############################################################################
+# 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. #
+############################################################################
+
+#
+# This shell script is used to create a descriptor package
+# The main functions of this script include:
+# - Generate checksums.txt file
+# - Generate a tar.gz file
+# This script can be used to create the required folders for
+# a descriptor package and a template descriptor
+
+# Usage: generate_descriptor_pkg.sh <base-directory> <package-directory>
+
+# Descriptor names should be
+# - (nsd|vnfd).(yaml|yml|json|xml)
+# - *_(nsd|vnfd).(yaml|yml|json|xml)
+# - *_(nsd|vnfd)_*.(yaml|yml|json|xml)
+# - (nsd|vnfd)/*.(yaml|yml|json|xml)
+#
+
+SCRIPTNAME=`basename $0`
+
+# From https://osm.etsi.org/wikipub/index.php/Release_0_Data_Model_Details
+# Supported folders for VNFD
+# cloud_init - Rel 4.3, not yet part of OSM
+VNFD_FOLDERS=(images scripts icons charms cloud_init)
+
+# Supported folders for NSD
+# OSM document specifies (ns|vnf)-config folder, while Rel 4.3
+# is using (ns|vnf)_config.
+NSD_FOLDERS=(scripts icons ns_config vnf_config)
+
+# Other files allowed in the descriptor base directory
+ALLOWED_FILES=(README)
+
+DESC_TYPES=(vnfd nsd)
+DESC_EXTN=(yml yaml json xml)
+CHKSUM='checksums.txt'
+
+VERBOSE=false
+DRY_RUN=false
+CREATE=false
+RM="--remove-files"
+DEBUG=false
+
+ARCHIVE=false
+CREATE_NSD=false
+VENDOR='OSM'
+INTF_TYPE='VIRTIO'
+VCPU=2
+MEMORY=4096
+STORAGE=10
+INTERFACES=1
+
+function usage() {
+ cat <<EOF
+Usage:
+ $SCRIPTNAME [-t <type>] [-N] [-c] [base-directory] <package-name>
+
+ -h|--help : show this message
+
+ -t|--package-type <nsd|vnfd> : Descriptor package type
+ is NSD or VNFD. Script will try to
+ determine the type if not provided.
+ Default is vnfd for create-folders.
+
+ -d|--destination-dir <destination directory>: Directory to create the
+ archived file.
+ Default is base-directory
+
+ -N|--no-remove-files : Do not remove the package files after creating
+ archive
+
+ Options specifc for create descriptor:
+
+ -c|--create-folder : Create folder with the structure for the
+ package type using the base-dir and package-dir
+ and a descriptor template
+
+ -a|--archive: Create package for the descriptor
+
+ --nsd : Generate NSD descriptor package also.
+
+ --vendor : Vendor name for descriptor. Default OSM
+
+ --interface-type : Interface type [VIRTIO|SR-IOV|PCI-PASSTHROUGH|E1000]
+ Default VIRTIO
+
+ VM Flavour options:
+
+ --vcpu : Virtual CPU count. Default 2
+
+ --memory : Memory for VM in MB. Default 4096MB
+
+ --storage : Storage size for VM in GB. Default 10GB
+
+ VDU Parameters:
+
+ --image : Location URI of the image
+
+ --cloud-init-file : Cloud init file
+
+ --cloud-init : Cloud init script. Will be ignored if
+ cloud-init-file is specified
+
+ --interfaces : Number of external interfaces in additon to OM-MGMT. Default 1.
+
+ End of create descriptor specific options
+
+ -v| --verbose : Generate progress details
+
+ -n| --dry-run : Validate the package dir
+
+ base-dir : Directory where the archive file or folders are created,
+ if destination directory is not specified.
+ Default is current directory
+
+ package-name : The descriptor name (full path if base-dir not specified)
+EOF
+}
+
+CP_TYPE='VPORT'
+function get_cp_type() {
+ case ${INTF_TYPE} in
+ VIRTIO ) CP_TYPE='VPORT';;
+ SR-IOV ) CP_TYPE='VPORT';;
+ PCI-PASSTHROUGH ) CP_TYPE='VPORT';;
+ OM-MGMT ) CP_TYPE='VPORT';;
+ E1000 ) CP_TYPE='VPORT';;
+ * ) echo "ERROR: Unknown interface type ${INTF_TYPE}"; exit 1;;
+ esac
+}
+
+# Get pci number starting from 0x0a
+get_pci() {
+ printf '%02x' $((10 + $1)) | tr '[:upper:]' '[:lower:]'
+}
+
+function write_readme() {
+ dir=$1
+ file=${dir}/README
+ date=$(date)
+
+ cat >$file <<EOF
+Descriptor created by OSM descriptor package generated
+Created on $date
+EOF
+
+}
+
+function write_vnfd_tmpl() {
+ name=$(basename $1)
+ desc_file="${name}.yaml"
+
+ cat >$desc_file <<EOF
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: ${name}
+ name: ${name}
+ short-name: ${name}
+ description: Generated by OSM pacakage generator
+ vendor: ${VENDOR}
+ version: '1.0'
+
+ # Place the logo as png in icons directory and provide the name here
+ # logo: <update, optional>
+
+ # Management interface
+ mgmt-interface:
+ vdu-id: ${name}-VM
+
+ # Atleast one VDU need to be specified
+ vdu:
+ # Additional VDUs can be created by copying the
+ # VDU descriptor below
+ - id: ${name}-VM
+ name: ${name}-VM
+ description: ${name}-VM
+ count: 1
+
+ # Flavour of the VM to be instantiated for the VDU
+ vm-flavor:
+ vcpu-count: ${VCPU}
+ memory-mb: ${MEMORY}
+ storage-gb: ${STORAGE}
+
+ # Image including the full path
+ image: '${IMAGE}'
+
+EOF
+
+ # Add the cloud init file or script
+ if [[ -n ${CLOUD_INIT_FILE} ]]; then
+ cif=$(basename ${CLOUD_INIT_FILE})
+ cat >>$desc_file <<EOF
+ # Cloud init file
+ cloud-init-file: '${cif}'
+EOF
+ elif [[ -n ${CLOUD_INIT} ]]; then
+ cat >>$desc_file <<EOF
+ # Cloud init to use
+ cloud-init: '${CLOUD_INIT}'
+EOF
+ fi
+
+ # Add external interfaces
+ cat >>$desc_file <<EOF
+ external-interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+EOF
+
+ # Add mgmt interface
+ cat >>$desc_file <<EOF
+ - name: eth0
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: '0000:00:0a.0'
+ vnfd-connection-point-ref: eth0
+EOF
+
+ # Add external interfaces
+ for i in `seq 1 ${INTERFACES}`; do
+ eth=$(($i))
+ pci=$(get_pci $eth)
+ cat >>$desc_file <<EOF
+ - name: eth${eth}
+ virtual-interface:
+ type: ${INTF_TYPE}
+ bandwidth: '0'
+ vpci: '0000:00:${pci}.0'
+ vnfd-connection-point-ref: eth${eth}
+EOF
+ done
+
+ # Add connection points
+ cat >>$desc_file <<EOF
+
+ connection-point:
+EOF
+
+ for i in `seq 0 ${INTERFACES}`; do
+ eth=$(($i))
+ cat >>$desc_file <<EOF
+ - name: eth${eth}
+ type: ${CP_TYPE}
+EOF
+ done
+
+ cat >>$desc_file <<EOF
+
+ # Uncomment and update below to enable juju
+ # charm configuration for the VNF
+ # vnf-configuration:
+ # juju:
+ # charm: <charm name>
+ # service-primitive:
+ # - name: config
+ # parameter:
+ # - name: <config parameter>
+ # data-type: [STRING|INTEGER]
+ # mandatory: [true|false]
+ # default-value: <value>
+ # - name: <action name>
+ # parameter:
+ # - name: <action parameter>
+ # data-type: [STRING|INTEGER]
+ # mandatory: [true|false]
+ # default-value: <value>
+ # initial-config-primitive:
+ # - name: config
+ # parameter:
+ # - name: <config name>
+ # value: <value>
+ # - name: <action name>
+ # parameter:
+ # - name: <action parameter>
+ # value: <value>
+EOF
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Created $desc_file"
+ fi
+}
+
+function write_nsd_tmpl() {
+ name=$(basename $1)
+ vnfd=$2
+ desc_file="${name}.yaml"
+
+ cat >$desc_file <<EOF
+nsd:nsd-catalog:
+ nsd:
+ - id: ${name}
+ name: ${name}
+ short-name: ${name}
+ description: Generated by OSM pacakage generator
+ vendor: ${VENDOR}
+ version: '1.0'
+
+ # Place the logo as png in icons directory and provide the name here
+ # logo: <update, optional>
+
+ # 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: ${vnfd}
+
+EOF
+
+ cat >>$desc_file <<EOF
+ vld:
+ # Networks for the VNFs
+EOF
+
+ # Add management VLD
+ cat >>$desc_file <<EOF
+ - id: ${name}_vld0
+ name: management
+ short-name: management
+ type: ELAN
+ mgmt-network: 'true'
+ # 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: ${vnfd}
+ # NOTE: Validate the entry below
+ nsd:vnfd-connection-point-ref: eth0
+EOF
+
+ # Add rest of VLDs
+ for i in `seq 1 ${INTERFACES}`; do
+ eth=$(($i))
+ cat >>$desc_file <<EOF
+ - id: ${name}_vld${i}
+ name: ${name}_vld${i}
+ short-name: ${name}_vld${i}
+ 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: ${vnfd}
+ # NOTE: Validate the entry below
+ nsd:vnfd-connection-point-ref: eth${eth}
+EOF
+ done
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Created $desc_file"
+ fi
+}
+
+function write_nsd_config_tmpl() {
+ name=$(basename $1)
+ cfg_file="ns_config/$name.yaml"
+
+ cat >$cfg_file <<EOF
+
+EOF
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Created $cfg_file"
+ fi
+}
+
+cur_dir=`pwd`
+
+# Check if the array contains a specific value
+# Taken from
+# http://stackoverflow.com/questions/3685970/check-if-an-array-contains-a-value
+function contains() {
+ local n=$#
+ local value=${!n}
+ for ((i=1;i < $#;i++)); do
+ if [ "${!i}" == "${value}" ]; then
+ echo "y"
+ return 0
+ fi
+ done
+ echo "n"
+ return 1
+}
+
+function check_type() {
+ type=$1
+ if [ $(contains "${DESC_TYPES[@]}" $type) == "y" ]; then
+ TYPE=$type
+ else
+ echo "ERROR: Unknown descriptor type $type!" >&2
+ exit 1
+ fi
+}
+
+function get_expr(){
+ # First argument is to specify if this is a negative match or not
+ # Rest are filename expressions without extension
+
+ local regex=" "
+ local n=$#
+ local neg="${1}"
+ local first="true"
+ for ((i=2;i <= $#;i++)); do
+ for extn in "${DESC_EXTN[@]}"; do
+ if [ $first == true ]; then
+ if [ $neg == true ]; then
+ subexpr='! -name'
+ else
+ subexpr='-name'
+ fi
+ first=false
+ else
+ if [ $neg == true ]; then
+ subexpr=' -a ! -name'
+ else
+ subexpr=' -o -name'
+ fi
+ fi
+
+ regex="$regex $subexpr ${!i}.$extn"
+ done
+ done
+
+ echo "$regex"
+}
+
+function generate_package(){
+ type=$1
+ name="${2}_${type}"
+ vnfd="${2}_vnfd" # Required for NSD
+ dest_dir=$3
+
+ dir="${dest_dir}/${name}"
+
+ # Create the folders for the descriptor
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Creating folders for $PKG in $dest_dir"
+ fi
+
+ # Remove any existing directory
+ if [ -d $dir ]; then
+ rm -rf $dir >/dev/null 2>&1
+ fi
+
+ mkdir -p $dir && cd $dir
+ if [ $? -ne 0 ]; then
+ rc=$?
+ echo "ERROR: creating directory $dir ($rc)" >&2
+ exit $rc
+ fi
+
+ if [ $type == 'nsd' ]; then
+ folders=("${NSD_FOLDERS[@]}")
+ else
+ folders=("${VNFD_FOLDERS[@]}")
+ fi
+
+ for d in ${folders[@]}; do
+ mkdir -p $dir/$d
+ if [ $? -ne 0 ]; then
+ rc=$?
+ echo "ERROR: creating directory $dir/$d ($rc)" >&2
+ exit $rc
+ fi
+ if [ $VERBOSE == true ]; then
+ echo "Created folder $d in $dir"
+ fi
+ done
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Created folders for in $dir"
+ fi
+
+ # Write a descriptor template file
+ if [ $type == 'vnfd' ]; then
+
+ # Copy cloud init file to correct folder
+ if [[ -n ${CLOUD_INIT_FILE} ]]; then
+ if [[ -e ${CLOUD_INIT_FILE} ]]; then
+ cp ${CLOUD_INIT_FILE} $dir/cloud_init
+ else
+ echo "ERROR: Unable to find cloud-init-file ${CLOUD_INIT_FILE}"
+ exit 1
+ fi
+ fi
+
+ write_vnfd_tmpl $dir
+ else
+ write_nsd_tmpl $dir $vnfd
+ fi
+
+ write_readme $dir
+
+ if [ $ARCHIVE == true ]; then
+ # Create archive of the package
+ cd $dest_dir
+ if [ $VERBOSE == true ]; then
+ tar zcvf ${name}.tar.gz ${name}
+ echo "Created package ${name}.tar.gz in $dest_dir"
+ else
+ tar zcvf ${name}.tar.gz ${name} >/dev/null 2>&1
+ fi
+
+ if [ $? -ne 0 ]; then
+ echo "ERROR: Creating archive for ${name} in $dest_dir" >&2
+ exit 1
+ fi
+
+ echo "$dest_dir/${name}.tar.gz" >&2
+
+ if [ $RM == true ]; then
+ rm -rf ${name}
+ fi
+ fi
+}
+
+OPTS=`getopt -o vhnt:d:caN --long verbose,dry-run,help,package-type:,destination-dir,create-folder,no-remove-files,archive,nsd,vendor:,interface-type:,vcpu:,memory:,storage:,image:,cloud-init-file:,cloud-init:,interfaces:,debug -n $SCRIPTNAME -- "$@"`
+
+if [ $? != 0 ] ; then
+ echo "ERROR: Failed parsing options ($?)." >&2
+ usage
+ exit 1
+fi
+
+#echo "$OPTS"
+eval set -- "$OPTS >/dev/null 2>&1"
+
+while true; do
+ case "$1" in
+ -v | --verbose ) VERBOSE=true; shift ;;
+ -h | --help ) usage; exit 0; shift ;;
+ -n | --dry-run ) DRY_RUN=true; shift ;;
+ -t | --package-type ) check_type "$2"; shift; shift ;;
+ -d | --destination-dir ) DEST_DIR=$2; shift; shift;;
+ -c | --create-folder ) CREATE=true; shift;;
+ -N | --no-remove-files ) RM=''; shift;;
+ -a | --archive ) ARCHIVE=true; shift;;
+ --nsd ) CREATE_NSD=true; shift;;
+ --vendor ) VENDOR=$2; shift; shift;;
+ --interface-type ) INTF_TYPE=$2; shift; shift;;
+ --vcpu ) VCPU=$2; shift; shift;;
+ --memory ) MEMORY=$2; shift; shift;;
+ --storage ) STORAGE=$2; shift; shift;;
+ --image ) IMAGE=$2; shift; shift;;
+ --cloud-init ) CLOUD_INIT=$2; shift; shift;;
+ --cloud-init-file ) CLOUD_INIT_FILE=$2; shift; shift;;
+ --interfaces ) INTERFACES=$2; shift; shift;;
+ --debug ) DEBUG=true; shift;;
+ -- ) shift; break ;;
+ * ) break ;;
+ esac
+done
+
+if [ $DEBUG == true ]; then
+ echo "INFO: Debugging ON"
+ set -x
+fi
+
+if [ $VERBOSE == true ]; then
+ echo "INFO: Descriptor type: $TYPE"
+fi
+
+# Dry run is to validate existing descriptor folders
+if [ $DRY_RUN == true ] && [ $CREATE == true ]; then
+ echo "ERROR: Option dry-run with create-folders not supported!" >&2
+ exit 1
+fi
+
+if [ $# -gt 1 ]; then
+ BASE_DIR=$1
+ PKG=$(basename $2)
+else
+ BASE_DIR=$(dirname $1)
+ PKG=$(basename $1)
+fi
+
+if [ $VERBOSE == true ]; then
+ echo "INFO: Using base dir: $BASE_DIR"
+fi
+
+if [ $VERBOSE == true ]; then
+ echo "INFO: Using package: $PKG"
+fi
+
+if [[ -z "$PKG" ]]; then
+ echo "ERROR: Need to specify the package name" >&2
+ usage >&2
+ exit 1
+fi
+
+if [[ ! -d $BASE_DIR ]]; then
+ if [ $CREATE == true ]; then
+ mkdir -p $BASE_DIR
+ if [ $? -ne 0 ]; then
+ echo "ERROR: Unable to create base directory $BASE_DIR" >&2
+ exit 1
+ fi
+ fi
+fi
+cd $BASE_DIR
+if [ $? -ne 0 ]; then
+ echo "ERROR: Unable to change to base directory $BASE_DIR!" >&2
+ exit 1
+fi
+
+# Get full base dir path
+BASE_DIR=`pwd`
+cd $cur_dir
+
+if [[ -z $DEST_DIR ]]; then
+ DEST_DIR=$BASE_DIR # Default to base directory
+fi
+
+mkdir -p $DEST_DIR
+
+cd $DEST_DIR
+if [ $? -ne 0 ]; then
+ echo "ERROR: Not able to access destination directory $DEST_DIR!" >&2
+ exit 1
+fi
+
+# Get the full destination dir path
+DEST_DIR=`pwd`
+cd $cur_dir
+
+dir=${BASE_DIR}/${PKG}
+
+function add_chksum() {
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Add file $1 to $CHKSUM"
+ fi
+
+ md5sum $1 >> $CHKSUM
+}
+
+if [ $CREATE == false ]; then
+ if [ ! -d $dir ]; then
+ echo "INFO: Package folder $dir not found!" >&2
+ exit 1
+ fi
+
+ cd $dir
+ if [ $? -ne 0 ]; then
+ rc=$?
+ echo "ERROR: changing directory to $dir ($rc)" >&2
+ exit $rc
+ fi
+
+ # Remove checksum file, if present
+ rm -f $CHKSUM
+
+ # Check if the descriptor file is present
+ if [[ -z $TYPE ]]; then
+ # Desc type not specified, look for the desc file and guess the type
+ # Required for backward compatibility
+ for ty in ${DESC_TYPES[@]}; do
+ re=$(get_expr false "$ty" "*_$ty" "*_${ty}_*")
+ desc=$(find * -maxdepth 0 -type f $re 2>/dev/null)
+
+ if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
+ # Check the vnfd|nsd folder
+ if [ ! -d $ty ]; then
+ continue
+ fi
+ re=$(get_expr false "*")
+ desc=$(find $ty/* -maxdepth 0 -type f $re 2>/dev/null)
+ if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
+ continue
+ elif [ ${#desc[@]} -gt 1 ]; then
+ echo "ERROR: Found multiple descriptor files: ${desc[@]}" >&2
+ exit 1
+ fi
+ # Descriptor sub directory
+ desc_sub_dir=$ty
+ fi
+
+ TYPE=$ty
+ if [ $TYPE == 'nsd' ]; then
+ folders=("${NSD_FOLDERS[@]}")
+ else
+ folders=("${VNFD_FOLDERS[@]}")
+ fi
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Determined descriptor is of type $TYPE"
+ fi
+ break
+ done
+
+ if [[ -z $TYPE ]]; then
+ echo "ERROR: Unable to determine the descriptor type!" >&2
+ exit 1
+ fi
+ else
+ if [ $TYPE == 'nsd' ]; then
+ folders=("${NSD_FOLDERS[@]}")
+ else
+ folders=("${VNFD_FOLDERS[@]}")
+ fi
+
+ # Check for descriptor of type provided on command line
+ re=$(get_expr false "$TYPE" "*_${TYPE}" "*_${TYPE}_*")
+ desc=$(find * -maxdepth 0 -type f $re 2>/dev/null)
+
+ if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
+ # Check if it is under vnfd/nsd subdirectory
+ # Backward compatibility support
+ re=$(get_expr false "*")
+ desc=$(find $TYPE/* -maxdepth 0 -type f $re 2>/dev/null)
+ if [[ -z $desc ]] || [ ${#desc[@]} -eq 0 ]; then
+ echo "ERROR: Did not find descriptor file of type $TYPE" \
+ " in $dir" >&2
+ exit 1
+ fi
+ desc_sub_dir=$ty
+ fi
+ fi
+
+ if [ ${#desc[@]} -gt 1 ]; then
+ echo "ERROR: Found multiple files of type $TYPE in $dir: $desc" >&2
+ exit 1
+ fi
+
+ descriptor=${desc[0]}
+
+ # Check if there are files not supported
+ files=$(find * -maxdepth 0 -type f ! -name $descriptor 2>/dev/null)
+
+ for f in ${files[@]}; do
+ if [ $(contains "${ALLOWED_FILES[@]}" $f) == "n" ]; then
+ echo "WARN: Unsupported file $f found"
+ fi
+ done
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Found descriptor package: ${desc_sub_dir} ${descriptor}"
+ fi
+
+ if [ $DRY_RUN == false ]; then
+ add_chksum ${descriptor}
+ fi
+
+ # Check the folders are supported ones
+ dirs=$( find * -maxdepth 0 -type d )
+
+ for d in ${dirs[@]}; do
+ if [ $(contains "${folders[@]}" $d) == "y" ]; then
+ if [ $DRY_RUN == false ]; then
+ find $d/* -type f 2>/dev/null|
+ while read file; do
+ add_chksum $file
+ done
+ fi
+ elif [[ -z $desc_sub_dir ]] || [ $d != $desc_sub_dir ]; then
+ echo "WARN: $d is not part of standard folders " \
+ "for descriptor type $TYPE in $PKG"
+ fi
+ done
+
+ if [ $VERBOSE == true ]; then
+ echo "INFO: Creating archive for $PKG"
+ fi
+
+ cd $BASE_DIR
+ if [ $DRY_RUN == false ]; then
+ if [ $VERBOSE == true ]; then
+ tar zcvf "$DEST_DIR/$PKG.tar.gz" "${PKG}" ${RM}
+ else
+ #tar zcvf ${name}.tar.gz ${name} >/dev/null 2>&1
+ tar zcvf "$DEST_DIR/$PKG.tar.gz" "${PKG}" ${RM} > /dev/null 2>&1
+ fi
+ if [ $? -ne 0 ]; then
+ rc=$?
+ echo "ERROR: creating archive for $PKG ($rc)" >&2
+ exit $rc
+ fi
+ fi
+else
+ # Create, default to VNFD if no type is defined
+ if [[ -z $TYPE ]]; then
+ TYPE=vnfd
+ if [ $VERBOSE == true ]; then
+ echo "WARNING: Defaulting to descriptor type $TYPE"
+ fi
+ fi
+
+ if [ $TYPE == 'vnfd' ]; then
+ if [[ -z $IMAGE ]]; then
+ echo "ERROR: Image file need to be specified for VNF"
+ exit 1
+ fi
+ generate_package vnfd $PKG $DEST_DIR
+ fi
+
+ if [ $TYPE == 'nsd' -o $CREATE_NSD == true ]; then
+ generate_package nsd $PKG $DEST_DIR
+ fi
+
+fi
+
+cd $cur_dir
--- /dev/null
+#
+# 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
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: VyOS
+ name: VyOS
+ short-name: VyOS
+ description: VyOS Router
+ logo: osm_2x.png
+ mgmt-interface:
+ vdu-id: VyOS-VM
+ vnf-configuration:
+ config-attributes:
+ config-delay: '0'
+ config-priority: '1'
+ service-primitive:
+ - name: config
+ parameter:
+ - name: user
+ data-type: STRING
+ mandatory: 'true'
+ default-value: vyos
+ - name: pass
+ data-type: STRING
+ mandatory: 'true'
+ default-value: vyos
+ - name: ping
+ parameter:
+ - name: destination
+ data-type: STRING
+ mandatory: 'true'
+ - name: count
+ data-type: INTEGER
+ mandatory: 'false'
+ default-value: 5
+ initial-config-primitive:
+ - name: config
+ parameter:
+ - name: hostname
+ value: <rw_mgmt_ip>
+ - name: pass
+ value: vyos
+ seq: '1'
+ juju:
+ charm: vyos-proxy
+ connection-point:
+ - name: eth0
+ type: VPORT
+ - name: eth1
+ type: VPORT
+ - name: eth2
+ type: VPORT
+ - name: eth3
+ type: VPORT
+ - name: eth4
+ type: VPORT
+ vdu:
+ - id: VyOS-VM
+ name: VyOS-VM
+ description: VyOS-VM
+ image: /mnt/powervault/virtualization/osm/VyOS/VyOS-1.1.7-signed-disk1.qcow2
+ vm-flavor:
+ memory-mb: '1024'
+ storage-gb: '40'
+ vcpu-count: '1'
+ mgmt-vpci: 0000:00:0a.0
+ external-interface:
+ - name: eth0
+ virtual-interface:
+ bandwidth: '0'
+ type: OM-MGMT
+ vpci: 0000:00:0a.0
+ vnfd-connection-point-ref: eth0
+ - name: eth1
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0b.0
+ vnfd-connection-point-ref: eth1
+ - name: eth2
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0c.0
+ vnfd-connection-point-ref: eth2
+ - name: eth3
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0d.0
+ vnfd-connection-point-ref: eth3
+ - name: eth4
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0e.0
+ vnfd-connection-point-ref: eth4
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ cpu-thread-pinning-policy: PREFER
+ mempage-size: LARGE
+ numa-node-policy:
+ mem-policy: STRICT
+ node:
+ - id: '0'
+ paired-threads:
+ num-paired-threads: '1'
+ node-cnt: '1'
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: cirros_vnfd
+ name: cirros_vnf
+ short-name: cirros_vnf
+ description: Simple VNF example with a cirros
+ vendor: OSM
+ version: '1.0'
+
+ # Place the logo as png in icons directory and provide the name here
+ logo: cirros-64.png
+
+ # Management interface
+ mgmt-interface:
+ vdu-id: cirros_vnfd-VM
+
+ # Atleast one VDU need to be specified
+ vdu:
+ - id: cirros_vnfd-VM
+ name: cirros_vnfd-VM
+ description: cirros_vnfd-VM
+ 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: 256
+ storage-gb: 2
+
+ # Image/checksum or image including the full path
+ image: 'CirrOS 0.3.4 64-bit'
+ #checksum:
+
+ external-interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ virtual-interface:
+ type: OM-MGMT
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ vnfd-connection-point-ref: eth0
+
+ connection-point:
+ - name: eth0
+ type: VPORT
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: IMS-ALLIN1_2p
+ name: IMS-ALLIN1_2p
+ short-name: IMS-ALLIN1_2p
+ description: IMS-ALLIN1_2p
+ logo: metaswitch_2x.png
+ mgmt-interface:
+ vdu-id: IMS-ALLIN1_2p-VM
+ vnf-configuration:
+ config-attributes:
+ config-delay: '0'
+ config-priority: '1'
+ service-primitive:
+ - name: config
+ parameter:
+ - name: home_domain
+ data-type: STRING
+ mandatory: 'true'
+ default-value: ims.com
+ - name: password
+ data-type: string
+ mandatory: 'true'
+ default-value: cw-aio
+ - name: create-update-user
+ parameter:
+ - name: number
+ data-type: STRING
+ mandatory: 'true'
+ - name: password
+ data-type: STRING
+ mandatory: 'true'
+ - name: delete-user
+ parameter:
+ - name: number
+ data-type: STRING
+ mandatory: 'true'
+ initial-config-primitive:
+ - name: config
+ parameter:
+ - name: proxied_ip
+ value: <rw_mgmt_ip>
+ seq: '1'
+ juju:
+ charm: clearwater-aio-proxy
+ connection-point:
+ - name: eth0
+ type: VPORT
+ - name: eth1
+ type: VPORT
+ vdu:
+ - id: IMS-ALLIN1_2p-VM
+ name: IMS-ALLIN1_2p-VM
+ description: IMS-ALLIN1_2p-VM
+ image: /mnt/powervault/virtualization/vnfs/demos/mwc2016/allin1.qcow2
+ vm-flavor:
+ memory-mb: '4096'
+ storage-gb: '10'
+ vcpu-count: '2'
+ mgmt-vpci: 0000:00:0a.0
+ external-interface:
+ - name: eth0
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0a.0
+ vnfd-connection-point-ref: eth0
+ - name: eth1
+ virtual-interface:
+ bandwidth: '0'
+ type: OM-MGMT
+ vpci: 0000:00:0b.0
+ vnfd-connection-point-ref: eth1
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ cpu-thread-pinning-policy: PREFER
+ mempage-size: LARGE
+ numa-node-policy:
+ mem-policy: STRICT
+ node:
+ - id: '0'
+ paired-threads:
+ num-paired-threads: '1'
+ node-cnt: '1'
--- /dev/null
+#
+# 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 ?= ../..
+
+VNFD_CHARM = pingpong
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
--- /dev/null
+#cloud-config
+password: fedora
+chpasswd: { expire: False }
+ssh_pwauth: True
--- /dev/null
+#
+# 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.
+#
+#
+
+vnfd:vnfd-catalog:
+ vnfd:vnfd:
+ - id: rift_ping_vnf
+ name: ping_vnf
+ short-name: ping_vnf
+ logo: rift_logo.png
+ vendor: RIFT.io
+ version: '1.1'
+ description: This is an example RIFT.ware VNF
+ connection-point:
+ - name: ping_vnfd/cp0
+ type: VPORT
+ - name: ping_vnfd/cp1
+ type: VPORT
+ http-endpoint:
+ - path: api/v1/ping/stats
+ polling_interval_secs: '2'
+ port: '18888'
+ mgmt-interface:
+ dashboard-params:
+ path: api/v1/ping/stats
+ port: '18888'
+ port: '18888'
+ vdu-id: iovdu_0
+ placement-groups:
+ - member-vdus:
+ - member-vdu-ref: iovdu_0
+ name: Eris
+ requirement: Place this VM on the Kuiper belt object Eris
+ strategy: COLOCATION
+ vdu:
+ - cloud-init-file: ping_cloud_init.cfg
+ count: '1'
+ external-interface:
+ - name: eth0
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: ping_vnfd/cp0
+ - name: eth1
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: ping_vnfd/cp1
+ id: iovdu_0
+ image: Fedora-x86_64-20-20131211.1-sda-ping.qcow2
+ name: iovdu_0
+ vm-flavor:
+ memory-mb: '512'
+ storage-gb: '4'
+ vcpu-count: '1'
+ vnf-configuration:
+ config-attributes:
+ config-delay: 10
+ service-primitive:
+ - name: start
+ - name: stop
+ - name: restart
+ - name: config
+ parameter:
+ - data-type: STRING
+ default-value: <rw_mgmt_ip>
+ name: ssh-hostname
+ - data-type: STRING
+ default-value: fedora
+ name: ssh-username
+ - data-type: STRING
+ default-value: fedora
+ name: ssh-password
+ - data-type: STRING
+ name: ssh-private-key
+ - data-type: STRING
+ default-value: ping
+ name: mode
+ read-only: 'true'
+ - name: set-server
+ parameter:
+ - data-type: STRING
+ name: server-ip
+ - data-type: INTEGER
+ name: server-port
+ - name: set-rate
+ parameter:
+ - data-type: INTEGER
+ default-value: '5'
+ name: rate
+ - name: start-traffic
+ - name: stop-traffic
+ initial-config-primitive:
+ - name: config
+ parameter:
+ - name: ssh-hostname
+ value: <rw_mgmt_ip>
+ - name: ssh-username
+ value: fedora
+ - name: ssh-password
+ value: fedora
+ - name: mode
+ value: ping
+ seq: '1'
+ - name: start
+ seq: '2'
+ juju:
+ charm: pingpong
--- /dev/null
+#
+# 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 ?= ../..
+
+VNFD_CHARM = pingpong
+include $(DESCRIPTORS_TOPDIR)/mk/pkg.mk
+
+all: $(BUILD_DIR)/$(PKG_NAME)
--- /dev/null
+#cloud-config
+password: fedora
+chpasswd: { expire: False }
+ssh_pwauth: True
--- /dev/null
+#
+# 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.
+#
+#
+
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: rift_pong_vnf
+ name: pong_vnf
+ short-name: pong_vnf
+ logo: rift_logo.png
+ vendor: RIFT.io
+ version: '1.1'
+ description: This is an example RIFT.ware VNF
+ connection-point:
+ - name: pong_vnfd/cp0
+ type: VPORT
+ - name: pong_vnfd/cp1
+ type: VPORT
+ http-endpoint:
+ - path: api/v1/pong/stats
+ polling_interval_secs: '2'
+ port: '18889'
+ mgmt-interface:
+ dashboard-params:
+ path: api/v1/pong/stats
+ port: '18889'
+ port: '18889'
+ vdu-id: iovdu_0
+ placement-groups:
+ - member-vdus:
+ - member-vdu-ref: iovdu_0
+ name: Weywot
+ requirement: Place this VM on the Kuiper belt object Weywot
+ strategy: COLOCATION
+ vdu:
+ - cloud-init-file: pong_cloud_init.cfg
+ count: '1'
+ external-interface:
+ - name: eth0
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: pong_vnfd/cp0
+ - name: eth1
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: pong_vnfd/cp1
+ id: iovdu_0
+ image: Fedora-x86_64-20-20131211.1-sda-pong.qcow2
+ name: iovdu_0
+ vm-flavor:
+ memory-mb: '512'
+ storage-gb: '4'
+ vcpu-count: '1'
+ vnf-configuration:
+ config-attributes:
+ config-delay: 10
+ service-primitive:
+ - name: start
+ - name: stop
+ - name: restart
+ - name: config
+ parameter:
+ - data-type: STRING
+ default-value: <rw_mgmt_ip>
+ name: ssh-hostname
+ - data-type: STRING
+ default-value: fedora
+ name: ssh-username
+ - data-type: STRING
+ default-value: fedora
+ name: ssh-password
+ - data-type: STRING
+ name: ssh-private-key
+ - data-type: STRING
+ default-value: pong
+ name: mode
+ read-only: 'true'
+ - name: set-server
+ parameter:
+ - data-type: STRING
+ name: server-ip
+ - data-type: INTEGER
+ name: server-port
+ - name: start-traffic
+ - name: stop-traffic
+ initial-config-primitive:
+ - name: config
+ parameter:
+ - name: ssh-hostname
+ value: <rw_mgmt_ip>
+ - name: ssh-username
+ value: fedora
+ - name: ssh-password
+ value: fedora
+ - name: mode
+ value: pong
+ seq: '1'
+ - name: start
+ seq: '2'
+ juju:
+ charm: pingpong
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - connection-point:
+ - name: mgmt0
+ type: VPORT
+ - name: west
+ type: VPORT
+ description: A simple VNF descriptor w/ VM1 and VM2
+ id: Ref_Vnf_11
+ name: Ref_VNF_11
+ short-name: Ref_VNF_11
+ internal-vld:
+ - description: Internal VL
+ id: VL12
+ name: VL12
+ short-name: VL12
+ type: ELAN
+ vendor: ETSI
+ internal-connection-point:
+ - id-ref: 'iface11'
+ - id-ref: 'iface21'
+ vdu:
+ - external-interface:
+ - name: iface10
+ virtual-interface:
+ type: OM-MGMT
+ vnfd-connection-point-ref: mgmt0
+ internal-interface:
+ - name: iface11
+ virtual-interface:
+ type: VIRTIO
+ vdu-internal-connection-point-ref: iface11
+ internal-connection-point:
+ - name: iface11
+ id: iface11
+ type: VPORT
+ id: Ref_VM1
+ image: ref_vm1.qcow2
+ name: Ref_VM1
+ vm-flavor:
+ memory-mb: '2048'
+ storage-gb: '8'
+ vcpu-count: '2'
+ - external-interface:
+ - name: iface22
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: west
+ internal-interface:
+ - name: iface21
+ virtual-interface:
+ type: VIRTIO
+ vdu-internal-connection-point-ref: iface21
+ internal-connection-point:
+ - name: iface21
+ id: iface21
+ type: VPORT
+ id: Ref_VM2
+ image: ref_vm2.qcow2
+ name: Ref_VM2
+ vm-flavor:
+ memory-mb: '4096'
+ storage-gb: '16'
+ vcpu-count: '2'
+ vendor: ETSI
+ version: '1.0'
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - connection-point:
+ - name: mgmt0
+ type: VPORT
+ - name: west
+ type: VPORT
+ - name: east
+ type: VPORT
+ description: A simple VNF descriptor w/ two VDU
+ id: Ref_Vnf_12
+ name: Ref_Vnf_12
+ short-name: Ref_Vnf_12
+ internal-vld:
+ - description: Internal VL
+ id: VL34
+ name: VL34
+ short-name: VL34
+ type: ELAN
+ vendor: ETSI
+ internal-connection-point:
+ - id-ref: 'iface31'
+ - id-ref: 'iface41'
+ vdu:
+ - description: Middlepoint
+ external-interface:
+ - name: iface30
+ virtual-interface:
+ type: OM-MGMT
+ vnfd-connection-point-ref: mgmt0
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ mempage-size: "LARGE"
+ id: a3a2f
+ image: ref_vm3.qcow2
+ internal-connection-point:
+ - id: iface31
+ name: iface31
+ type: VPORT
+ internal-interface:
+ - name: iface31
+ vdu-internal-connection-point-ref: iface31
+ virtual-interface:
+ type: VIRTIO
+ name: Ref_VM3
+ vm-flavor:
+ memory-mb: '2048'
+ storage-gb: '8'
+ vcpu-count: '2'
+ - external-interface:
+ - name: iface42
+ virtual-interface:
+ type: PCI-PASSTHROUGH
+ vnfd-connection-point-ref: west
+ - name: iface43
+ virtual-interface:
+ type: SR-IOV
+ vnfd-connection-point-ref: east
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ id: e526e
+ internal-connection-point:
+ - id: iface41
+ name: iface41
+ type: VPORT
+ name: Ref_VM4
+ internal-interface:
+ - name: iface41
+ vdu-internal-connection-point-ref: iface41
+ virtual-interface:
+ type: VIRTIO
+ vendor: ETSI
+ version: '1.0'
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - connection-point:
+ - name: mgmt
+ type: VPORT
+ - name: data
+ type: VPORT
+ description: A simple VNF descriptor w/ one VDU
+ id: Ref_Vnf_21
+ name: Ref_Vnf_21
+ short-name: Ref_Vnf_21
+ vdu:
+ - external-interface:
+ - name: iface50
+ virtual-interface:
+ type: OM-MGMT
+ vnfd-connection-point-ref: mgmt
+ - name: iface51
+ virtual-interface:
+ type: VIRTIO
+ vnfd-connection-point-ref: data
+ id: ref_vm21
+ image: ref_vm21.qcow2
+ name: Ref_VM_5
+ vm-flavor:
+ memory-mb: '1024'
+ storage-gb: '16'
+ vcpu-count: '1'
+ vendor: ETSI
+ version: '1.0'
--- /dev/null
+#
+# 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)
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - connection-point:
+ - name: mgmt
+ type: VPORT
+ - name: west
+ type: VPORT
+ - name: east
+ type: VPORT
+ description: A simple VNF descriptor w/ one VDU
+ id: Ref_Vnf_22
+ name: Ref_VNF_22
+ short-name: Ref_VNF_22
+ vdu:
+ - external-interface:
+ - name: iface60
+ virtual-interface:
+ type: OM-MGMT
+ vnfd-connection-point-ref: mgmt
+ - name: iface61
+ virtual-interface:
+ type: PCI-PASSTHROUGH
+ vnfd-connection-point-ref: west
+ - name: iface62
+ virtual-interface:
+ type: SR-IOV
+ vnfd-connection-point-ref: east
+ id: abd6831e-f811-4580-9aad-1de9c6424180
+ image: ref_vm22.qcow2
+ name: Ref_VM6
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ mempage-size: "LARGE"
+ vm-flavor:
+ memory-mb: '1024'
+ storage-gb: '16'
+ vcpu-count: '1'
+ vendor: ETSI
+ version: '1.0'
--- /dev/null
+#
+# 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)
--- /dev/null
+#cloud-config
+password: ubuntu
+chpasswd: { expire: False }
+ssh_pwauth: True
+
--- /dev/null
+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
--- /dev/null
+#
+# 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)
--- /dev/null
+#cloud-config
+password: ubuntu
+chpasswd: { expire: False }
+ssh_pwauth: True
+
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: ubuntu_xenial_vnfd
+ name: ubuntu_xenial_vnf
+ short-name: ubuntu_xenial_vnf
+ 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: ubuntu-logo14.png
+
+ # Management interface
+ mgmt-interface:
+ vdu-id: ubuntu_xenial_vnfd-VM
+
+ # Atleast one VDU need to be specified
+ vdu:
+ - id: ubuntu_xenial_vnfd-VM
+ name: ubuntu_xenial_vnfd-VM
+ description: ubuntu_xenial_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
+
+ # 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
+ - name: eth0
+ virtual-interface:
+ type: OM-MGMT
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ vnfd-connection-point-ref: eth0
+
+ connection-point:
+ - name: eth0
+ type: VPORT
--- /dev/null
+deps/
+builds/
--- /dev/null
+FROM ubuntu:16.04
+
+RUN apt-get update && apt install -y charm-tools
+
BUILD_DIR = .
-CHARMS:= vpe-router vyos-proxy pingpong flownac sandvine-pts-proxy
+CHARMS:= pingpong vyos-proxy netutils
CHARM_SRC_DIR := layers
CHARM_BUILD_DIR := $(BUILD_DIR)/builds
CHARM_SRC_DIRS := $(addprefix $(CHARM_SRC_DIR)/, $(CHARMS))
CHARM_BUILD_DIRS := $(addprefix $(CHARM_BUILD_DIR)/, $(CHARMS))
+CHARM_DOCKER_TAG := charm-tools
all: $(CHARM_BUILD_DIRS)
-@ $(RM) -rf $(CHARM_BUILD_DIR)
$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
- charm-build -o $(BUILD_DIR) $<
+ docker build -t $(CHARM_DOCKER_TAG) .
+ docker run -u $$(id -u):$$(id -g) -v$$(pwd):$$(pwd) -w$$(pwd) $(CHARM_DOCKER_TAG) charm-build -o $(BUILD_DIR) $<