| Suresh Balakrishnan | bb49246 | 2016-10-06 05:37:50 -0400 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2016 RIFT.io Inc |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | # |
| 17 | |
| 18 | vnfd:vnfd-catalog: |
| Rajesh | 9c7073a | 2016-10-10 12:34:37 -0400 | [diff] [blame] | 19 | vnfd: |
| 20 | - connection-point: |
| 21 | - name: ping_vnfd/cp0 |
| 22 | type: VPORT |
| 23 | - name: ping_vnfd/cp1 |
| 24 | type: VPORT |
| 25 | description: This is an example RIFT.ware VNF |
| 26 | http-endpoint: |
| 27 | - path: api/v1/ping/stats |
| 28 | polling_interval_secs: '2' |
| 29 | port: '18888' |
| 30 | id: 8759e766-8b99-11e6-9664-02b76030c497 |
| 31 | logo: rift_logo.png |
| 32 | mgmt-interface: |
| 33 | dashboard-params: |
| 34 | path: api/v1/ping/stats |
| 35 | port: '18888' |
| 36 | port: '18888' |
| 37 | vdu-id: iovdu_0 |
| 38 | monitoring-param: |
| 39 | - description: no of ping requests |
| 40 | group-tag: Group1 |
| 41 | http-endpoint-ref: api/v1/ping/stats |
| 42 | id: '1' |
| 43 | json-query-method: NAMEKEY |
| 44 | name: ping-request-tx-count |
| 45 | units: packets |
| 46 | value-type: INT |
| 47 | widget-type: COUNTER |
| 48 | - description: no of ping responses |
| 49 | group-tag: Group1 |
| 50 | http-endpoint-ref: api/v1/ping/stats |
| 51 | id: '2' |
| 52 | json-query-method: NAMEKEY |
| 53 | name: ping-response-rx-count |
| 54 | units: packets |
| 55 | value-type: INT |
| 56 | widget-type: COUNTER |
| 57 | name: ping_vnfd |
| 58 | placement-groups: |
| 59 | - member-vdus: |
| 60 | - member-vdu-ref: iovdu_0 |
| 61 | name: Eris |
| 62 | requirement: Place this VM on the Kuiper belt object Eris |
| 63 | strategy: COLOCATION |
| 64 | short-name: ping_vnfd |
| 65 | vdu: |
| 66 | - count: '1' |
| 67 | external-interface: |
| 68 | - name: eth0 |
| 69 | virtual-interface: |
| 70 | type: OM-MGMT |
| 71 | vnfd-connection-point-ref: ping_vnfd/cp0 |
| 72 | - name: eth1 |
| 73 | virtual-interface: |
| 74 | type: VIRTIO |
| 75 | vnfd-connection-point-ref: ping_vnfd/cp1 |
| 76 | id: iovdu_0 |
| 77 | image: Fedora-x86_64-20-20131211.1-sda-ping.qcow2 |
| 78 | image-checksum: a6ffaa77f949a9e4ebb082c6147187cf |
| 79 | name: iovdu_0 |
| 80 | vm-flavor: |
| 81 | memory-mb: '512' |
| 82 | storage-gb: '4' |
| 83 | vcpu-count: '1' |
| 84 | vendor: RIFT.io |
| 85 | version: '1.0' |
| 86 | vnf-configuration: |
| 87 | config-attributes: |
| 88 | config-delay: '0' |
| 89 | config-priority: '2' |
| 90 | config-template: "\n#!/bin/bash\n\n# Rest API config\nping_mgmt_ip='<rw_mgmt_ip>'\n\ |
| Suresh Balakrishnan | bb49246 | 2016-10-06 05:37:50 -0400 | [diff] [blame] | 91 | ping_mgmt_port=18888\n\n# VNF specific configuration\npong_server_ip='<rw_connection_point_name\ |
| 92 | \ pong_vnfd/cp0>'\nping_rate=5\nserver_port=5555\n\n# Make rest API\ |
| 93 | \ calls to configure VNF\ncurl -D /dev/stdout \\\n -H \"Accept:\ |
| 94 | \ application/vnd.yang.data+xml\" \\\n -H \"Content-Type: application/vnd.yang.data+json\"\ |
| 95 | \ \\\n -X POST \\\n -d \"{\\\"ip\\\":\\\"$pong_server_ip\\\"\ |
| 96 | , \\\"port\\\":$server_port}\" \\\n http://${ping_mgmt_ip}:${ping_mgmt_port}/api/v1/ping/server\n\ |
| 97 | rc=$?\nif [ $rc -ne 0 ]\nthen\n echo \"Failed to set server info\ |
| 98 | \ for ping!\"\n exit $rc\nfi\n\ncurl -D /dev/stdout \\\n -H\ |
| 99 | \ \"Accept: application/vnd.yang.data+xml\" \\\n -H \"Content-Type:\ |
| 100 | \ application/vnd.yang.data+json\" \\\n -X POST \\\n -d \"{\\\ |
| 101 | \"rate\\\":$ping_rate}\" \\\n http://${ping_mgmt_ip}:${ping_mgmt_port}/api/v1/ping/rate\n\ |
| 102 | rc=$?\nif [ $rc -ne 0 ]\nthen\n echo \"Failed to set ping rate!\"\ |
| 103 | \n exit $rc\nfi\n\n\noutput=$(curl -D /dev/stdout \\\n -H \"\ |
| 104 | Accept: application/vnd.yang.data+xml\" \\\n -H \"Content-Type:\ |
| 105 | \ application/vnd.yang.data+json\" \\\n -X POST \\\n -d \"{\\\ |
| 106 | \"enable\\\":true}\" \\\n http://${ping_mgmt_ip}:${ping_mgmt_port}/api/v1/ping/adminstatus/state)\n\ |
| 107 | if [[ $output == *\"Internal Server Error\"* ]]\nthen\n echo $output\n\ |
| 108 | \ exit 3\nelse\n echo $output\nfi\n\nexit 0\n" |
| Rajesh | 9c7073a | 2016-10-10 12:34:37 -0400 | [diff] [blame] | 109 | script: |
| 110 | script-type: bash |