3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 mkdir
-p /etc
/systemd
/system
/scripts
16 cat > /etc
/systemd
/system
/scripts
/osm-vimemu-startup.sh
<<-'EOF'
19 export OSM_HOSTNAME=127.0.0.1
20 export OSM_SOL005=True
22 echo "Waiting for OSM startup"
24 # wait for startup of osm
26 if [ "$?" -eq 0 ]; then
33 export VIMEMU_HOSTNAME=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
34 osm vim-create --name vim-emulator --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack
35 osm vnfd-create /home/vagrant/vim-emu/examples/vnfs/ping.tar.gz
36 osm vnfd-create /home/vagrant/vim-emu/examples/vnfs/pong.tar.gz
37 osm nsd-create /home/vagrant/vim-emu/examples/services/pingpong_nsd.tar.gz
38 osm ns-create --nsd_name pingpong --ns_name test --vim_account vim-emulator
40 echo "VIM emulator created"
41 systemctl disable osm-vimemu-setup.service
43 chmod +x
/etc
/systemd
/system
/scripts
/osm-vimemu-startup.sh
45 cat > /etc
/systemd
/system
/osm-vimemu-setup.service
<<-'EOF'
47 Description=OSM VIM emulator setup
51 ExecStart=/etc/systemd/system/scripts/osm-vimemu-startup.sh
55 # Output needs to appear in instance console output
56 StandardOutput=journal+console
59 WantedBy=multi-user.target
62 #systemctl enable osm-vimemu-setup.service