From ccccedae0b0a77c98a0bccffb18cc0f0da7b94d7 Mon Sep 17 00:00:00 2001 From: "juraj.linkes" Date: Tue, 6 Dec 2016 10:30:35 +0100 Subject: Added basic script for creating two vms using openstack client and a script that mimics functests' vping_ssh using openstack client Change-Id: I90cfacd8d4f042f707a197deb6a3dc680ff692e5 Signed-off-by: juraj.linkes --- scripts/create_two_vms.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/create_two_vms.sh (limited to 'scripts/create_two_vms.sh') diff --git a/scripts/create_two_vms.sh b/scripts/create_two_vms.sh new file mode 100755 index 0000000..10cc094 --- /dev/null +++ b/scripts/create_two_vms.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# NETWORK AND SUBNET +echo "Creating network with subnet" +neutron net-create test-net +neutron subnet-create --name test-subnet test-net 192.168.20.0/24 + +# ATTACH NETWORK TO ROUTER +echo "Attaching external and tenant networks to reouter" +neutron router-create test-router +neutron router-interface-add test-router test-subnet +neutron router-gateway-set test-router external + +# FIRST VM +echo "Creating port and first VM" +neutron port-create --name test-port1 test-net +nova boot --image cirros-0.3.4 --flavor nfv --nic port-id=`neutron port-list | grep test-port1 | cut -f 2 -d " "` test-vm1 + +# SECOND VM +echo "Creating port and second VM" +neutron port-create --name test-port2 test-net +nova boot --image cirros-0.3.4 --flavor nfv --nic port-id=`neutron port-list | grep test-port2 | cut -f 2 -d " "` test-vm2 + +# FLOATING IP +echo "Creating floating IP for the first VM" +neutron floatingip-create external --port-id `neutron port-list | grep test-port1 | cut -f 2 -d " "` -- cgit 1.2.3-korg