2 mkdir
-p /etc
/systemd
/system
/scripts
3 cat > /etc
/systemd
/system
/scripts
/osm-vimemu-startup.sh
<<-'EOF'
6 export OSM_HOSTNAME=127.0.0.1
9 echo "Waiting for OSM startup"
11 # wait for startup of osm
13 if [ "$?" -eq 0 ]; then
20 export VIMEMU_HOSTNAME=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
21 osm vim-create --name vim-emulator --user username --password password --auth_url http://$VIMEMU_HOSTNAME:6001/v2.0 --tenant tenantName --account_type openstack
22 osm vnfd-create /home/vagrant/vim-emu/examples/vnfs/ping.tar.gz
23 osm vnfd-create /home/vagrant/vim-emu/examples/vnfs/pong.tar.gz
24 osm nsd-create /home/vagrant/vim-emu/examples/services/pingpong_nsd.tar.gz
25 osm ns-create --nsd_name pingpong --ns_name test --vim_account vim-emulator
27 echo "VIM emulator created"
28 systemctl disable osm-vimemu-setup.service
30 chmod +x
/etc
/systemd
/system
/scripts
/osm-vimemu-startup.sh
32 cat > /etc
/systemd
/system
/osm-vimemu-setup.service
<<-'EOF'
34 Description=OSM VIM emulator setup
38 ExecStart=/etc/systemd/system/scripts/osm-vimemu-startup.sh
42 # Output needs to appear in instance console output
43 StandardOutput=journal+console
46 WantedBy=multi-user.target
49 #systemctl enable osm-vimemu-setup.service