# 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)
+NSD_FOLDERS=(scripts charms icons ns_config vnf_config)
# Other files allowed in the descriptor base directory
ALLOWED_FILES=(README)
+ALLOWED_FILES_WILDCARDS=(README)
DESC_TYPES=(vnfd nsd)
DESC_EXTN=(yml yaml json xml)
ARCHIVE=false
CREATE_NSD=false
VENDOR='OSM'
-INTF_TYPE='VIRTIO'
+INTF_TYPE='PARAVIRT'
VCPU=2
MEMORY=4096
STORAGE=10
--vendor : Vendor name for descriptor. Default OSM
- --interface-type : Interface type [VIRTIO|SR-IOV|PCI-PASSTHROUGH|E1000]
- Default VIRTIO
+ --interface-type : Interface type [PARAVIRT|SR-IOV|PCI-PASSTHROUGH|E1000]
+ Default PARAVIRT
VM Flavour options:
CP_TYPE='VPORT'
function get_cp_type() {
case ${INTF_TYPE} in
- VIRTIO ) CP_TYPE='VPORT';;
+ PARAVIRT ) CP_TYPE='VPORT';;
SR-IOV ) CP_TYPE='VPORT';;
PCI-PASSTHROUGH ) CP_TYPE='VPORT';;
OM-MGMT ) CP_TYPE='VPORT';;
- id: ${name}
name: ${name}
short-name: ${name}
- description: Generated by OSM pacakage generator
+ description: Generated by OSM package generator
vendor: ${VENDOR}
version: '1.0'
# Management interface
mgmt-interface:
- vdu-id: ${name}-VM
+ cp: vnf-cp0
# Atleast one VDU need to be specified
vdu:
# Add external interfaces
cat >>$desc_file <<EOF
- external-interface:
+ 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'
- vnfd-connection-point-ref: eth0
+ type: PARAVIRT
+ external-connection-point-ref: vnf-cp0
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'
- vnfd-connection-point-ref: eth${eth}
+ external-connection-point-ref: vnf-cp${eth}
EOF
done
for i in `seq 0 ${INTERFACES}`; do
eth=$(($i))
cat >>$desc_file <<EOF
- - name: eth${eth}
- type: ${CP_TYPE}
+ - name: vnf-cp${eth}
EOF
done
- id: ${name}
name: ${name}
short-name: ${name}
- description: Generated by OSM pacakage generator
+ description: Generated by OSM package generator
vendor: ${VENDOR}
version: '1.0'
# 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
+ - 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
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: ${vnfd}
+ # NOTE: Validate the entry below
+ vnfd-connection-point-ref: vnf-cp0
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}
+ - 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
+ - member-vnf-index-ref: 1
+ vnfd-id-ref: ${vnfd}
+ # NOTE: Validate the entry below
+ vnfd-connection-point-ref: vnf-cp${eth}
EOF
- done
+ done
if [ $VERBOSE == true ]; then
echo "INFO: Created $desc_file"
for f in ${files[@]}; do
if [ $(contains "${ALLOWED_FILES[@]}" $f) == "n" ]; then
- echo "WARN: Unsupported file $f found"
+ for j in ${ALLOWED_FILES_WILDCARDS[@]}; do
+ if [[ $f != *"$j"* ]]; then
+ echo "WARN: Unsupported file $f found"
+ fi
+ done
fi
done
fi
cd $BASE_DIR
+ # Mrityunjay Yadav: Validate descriptor
+ GEN_BASEDIR=$(dirname "$0")
+ python3 $GEN_BASEDIR/validate_descriptor.py $BASE_DIR/$PKG/$descriptor
+ if [ $? -ne 0 ]; then
+ rc=$?
+ echo "ERROR: validating descriptor for $PKG ($rc)" >&2
+ exit $rc
+ fi
if [ $DRY_RUN == false ]; then
if [ $VERBOSE == true ]; then
tar zcvf "$DEST_DIR/$PKG.tar.gz" "${PKG}" ${RM}