--- /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
On Fedora, install using: pip install charm-tools
On Ubuntu, install using: apt install charm-tools
For other platforms, check https://jujucharms.com/docs/2.0/tools-charm-tools
+You need also docker
Due to license issues, for the IMS VNFD package, the IMS charm is fetched
extracted from the respective git repository prior to packaging. Because of
--- /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
+DOCKER_BUILD ?=
+
+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
+ $(Q)mkdir -p $@
+ $(Q)cp -rf $</. $@
+ $(Q)$(GEN_VNFD_PKG) $< $@
+else
+$(BUILD_DIR)/$(PKG_BASE_NAME): src
+ $(Q)mkdir -p $@
+ $(Q)cp -rf $</. $@
+ $(Q)$(GEN_NSD_PKG) $< $@
+endif
+
+ifdef VNFD_CHARM
+$(BUILD_DIR)/$(PKG_NAME): $(DEP_FILES) $(CHARM_BUILD_DIR)/$(VNFD_CHARM)
+ $(Q)echo "building $(PKG_BASE_NAME) with charm $(VNFD_CHARM)"
+ $(Q)$(MAKE) --no-print-directory $(BUILD_DIR)/$(PKG_BASE_NAME)
+ $(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): $(DEP_FILES)
+ $(Q)echo "building $(PKG_BASE_NAME) $(BUILD_DIR)"
+ $(Q)$(MAKE) --no-print-directory $(BUILD_DIR)/$(PKG_BASE_NAME)
+ $(Q)$(GEN_PKG) --no-remove-files -d $(BUILD_DIR) $(BUILD_DIR)/$(PKG_BASE_NAME)
+endif
+
+ifdef DOCKER_BUILD
+$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
+ $(Q)docker build -q -t $(CHARM_DOCKER_TAG) $(CHARM_DIR)/.
+ $(CHARM_DIR) $(CHARM_DOCKER_TAG) charm-build -o $(CHARM_DIR) $<
+else
+$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
+ $(Q)charm-build -o $(CHARM_DIR) $<
+endif
+
+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
+ mgmt-network: 'true'
+ 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
+ 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
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: cirros_vnfd
+ vnfd-connection-point-ref: eth0
+ - member-vnf-index-ref: 2
+ vnfd-id-ref: cirros_vnfd
+ 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_noportsecurity_2vnf_nsd
+ name: cirros_noportsecurity_2vnf_ns
+ short-name: cirros_noportsecurity_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_noportsecurity_vnfd
+ - member-vnf-index: 2
+ vnfd-id-ref: cirros_noportsecurity_vnfd
+
+
+ vld:
+ # Networks for the VNFs
+ - id: cirros_2vnf_nsd_vld1
+ name: cirros_2vnf_nsd_vld1
+ short-name: cirros_2vnf_nsd_vld1
+ 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: cirros_noportsecurity_vnfd
+ nsd:vnfd-connection-point-ref: eth0
+ - nsd:member-vnf-index-ref: 2
+ nsd:vnfd-id-ref: cirros_noportsecurity_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
+ 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
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: cirros_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: cirros_set_vim_network_ns
+ name: cirros_set_vim_network_ns
+ short-name: cirros_set_vim_network_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
+ mgmt-network: 'true'
+ # vim-network-name: <update>
+ # provider-network:
+ # overlay-type: VLAN
+ # segmentation_id: <update>
+ vim-network-name: mgmt
+ 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:nsd:
+ - nsd:constituent-vnfd:
+ - nsd:member-vnf-index: '1'
+ nsd:start-by-default: 'true'
+ nsd:vnfd-id-ref: dns_forwarder
+ nsd:id: dns_forwarder_ns
+ nsd:logo: dns.jpg
+ nsd:name: dns_forwarder_ns
+ nsd:vld:
+ - nsd:id: management
+ nsd:mgmt-network: 'true'
+ nsd:name: management
+ nsd:vim-network-name: subnet-8a91b2c0
+ nsd:vnfd-connection-point-ref:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-connection-point-ref: eth0
+ nsd:vnfd-id-ref: dns_forwarder
+ rw-nsd:meta: '{"containerPositionMap":{"1":{"top":210.5,"left":248,"right":498,"bottom":265.5,"width":250,"height":55},"ada27681-7f3e-4768-8be8-41973f849066":{"top":30,"left":135,"right":385,"bottom":85,"width":250,"height":55},"vld-1":{"top":60,"left":495,"right":745,"bottom":98,"width":250,"height":38},"management":{"top":90,"left":480,"right":730,"bottom":128,"width":250,"height":38}}}'
--- /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
+ mgmt-network: 'true'
+ 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:
+ - id: rift_ping_pong_ns
+ logo: rift_logo.png
+ name: ping_pong_ns
+ short-name: ping_pong_ns
+ vendor: RIFT.io
+ version: '1.1'
+ description: RIFT.io sample ping pong network service
+ constituent-vnfd:
+ - member-vnf-index: '1'
+ vnfd-id-ref: rift_ping_vnf
+ - member-vnf-index: '2'
+ vnfd-id-ref: rift_pong_vnf
+ initial-service-primitive:
+ - name: start traffic
+ parameter:
+ - name: port
+ value: 5555
+ - name: ssh-username
+ value: fedora
+ - name: ssh-password
+ value: fedora
+ seq: '1'
+ user-defined-script: start_traffic.py
+ input-parameter-xpath:
+ - xpath: /nsd:nsd-catalog/nsd:nsd/nsd:vendor
+ ip-profiles:
+ - description: Inter VNF Link
+ ip-profile-params:
+ gateway-address: 31.31.31.210
+ ip-version: ipv4
+ subnet-address: 31.31.31.0/24
+ dhcp-params:
+ count: 200
+ start-address: 31.31.31.2
+ name: InterVNFLink
+ placement-groups:
+ - member-vnfd:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: rift_ping_vnf
+ - member-vnf-index-ref: '2'
+ vnfd-id-ref: rift_pong_vnf
+ name: Orcus
+ requirement: Place this VM on the Kuiper belt object Orcus
+ strategy: COLOCATION
+ - member-vnfd:
+ - member-vnf-index-ref: '1'
+ vnfd-id-ref: rift_ping_vnf
+ - member-vnf-index-ref: '2'
+ vnfd-id-ref: rift_pong_vnf
+ name: Quaoar
+ requirement: Place this VM on the Kuiper belt object Quaoar
+ strategy: COLOCATION
+ vld:
+ - id: mgmt_vl
+ description: Management VL
+ name: mgmt_vl
+ short-name: mgmt_vl
+ vim-network-name: mgmt
+ type: ELAN
+ vendor: RIFT.io
+ version: '1.0'
+ mgmt-network: 'true'
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: ping_vnfd/cp0
+ vnfd-id-ref: rift_ping_vnf
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: pong_vnfd/cp0
+ vnfd-id-ref: rift_pong_vnf
+ - id: ping_pong_vl1
+ description: Data VL
+ ip-profile-ref: InterVNFLink
+ name: data_vl
+ short-name: data_vl
+ type: ELAN
+ vendor: RIFT.io
+ version: '1.0'
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: '1'
+ vnfd-connection-point-ref: ping_vnfd/cp1
+ vnfd-id-ref: rift_ping_vnf
+ - member-vnf-index-ref: '2'
+ vnfd-connection-point-ref: pong_vnfd/cp1
+ 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
+ mgmt-network: 'true'
+ 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'
+ mgmt-network: 'true'
+ 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
+ mgmt-network: 'true'
+ 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:nsd:
+ - nsd:constituent-vnfd:
+ - nsd:member-vnf-index: '1'
+ nsd:start-by-default: 'true'
+ nsd:vnfd-id-ref: ubuntu_1iface_cloudinit_newfile_vnfd
+ nsd:id: ubuntu_cloudinit
+ nsd:name: ubuntu_cloudinit
+ nsd:short-name: ubuntu_cloudinit
+ nsd:vld:
+ - nsd:id: mgmt
+ nsd:mgmt-network: 'false'
+ nsd:name: mgmt
+ nsd:short-name: mgmt
+ mgmt-network: 'true'
+ nsd:vnfd-connection-point-ref:
+ - nsd:member-vnf-index-ref: '1'
+ nsd:vnfd-connection-point-ref: eth0
+ nsd:vnfd-id-ref: ubuntu_1iface_cloudinit_newfile_vnfd
--- /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_epa_virtio_ns
+ name: ubuntu_epa_virtio_ns
+ short-name: ubuntu_epa_virtio_ns
+ description: One VNF based on Ubuntu 16.04 with EPA and virtio connected to mgmt
+ vendor: OSM
+ version: '1.0'
+ logo: tef.png
+
+ constituent-vnfd:
+ - member-vnf-index: 1
+ vnfd-id-ref: ubuntu_epa_virtio_vnf
+
+ vld:
+ - id: mgmt
+ name: mgmt
+ short-name: mgmt
+ type: ELAN
+ mgmt-network: 'true'
+ vnfd-connection-point-ref:
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: ubuntu_epa_virtio_vnf
+ 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
+ mgmt-network: 'true'
+ 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
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: ubuntu_xenial_vnfd
+ # NOTE: Validate the entry below
+ 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
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+EOF
+
+ # Add mgmt interface
+ cat >>$desc_file <<EOF
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: '0000:00:0a.0'
+ external-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}
+ type: EXTERNAL
+ virtual-interface:
+ type: ${INTF_TYPE}
+ bandwidth: '0'
+ vpci: '0000:00:${pci}.0'
+ external-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:
+ cp: eth0
+ vnf-configuration:
+ 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
+ interface:
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0a.0
+ external-connection-point-ref: eth0
+ - name: eth1
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0b.0
+ external-connection-point-ref: eth1
+ - name: eth2
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0c.0
+ external-connection-point-ref: eth2
+ - name: eth3
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0d.0
+ external-connection-point-ref: eth3
+ - name: eth4
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0e.0
+ external-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_noportsecurity_vnfd
+ name: cirros_noportsecurity_vnf
+ short-name: cirros_noportsecurity_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:
+ cp: eth0
+
+ # 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:
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ external-connection-point-ref: eth0
+
+ connection-point:
+ - name: eth0
+ type: VPORT
+ port-security-enabled: "false"
--- /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:
+ cp: eth0
+
+ # 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.5-x86_64-disk.img'
+ #checksum:
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ external-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
+#cloud-config
+
+password: c0mpl3xp4ssw0rd
+chpasswd: { expire: False }
+ssh_pwauth: True
+
+write_files:
+- content: |
+ # My new helloworld file
+ sudo apt update
+ sudo apt install dnsmasq -y
+ sudo bash -c 'cat << EOF > /etc/dnsmasq.conf
+ strict-order
+ interface=eth0
+ no-dhcp-interface=eth0
+ EOF'
+ owner: root:root
+ permissions: '0774'
+ path: /tmp/configure_dns
+
+runcmd:
+ - /tmp/configure_dns
+
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:vnfd:
+ - rw-vnfd:meta: '{"containerPositionMap":{"dns_forwarder":{"top":30,"left":260,"right":510,"bottom":85,"width":250,"height":55},"dns_forwarder/dns_forwarder-VM":{"top":130,"left":260,"right":510,"bottom":185,"width":250,"height":55}}}'
+ vnfd:connection-point:
+ - vnfd:name: eth0
+ vnfd:type: VPORT
+ vnfd:description: Simple VNF example with a DNS forwarder
+ vnfd:id: dns_forwarder
+ vnfd:logo: dns.jpg
+ vnfd:mgmt-interface:
+ vnfd:cp: eth0
+ vnfd:name: dns_forwarder
+ vnfd:service-function-chain: UNAWARE
+ vnfd:short-name: dns_forwarder
+ vnfd:vdu:
+ - vnfd:count: '1'
+ vnfd:description: dns_forwarder-VM
+ vnfd:interface:
+ - vnfd:name: eth0
+ vnfd:type: EXTERNAL
+ vnfd:virtual-interface:
+ vnfd:bandwidth: '0'
+ vnfd:type: VIRTIO
+ vnfd:vpci: 0000:00:0a.0
+ vnfd:external-connection-point-ref: eth0
+ vnfd:guest-epa:
+ vnfd:cpu-pinning-policy: ANY
+ vnfd:id: dns_forwarder-VM
+ vnfd:image: ubuntu/images/hvm-ssd/ubuntu-zesty-17.04-amd64-server-20170619.1
+ vnfd:cloud-init-file: cloud_init.cfg
+ vnfd:name: dns_forwarder-VM
+ vnfd:supplemental-boot-data:
+ vnfd:boot-data-drive: 'false'
+ vnfd:vm-flavor:
+ vnfd:memory-mb: '1024'
+ vnfd:storage-gb: '1'
+ vnfd:vcpu-count: '1'
+ vnfd:vendor: OSM
+ vnfd: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:
+ - id: IMS-ALLIN1_2p
+ name: IMS-ALLIN1_2p
+ short-name: IMS-ALLIN1_2p
+ description: IMS-ALLIN1_2p
+ logo: metaswitch_2x.png
+ mgmt-interface:
+ cp: eth1
+ vnf-configuration:
+ 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
+ interface:
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0a.0
+ external-connection-point-ref: eth0
+ - name: eth1
+ type: EXTERNAL
+ virtual-interface:
+ bandwidth: '0'
+ type: VIRTIO
+ vpci: 0000:00:0b.0
+ external-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:
+ - 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
+ port: '18888'
+ mgmt-interface:
+ dashboard-params:
+ path: api/v1/ping/stats
+ port: '18888'
+ port: '18888'
+ cp: ping_vnfd/cp0
+ # 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'
+ interface:
+ - name: eth0
+ position: 0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: ping_vnfd/cp0
+ - name: eth1
+ position: 1
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-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-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
+ port: '18889'
+ mgmt-interface:
+ dashboard-params:
+ path: api/v1/pong/stats
+ port: '18889'
+ port: '18889'
+ cp: pong_vnfd/cp0
+ # 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'
+ interface:
+ - name: eth0
+ position: 0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: pong_vnfd/cp0
+ - name: eth1
+ position: 1
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-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-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
+ mgmt-interface:
+ cp: mgmt0
+ 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:
+ - interface:
+ - name: iface10
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: mgmt0
+ - name: iface11
+ type: INTERNAL
+ virtual-interface:
+ type: VIRTIO
+ 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'
+ - interface:
+ - name: iface22
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: west
+ - name: iface21
+ type: INTERNAL
+ virtual-interface:
+ type: VIRTIO
+ 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
+ mgmt-interface:
+ cp: mgmt0
+ 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
+ interface:
+ - name: iface30
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: mgmt0
+ - name: iface31
+ type: INTERNAL
+ internal-connection-point-ref: iface31
+ virtual-interface:
+ type: VIRTIO
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ mempage-size: "LARGE"
+ id: a3a2f
+ image: ref_vm3.qcow2
+ internal-connection-point:
+ - id: iface31
+ name: iface31
+ type: VPORT
+ name: Ref_VM3
+ vm-flavor:
+ memory-mb: '2048'
+ storage-gb: '8'
+ vcpu-count: '2'
+ - interface:
+ - name: iface42
+ type: EXTERNAL
+ virtual-interface:
+ type: PCI-PASSTHROUGH
+ external-connection-point-ref: west
+ - name: iface43
+ type: EXTERNAL
+ virtual-interface:
+ type: SR-IOV
+ external-connection-point-ref: east
+ - name: iface41
+ type: INTERNAL
+ internal-connection-point-ref: iface41
+ virtual-interface:
+ type: VIRTIO
+ guest-epa:
+ cpu-pinning-policy: DEDICATED
+ id: e526e
+ internal-connection-point:
+ - id: iface41
+ name: iface41
+ type: VPORT
+ name: Ref_VM4
+ 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
+ mgmt-interface:
+ cp: mgmt
+ vdu:
+ - interface:
+ - name: iface50
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: mgmt
+ - name: iface51
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-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
+ mgmt-interface:
+ cp: mgmt
+ vdu:
+ - interface:
+ - name: iface60
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-connection-point-ref: mgmt
+ - name: iface61
+ type: EXTERNAL
+ virtual-interface:
+ type: PCI-PASSTHROUGH
+ external-connection-point-ref: west
+ - name: iface62
+ type: EXTERNAL
+ virtual-interface:
+ type: SR-IOV
+ external-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
+
+# Add public key to the default user's authorized_keys file
+ssh_authorized_keys:
+- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXYVPzII6lwC/hb1PHsgJcf11mYKI1pEeHzcjQ8X8P7YwOj2ihikhy6IRtm38HzP7udMWjQolPUbIzNBmldt8fy6EFkZEpf7R3QziDbqw3FH6wIbQnLpCZWa9OCGRyPyPdBY//K0Ya5b/IBfG4t+KoIVwkJuSG+oYRGhCYhnAwRZ/IUwxhtbNVsS26wN+jGsaUKIWCEBbS5ccFeb9k3eovIFkELNDJVWVJsh2tyGrUd+HQ1+xQGtBUcnipJV75lwL2Z2rprnMIIuVc+A1tTNWArHccLSyfxf2kANy5jGCkwNAH1ETp3r8A5BgoFYd7NSLxK3ob3XycXvYvt/XMrUDP test4
+
+write_files:
+- content: |
+ # My new helloworld file
+
+ owner: root:root
+ permissions: '0644'
+ path: /root/helloworld.txt
+
--- /dev/null
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA12FT8yCOpcAv4W9Tx7ICXH9dZmCiNaRHh83I0PF/D+2MDo9o
+oYpIcuiEbZt/B8z+7nTFo0KJT1GyMzQZpXbfH8uhBZGRKX+0d0M4g26sNxR+sCG0
+Jy6QmVmvTghkcj8j3QWP/ytGGuW/yAXxuLfiqCFcJCbkhvqGERoQmIZwMEWfyFMM
+YbWzVbEtusDfoxrGlCiFghAW0uXHBXm/ZN3qLyBZBCzQyVVlSbIdrchq1Hfh0Nfs
+UBrQVHJ4qSVe+ZcC9mdq6a5zCCLlXPgNbUzVgKx3HC0sn8X9pADcuYxgpMDQB9RE
+6d6/AOQYKBWHezUi8St6G918nF72L7f1zK1AzwIDAQABAoIBAG7mNYS9odWk1MKe
+QSRU+zRHfH8niL5YHWDGy/0SLBu2c+RXYUe0XUOViAKsC0en/SgpRk6fBvapmTkW
+PZJeV9sWTY4Bex5EHFdAbIv4Y4Jk8iqc4BdAucHMVSC334iYDE5U++Umkg1teUd0
+EBfNz05FBx2yTP9XZcrOgfcXWhLwBNmd99+gV6cQB6NF0ZFVm6TLuA7gH3joyipi
+Kfhod7uonFRVXSg6vipXs3+oH6BkpgYxQ5EC9U21q7YS4/H5nyBJDQymf88Lvm0l
+IkZasKC8RKkHJupROyUUrORW0n6ZV5P3jPCtsav/n6QIQStqCniR1SluONHlI/Sm
+qy71VpECgYEA7APuEsSSR/AQtxMp057+jqx6VE+UjIyrtkLBFzHl6GxU4SRz9fIS
+LxvI8fTv3AMpJTIQcf78l8CNBs0lpxOxOhuoFQcwqZsMb/Hg5wdS6r0t6ggKMMhO
+ig0xITzGEW5cVMQ2t3mE1sHP92NT8BTx0eD8nG9b4hxDFujrNOoTMicCgYEA6Z4X
+sIm5LcFRPe/mNhasLxYuh+d5sat20Om2YtNXDA349qQ9e4mC33mKLR1/EVA5dDud
+yvjwOvwvefLEuC/1W8d8AxUaYUMQHtoPB4qG//D/cIGhm3YtvUuaJoXEP0kd47mq
+Pr6Nu/W5b7jO/rCIBOZN6T+h2dxClCLApZ9vrRkCgYEA2+VperkFZdspZ7mGHfKk
+UEApFcazrCQglIcrqrXF9MCCcOZq2Hr7MEMd/TluBbo4Kryzj9K4e5dejjizXTC+
+zloYR8dUMqIQe3iMSBSNz8IFNmjZPcxTSNKztLkP/guqIRxTsqyY9RLM9jzoZubM
+y/RoyEQFAu28IGtRQhLZYb8CgYBF6e8TARRvEgSbMZlGpKBg8xV3zJlJx5OmT9sq
+Vi8dx2yze1F/EBcfhAMLH2Gwr76R/2lonfle3avjpfijWo7mKZv+XClp5CUF5qJK
+0nU2UUxQwiq4GLT1ipOWZb/mZJ5SUXUWk/Zcwtv9CGTCKdh7BuVYIZfxWA6AwKnA
+pydHuQKBgQCMKBFNH0W5bXp+40xmm5CYuvR2hNrDlgjL0g4X4RBYEBcg6yCCq1fo
+gv0OBqNe1L72LWhI6oI2qlKPveN1fdh0jsAvPpQpce/16Y0f7xsl5N3upp+yHHNk
+xruDOG7npSCyHKfcQjDtaHOPKYiQ/3CuXp7OJOvjbNZFf0GJZA9XQA==
+-----END RSA PRIVATE KEY-----
--- /dev/null
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXYVPzII6lwC/hb1PHsgJcf11mYKI1pEeHzcjQ8X8P7YwOj2ihikhy6IRtm38HzP7udMWjQolPUbIzNBmldt8fy6EFkZEpf7R3QziDbqw3FH6wIbQnLpCZWa9OCGRyPyPdBY//K0Ya5b/IBfG4t+KoIVwkJuSG+oYRGhCYhnAwRZ/IUwxhtbNVsS26wN+jGsaUKIWCEBbS5ccFeb9k3eovIFkELNDJVWVJsh2tyGrUd+HQ1+xQGtBUcnipJV75lwL2Z2rprnMIIuVc+A1tTNWArHccLSyfxf2kANy5jGCkwNAH1ETp3r8A5BgoFYd7NSLxK3ob3XycXvYvt/XMrUDP test4
--- /dev/null
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: ubuntu_1iface_cloudinit_newfile_vnfd
+ name: ubuntu_1iface_cloudinit_newfile_vnf
+ short-name: ubuntu_1iface_cloudinit_newfile_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:
+ cp: eth0
+
+ # Atleast one VDU need to be specified
+ vdu:
+ - id: ubuntu_1iface_cloudinit_newfile_vnfd-VM
+ name: ubuntu_1iface_cloudinit_newfile_vnfd-VM
+ description: ubuntu_1iface_cloudinit_newfile_vnfd-VM
+ count: 1
+
+ # Flavour of the VM to be instantiated for the VDU
+ vm-flavor:
+ vcpu-count: 1
+ memory-mb: 1024
+ storage-gb: 10
+
+ # Image including the full path
+ image: 'ubuntu1604'
+
+ # User-data injection
+ cloud-init-file: cloud_init.cfg
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ external-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
+#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:
+ cp: eth0
+
+ # 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
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ external-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
+vnfd:vnfd-catalog:
+ vnfd:
+ - id: ubuntu_epa_virtio_vnf
+ name: ubuntu_epa_virtio_vnf
+ short-name: ubuntu_epa_virtio
+ description: VNF based on Ubuntu 16.04 LTS with EPA, 1 virtio interface and user osm
+ 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:
+ cp: eth0
+
+ # Atleast one VDU need to be specified
+ vdu:
+ - id: ubuntu_epa_virtio_vnf-VM
+ name: ubuntu_epa_virtio_vnf-VM
+ description: ubuntu_epa_virtio_vnf-VM
+ count: 1
+
+ # Flavour of the VM to be instantiated for the VDU
+ vm-flavor:
+ memory-mb: 2048
+ storage-gb: 10
+
+ # Image including the full path
+ image: 'ubuntu1604'
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ external-connection-point-ref: eth0
+ host-epa:
+ om-cpu-model-string: "Intel(R) Xeon(R) CPU E5-4620 0 @ 2.20GHz"
+ om-cpu-feature:
+ - feature: "64b"
+ - feature: "iommu"
+ - feature: "lps"
+ - feature: "tlbps"
+ - feature: "hwsv"
+ - feature: "dioc"
+ - feature: "ht"
+ guest-epa:
+ numa-node-policy:
+ node:
+ - id: 0
+ paired-threads:
+ num-paired-threads: 1
+ mem-policy: "STRICT"
+ node-cnt: 1
+ mempage-size: "LARGE"
+ cpu-pinning-policy: "DEDICATED"
+ cpu-thread-pinning-policy: "PREFER"
+ hypervisor-epa:
+ version: "10002|12001|2.6.32-358.el6.x86_64"
+ type: "REQUIRE_KVM"
+
+ 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:
+ cp: eth0
+
+ # 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
+
+ interface:
+ # Specify the external interfaces
+ # There can be multiple interfaces defined
+ - name: eth0
+ type: EXTERNAL
+ virtual-interface:
+ type: VIRTIO
+ bandwidth: '0'
+ vpci: 0000:00:0a.0
+ external-connection-point-ref: eth0
+
+ connection-point:
+ - name: eth0
+ type: VPORT
export VCA_CONTAINER_IP=`lxc list VCA -c 4|grep eth0 |awk '{print $2}'`
export SO_CONTAINER_IP=`lxc list SO-ub -c 4|grep eth0 |awk '{print $2}'`
export RO_CONTAINER_IP=`lxc list RO -c 4|grep eth0 |awk '{print $2}'`
-
+#export MON_CONTAINER_IP=`lxc list MON -c 4|grep eth0|awk '{print $2}'`
sudo $OSM_DEVOPS/installers/nat_osm
}
+function FATAL(){
+ echo "FATAL error: Cannot install OSM due to \"$1\""
+ exit 1
+}
+
#Update RO, SO and UI:
function update(){
echo -e "\nUpdating components"
echo
}
-function so_is_up(){
+function so_is_up() {
SO_IP=$1
time=0
step=5
timelength=300
while [ $time -le $timelength ]
do
- curl -k https://$SO_IP:8008/api/operational/vcs/info \
- --header 'accept: application/vnd.yang.data+json' \
- --header 'authorization: Basic YWRtaW46YWRtaW4=' \
- --header 'cache-control: no-cache' \
- --header 'content-type: application/vnd.yang.data+json' &> /dev/null
- RET=$?
- if [ "$RET" == 0 ]; then
- break
+ if [[ `curl -k -X GET https://$SO_IP:8008/api/operational/vcs/info \
+ -H 'accept: application/vnd.yang.data+json' \
+ -H 'authorization: Basic YWRtaW46YWRtaW4=' \
+ -H 'cache-control: no-cache' 2> /dev/null | jq '.[].components.component_info[] | select(.component_name=="RW.Restconf")' 2>/dev/null | grep "RUNNING" | wc -l` -eq 1 ]]
+ then
+ echo "RW.Restconf running....SO is up"
+ return 0
fi
+
sleep $step
echo -n "."
time=$((time+step))
done
- if [ "$RET" != 0 ]; then
- FATAL "OSM Failed to startup"
- fi
- echo
+
+ FATAL "OSM Failed to startup"
}
#Configure VCA, SO and RO with the initial configuration:
echo -e " Configuring SO"
sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP
sudo sed -i "$ i route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP" /etc/rc.local
+
+ # make journaling persistent
+ lxc exec SO-ub -- mkdir -p /var/log/journal
+ lxc exec SO-ub -- systemd-tmpfiles --create --prefix /var/log/journal
+ lxc exec SO-ub -- systemctl restart systemd-journald
+
+ echo RIFT_EXTERNAL_ADDRESS=$DEFAULT_IP | lxc exec SO-ub -- tee -a /usr/rift/etc/default/launchpad
+
lxc exec SO-ub -- systemctl restart launchpad
so_is_up $SO_CONTAINER_IP
--data '{"account": [ { "name": "osmjuju", "account-type": "juju", "juju": { "ip-address": "'$JUJU_CONTROLLER_IP'", "port": "17070", "user": "admin", "secret": "'$JUJU_PASSWD'" } } ]}')
[[ $result =~ .*success.* ]] || FATAL "Failed config-agent configuration: $result"
+ #R1/R2 config line
+ #result=$(curl -k --request PUT \
+ # --url https://$SO_CONTAINER_IP:8008/api/config/resource-orchestrator \
+ # --header 'accept: application/vnd.yang.data+json' \
+ # --header 'authorization: Basic YWRtaW46YWRtaW4=' \
+ # --header 'cache-control: no-cache' \
+ # --header 'content-type: application/vnd.yang.data+json' \
+ # --data '{ "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'" }, "name": "osmopenmano", "account-type": "openmano" }')
+
result=$(curl -k --request PUT \
- --url https://$SO_CONTAINER_IP:8008/api/config/resource-orchestrator \
+ --url https://$SO_CONTAINER_IP:8008/api/config/project/default/ro-account/account \
--header 'accept: application/vnd.yang.data+json' \
--header 'authorization: Basic YWRtaW46YWRtaW4=' \
- --header 'cache-control: no-cache' \
+ --header 'cache-control: no-cache' \
--header 'content-type: application/vnd.yang.data+json' \
- --data '{ "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'" }, "name": "osmopenmano", "account-type": "openmano" }')
+ --data '{"rw-ro-account:account": [ { "openmano": { "host": "'$RO_CONTAINER_IP'", "port": "9090", "tenant-id": "'$RO_TENANT_ID'"}, "name": "osmopenmano", "ro-account-type": "openmano" }]}')
[[ $result =~ .*success.* ]] || FATAL "Failed resource-orchestrator configuration: $result"
+
+ result=$(curl -k --request PATCH \
+ --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/redirect-uri \
+ --header 'accept: application/vnd.yang.data+json' \
+ --header 'authorization: Basic YWRtaW46YWRtaW4=' \
+ --header 'cache-control: no-cache' \
+ --header 'content-type: application/vnd.yang.data+json' \
+ --data '{"redirect-uri": "https://'$DEFAULT_IP':8443/callback" }')
+ [[ $result =~ .*success.* ]] || FATAL "Failed redirect-uri configuration: $result"
+
+ result=$(curl -k --request PATCH \
+ --url https://$SO_CONTAINER_IP:8008/v2/api/config/openidc-provider-config/rw-ui-client/post-logout-redirect-uri \
+ --header 'accept: application/vnd.yang.data+json' \
+ --header 'authorization: Basic YWRtaW46YWRtaW4=' \
+ --header 'cache-control: no-cache' \
+ --header 'content-type: application/vnd.yang.data+json' \
+ --data '{"post-logout-redirect-uri": "https://'$DEFAULT_IP':8443/?api_server=https://'$DEFAULT_IP'" }')
+ [[ $result =~ .*success.* ]] || FATAL "Failed post-logout-redirect-uri configuration: $result"
+
+ lxc exec SO-ub -- tee /etc/network/interfaces.d/60-rift.cfg <<EOF
+auto lo:1
+iface lo:1 inet static
+ address $DEFAULT_IP
+ netmask 255.255.255.255
+EOF
+ lxc exec SO-ub ifup lo:1
+
}
function install_lxd() {
COMMIT_ID=""
ASSUME_YES=""
INSTALL_FROM_SOURCE=""
+RELEASE="-R ReleaseTHREE"
while getopts ":hy-:b:r:k:u:R:" o; do
case "${o}" in
# if develop, we force master
[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
-# if master, force install from source
-[ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
+# forcing source from master removed. Now only install from source when explicit
+# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
if [ -n "$TEST_INSTALLER" ]; then
echo -e "\nUsing local devops repo for OSM installation"
trap 'rm -rf "$TEMPDIR"' EXIT
fi
-echo -e "Checking required packages: git"
-dpkg -l git &>/dev/null || ! echo -e " git not installed.\nInstalling git requires root privileges" || sudo apt-get install -y git
+need_packages="git jq"
+for package in $need_packages; do
+ echo -e "Checking required packages: $package"
+ dpkg -l $package &>/dev/null \
+ || ! echo -e " $package not installed.\nInstalling $package requires root privileges" \
+ || sudo apt-get install -y $package \
+ || FATAL "failed to install $package"
+done
+
if [ -z "$TEST_INSTALLER" ]; then
echo -e "\nCloning devops repo temporarily"
git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
fi
echo -e "\nGuessing the current stable release"
-LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | tail -n1`
+LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | sort -V | tail -n1`
[ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
[ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
lxd --version &>/dev/null || FATAL "lxd not present, exiting."
[ -n "$LXD" ] && echo -e "\nConfiguring lxd" && install_lxd
-wget -q -O- https://osm-download.etsi.org/ftp/osm-2.0-two/README.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-3.0-three/README.txt &> /dev/null
+# use local devops for containers
+export OSM_USE_LOCAL_DEVOPS=true
if [ -z "$INSTALL_FROM_SOURCE" ]; then
echo -e "\nCreating the containers and installing from binaries ..."
$OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed"
#Configure components
configure
-wget -q -O- https://osm-download.etsi.org/ftp/osm-2.0-two/README2.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-3.0-three/README2.txt &> /dev/null
echo -e "\nDONE"
print "#Autogenerated by nat_osm"
print "-A PREROUTING -d "RO_IP" -p tcp -m tcp --dport 9090 -j DNAT --to-destination "openmano_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8000 -j DNAT --to-destination "rift_ip
- print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 4567 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8443 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8008 -j DNAT --to-destination "rift_ip
+ print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8009 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 80 -j DNAT --to-destination "rift_ip
#print "-A PREROUTING -d "VCA_IP" -p tcp -m tcp --dport 443 -j DNAT --to-destination "juju_ip
#print "-A PREROUTING -d "VCA_IP" -p tcp -m tcp --dport 17070 -j DNAT --to-destination "juju_ip
print "#Autogenerated by nat_osm"
print "-A PREROUTING -d "RO_IP" -p tcp -m tcp --dport 9090 -j DNAT --to-destination "openmano_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8000 -j DNAT --to-destination "rift_ip
- print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 4567 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8443 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8008 -j DNAT --to-destination "rift_ip
+ print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 8009 -j DNAT --to-destination "rift_ip
print "-A PREROUTING -d "UI_IP" -p tcp -m tcp --dport 80 -j DNAT --to-destination "rift_ip
#print "-A PREROUTING -d "VCA_IP" -p tcp -m tcp --dport 443 -j DNAT --to-destination "juju_ip
#print "-A PREROUTING -d "VCA_IP" -p tcp -m tcp --dport 17070 -j DNAT --to-destination "juju_ip
--- /dev/null
+# Copyright 2017 Intel Research and Development Ireland Limited
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Intel Corporation
+
+# 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.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com
+
+#__author__ = "Prithiv Mohan"
+#__date__ = "25/Sep/2017"
+
+# This variable holds the name of the container image needed to build or run this product
+export OSM_BASE_IMAGE=ubuntu:16.04
+
+# This variable holds the name of the container to be used to build a package
+# if this container already exists, the build process can skip the container build
+export OSM_BUILD_CONTAINER=MON
+
+# This variable holds the name of the container to be used to run a package
+# if this container already exists, the run processes can skip the container build
+export OSM_RUNTIME_CONTAINER=MON
--- /dev/null
+# Copyright 2017 Intel Research and Development Ireland Limited
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Intel Corporation
+
+# 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.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com
+
+#__author__ = "Prithiv Mohan"
+#__date__ = "25/Sep/2017"
+
+HERE=$(realpath $(dirname $0))
+OSM_JENKINS=$(dirname $HERE)
+. $OSM_JENKINS/common/all_funcs
+
+# SET YOUR MDG repository name here
+export OSM_MDG=MON
+OSM_load_config
+
+. $OSM_JENKINS/common/install_common
+
+# Installation starts here
+
+#Release TWO
+
+apt-get update
+
+DEBIAN_FRONTEND=noninteractive apt-get install --yes python-all python-pip && pip install --upgrade pip
+DEBIAN_FRONTEND=noninteractive apt-get --yes install default-jre
+DEBIAN_FRONTEND=noninteractive python kafkad
+RC=$?
+INFO "done, RC=$RC"
+exit $RC
--- /dev/null
+# Copyright 2017 Intel Research and Development Ireland Limited
+# *************************************************************
+
+# This file is part of OSM Monitoring module
+# All Rights Reserved to Intel Corporation
+
+# 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.
+
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact: prithiv.mohan@intel.com or adrian.hoban@intel.com
+
+#__author__ = "Prithiv Mohan"
+#__date__ = "25/Sep/2017"
+
+HERE=$(realpath $(dirname $0)
+OSM_JENKINS=$(dirname $HERE)
+. $OSM_JENKINS/common/all_funcs
+
+# SET YOU MDG repository name here
+export OSM_MDG=RO
+OSM_load_config
+OSM_git_checkout "$@"
+python -m py_compile kafkad
+python kafkad
+INFO "Starting Kafka"
+service kafka start
+
+#Start VMWare install script
+INFO "Installing vROPs Web Service"
+. plugins/vRealiseOps/vROPs_Webservice/install.sh
+INFO "Startinv vrops Web Service"
+python plugins/vRealiseOps/vROPs_Webservice/vrops_webservice
+
+RC=$?
+INFO "done, RC=$RC"
+exit $RC
###############################################################################
# Set up repo and version
-PLATFORM_REPOSITORY=OSM
-PLATFORM_VERSION=4.4.2.1.61839
+PLATFORM_REPOSITORY=OSM3
+PLATFORM_VERSION=5.2.0.2.72254
while getopts ":P:V:h" o; do
case "${o}" in
# Main block
# enable the right repos
+echo "### INSTALLING RIFT platform ${PLATFORM_VERSION} from repository ${PLATFORM_REPOSITORY}"
+
curl http://repos.riftio.com/public/xenial-riftware-public-key | apt-key add -
-curl -o /etc/apt/sources.list.d/RIFT.list http://buildtracker.riftio.com/repo_file/ub16/${PLATFORM_REPOSITORY}/
+curl -o /etc/apt/sources.list.d/rift.list http://buildtracker.riftio.com/repo_file/ub16/${PLATFORM_REPOSITORY}/
# Make the Rift repo a higher priority to work around version conflicts.
cat <<EOF > /etc/apt/preferences.d/rift
Pin-Priority: 600
EOF
+
+
+#######################
+# temp fix
+# this is normally done by mkcontainer, but the last line is missing
+# we can take this out when we update the RIFT platform
+
+cat <<EOF >>/etc/systemd/user.conf
+DefaultLimitNOFILE=65536
+DefaultLimitMSGQUEUE=8192000
+DefaultLimitNPROC=65536
+DefaultTasksMax=65536
+EOF
+cat <<EOF >>/etc/systemd/system.conf
+DefaultLimitNOFILE=65536
+DefaultLimitMSGQUEUE=8192000
+DefaultLimitNPROC=65536
+DefaultTasksMax=65536
+EOF
+systemctl daemon-reload
+
+##################################
+
+
apt-get update
# and install the tools
-apt remove -y rw.toolchain-rwbase tcpdump
+apt remove -y tcpdump
apt-get install -y --allow-downgrades rw.tools-container-tools=${PLATFORM_VERSION} rw.tools-scripts=${PLATFORM_VERSION} python
-/usr/rift/container_tools/mkcontainer --modes ext --modes platform --rw-version ${PLATFORM_VERSION}
-pip3 install lxml==3.4.0
-
-chmod 777 /usr/rift /usr/rift/usr/share
+/usr/rift/container_tools/mkcontainer --modes MANO-base,rw-platform --rw-version ${PLATFORM_VERSION}
# now disable the RIFT OSM repo so that we'll get MANO from
# the OSM repos
-rm -f /etc/apt/sources.list.d/RIFT.list
+rm -f /etc/apt/sources.list.d/rift.list
apt-get update
apt-get install -y \
- rw.core.mano-rwcal_yang_ylib-1.0 \
- rw.core.mano-rwconfig_agent_yang_ylib-1.0 \
- rw.core.mano-rwlaunchpad_yang_ylib-1.0 \
- rw.core.mano-mano_yang_ylib-1.0 \
- rw.core.mano-common-1.0 \
- rw.core.mano-rwsdn_yang_ylib-1.0 \
- rw.core.mano-rwsdnal_yang_ylib-1.0 \
- rw.core.mano-mano-types_yang_ylib-1.0 \
- rw.core.mano-rwcal-cloudsim-1.0 \
- rw.core.mano-rwcal-1.0 \
- rw.core.mano-rw_conman_yang_ylib-1.0 \
- rw.core.mano-rwcalproxytasklet-1.0 \
- rw.core.mano-rwlaunchpad-1.0 \
- rw.core.mano-rwcal-openmano-vimconnector-1.0 \
- rw.core.mano-lpmocklet_yang_ylib-1.0 \
- rw.core.mano-rwmon-1.0 \
- rw.core.mano-rwcloud_yang_ylib-1.0 \
- rw.core.mano-rwcal-openstack-1.0 \
- rw.core.mano-rw.core.mano_foss \
- rw.core.mano-rwmon_yang_ylib-1.0 \
- rw.core.mano-rwcm-1.0 \
- rw.core.mano-rwcal-mock-1.0 \
- rw.core.mano-rwcal-cloudsimproxy-1.0 \
- rw.core.mano-models-1.0 \
- rw.core.mano-rwcal-aws-1.0
+ rw.core.mano-mano \
+ rw.core.mano-rwcal-plugin-aws \
+ rw.core.mano-rwcal-plugin-cloudsim \
+ rw.core.mano-rwcal-plugin-cloudsimproxy \
+ rw.core.mano-rwcal-plugin-openmano-vimconnector \
+ rw.core.mano-rwcal-plugin-openstack \
+ rw.core.mano-rwcal-plugin-mock
+
+# Install libjuju
+apt-get install -y python3-pip python3-setuptools
+
+pip3 install juju
OSM_JENKINS=$(dirname $HERE)
. $OSM_JENKINS/common/install_common
-rm -f /etc/apt/sources.list.d/RIFT.list
+
+
+# Defensive bash programming flags
+set -o errexit # Exit on any error
+trap 'echo ERROR: Command failed: \"$BASH_COMMAND\"' ERR
+set -o nounset # Expanding an unset variable is an error. Variables must be
+ # set before they can be used.
+
+###############################################################################
+# Set up repo and version
+PLATFORM_REPOSITORY=OSM3
+PLATFORM_VERSION=5.2.0.2.72254
+
+while getopts ":P:V:h" o; do
+ case "${o}" in
+ P)
+ PLATFORM_REPOSITORY=${OPTARG}
+ ;;
+ V)
+ PLATFORM_VERSION=${OPTARG}
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+function usage() {
+ echo
+ echo "NAME:"
+ echo " $0"
+ echo
+ echo "SYNOPSIS:"
+ echo " $0 -h|--help"
+ echo " $0 -P <PLATFORM_REPOSITORY> -V <PLATFORM_VERSION>"
+ echo
+ echo "DESCRIPTION:"
+ echo " Prepare current system to run SO and UI."
+ echo
+ echo " PLATFORM_REPOSITORY (optional): name of the RIFT.ware repository."
+ echo " PLATFORM_VERSION (optional): version of the platform packages to be installed."
+ echo
+}
+
+
+###############################################################################
+# Main block
+
+# enable the right repos
+curl http://repos.riftio.com/public/xenial-riftware-public-key | apt-key add -
+curl -o /etc/apt/sources.list.d/rift.list http://buildtracker.riftio.com/repo_file/ub16/${PLATFORM_REPOSITORY}/
+
+# Make the Rift repo a higher priority to work around version conflicts.
+cat <<EOF > /etc/apt/preferences.d/rift
+Package: *
+Pin: origin repos.riftio.com
+Pin-Priority: 600
+EOF
+
apt-get update
-apt-get install -y rw.ui-skyquake
+# and install the tools
+apt-get install -y --allow-downgrades rw.tools-container-tools=${PLATFORM_VERSION} rw.tools-scripts=${PLATFORM_VERSION} python
+/usr/rift/container_tools/mkcontainer --modes UI-base --rw-version ${PLATFORM_VERSION}
+
+# now disable the RIFT OSM repo so that we'll get UI from
+# the OSM repos
+rm -f /etc/apt/sources.list.d/rift.list
+
+apt-get update
+apt-get install -y rw.ui-skyquake
echo "Creating Service ...."
/usr/rift/bin/create_launchpad_service
OSM_load_config
OSM_git_checkout "$@"
+trap 'WARNING "INTERRUPT"; exit 1' INT
INFO "starting build"
make clean || FATAL "Make clean failed"
-make -j16 || FATAL "Make failed"
-sudo make install || FATAL "Make install Failed"
+./BUILD.sh
-INFO "build done"
-exit 0
+RC=$?
+
+INFO "done, RC=$RC"
+exit $RC
DEFAULT_MTU=$( ip addr show $DEFAULT_INTERFACE | perl -ne 'if (/mtu\s(\d+)/) {print $1;}')
INFO "Setting lxdbr0 MTU to $DEFAULT_MTU"
+
+# This sets the MTU of lxdbr0 on the host machine without the need to recycle
+# the interface or reboot the machine.
ifconfig lxdbr0 mtu $DEFAULT_MTU
-# Make the MTU change persistent between reboots
-sed -i '/ifconfig lxdbr0 mtu/d' /etc/rc.local
-sed -i "$ i ifconfig lxdbr0 mtu $DEFAULT_MTU" /etc/rc.local
+# Setting the MTU in the default profile will be applied to every lxc container.
+# Existing containers will need to be restarted for the new MTU to take effect.
+# This will also persist the MTU change for the host's lxdbr0
+lxc profile device set default eth0 mtu $DEFAULT_MTU
INFO "Pre-caching Ubuntu:16.04 image (this may take several minutes)..."
set -eux
# The basic charm layer also installs all the things. 47 packages.
-LAYER_BASIC="gcc build-essential python3-pip python3-setuptools python3-yaml"
+LAYER_BASIC="gcc build-essential python3-pip python3-setuptools libyaml-dev python3-yaml python3-dev"
# the basic layer also installs virtualenv, but the name changed in xenial.
TRUSTY_PACKAGES="python-virtualenv"
lxc exec $container -- apt-get update -y
lxc exec $container -- apt-get upgrade -y
lxc exec $container -- apt-get install -y $PACKAGES $2
+ lxc exec $container -- pip3 install --upgrade pip
lxc exec $container -- pip3 install --upgrade $PYPI
lxc stop $container
println("retrieve archive for ${mdg}/${branch}/${build_name}/${build_number}/${pattern}")
+ // if the build name does not contain merge, then this is a patchset/staging job
+ if (!build_name.contains('merge')) {
+ branch += '-staging'
+ }
def repo_prefix = 'osm-'
def downloadSpec = """{
"files": [
{
"target": "./",
- "pattern": "${repo_prefix}${mdg}/${branch}/${pattern}",
+ "pattern": "${repo_prefix}${mdg}/${branch}/${build_number}/${pattern}",
"build": "${build_name}/${build_number}"
}
]
}"""
server.download(downloadSpec)
- // workaround. flatten and repo the specific build num from the directory
+ // workaround. flatten repo to remove specific build num from the directory
sh "cp -R ${branch}/${build_num}/* ."
sh "rm -rf ${branch}/${build_num}"
}
return sh(returnStdout: true, script: "lxc exec ${container_name} -- ${cmd}").trim()
}
+def lxc_file_push(container_name,file,destination) {
+ return sh(returnStdout: true, script: "lxc file push ${file} ${container_name}/${destination}").trim()
+}
+
// start a http server
// return the http server URL
def start_http_server(repo_dir,server_name) {
sh "lxc file pull ${container_name}/${file} ${destination}"
}
-def systest_run(container_name, test) {
+def systest_run(container_name, test, source_rc = null) {
// need to get the SO IP inside the running container
so_ip = lxc_run(container_name,"lxc list SO-ub -c 4|grep eth0 |awk '{print \$2}'")
+ ro_ip = lxc_run(container_name,"lxc list RO -c 4|grep eth0 |awk '{print \$2}'")
//container_ip = get_ip_from_container(container_name)
- //
- lxc_run(container_name, "make -C devops/systest OSM_HOSTNAME=${so_ip} ${test}")
+
+ if ( source_rc ) {
+ pre_source = "/tmp/" + source_rc.substring(source_rc.lastIndexOf('/')+1)
+
+ lxc_file_push(container_name,source_rc,pre_source)
+ lxc_run(container_name, "sh -c '. ${pre_source}; make -C devops/systest OSM_HOSTNAME=${so_ip} OSM_RO_HOSTNAME=${ro_ip} ${test}'")
+ }
+ else
+ {
+ lxc_run(container_name, "make -C devops/systest OSM_HOSTNAME=${so_ip} OSM_RO_HOSTNAME=${ro_ip} ${test}")
+ }
lxc_get_file(container_name, "/root/devops/systest/reports/pytest-${test}.xml",'.')
}
def archive(artifactory_server,mdg,branch,status) {
server = Artifactory.server artifactory_server
- def properties = "branch=${branch};status=${status}"
+ def properties = ""
+ //def properties = "branch=${branch};status=${status}"
def repo_prefix = 'osm-'
+
+ // if the build name does not contain merge, then this is a patchset/staging job
+ if ( !JOB_NAME.contains('merge') ) {
+ branch += '-staging'
+ }
def uploadSpec = """{
"files": [
{
"target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/",
"props": "${properties}",
"flat": false
+ },
+ {
+ "pattern": "changelog/*",
+ "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/",
+ "props": "${properties}",
+ "flat": false
}]
}"""
}
stage('downstream') {
+ // initially use stage_name as the event_type
+ def stage_name = GERRIT_EVENT_TYPE
+
+ switch(GERRIT_EVENT_TYPE) {
+ case "change-merged":
+ stage_name = "stage_2-merge"
+ break
+
+ case "patchset-created":
+ stage_name = "stage_2"
+ break
+ }
+ do_stage_4 = false
+ if (params.DO_STAGE_4)
+ {
+ do_stage_4 = params.DO_STAGE_4
+ }
+
// pipeline running from gerrit trigger.
// kickoff the downstream multibranch pipeline
def downstream_params = [
string(name: 'GERRIT_PATCHSET_REVISION', value: GERRIT_PATCHSET_REVISION),
string(name: 'PROJECT_URL_PREFIX', value: params.PROJECT_URL_PREFIX),
booleanParam(name: 'TEST_INSTALL', value: params.TEST_INSTALL),
+ booleanParam(name: 'DO_STAGE_4', value: do_stage_4),
]
-
- stage_name = "stage_2"
+
if ( params.STAGE )
{
// go directly to stage 3 (osm system)
stage_name = "stage_3"
mdg = "osm"
+ if ( ! params.TEST_INSTALL )
+ {
+ println("disabling stage_3 invocation")
+ return
+ }
}
- println("TEST_INSTALL = ${params.TEST_INSTALL}")
// callout to stage_2. This is a multi-branch pipeline.
- upstream_job_name = "${mdg}-${stage_name}/${GERRIT_BRANCH}"
+ downstream_job_name = "${mdg}-${stage_name}/${GERRIT_BRANCH}"
+
+ println("TEST_INSTALL = ${params.TEST_INSTALL}, downstream job: ${downstream_job_name}")
- stage_2_result = build job: "${upstream_job_name}", parameters: downstream_params, propagate: true
+ stage_2_result = build job: "${downstream_job_name}", parameters: downstream_params, propagate: true
if (stage_2_result.getResult() != 'SUCCESS') {
project = stage_2_result.getProjectName()
build = stage_2_result.getNumber()
}
}
-def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,build_system,artifactory_server) {
- println("build_system = ${build_system}")
+def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifactory_server,docker_args="",do_stage_4=false) {
+ println("do_stage_3= ${do_stage_3}")
ci_helper = load "devops/jenkins/ci-pipelines/ci_helper.groovy"
stage('Prepare') {
sh "docker build -t ${container_name} ."
}
- withDockerContainer("${container_name}") {
+ withDockerContainer(image: "${container_name}", args: docker_args) {
stage('Test') {
sh 'devops-stages/stage-test.sh'
}
}
stage('Archive') {
+ sh "mkdir -p changelog"
+ sh "devops/tools/generatechangelog-pipeline.sh > changelog/changelog-${mdg}.html"
sh(returnStdout:true, script: 'devops-stages/stage-archive.sh').trim()
ci_helper.archive(artifactory_server,mdg,branch,'untested')
}
- if ( build_system ) {
+ if ( do_stage_3 ) {
stage('Build System') {
def downstream_params_stage_3 = [
string(name: 'GERRIT_BRANCH', value: "${branch}"),
string(name: 'UPSTREAM_JOB_NAME', value: "${JOB_NAME}" ),
string(name: 'UPSTREAM_JOB_NUMBER', value: "${BUILD_NUMBER}" ),
+ booleanParam(name: 'DO_STAGE_4', value: do_stage_4 )
]
+ stage_3_job = "osm-stage_3"
+ if ( JOB_NAME.contains('merge') ) {
+ stage_3_job += '-merge'
+ }
- // callout to stage_3. This is the system build
- result = build job: "osm-stage_3/${branch}", parameters: downstream_params_stage_3, propagate: true
+ // callout to stage_3. This is the system build
+ result = build job: "${stage_3_job}/${branch}", parameters: downstream_params_stage_3, propagate: true
if (result.getResult() != 'SUCCESS') {
project = result.getProjectName()
build = result.getNumber()
string(defaultValue: '', description: '', name: 'UPSTREAM_JOB_NUMBER'),
string(defaultValue: 'dpkg1', description: '', name: 'GPG_KEY_NAME'),
string(defaultValue: 'artifactory-osm', description: '', name: 'ARTIFACTORY_SERVER'),
+ string(defaultValue: 'osm-stage_4', description: '', name: 'DOWNSTREAM_STAGE_NAME'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_FAIL'),
booleanParam(defaultValue: false, description: '', name: 'SAVE_CONTAINER_ON_PASS'),
+ booleanParam(defaultValue: false, description: '', name: 'DO_STAGE_4'),
])
])
sh 'env'
tag_or_branch = params.GERRIT_BRANCH.replaceAll(/\./,"")
- container_name_prefix = "osm-${tag_or_branch}"
- container_name = "${container_name_prefix}-${BUILD_NUMBER}"
stage("Checkout") {
checkout scm
ci_helper = load "jenkins/ci-pipelines/ci_helper.groovy"
+ def upstream_main_job = params.UPSTREAM_SUFFIX
+ def save_artifacts = false
+
+ // upstream jobs always use merged artifacts
+ upstream_main_job += '-merge'
+ container_name_prefix = "osm-${tag_or_branch}"
+ container_name = "${container_name_prefix}"
+ if ( JOB_NAME.contains('merge') ) {
+ save_artifacts = true
+ println("merge job, saving artifacts")
+ container_name += "-merge"
+ }
+ container_name += "-${BUILD_NUMBER}"
+
// Copy the artifacts from the upstream jobs
stage("Copy Artifacts") {
// cleanup any previous repo
sh 'rm -rf repo'
- if ( params.UPSTREAM_SUFFIX ) {
-
- dir("repo") {
- // grab all stable upstream builds based on the
- // given target UPSTREAM_SUFFIX
-
- dir("${RELEASE}") {
- def list = ["SO", "UI", "RO", "openvim", "osmclient", "IM"]
- for (component in list) {
- step ([$class: 'CopyArtifact',
- projectName: "${component}${params.UPSTREAM_SUFFIX}/${GERRIT_BRANCH}"])
-
- // grab the build name/number
- //options = get_env_from_build('build.env')
- build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
- //build_num = sh(returnStdout:true, script: "cat build.env | awk -F= '/BUILD_NUMBER/{print \$2}'").trim()
- ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${component}-stage_2 :: ${GERRIT_BRANCH}", build_num)
-
- // cleanup any prevously defined dists
- sh "rm -rf dists"
- }
-
- // check if an upstream artifact based on specific build number has been requested
- // This is the case of a merge build and the upstream merge build is not yet complete (it is not deemed
- // a successful build yet). The upstream job is calling this downstream job (with the its build artifiact)
- if ( params.UPSTREAM_JOB_NAME ) {
- step ([$class: 'CopyArtifact',
- projectName: "${params.UPSTREAM_JOB_NAME}",
- selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
- ])
-
- //options = get_env_from_build('build.env')
- // grab the build name/number
- //build_num = sh(returnStdout:true, script: "cat build.env | awk -F= '/BUILD_NUMBER/{print \$2}'").trim()
- build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
- component = ci_helper.get_mdg_from_project(ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
-
- ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${component}-stage_2 :: ${GERRIT_BRANCH}", build_num)
-
- sh "rm -rf dists"
- }
-
- // sign all the components
- for (component in list) {
- sh "dpkg-sig --sign builder -k ${GPG_KEY_NAME} pool/${component}/*"
- }
-
- // now create the distro
- for (component in list) {
- sh "mkdir -p dists/${params.REPO_DISTRO}/${component}/binary-amd64/"
- sh "apt-ftparchive packages pool/${component} > dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
- sh "gzip -9fk dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
- }
-
- // create and sign the release file
- sh "apt-ftparchive release dists/${params.REPO_DISTRO} > dists/${params.REPO_DISTRO}/Release"
- sh "gpg --yes -abs -u ${GPG_KEY_NAME} -o dists/${params.REPO_DISTRO}/Release.gpg dists/${params.REPO_DISTRO}/Release"
-
- // copy the public key into the release folder
- // this pulls the key from the home dir of the current user (jenkins)
- sh "cp ~/${REPO_KEY_NAME} ."
+ dir("repo") {
+ // grab all stable upstream builds based on the
+
+ dir("${RELEASE}") {
+ def list = ["SO", "UI", "RO", "openvim", "osmclient", "IM"]
+ for (component in list) {
+ step ([$class: 'CopyArtifact',
+ projectName: "${component}${upstream_main_job}/${GERRIT_BRANCH}"])
+
+ // grab the build name/number
+ //options = get_env_from_build('build.env')
+ build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
+
+ // grab the archives from the stage_2 builds (ie. this will be the artifacts stored based on a merge)
+ ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${component}${upstream_main_job} :: ${GERRIT_BRANCH}", build_num)
+
+ // cleanup any prevously defined dists
+ sh "rm -rf dists"
+ }
+
+ // check if an upstream artifact based on specific build number has been requested
+ // This is the case of a merge build and the upstream merge build is not yet complete (it is not deemed
+ // a successful build yet). The upstream job is calling this downstream job (with the its build artifiact)
+ if ( params.UPSTREAM_JOB_NAME ) {
+ step ([$class: 'CopyArtifact',
+ projectName: "${params.UPSTREAM_JOB_NAME}",
+ selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
+ ])
+
+ //options = get_env_from_build('build.env')
+ // grab the build name/number
+ //build_num = sh(returnStdout:true, script: "cat build.env | awk -F= '/BUILD_NUMBER/{print \$2}'").trim()
+ build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
+ component = ci_helper.get_mdg_from_project(ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
+
+ // the upstream job name contains suffix with the project. Need this stripped off
+ def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
+
+ ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${project_without_branch} :: ${GERRIT_BRANCH}", build_num)
+
+ sh "rm -rf dists"
+ }
+
+ // sign all the components
+ for (component in list) {
+ sh "dpkg-sig --sign builder -k ${GPG_KEY_NAME} pool/${component}/*"
+ }
+
+ // now create the distro
+ for (component in list) {
+ sh "mkdir -p dists/${params.REPO_DISTRO}/${component}/binary-amd64/"
+ sh "apt-ftparchive packages pool/${component} > dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
+ sh "gzip -9fk dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages"
}
- // start an apache server to serve up the images
- http_server_name = "${container_name}-apache"
- pwd = sh(returnStdout:true, script: 'pwd').trim()
- repo_base_url = ci_helper.start_http_server(pwd,http_server_name)
+ // create and sign the release file
+ sh "apt-ftparchive release dists/${params.REPO_DISTRO} > dists/${params.REPO_DISTRO}/Release"
+ sh "gpg --yes -abs -u ${GPG_KEY_NAME} -o dists/${params.REPO_DISTRO}/Release.gpg dists/${params.REPO_DISTRO}/Release"
+
+ // copy the public key into the release folder
+ // this pulls the key from the home dir of the current user (jenkins)
+ sh "cp ~/${REPO_KEY_NAME} ."
+
+ // merge the change logs
+ sh """
+ rm -f changelog/changelog-osm.html
+ [ ! -d changelog ] || for mdgchange in \$(ls changelog); do cat changelog/\$mdgchange >> changelog/changelog-osm.html; done
+ """
}
+ // start an apache server to serve up the images
+ http_server_name = "${container_name}-apache"
+
+ pwd = sh(returnStdout:true, script: 'pwd').trim()
+ repo_base_url = ci_helper.start_http_server(pwd,http_server_name)
}
}
"""
}
- stage("Test") {
+ stage("Smoke") {
ci_helper.systest_run(container_name, 'smoke')
junit '*.xml'
}
- stage("Archive") {
- sh "echo ${container_name} > build_version.txt"
- archiveArtifacts artifacts: "build_version.txt", fingerprint: true
+ if ( params.DO_STAGE_4 ) {
+ stage("stage_4") {
+ def downstream_params = [
+ string(name: 'CONTAINER_NAME', value: container_name),
+ ]
+ stage_4_result = build job: "${params.DOWNSTREAM_STAGE_NAME}/${GERRIT_BRANCH}", parameters: downstream_params, propagate: false
+
+ currentBuild.result = stage_4_result.result
+ }
+ }
- // Archive the tested repo
- dir("repo/${RELEASE}") {
- ci_helper.archive(params.ARTIFACTORY_SERVER,RELEASE,GERRIT_BRANCH,'tested')
+ // save the artifacts of this build if this is a merge job
+ if ( save_artifacts ) {
+ stage("Archive") {
+ sh "echo ${container_name} > build_version.txt"
+ archiveArtifacts artifacts: "build_version.txt", fingerprint: true
+
+ // Archive the tested repo
+ dir("repo/${RELEASE}") {
+ ci_helper.archive(params.ARTIFACTORY_SERVER,RELEASE,GERRIT_BRANCH,'tested')
+ }
}
}
}
catch(caughtError) {
+ println("Caught error!")
error = caughtError
currentBuild.result = 'FAILURE'
}
properties([
parameters([
+ string(defaultValue: '', description: '', name: 'CONTAINER_NAME' ),
string(defaultValue: 'osm-stage_3', description: '', name: 'UPSTREAM_PROJECT'),
- string(defaultValue: 'release', description: '', name: 'RELEASE'),
string(defaultValue: 'pipeline', description: '', name: 'NODE'),
+ string(defaultValue: '/home/jenkins/hive/openstack-telefonica.rc', description: '', name: 'HIVE_VIM_1'),
])
])
ci_helper = load "jenkins/ci-pipelines/ci_helper.groovy"
- stage("get artifacts") {
- // grab the upstream artifact name
+ if ( params.CONTAINER_NAME ) {
+ container_name = params.CONTAINER_NAME
+ }
+ else if ( params.UPSTREAM_PROJECT ) {
step ([$class: 'CopyArtifact',
projectName: "${params.UPSTREAM_PROJECT}/${BRANCH_NAME}"])
+ container_name = sh(returnStdout: true, script: 'cat build_version.txt').trim()
}
-
- container_name = sh(returnStdout: true, script: 'cat build_version.txt').trim()
-
- stage("Test") {
- ci_helper.systest_run(container_name, 'smoke')
- junit '*.xml'
+ else {
+ println("no OSM container found")
+ currentBuild.result = 'FAILURE'
+ return
}
+ println("OSM container = ${container_name}")
-/* os_credentials = "OS_AUTH_URL=${params.OS_AUTH_URL} OS_USERNAME=${params.OS_USERNAME} OS_PASSWORD=${params.OS_PASSWORD} OS_PROJECT_NAME=${params.OS_PROJECT_NAME}"
- stage("cirros-test") {
- sh """
- make -C systest OSM_HOSTNAME=${osm_ip} ${os_credentials} cirros
- """
- junit 'systest/reports/pytest-cirros.xml'
+ if ( params.HIVE_VIM_1 ) {
+ stage( "${params.HIVE_VIM_1}" ) {
+ ci_helper.systest_run(container_name, 'cirros', params.HIVE_VIM_1)
+ ci_helper.systest_run(container_name, 'ns_scale', params.HIVE_VIM_1)
+ junit '*.xml'
}
-*/
+ }
}
#
#
-RELEASE="ReleaseTWO"
+RELEASE="ReleaseTHREE"
REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
REPOSITORY="stable"
REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian"
-while getopts ":r:k:u:R:" o; do
+while getopts ":r:k:u:R:b:-:" o; do
case "${o}" in
r)
REPOSITORY=${OPTARG}
u)
REPOSITORY_BASE=${OPTARG}
;;
- *)
- exit 1
+ b)
+ ## ignore branch option
+ ;;
+ -)
;;
esac
done
key_location=$REPOSITORY_BASE/$RELEASE/$REPOSITORY_KEY
+echo $key_location
curl $key_location | apt-key add -
systemctl enable lxd-bridge
systemctl start lxd-bridge
-apt-get install -y python-pip python python-pycurl charm-tools python-pytest
+apt-get install -y python-pip python python-pycurl charm-tools python-pytest python-openstackclient
apt-get install -y python-osmclient
--- /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
+DOCKER_BUILD ?=
all: $(CHARM_BUILD_DIRS)
clean:
-@ $(RM) -rf $(CHARM_BUILD_DIR)
+
+ifdef DOCKER_BUILD
+$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_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) $<
+else
$(CHARM_BUILD_DIR)/%: $(CHARM_SRC_DIR)/%
charm-build -o $(BUILD_DIR) $<
+endif
remove_state as remove_flag,
set_state as set_flag,
when,
+ when_not,
)
import charms.sshproxy
-from subprocess import (
- Popen,
- CalledProcessError,
- PIPE,
-)
+# from subprocess import (
+# Popen,
+# CalledProcessError,
+# PIPE,
+# )
cfg = config()
-@when('config.changed')
+@when_not('pingpong.configured')
+def not_configured():
+ """Check the current configuration.
+
+ Check the current values in config to see if we have enough
+ information to continue.
+ """
+ config_changed()
+
+
+@when('config.changed', 'sshproxy.configured')
def config_changed():
+ """Verify the configuration.
+
+ Verify that the charm has been configured
+ """
+ status_set('maintenance', 'Verifying configuration data...')
+ (validated, output) = charms.sshproxy.verify_ssh_credentials()
+ if not validated:
+ status_set('blocked', 'Unable to verify SSH credentials: {}'.format(
+ output
+ ))
+ return
if all(k in cfg for k in ['mode']):
if cfg['mode'] in ['ping', 'pong']:
set_flag('pingpong.configured')
status_set('blocked', 'Waiting for configuration')
+@when('config.changed')
+@when_not('sshproxy.configured')
+def invalid_credentials():
+ status_set('blocked', 'Waiting for SSH credentials.')
+ pass
+
+
def is_ping():
if cfg['mode'] == 'ping':
return True
remove_flag('actions.start')
return
+ # Attempt to raise the non-mgmt interface, but ignore failures if
+ # the interface is already up.
try:
- cmd = "sudo timeout 30 /sbin/ifup eth1"
+ cmd = "sudo timeout 30 /sbin/ifup eth1"
result, err = charms.sshproxy._run(cmd)
except Exception as e:
- action_fail('command failed: {}, errors: {}'.format(e, e.output))
- remove_flag('actions.start')
- return
+ pass
try:
- cmd = "sudo timeout 30 /usr/bin/systemctl start {}". \
+ cmd = "sudo timeout 30 /usr/bin/systemctl start {}". \
format(cfg['mode'])
result, err = charms.sshproxy._run(cmd)
except Exception as e:
.cache
descriptor-packages/
*.xml
+images/*
# export OS_PASSWORD=admin
# export OS_PROJECT_NAME=admin
OSM_HOSTNAME ?=
+OSM_RO_HOSTNAME ?=
OS_AUTH_URL ?=
OS_USERNAME ?=
OS_PASSWORD_NAME ?=
OS_PROJECT_NAME ?=
+VIM_CONFIG ?=
+
+TOPDIR=$(shell readlink -f .|sed -e 's/systest.*//')
ifdef OS_AUTH_URL
OPTION_OS_AUTH_URL=--os-url $(OS_AUTH_URL)
ifdef TEST_NSD_DESCRIPTORS
OPTION_TEST_NSD_DESCRIPTORS=--osm-nsd-descriptor-packages $(TEST_NSD_DESCRIPTORS)
endif
+ifdef OSM_RO_HOSTNAME
+ OPTION_RO_HOSTNAME=--osm_ro_host $(OSM_RO_HOSTNAME)
+else
+ OPTION_RO_HOSTNAME=--osm_ro_host $(OSM_HOSTNAME)
+endif
-DESCRIPTOR_REPO_NAME = descriptor-packages
-DESCRIPTOR_REPO_DIR ?= $(shell pwd)/descriptor-packages
-DESCRIPTOR_BUILD_DIR := $(DESCRIPTOR_REPO_DIR)/build
-OPTION_DESCRIPTOR_BUILD_DIR=--osm-descriptor-packages $(DESCRIPTOR_BUILD_DIR)
+ifdef VIM_CONFIG
+ OPTION_VIM_CONFIG=--vim-config "$(VIM_CONFIG)"
+else
+endif
-TEST_OSM_NS_NAME_PREFIX=pytest-$(shell date +%D-%T)-
-OPTION_TEST_OSM_NS_NAME_PREFIX=--osm-ns-name-prefix $(TEST_OSM_NS_NAME_PREFIX)
+DESCRIPTOR_DIR ?= $(TOPDIR)/descriptor-packages
+
+#TODO: Need to re-add this once charm application name length issue is resolved
+#TEST_OSM_NS_NAME_PREFIX=pytest-$(shell date +%D-%T)-
+#OPTION_TEST_OSM_NS_NAME_PREFIX=--osm-ns-name-prefix $(TEST_OSM_NS_NAME_PREFIX)
JUNITXML_DIR = reports
PYTEST_OPTIONS=
Q=@
-DESCRIPTOR_REPO ?= https://osm.etsi.org/gerrit/osm/$(DESCRIPTOR_REPO_NAME)
-
-
TEST_VNFD_DESCRIPTORS ?= None
TEST_NSD_DESCRIPTORS ?= None
.PHONY: check_openstack_env check_OSM_HOSTNAME
-descriptors:
- test -e $(DESCRIPTOR_REPO_NAME) || git clone $(DESCRIPTOR_REPO)
- $(MAKE) -C $(DESCRIPTOR_REPO_NAME)
-
report_dir:
@mkdir -p reports
_run_test: report_dir
- $(Q)py.test \
+ -$(Q)py.test \
--osmhost $(OSM_HOSTNAME) \
+ $(OPTION_RO_HOSTNAME) \
$(OPTION_OS_AUTH_URL) \
$(OPTION_OS_USERNAME) \
$(OPTION_OS_PASSWORD) \
+ $(OPTION_VIM_CONFIG) \
$(OPTION_OS_PROJECT_NAME) \
$(OPTION_TEST_VNFD_DESCRIPTORS) \
$(OPTION_TEST_NSD_DESCRIPTORS) \
--junitxml $(JUNITXML_DIR)/$(JUNITXML) \
$(PYTEST_OPTIONS)
-cirros: check_OSM_HOSTNAME check_openstack_env
+$(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/%.tar.gz:
+ $(MAKE) -C $(DESCRIPTOR_DIR)/vnfd/cirros_vnf
+
+$(DESCRIPTOR_DIR)/nsd/cirros_ns/build/%.tar.gz:
+ $(MAKE) -C $(DESCRIPTOR_DIR)/nsd/cirros_ns
+
+images/cache/cirros-0.3.5-x86_64-disk.img:
+ $(Q)mkdir -p images/cache
+ $(Q)wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img -O $@
+
+images/cache/Fedora-x86_64-20-20131211.1-sda-ping.qcow2:
+ $(Q)mkdir -p images/cache
+ $(Q)wget ftp://osm-download.etsi.org/examples/ping_pong_ns/images/Fedora-x86_64-20-20131211.1-sda-ping.qcow2 -O $@
+
+images/cache/Fedora-x86_64-20-20131211.1-sda-pong.qcow2:
+ $(Q)mkdir -p images/cache
+ $(Q)wget ftp://osm-download.etsi.org/examples/ping_pong_ns/images/Fedora-x86_64-20-20131211.1-sda-pong.qcow2 -O $@
+
+# images are prefixed with 'osm/' to separate osm uploaded images from VIM installed images
+OSM_IMAGE_PREFIX ?=
+
+ifdef OS_AUTH_URL
+images/%.qcow2 images/%.img:
+ $(Q)openstack image show $(OSM_IMAGE_PREFIX)$(shell basename $@) || \
+ sh -c "make images/cache/$(shell basename $@) && openstack image create --file images/cache/$(shell basename $@) $(OSM_IMAGE_PREFIX)$(shell basename $@)"
+else
+images/%.img:
+ echo "No method selected to upload image to VIM"
+endif
+
+cirros: check_OSM_HOSTNAME check_openstack_env \
+ $(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ $(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz \
+ images/cirros-0.3.5-x86_64-disk.img
$(Q)$(MAKE) \
- TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_BUILD_DIR)/vnfd_pkgs/cirros_vnf.tar.gz \
- TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_BUILD_DIR)/nsd_pkgs/cirros_ns.tar.gz \
+ TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz \
JUNITXML=pytest-$@.xml \
PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m vnf" _run_test
-ns_scale: check_OSM_HOSTNAME check_openstack_env
+ns_scale: check_OSM_HOSTNAME check_openstack_env \
+ $(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ $(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz \
+ images/cirros-0.3.5-x86_64-disk.img
$(Q)$(MAKE) \
- TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_BUILD_DIR)/vnfd_pkgs/cirros_vnf.tar.gz \
- TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_BUILD_DIR)/nsd_pkgs/cirros_ns.tar.gz \
+ TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz \
JUNITXML=pytest-$@.xml \
PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m ns_scale" _run_test
-smoke: check_OSM_HOSTNAME
+smoke: check_OSM_HOSTNAME \
+ $(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ $(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz
$(Q)$(MAKE) \
JUNITXML=pytest-$@.xml \
- PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m smoke" _run_test
+ PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m smoke" _run_test \
+ TEST_VNFD_DESCRIPTORS=$(DESCRIPTOR_DIR)/vnfd/cirros_vnf/build/cirros_vnf.tar.gz \
+ TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_DIR)/nsd/cirros_ns/build/cirros_ns.tar.gz
vim: check_OSM_HOSTNAME check_openstack_env
$(Q)$(MAKE) \
JUNITXML=pytest-$@.xml \
PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m vim" _run_test
-ping_pong: check_OSM_HOSTNAME check_openstack_env
+$(DESCRIPTOR_DIR)/vnfd/ping_vnf/build/%.tar.gz:
+ $(MAKE) -C $(DESCRIPTOR_DIR)/vnfd/ping_vnf
+
+$(DESCRIPTOR_DIR)/vnfd/pong_vnf/build/%.tar.gz:
+ $(MAKE) -C $(DESCRIPTOR_DIR)/vnfd/pong_vnf
+
+$(DESCRIPTOR_DIR)/nsd/ping_pong_ns/build/%.tar.gz:
+ $(MAKE) -C $(DESCRIPTOR_DIR)/nsd/ping_pong_ns
+
+ping_pong: check_OSM_HOSTNAME check_openstack_env \
+ $(DESCRIPTOR_DIR)/vnfd/ping_vnf/build/ping_vnf.tar.gz \
+ $(DESCRIPTOR_DIR)/vnfd/pong_vnf/build/pong_vnf.tar.gz \
+ $(DESCRIPTOR_DIR)/nsd/ping_pong_ns/build/ping_pong_ns.tar.gz \
+ images/Fedora-x86_64-20-20131211.1-sda-ping.qcow2 \
+ images/Fedora-x86_64-20-20131211.1-sda-pong.qcow2
$(Q)$(MAKE) \
- TEST_VNFD_DESCRIPTORS="$(DESCRIPTOR_BUILD_DIR)/vnfd_pkgs/ping_vnf.tar.gz,$(DESCRIPTOR_BUILD_DIR)/vnfd_pkgs/pong_vnf.tar.gz" \
- TEST_NSD_DESCRIPTORS="$(DESCRIPTOR_BUILD_DIR)/nsd_pkgs/ping_pong_ns.tar.gz" \
+ TEST_VNFD_DESCRIPTORS="$(DESCRIPTOR_DIR)/vnfd/ping_vnf/build/ping_vnf.tar.gz,$(DESCRIPTOR_DIR)/vnfd/pong_vnf/build/pong_vnf.tar.gz" \
+ TEST_NSD_DESCRIPTORS=$(DESCRIPTOR_DIR)/nsd/ping_pong_ns/build/ping_pong_ns.tar.gz \
JUNITXML=pytest-$@.xml \
PYTEST_OPTIONS="$(PYTEST_OPTIONS) -m vnf" _run_test
parser.addoption("--os-username", default="", help="openstack username")
parser.addoption("--os-password", default="", help="openstack password")
parser.addoption("--os-project-name", default="", help="openstack project name")
+ parser.addoption("--vim-config", default="", help="vim/openstack specific configuration")
@pytest.fixture
def openstack(request):
access['vim-tenant-name'] = request.config.getoption("--os-project-name")
access['vim-type'] = 'openstack'
access['description'] = 'pytest system test'
+ access['config'] = request.config.getoption("--vim-config")
return openstack.Openstack(access)
def osm_add_options(parser):
parser.addoption("--osmhost", default="", help="osm hostname")
+ parser.addoption("--osm_ro_host", default="", help="osm ro_host")
parser.addoption("--osm-descriptor-packages", default="", help="location of descriptor packages")
parser.addoption("--osm-vnfd-descriptor-packages", default="", help="vnfd packages to test")
parser.addoption("--osm-nsd-descriptor-packages", default="", help="nsd package to test")
def osm(request):
from lib.osm import osm
osmhost=request.config.getoption("--osmhost")
+ osm_ro_host=request.config.getoption("--osm_ro_host")
descriptors_dir=request.config.getoption("--osm-descriptor-packages")
vnfd_descriptors_list=request.config.getoption("--osm-vnfd-descriptor-packages").split(',')
nsd_descriptors_list=request.config.getoption("--osm-nsd-descriptor-packages").split(',')
ns_name_prefix=request.config.getoption("--osm-ns-name-prefix")
return osm.Osm(osmhost,
+ ro_host=osm_ro_host,
descriptors_dir=descriptors_dir,
vnfd_descriptors_list=vnfd_descriptors_list,
nsd_descriptors_list=nsd_descriptors_list,
from osmclient.client import client
class Osm():
- def __init__(self,osmhost,descriptors_dir=None,vnfd_descriptors_list=None,nsd_descriptors_list=None,ns_name_prefix=None):
- self._OsmApi=client.Client(host=osmhost)
+ def __init__(self,osmhost,ro_host=None,descriptors_dir=None,vnfd_descriptors_list=None,nsd_descriptors_list=None,ns_name_prefix=None):
+ self._OsmApi=client.Client(host=osmhost,ro_host=ro_host)
self._descriptors_dir = descriptors_dir
self.vnfd_descriptors_list = vnfd_descriptors_list
self.nsd_descriptors_list = nsd_descriptors_list
def test_empty_ns_catalog(self,osm):
assert not osm.get_api().nsd.list()
+
+ def vnf_upload_packages(self, osm, descriptor_file_list ):
+ for file in descriptor_file_list:
+ assert not osm.get_api().package.upload(file)
+ assert not osm.get_api().package.wait_for_upload(file)
+ desc = osm.get_api().package.get_key_val_from_pkg(file)
+ assert desc
+
+ def delete_all_packages(self, osm):
+ for nsd in osm.get_api().nsd.list():
+ assert not osm.get_api().nsd.delete(nsd['name'])
+
+ for vnfd in osm.get_api().vnfd.list():
+ assert not osm.get_api().vnfd.delete(vnfd['name'])
+
+ def test_upload_vnf_package(self, osm):
+ vnfd_file_list = osm.vnfd_descriptors_list
+ nsd_file_list = osm.nsd_descriptors_list
+ # upload vnfd's
+ self.vnf_upload_packages(osm, vnfd_file_list )
+ # upload nsd's
+ self.vnf_upload_packages(osm, nsd_file_list )
+
+ # now delete all packages
+ self.delete_all_packages(osm)
def cleanup_test_add_vim_account(self,osm,request):
def teardown():
try:
- osm.get_api().vim.delete('pytest')
+ for vim in osm.get_api().vim.list(False):
+ osm.get_api().vim.delete(vim['name'])
except:
pass
request.addfinalizer(teardown)
@pytest.mark.openstack
+ @pytest.mark.smoke
def test_add_vim_account(self,osm,openstack,cleanup_test_add_vim_account):
- os_access=openstack.get_access()
- assert not osm.get_api().vim.create('pytest',os_access)
+ os_access = {}
+ vim_name = 'helloworld-os'
+ os_access['vim-url'] = 'https://169.254.169.245/'
+ os_access['vim-username'] = 'pytest2'
+ os_access['vim-password'] = 'fred'
+ os_access['vim-tenant-name'] = 'pytest3'
+ os_access['vim-type'] = 'openstack'
+ os_access['description'] = 'a test vim'
+ assert not osm.get_api().vim.create(vim_name,os_access)
- resp=osm.get_api().vim.get('pytest')
- assert resp['name'] == 'pytest'
+ resp=osm.get_api().vim.get(vim_name)
+ assert resp['name'] == vim_name
assert resp['type'] == 'openstack'
assert resp['vim_url'] == os_access['vim-url']
assert resp['vim_url_admin'] == os_access['vim-url']
assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
-
- assert not osm.get_api().vim.delete('pytest')
+ assert not osm.get_api().vim.delete(vim_name)
@pytest.mark.vmware
+ @pytest.mark.smoke
def test_add_vim_account_vmware(self,osm,vmware,cleanup_test_add_vim_account):
- os_access=vmware.get_access()
- assert not osm.get_api().vim.create('pytest',os_access)
+ os_access = {}
+ vim_name = 'helloworld-vmware'
+ os_access['vim-url'] = 'https://169.254.169.245/'
+ os_access['vim-username'] = 'pytest2'
+ os_access['vim-password'] = 'fred'
+ os_access['vim-tenant-name'] = 'pytest3'
+ os_access['vim-type'] = 'vmware'
+ os_access['description'] = 'a test vim'
+ assert not osm.get_api().vim.create(vim_name,os_access)
- resp=osm.get_api().vim.get('pytest')
- assert resp['name'] == 'pytest'
+ resp=osm.get_api().vim.get(vim_name)
+ assert resp['name'] == vim_name
assert resp['type'] == 'vmware'
assert resp['vim_url'] == os_access['vim-url']
assert resp['vim_url_admin'] == os_access['vim-url']
assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
- assert not osm.get_api().vim.delete('pytest')
+ assert not osm.get_api().vim.delete(vim_name)
+
+ @pytest.mark.smoke
+ def test_add_multiple_accounts(self,osm,cleanup_test_add_vim_account):
+ os_access = {}
+ vims = [ {'name': 'testvim1', 'vim-type': 'openstack'}, {'name': 'testvim2','vim-type': 'vmware'} ]
+ os_access['vim-url'] = 'https://169.254.169.245/'
+ os_access['vim-username'] = 'pytest2'
+ os_access['vim-password'] = 'fred'
+ os_access['vim-tenant-name'] = 'pytest3'
+ os_access['description'] = 'a test vim'
+
+ for vim in vims:
+ os_access['vim-type'] = vim['vim-type']
+ assert not osm.get_api().vim.create(vim['name'],os_access)
+ resp=osm.get_api().vim.get(vim['name'])
+ assert resp['name'] == vim['name']
+ assert resp['type'] == vim['vim-type']
+ assert resp['vim_url'] == os_access['vim-url']
+ assert resp['vim_url_admin'] == os_access['vim-url']
+ assert resp['vim_tenants'][0]['user'] == os_access['vim-username']
+ assert resp['vim_tenants'][0]['vim_tenant_name'] == os_access['vim-tenant-name']
+
+ for vim in osm.get_api().vim.list(False):
+ osm.get_api().vim.delete(vim['name'])
assert not osm.get_api().ns.create(nsd_desc['name'],ns_name,vim.vim_name)
- assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='init')
+ assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='vnf-init-phase')
# make sure ns is running
assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='running',wait_time=120)
# wait for ns to be in running-state
assert utils.wait_for_value(lambda: osm.get_api().ns.get_field(ns_name,'operational-status'),result='running',wait_time=120)
+ time.sleep(10)
+
assert not osm.get_api().ns.delete(ns_name)
assert not osm.get_api().nsd.delete(nsd_desc['name'])
--- /dev/null
+#!/usr/bin/env python
+#
+# 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.
+#
+#
+import requests
+import json
+import pprint
+import argparse
+
+from dateutil import parser
+from dateutil.tz import tzutc
+from datetime import datetime
+import time
+
+arg_parser=argparse.ArgumentParser(description="Tool to retrieve the latest build from the artifactory server")
+arg_parser.add_argument('branch')
+arg_parser.add_argument('--project',default='osm-stage_3')
+arg_parser.add_argument('--url',default='http://osm1.etsi.org:8081/')
+arg_parser.add_argument('--keep',default=5)
+arg_parser.add_argument('--password',default='')
+args = arg_parser.parse_args()
+
+url = args.url + 'artifactory/api/build/' + args.project + " :: " + args.branch
+
+resp = requests.get(url)
+jsonData = json.loads(resp.content)
+if 'buildsNumbers' not in jsonData:
+ print("Cannot find any valid builds")
+ exit(1)
+
+# first entry is the latest build
+buildlist = sorted(jsonData['buildsNumbers'], key=lambda x: int(x['uri'][1:]),reverse=True)
+print("total builds is {}".format(len(buildlist)))
+pprint.pprint(buildlist)
+
+if len(buildlist) < args.keep:
+ print("nothing to cleanup")
+ exit(0)
+
+def convert_to_ms(datetime):
+ #get the millisecond from the date/time
+ ms=datetime.split('.')[1].split('+')[0]
+ parser_out=parser.parse(datetime)
+ timeval=parser_out
+ tuple=int(time.mktime(timeval.timetuple()))
+ return (tuple*1000+int(ms)-(time.timezone*1000))
+
+def buildPost(dateInMS,buildNumber):
+ build = {}
+ data = {}
+ build['buildName'] = args.project + " :: " + args.branch
+ build['buildNumber'] = buildNumber
+ build['date'] = str(dateInMS)
+
+ data['buildsCoordinates'] = list()
+ data['buildsCoordinates'].append(build)
+ return data
+
+delete_url = args.url + 'artifactory/ui/builds/buildsDelete'
+headers = {'Content-Type': 'application/json'}
+
+for entry in buildlist[int(args.keep):]:
+ ms = convert_to_ms(entry['started'])
+ buildNumber = entry['uri'].split('/')[1]
+ print("deleting build {} ms {}".format(args.project + " :: " + args.branch + '/' + buildNumber,ms))
+ postData = buildPost(ms,entry['uri'].split('/')[1])
+
+ requests.post(delete_url,data=json.dumps(postData),headers=headers,auth=('admin',args.password))
--- /dev/null
+#!/usr/bin/env python
+#
+# 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.
+#
+#
+import requests
+import json
+import pprint
+import argparse
+
+from dateutil import parser
+from dateutil.tz import tzutc
+from datetime import datetime
+import time
+
+arg_parser=argparse.ArgumentParser(description="Tool to retrieve the latest build from the artifactory server")
+arg_parser.add_argument('--branch',default=None)
+arg_parser.add_argument('repo')
+arg_parser.add_argument('--url',default='http://osm1.etsi.org:8081/')
+arg_parser.add_argument('--keep',default=5)
+arg_parser.add_argument('--password',default='')
+arg_parser.add_argument('--debug',default=None)
+
+args = arg_parser.parse_args()
+
+
+if args.branch:
+ url = args.url + 'artifactory/api/storage/' + args.repo + '/' + args.branch
+ delete_url = args.url + 'artifactory/' + args.repo + '/' + args.branch
+else:
+ url = args.url + 'artifactory/api/storage/' + args.repo
+ delete_url = args.url + 'artifactory/' + args.repo
+
+resp = requests.get(url)
+jsonData = json.loads(resp.content)
+
+# first entry is the latest build
+filtered_list = filter(lambda x: x['uri'].split('/')[1].isdigit(), jsonData['children'])
+folders_sorted = sorted(filtered_list, key=lambda x: int(x['uri'].split('/')[1]),reverse=True)
+
+if len(folders_sorted) < int(args.keep):
+ print("nothing to cleanup")
+ exit(0)
+
+
+for entry in folders_sorted[int(args.keep):]:
+ if args.debug:
+ print("going to delete {}".format(delete_url+entry['uri']))
+ else:
+ requests.delete(delete_url + entry['uri'], auth=('admin',args.password))
+
+
+# empty the trash can
+empty_trash_url=args.url + 'artifactory/ui/artifactactions/emptytrash'
+headers = {'Content-Type': 'application/json'}
+requests.post(empty_trash_url,headers=headers,auth=('admin',args.password))
+
+
echo -e " -h <rsync user@host> "
echo -e " -R <rsync options> "
echo -e " -P <public key file> "
+ echo -e " -c <changelogfile> "
exit 1
}
echo "RSYNC_USER_HOST $RSYNC_USER_HOST"
echo "RSYNC_OPTIONS $RSYNC_OPTIONS"
echo "PUBLIC_KEY_FILE $PUBLIC_KEY_FILE"
+ echo "BUILD: $BUILD"
+ echo "BUILD_NUMBER: $BUILD_NUMBER"
}
IN_REPO="unstable"
RSYNC_USER_HOST=osmusers@osm-download.etsi.org
CURR_DIR=$(pwd)
PUBLIC_KEY_FILE=~/OSM\ ETSI\ Release\ Key.gpg
+CHANGE_LOG_FILE=
-while getopts ":p:i:o:k:j::d:b:r:h:R:P:" o; do
+while getopts ":p:i:o:k:j::d:b:r:h:R:P:c:" o; do
case "${o}" in
p)
PASSPHRASE_FILE=${OPTARG}
P)
PUBLIC_KEY_FILE=${OPTARG}
;;
+ c)
+ CHANGE_LOG_FILE=${OPTARG}
+ ;;
*)
usage
exit 1
esac
done
-dump_vars
-
BASE_DIR=$REPO_BASE/osm/debian/$RELEASE_DIR
[ -z "$BUILD" ] && FATAL "missing option: -b <build>"
+BUILD_NUMBER=$(echo "$BUILD" | sed -e 's/.*:: //g')
+
+dump_vars
+
[ -x $JFROG_CLI ] || FATAL "jfrog cli not found. Please install https://www.jfrog.com/getcli/ and use option '-j <jfrog cli location>'"
$JFROG_CLI rt download --build "$BUILD" osm-release || FATAL "Failed to download"
-BUILD_NUMBER=$(basename "$BUILD")
[ $PASSPHRASE_FILE ] && GPG_PASSPHRASE="--no-tty --no-use-agent --passphrase \"$(cat $PASSPHRASE_FILE)\""
cp -R $BUILD_NUMBER/dists/$IN_REPO $BASE_DIR/dists/$OUT_REPO
cp -R $BUILD_NUMBER/pool $BASE_DIR/
+[ -d "$BUILD_NUMBER/changelog" ] && cp -R $BUILD_NUMBER/changelog $BASE_DIR/
cd $BASE_DIR
-for i in RO osmclient openvim SO UI; do
+for i in RO osmclient openvim SO UI IM; do
# gpg sign the packages
dpkg-sig -g "$GPG_PASSPHRASE" -k $GPGKEY --sign builder pool/$i/*.deb
# copy over the public key file
[ "$PUBLIC_KEY_FILE" ] && cp "$PUBLIC_KEY_FILE" osm/debian/$RELEASE_DIR
+# copy over the changelog file
+[ "$CHANGE_LOG_FILE" ] && cp "$CHANGE_LOG_FILE" osm/debian/$RELEASE_DIR
+
rsync -avR $RSYNC_OPTIONS osm/debian/$RELEASE_DIR rsync://$RSYNC_USER_HOST/repos
--- /dev/null
+#!/bin/bash
+
+REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1)
+# get the latest tag
+TAG_END="HEAD"
+TAG_START=$(git tag | sort -Vr | head -1)
+git pull --tags origin master &> /dev/null
+echo "<h1>$REPO_NAME Changelog</h1>"
+echo "<h2>tag: ${TAG_START} -> ${TAG_END}</h2>"
+git log --pretty=format:"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/$REPO_NAME.git;a=commitdiff;h=%H>%h •</a> %s</li> " --reverse ${TAG_START}..${TAG_END}
--- /dev/null
+#!/bin/bash
+if [ $# -ne 2 ]; then
+ echo "Usage $0 <repo> <outfile>"
+ exit 1
+fi
+
+REPO="$1"
+OUTFILE=$2
+
+modules="devops openvim RO SO UI IM osmclient"
+list=""
+for i in $modules; do
+ if [ $REPO == "$i" -o $REPO == "all" ]; then
+ list=$REPO
+ break
+ fi
+done
+
+[ $REPO == "all" ] && list=$modules
+
+if [ -z "$list" ]; then
+ echo "Repo must be one of these: $modules all"
+ exit 1
+fi
+
+TEMPDIR=$(mktemp -d)
+
+echo "<h1>OSM Changelog</h1>" >> $OUTFILE
+for i in $list; do
+ REPODIR=$TEMPDIR/$i
+ echo
+ echo $i
+ if [ ! -d $REPODIR ]; then
+ git clone https://osm.etsi.org/gerrit/osm/$i $REPODIR
+ fi
+ git -C $REPODIR checkout master
+ git -C $REPODIR pull --rebase
+ git -C $REPODIR fetch --tags
+ TAG_START=$(git -C $REPODIR tag | sort -Vr | head -2 | sort -V | head -1)
+ TAG_END=$(git -C $REPODIR tag | sort -Vr | head -1)
+ echo "<h2>Changes for $i tag: ${TAG_START}..${TAG_END}</h2>" >> $OUTFILE
+ #git -C $i log --pretty=format:"* %h; author: %cn; date: %ci; subject:%s" ${TAG_START}..${TAG_END} >> $OUTFILE
+ git -C $REPODIR log --pretty=format:"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/$i.git;a=commitdiff;h=%H>%h •</a> %s</li> " --reverse ${TAG_START}..${TAG_END} >> $OUTFILE
+ echo "" >> $OUTFILE
+done
+
+exit 0
#!/bin/bash
-if [ $# -ne 2 ]; then
- echo "Usage $0 <repo> <tag>"
+if [ $# -ne 3 ]; then
+ echo "Usage $0 <repo> <tag> <user>"
exit 1
fi
-CURRENT_BRANCH="v2.0"
+USER=$3
TAG="$2"
-tag_header="OSM Release TWO:"
-tag_message="$tag_header version $TAG"
+tag_header="OSM Release THREE:" tag_message="$tag_header version $TAG"
-modules="juju-charms devops descriptor-packages openvim RO SO UI osmclient"
+modules="devops openvim RO SO UI IM osmclient"
list=""
for i in $modules; do
if [ "$1" == "$i" -o "$1" == "all" ]; then
fi
for i in $list; do
- echo
echo $i
- if [ "$i" == "juju-charms" ] && [ "$1" == "all" ] ; then
- #This is to allow "./newtag.sh all v2.0.0", and still checkout master in "juju-charms" before tagging
- git -C $i checkout master
- else
- git -C $i checkout $CURRENT_BRANCH
+ if [ ! -d $i ]; then
+ git clone ssh://$USER@osm.etsi.org:29418/osm/$i
fi
+ git -C $i checkout master
git -C $i pull --rebase
git -C $i tag -a $TAG -m"$tag_message"
git -C $i push origin $TAG --follow-tags
done
exit 0
-