diff --git a/src/ozones/test/etc/oned.conf.a b/src/ozones/test/etc/oned.conf.a new file mode 100644 index 0000000000..4b63ff1534 --- /dev/null +++ b/src/ozones/test/etc/oned.conf.a @@ -0,0 +1,57 @@ +HOST_MONITORING_INTERVAL = 600 +#HOST_PER_INTERVAL = 15 + +VM_POLLING_INTERVAL = 600 +#VM_PER_INTERVAL = 5 + +#VM_DIR=/srv/cloud/one/var + +SCRIPTS_REMOTE_DIR=/var/tmp/one + +PORT = 2666 + +DB = [ backend = "sqlite" ] + +VNC_BASE_PORT = 5900 + +DEBUG_LEVEL = 3 + +NETWORK_SIZE = 254 + +MAC_PREFIX = "02:00" + +DEFAULT_IMAGE_TYPE = "OS" +DEFAULT_DEVICE_PREFIX = "hd" + + +IM_MAD = [ name="im_dummy", executable="one_im_dummy"] + +VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] + +TM_MAD = [ + name = "tm_dummy", + executable = "one_tm", + arguments = "tm_dummy/tm_dummy.conf" ] + +IMAGE_MAD = [ + executable = "one_image", + arguments = "fs -t 15" ] + +HM_MAD = [ + executable = "one_hm" ] + +AUTH_MAD = [ + executable = "one_auth_mad", + arguments = "--authn ssh,x509,ldap,server_cipher,server_x509" +# arguments = "--authz quota --authn ssh,x509,ldap,server_cipher,server_x509" +] + +SESSION_EXPIRATION_TIME = 900 + +VM_RESTRICTED_ATTR = "CONTEXT/FILES" +VM_RESTRICTED_ATTR = "DISK/SOURCE" +VM_RESTRICTED_ATTR = "NIC/MAC" +VM_RESTRICTED_ATTR = "NIC/VLAN_ID" +VM_RESTRICTED_ATTR = "RANK" + +IMAGE_RESTRICTED_ATTR = "SOURCE" diff --git a/src/ozones/test/etc/oned.conf.b b/src/ozones/test/etc/oned.conf.b index c7f90b798d..589cf164ba 100644 --- a/src/ozones/test/etc/oned.conf.b +++ b/src/ozones/test/etc/oned.conf.b @@ -1,30 +1,57 @@ -#******************************************************************************* -# OpenNebula Configuration file -#******************************************************************************* - -# General - HOST_MONITORING_INTERVAL = 600 +#HOST_PER_INTERVAL = 15 + VM_POLLING_INTERVAL = 600 +#VM_PER_INTERVAL = 5 + +#VM_DIR=/srv/cloud/one/var + SCRIPTS_REMOTE_DIR=/var/tmp/one -PORT=2637 + +PORT = 2667 + DB = [ backend = "sqlite" ] + VNC_BASE_PORT = 5900 -DEBUG_LEVEL=3 + +DEBUG_LEVEL = 3 + NETWORK_SIZE = 254 + MAC_PREFIX = "02:00" + DEFAULT_IMAGE_TYPE = "OS" DEFAULT_DEVICE_PREFIX = "hd" -# Dummy IM_MAD = [ name="im_dummy", executable="one_im_dummy"] -VM_MAD = [ name="vmm_dummy",executable="one_vmm_dummy", type="xml" ] -TM_MAD = [ name="tm_dummy", executable="one_tm", arguments ="tm_dummy/tm_dummy.conf" ] -# Image -IMAGE_MAD = [ executable = "one_image", arguments = "fs -t 15" ] +VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] -# Hook -HM_MAD = [ executable = "one_hm" ] +TM_MAD = [ + name = "tm_dummy", + executable = "one_tm", + arguments = "tm_dummy/tm_dummy.conf" ] +IMAGE_MAD = [ + executable = "one_image", + arguments = "fs -t 15" ] + +HM_MAD = [ + executable = "one_hm" ] + +AUTH_MAD = [ + executable = "one_auth_mad", + arguments = "--authn ssh,x509,ldap,server_cipher,server_x509" +# arguments = "--authz quota --authn ssh,x509,ldap,server_cipher,server_x509" +] + +SESSION_EXPIRATION_TIME = 900 + +VM_RESTRICTED_ATTR = "CONTEXT/FILES" +VM_RESTRICTED_ATTR = "DISK/SOURCE" +VM_RESTRICTED_ATTR = "NIC/MAC" +VM_RESTRICTED_ATTR = "NIC/VLAN_ID" +VM_RESTRICTED_ATTR = "RANK" + +IMAGE_RESTRICTED_ATTR = "SOURCE" diff --git a/src/ozones/test/spec/VDCManagement_spec.rb b/src/ozones/test/spec/VDCManagement_spec.rb index 03b8c32c82..832fd8a37d 100644 --- a/src/ozones/test/spec/VDCManagement_spec.rb +++ b/src/ozones/test/spec/VDCManagement_spec.rb @@ -33,85 +33,90 @@ module OZones describe "oZones server regarding VDCs" do before(:all) do - @zonehelper = + @zonehelper = ZonesHelper.new("zone", "ozonesadmin","ozonespassword") - @vdchelper = - VDCHelper.new("vdc", "ozonesadmin","ozonespassword") - + @vdchelper = + VDCHelper.new("vdc", "ozonesadmin","ozonespassword") + @clientA = OpenNebula::Client.new(File.read( - File.dirname(__FILE__)+"/../etc/one_auth_a"), - "http://localhost:2636/RPC2") - + File.dirname(__FILE__)+"/../etc/one_auth_a"), + "http://localhost:2666/RPC2") + @clientB = OpenNebula::Client.new(File.read( - File.dirname(__FILE__)+"/../etc/one_auth_b"), - "http://localhost:2637/RPC2") - + File.dirname(__FILE__)+"/../etc/one_auth_b"), + "http://localhost:2667/RPC2") + hostA=OpenNebula::Host.new(OpenNebula::Host.build_xml, @clientA) - hostA.allocate("hostA1","im_dummy","vmm_dummy","tm_dummy") - hostA.allocate("hostA2","im_dummy","vmm_dummy","tm_dummy") - hostA.allocate("hostA3","im_dummy","vmm_dummy","tm_dummy") - hostA.allocate("hostA4","im_dummy","vmm_dummy","tm_dummy") - + hostA.allocate("hostA1","im_dummy","vmm_dummy","tm_dummy","dummy") + hostA.allocate("hostA2","im_dummy","vmm_dummy","tm_dummy","dummy") + hostA.allocate("hostA3","im_dummy","vmm_dummy","tm_dummy","dummy") + hostA.allocate("hostA4","im_dummy","vmm_dummy","tm_dummy","dummy") + hostB=OpenNebula::Host.new(OpenNebula::Host.build_xml, @clientB) - hostB.allocate("hostB1","im_dummy","vmm_dummy","tm_dummy") - hostB.allocate("hostB2","im_dummy","vmm_dummy","tm_dummy") - hostB.allocate("hostB3","im_dummy","vmm_dummy","tm_dummy") + hostB.allocate("hostB1","im_dummy","vmm_dummy","tm_dummy","dummy") + hostB.allocate("hostB2","im_dummy","vmm_dummy","tm_dummy","dummy") + hostB.allocate("hostB3","im_dummy","vmm_dummy","tm_dummy","dummy") end - + it "should be able to create a couple of zones" do @zonehelper.create_resource(File.dirname(__FILE__)+ "/../templates/zoneA.template")[0].should eql(0) @zonehelper.create_resource(File.dirname(__FILE__)+ - "/../templates/zoneB.template")[0].should eql(0) - end - + "/../templates/zoneB.template")[0].should eql(0) + end + it "should be able to create one vdc with the apropiate ONE resources" do @vdchelper.create_resource(File.dirname(__FILE__)+ - "/../templates/vdcA.template")[0].should eql(0) - + "/../templates/vdcA.template", + {:force => false})[0].should eql(0) + upool = OpenNebula::UserPool.new(@clientA) upool.info userExist=false - upool.each{|user| + upool.each{|user| if user['NAME'] == "vdcadminA" userExist=true end } - + userExist.should eql(true) - + gpool = OpenNebula::GroupPool.new(@clientA) gpool.info groupExist=false - gpool.each{|group| + gpool.each{|group| if group['NAME'] == "vdcA" groupExist=true end - } - + } + groupExist.should eql(true) - + apool = OpenNebula::AclPool.new(@clientA) apool.info # TODO check ACLs end - - it "should be able to create a couple of VDCs" do + + it "should be able to create a couple of VDCs" do @vdchelper.create_resource(File.dirname(__FILE__)+ - "/../templates/vdcB.template")[0].should eql(0) + "/../templates/vdcB.template", + {:force => false})[0].should eql(0) @vdchelper.create_resource(File.dirname(__FILE__)+ - "/../templates/vdcC.template")[0].should eql(0) - end - - it "should fail when creating an existing VDC" do + "/../templates/vdcC.template", + {:force => false})[0].should eql(0) + end + + it "should fail when creating an existing VDC" do @vdchelper.create_resource(File.dirname(__FILE__)+ - "/../templates/vdcA.template")[0].should eql(-1) - end - - it "should fail when creating a VDC upon a non existing zone" do + "/../templates/vdcA.template", + {:force => false})[0].should eql(-1) + end + + it "should fail when creating a VDC upon a non existing zone" do @vdchelper.create_resource(File.dirname(__FILE__)+ - "/../templates/vdc.no.zone.template")[0].should eql(-1) - end - + "/../templates/vdc.no.zone.template", + {:force => false})[0].should eql(-1) + end + end end diff --git a/src/ozones/test/templates/vdcC.template b/src/ozones/test/templates/vdcC.template index 31fbb6c4a0..47c2b9148b 100644 --- a/src/ozones/test/templates/vdcC.template +++ b/src/ozones/test/templates/vdcC.template @@ -2,4 +2,4 @@ NAME=vdcC VDCADMINNAME=vdcadminC VDCADMINPASS=vdcpassC ZONEID=1 -HOSTS=3 \ No newline at end of file +HOSTS=4 diff --git a/src/ozones/test/templates/zoneA.template b/src/ozones/test/templates/zoneA.template index 35b6adfb5f..bd92fcb475 100644 --- a/src/ozones/test/templates/zoneA.template +++ b/src/ozones/test/templates/zoneA.template @@ -1,5 +1,5 @@ NAME=zoneA ONENAME=oneadminA ONEPASS=opennebulaA -ENDPOINT=http://localhost:2636/RPC2 -SUNSENDPOINT=http://localhost:9869 \ No newline at end of file +ENDPOINT=http://localhost:2666/RPC2 +SUNSENDPOINT=http://localhost:9869 diff --git a/src/ozones/test/templates/zoneB.template b/src/ozones/test/templates/zoneB.template index 3eb7b9348b..9aa9cdda36 100644 --- a/src/ozones/test/templates/zoneB.template +++ b/src/ozones/test/templates/zoneB.template @@ -1,4 +1,4 @@ NAME=zoneB ONENAME=oneadminB ONEPASS=opennebulaB -ENDPOINT=http://localhost:2637/RPC2 \ No newline at end of file +ENDPOINT=http://localhost:2667/RPC2 diff --git a/src/ozones/test/test.sh b/src/ozones/test/test.sh index 963032dcf2..a1822faffc 100755 --- a/src/ozones/test/test.sh +++ b/src/ozones/test/test.sh @@ -35,8 +35,7 @@ for j in `ls ./spec/*_spec.rb` ; do OZONES_AUTH=$PWD/etc/ozones_auth ONE_LOCATION=$ONE_LOCATION_A oneA/bin/ozones-server start sleep 5 - - ONE_LOCATION=$ONE_LOCATION_A spec $j -f s + ONE_LOCATION=$ONE_LOCATION_A rspec $j -f s CODE=$? if [ $CODE != 0 ] ; then @@ -62,8 +61,4 @@ if (($CODE == 0)); then # Delete directories rm -rf oneA rm -rf oneB -fi - - - - +fi \ No newline at end of file