| Jeremy Mordkoff | 6f07e6f | 2016-09-07 18:56:51 -0400 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| 3 | set -e |
| 4 | set -x |
| 5 | |
| 6 | SOURCE_DIR=@CMAKE_CURRENT_SOURCE_DIR@ |
| 7 | BINARY_DIR=@CMAKE_CURRENT_BINARY_DIR@ |
| 8 | PROJECT_TOP_DIR=@PROJECT_TOP_DIR@ |
| 9 | QCOW_IMAGE=${RIFT_ROOT}/images/Fedora-x86_64-20-20131211.1-sda.qcow2 |
| 10 | RIFT_QCOW_IMAGE=${RIFT_ROOT}/images/Fedora-x86_64-20-20131211.1-sda.qcow2 |
| 11 | PONG_QCOW_IMAGE=${RIFT_ROOT}/images/Fedora-x86_64-20-20131211.1-sda-pong.qcow2 |
| 12 | PING_QCOW_IMAGE=${RIFT_ROOT}/images/Fedora-x86_64-20-20131211.1-sda-ping.qcow2 |
| 13 | |
| 14 | # These paths are needed for finding the overrides and so files |
| Philip Joseph | 06ba382 | 2016-09-16 07:24:18 -0400 | [diff] [blame] | 15 | PYTHONPATH=@RIFT_SUBMODULE_SOURCE_ROOT@/rwvcs/ra:@RIFT_SUBMODULE_BINARY_ROOT@/models/plugins/yang:${PYTHONPATH} |
| 16 | PYTHON3PATH=@RIFT_SUBMODULE_SOURCE_ROOT@/rwvcs/ra:@RIFT_SUBMODULE_BINARY_ROOT@/models/plugins/yang:${PYTHON3PATH} |
| 17 | LD_LIBRARY_PATH=@RIFT_SUBMODULE_BINARY_ROOT@/models/plugins/yang:@RIFT_SUBMODULE_BINARY_ROOT@/common/plugins/yang:${LD_LIBRARY_PATH} |
| Jeremy Mordkoff | 6f07e6f | 2016-09-07 18:56:51 -0400 | [diff] [blame] | 18 | |
| 19 | #Rift Logos |
| 20 | PING_VNFD_LOGO=${SOURCE_DIR}/rift_logo.png |
| 21 | PONG_VNFD_LOGO=${SOURCE_DIR}/rift_logo.png |
| 22 | PING_PONG_NSD_LOGO=${SOURCE_DIR}/rift_logo.png |
| 23 | |
| 24 | # Remove any old directories |
| 25 | rm -rf ${BINARY_DIR}/ping_vnfd |
| 26 | rm -rf ${BINARY_DIR}/pong_vnfd |
| 27 | rm -rf ${BINARY_DIR}/ping_pong_nsd |
| 28 | |
| 29 | rm -rf ${BINARY_DIR}/ping_vnfd_with_image |
| 30 | rm -rf ${BINARY_DIR}/pong_vnfd_with_image |
| 31 | |
| 32 | |
| 33 | rm -rf ${BINARY_DIR}/ping_vnfd_aws |
| 34 | rm -rf ${BINARY_DIR}/pong_vnfd_aws |
| 35 | rm -rf ${BINARY_DIR}/ping_pong_nsd_aws |
| 36 | |
| 37 | rm -rf ${BINARY_DIR}/ping_vnfd_with_epa |
| 38 | rm -rf ${BINARY_DIR}/pong_vnfd_with_epa |
| 39 | rm -rf ${BINARY_DIR}/ping_pong_nsd_with_epa |
| 40 | |
| 41 | |
| 42 | # Generate image md5sum |
| 43 | ping_md5sum="$(md5sum ${PING_QCOW_IMAGE} | cut -f1 -d" ")" |
| 44 | pong_md5sum="$(md5sum ${PONG_QCOW_IMAGE} | cut -f1 -d" ")" |
| 45 | |
| 46 | # Generate the descriptors (in various formats) |
| 47 | ${SOURCE_DIR}/ping_pong_nsd.py --outdir=${BINARY_DIR} --format=yaml --ping-image-md5=${ping_md5sum} --pong-image-md5=${pong_md5sum} --pong-cloud-init=pong_cloud_init.cfg --ping-cloud-init=ping_cloud_init.cfg |
| 48 | |
| 49 | |
| 50 | # create directories for packages with images |
| 51 | cp -r ${BINARY_DIR}/ping_vnfd ${BINARY_DIR}/ping_vnfd_with_image |
| 52 | cp -r ${BINARY_DIR}/pong_vnfd ${BINARY_DIR}/pong_vnfd_with_image |
| 53 | mkdir -p ${BINARY_DIR}/ping_vnfd_with_image/images |
| 54 | mkdir -p ${BINARY_DIR}/pong_vnfd_with_image/images |
| 55 | |
| 56 | ### Generate descriptors for AWS |
| 57 | ${SOURCE_DIR}/ping_pong_nsd.py --outdir=${BINARY_DIR}/aws --format=json --aws |
| 58 | |
| 59 | ### Move the generated artifacts to appropriate directories |
| 60 | mv ${BINARY_DIR}/aws/ping_vnfd ${BINARY_DIR}/ping_vnfd_aws |
| 61 | mv ${BINARY_DIR}/aws/pong_vnfd ${BINARY_DIR}/pong_vnfd_aws |
| 62 | mv ${BINARY_DIR}/aws/ping_pong_nsd ${BINARY_DIR}/ping_pong_nsd_aws |
| 63 | |
| 64 | ### ReMove the original directories |
| 65 | rm -rf ${BINARY_DIR}/aws |
| 66 | |
| 67 | ### Generate descriptors with EPA |
| 68 | ${SOURCE_DIR}/ping_pong_nsd.py --outdir=${BINARY_DIR}/with_epa --format=json --epa --ping-image-md5=${ping_md5sum} --pong-image-md5=${pong_md5sum} |
| 69 | |
| 70 | ### Move the generated artifacts to appropriate directories |
| 71 | mv ${BINARY_DIR}/with_epa/ping_vnfd ${BINARY_DIR}/ping_vnfd_with_epa |
| 72 | mv ${BINARY_DIR}/with_epa/pong_vnfd ${BINARY_DIR}/pong_vnfd_with_epa |
| 73 | mv ${BINARY_DIR}/with_epa/ping_pong_nsd ${BINARY_DIR}/ping_pong_nsd_with_epa |
| 74 | |
| 75 | ### ReMove the original directories |
| 76 | rm -rf ${BINARY_DIR}/with_epa |
| 77 | |
| 78 | # copy a dummy image for now |
| 79 | if [ -e ${PING_QCOW_IMAGE} ]; then |
| 80 | # Add RIFT Logos |
| 81 | mkdir -p ${BINARY_DIR}/ping_vnfd_with_image/icons |
| 82 | cp ${PING_VNFD_LOGO} ${BINARY_DIR}/ping_vnfd_with_image/icons/ |
| 83 | |
| 84 | cp ${PING_QCOW_IMAGE} ${BINARY_DIR}/ping_vnfd_with_image/images/ |
| 85 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_vnfd_with_image |
| 86 | else |
| 87 | echo >&2 "Warn: Skipped creating ping_vnfd_with_image due to missing image: ${PING_QCOW_IMAGE}" |
| 88 | fi |
| 89 | |
| 90 | if [ -e ${PONG_QCOW_IMAGE} ]; then |
| 91 | # Add RIFT Logos |
| 92 | mkdir -p ${BINARY_DIR}/pong_vnfd_with_image/icons |
| 93 | cp ${PONG_VNFD_LOGO} ${BINARY_DIR}/pong_vnfd_with_image/icons/ |
| 94 | |
| 95 | cp ${PONG_QCOW_IMAGE} ${BINARY_DIR}/pong_vnfd_with_image/images/ |
| 96 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} pong_vnfd_with_image |
| 97 | else |
| 98 | echo >&2 "Warn: Skipped creating pong_vnfd_with_image due to missing image: ${PONG_QCOW_IMAGE}" |
| 99 | fi |
| 100 | |
| 101 | # Add RIFT Logos |
| 102 | mkdir -p ${BINARY_DIR}/ping_vnfd/icons |
| 103 | mkdir -p ${BINARY_DIR}/pong_vnfd/icons |
| 104 | mkdir -p ${BINARY_DIR}/ping_pong_nsd/icons |
| 105 | |
| 106 | cp ${PING_VNFD_LOGO} ${BINARY_DIR}/ping_vnfd/icons/ |
| 107 | cp ${PONG_VNFD_LOGO} ${BINARY_DIR}/pong_vnfd/icons/ |
| 108 | cp ${PING_PONG_NSD_LOGO} ${BINARY_DIR}/ping_pong_nsd/icons/ |
| 109 | |
| 110 | # Generate the tar files |
| 111 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_vnfd |
| 112 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} pong_vnfd |
| 113 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_pong_nsd |
| 114 | |
| 115 | |
| 116 | # Add RIFT Logos |
| 117 | mkdir -p ${BINARY_DIR}/ping_vnfd_aws/icons |
| 118 | mkdir -p ${BINARY_DIR}/pong_vnfd_aws/icons |
| 119 | mkdir -p ${BINARY_DIR}/ping_pong_nsd_aws/icons |
| 120 | |
| 121 | cp ${PING_VNFD_LOGO} ${BINARY_DIR}/ping_vnfd_aws/icons/ |
| 122 | cp ${PONG_VNFD_LOGO} ${BINARY_DIR}/pong_vnfd_aws/icons/ |
| 123 | cp ${PING_PONG_NSD_LOGO} ${BINARY_DIR}/ping_pong_nsd_aws/icons/ |
| 124 | |
| 125 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_vnfd_aws |
| 126 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} pong_vnfd_aws |
| 127 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_pong_nsd_aws |
| 128 | |
| 129 | # Add RIFT Logos |
| 130 | mkdir -p ${BINARY_DIR}/ping_vnfd_with_epa/icons |
| 131 | mkdir -p ${BINARY_DIR}/pong_vnfd_with_epa/icons |
| 132 | mkdir -p ${BINARY_DIR}/ping_pong_nsd_with_epa/icons |
| 133 | |
| 134 | cp ${PING_VNFD_LOGO} ${BINARY_DIR}/ping_vnfd_with_epa/icons/ |
| 135 | cp ${PONG_VNFD_LOGO} ${BINARY_DIR}/pong_vnfd_with_epa/icons/ |
| 136 | cp ${PING_PONG_NSD_LOGO} ${BINARY_DIR}/ping_pong_nsd_with_epa/icons/ |
| 137 | |
| 138 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_vnfd_with_epa |
| 139 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} pong_vnfd_with_epa |
| 140 | ${RIFT_INSTALL}/usr/rift/toolchain/cmake/bin/generate_descriptor_pkg.sh ${BINARY_DIR} ping_pong_nsd_with_epa |