cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [10/16] git commit: updated refs/heads/master to 67b753c
Date Mon, 28 Dec 2015 10:22:34 GMT
CLOUDSTACK-9074: Marvin tests for NSX Shared Networks Support


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ac27377
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ac27377
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ac27377

Branch: refs/heads/master
Commit: 4ac2737754a20c0ff8ccb3f1b9622e0651fe1b8b
Parents: 0726420
Author: nvazquez <nicolas.m.vazquez@gmail.com>
Authored: Wed Dec 9 10:58:02 2015 -0800
Committer: nvazquez <nicovazquez90@gmail.com>
Committed: Thu Dec 24 16:07:06 2015 -0300

----------------------------------------------------------------------
 .../plugins/test_nicira_controller.py           | 210 ++++++++++++++++---
 tools/marvin/marvin/lib/base.py                 |   9 +-
 2 files changed, 189 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ac27377/test/integration/plugins/test_nicira_controller.py
----------------------------------------------------------------------
diff --git a/test/integration/plugins/test_nicira_controller.py b/test/integration/plugins/test_nicira_controller.py
index 6c625b6..c2523b7 100644
--- a/test/integration/plugins/test_nicira_controller.py
+++ b/test/integration/plugins/test_nicira_controller.py
@@ -54,28 +54,52 @@ class TestNiciraContoller(cloudstackTestCase):
 
         cls.physical_networks = cls.config.zones[0].physical_networks
         cls.nicira_hosts      = cls.config.niciraNvp.hosts
+		
+        cls.l2gatewayserviceuuid   = cls.config.niciraNvp.l2gatewayserviceuuid
 
         cls.physical_network_id = cls.get_nicira_enabled_physical_network_id(cls.physical_networks)
 
-        cls.network_offerring_services = {
-            'name':              'NiciraEnabledNetwork',
-            'displaytext':       'NiciraEnabledNetwork',
-            'guestiptype':       'Isolated',
-            'supportedservices': 'SourceNat,Dhcp,Dns,Firewall,PortForwarding,Connectivity',
-            'traffictype':       'GUEST',
-            'availability':      'Optional',
-            'serviceProviderList': {
-                    'SourceNat':      'VirtualRouter',
-                    'Dhcp':           'VirtualRouter',
-                    'Dns':            'VirtualRouter',
-                    'Firewall':       'VirtualRouter',
-                    'PortForwarding': 'VirtualRouter',
-                    'Connectivity':   'NiciraNvp'
-            }
-        }
-
-        cls.network_offering = NetworkOffering.create(cls.api_client, cls.network_offerring_services)
-        cls.network_offering.update(cls.api_client, state='Enabled')
+        cls.network_offerring_services = [
+			{
+				'name':              'NiciraEnabledNetwork',
+				'displaytext':       'NiciraEnabledNetwork',
+				'guestiptype':       'Isolated',
+            			'supportedservices': 'SourceNat,Dhcp,Dns,Firewall,PortForwarding,Connectivity',
+				'traffictype':       'GUEST',
+				'availability':      'Optional',
+				'serviceProviderList': {
+						'SourceNat':      'VirtualRouter',
+                    				'Dhcp':           'VirtualRouter',
+                    				'Dns':            'VirtualRouter',
+						'Firewall':       'VirtualRouter',
+						'PortForwarding': 'VirtualRouter',
+						'Connectivity':   'NiciraNvp'
+				}
+			},
+			{
+				'name':              'NiciraEnabledSharedNetwork',
+				'displaytext':       'NiciraEnabledSharedNetwork',
+				'guestiptype':       'Shared',
+				'supportedservices': 'Connectivity,Dhcp,UserData',
+				'traffictype':       'GUEST',
+				'availability':      'Optional',
+				'specifyVlan':		'true',
+				'specifyIpRanges':	'true',
+				'serviceProviderList': {
+						'Connectivity':   	'NiciraNvp',
+						'Dhcp':       		'VirtualRouter',
+						'UserData': 		'VirtualRouter'
+				}
+			}
+		]
+
+        cls.network_offering_isolated = NetworkOffering.create(cls.api_client, cls.network_offerring_services[0])
+        cls.network_offering_isolated.update(cls.api_client, state='Enabled')
+
+        cls.network_offering_shared = NetworkOffering.create(cls.api_client, cls.network_offerring_services[1])
+        cls.network_offering_shared.update(cls.api_client, state='Enabled')
+		
+        cls.ip_ranges_shared = cls.config.zones[0].ipranges[0]
 
         cls.nicira_credentials = {
             'username': 'admin',
@@ -123,6 +147,7 @@ class TestNiciraContoller(cloudstackTestCase):
                     'cpunumber':   1,
                     'cpuspeed':    100,
                     'memory':      64,
+					'offerha':		'true'
                 }
             }
         }
@@ -136,8 +161,9 @@ class TestNiciraContoller(cloudstackTestCase):
         )
 
         cls.cleanup = [
-            cls.network_offering,
-            cls.service_offering
+            cls.network_offering_isolated,
+            cls.service_offering,
+			cls.network_offering_shared
         ]
 
         cls.logger = logging.getLogger('TestNiciraContoller')
@@ -230,13 +256,86 @@ class TestNiciraContoller(cloudstackTestCase):
             transportzoneuuid=self.transport_zone_uuid)
         self.test_cleanup.append(nicira_device)
 
+    def add_nicira_device_l2gateway(self, hostname):
+        nicira_device = NiciraNvp.add(
+            self.api_client,
+            None,
+            self.physical_network_id,
+            hostname=hostname,
+            username=self.nicira_credentials['username'],
+            password=self.nicira_credentials['password'],
+            transportzoneuuid=self.transport_zone_uuid,
+            l2gatewayserviceuuid=self.l2gatewayserviceuuid)
+        self.test_cleanup.append(nicira_device)
+
+    def create_guest_isolated_network(self):
+        network_services = {
+            'name'            : 'nicira_enabled_network_isolated',
+            'displaytext'     : 'nicira_enabled_network_isolated',
+            'zoneid'          : self.zone.id,
+            'networkoffering' : self.network_offering_isolated.id
+        }
+        network = Network.create(
+            self.api_client,
+            network_services,
+            accountid='admin',
+            domainid=self.domain.id,
+        )
+        self.test_cleanup.append(network)
+        return network
+
+    def create_guest_shared_network_numerical_vlanid(self):
+        network_services = {
+            'name'            : 'nicira_enabled_network_shared',
+            'displaytext'     : 'nicira_enabled_network_shared',
+            'zoneid'          : self.zone.id,
+            'networkoffering' : self.network_offering_shared.id,
+			'startip'			: self.ip_ranges_shared.startip,
+			'endip'				: self.ip_ranges_shared.endip,
+			'netmask'			: self.ip_ranges_shared.netmask,
+			'gateway'			: self.ip_ranges_shared.gateway
+        }
+        network = Network.create(
+            self.api_client,
+            network_services,
+            accountid='admin',
+            domainid=self.domain.id,
+			vlan=self.ip_ranges_shared.vlan
+        )
+        self.test_cleanup.append(network)
+        return network
+
+    def create_guest_shared_network_uuid_vlanid(self):
+        network_services = {
+            'name'            : 'nicira_enabled_network_shared',
+            'displaytext'     : 'nicira_enabled_network_shared',
+            'zoneid'          : self.zone.id,
+            'networkoffering' : self.network_offering_shared.id,
+			'startip'			: self.ip_ranges_shared.startip,
+			'endip'				: self.ip_ranges_shared.endip,
+			'netmask'			: self.ip_ranges_shared.netmask,
+			'gateway'			: self.ip_ranges_shared.gateway
+        }
+        network = Network.create(
+            self.api_client,
+            network_services,
+            accountid='admin',
+            domainid=self.domain.id,
+			vlan=self.ip_ranges_shared.vlan_uuid
+        )
+        self.test_cleanup.append(network)
+        return network
 
-    def create_guest_network(self):
+    def create_guest_shared_network_services(self):
         network_services = {
-            'name'            : 'nicira_enabled_network',
-            'displaytext'     : 'nicira_enabled_network',
+            'name'            : 'nicira_enabled_network_shared',
+            'displaytext'     : 'nicira_enabled_network_shared',
             'zoneid'          : self.zone.id,
-            'networkoffering' : self.network_offering.id
+            'networkoffering' : self.network_offering_shared.id,
+			'startip'			: self.ip_ranges_shared.startip,
+			'endip'				: self.ip_ranges_shared.endip,
+			'netmask'			: self.ip_ranges_shared.netmask,
+			'gateway'			: self.ip_ranges_shared.gateway
         }
         network = Network.create(
             self.api_client,
@@ -261,6 +360,19 @@ class TestNiciraContoller(cloudstackTestCase):
         self.test_cleanup.append(virtual_machine)
         return virtual_machine
 
+    def create_virtual_machine_shared_networks(self, network):
+        virtual_machine = VirtualMachine.create(
+            self.api_client,
+            self.vm_services['small'],
+            accountid='admin',
+            domainid=self.domain.id,
+            serviceofferingid=self.service_offering.id,
+            networkids=[network.id],
+            mode='BASIC'
+        )
+        self.test_cleanup.append(virtual_machine)
+        return virtual_machine
+
 
     def get_routers_for_network(self, network):
         return list_routers(
@@ -336,7 +448,7 @@ class TestNiciraContoller(cloudstackTestCase):
     def test_01_nicira_controller(self):
         self.add_nicira_device(self.nicira_master_controller)
 
-        network         = self.create_guest_network()
+        network         = self.create_guest_isolated_network()
         virtual_machine = self.create_virtual_machine(network)
 
         list_vm_response = VirtualMachine.list(self.api_client, id=virtual_machine.id)
@@ -367,7 +479,7 @@ class TestNiciraContoller(cloudstackTestCase):
 
         self.add_nicira_device(nicira_slave)
 
-        network         = self.create_guest_network()
+        network         = self.create_guest_isolated_network()
         virtual_machine = self.create_virtual_machine(network)
 
         list_vm_response = VirtualMachine.list(self.api_client, id=virtual_machine.id)
@@ -384,7 +496,7 @@ class TestNiciraContoller(cloudstackTestCase):
     @attr(tags = ["advanced", "smoke", "nicira"], required_hardware="true")
     def test_03_nicira_tunnel_guest_network(self):
         self.add_nicira_device(self.nicira_master_controller)
-        network         = self.create_guest_network()
+        network         = self.create_guest_isolated_network()
         virtual_machine = self.create_virtual_machine(network)
         public_ip       = self.acquire_publicip(network)
         nat_rule        = self.create_natrule(virtual_machine, public_ip, network)
@@ -415,3 +527,45 @@ class TestNiciraContoller(cloudstackTestCase):
             self.fail("SSH Access failed for %s: %s" % (vmObj.get_ip(), e))
 
         self.assertEqual(result.count('3 packets received'), 1, 'Ping to outside world from
VM should be successful')
+		
+    @attr(tags = ["advanced", "smoke", "nicira"], required_hardware="true")
+    def test_04_nicira_shared_networks_numerical_vlanid(self):
+        """
+            Shared Networks Support
+            CASE 1) Numerical VLAN_ID provided in network creation
+        """
+        self.debug("Starting test case 1 for Shared Networks")
+        self.add_nicira_device_l2gateway(self.nicira_master_controller)
+        network = self.create_guest_shared_network_numerical_vlanid()
+        virtual_machine = self.create_virtual_machine_shared_networks(network)
+		
+        list_vm_response = VirtualMachine.list(self.api_client, id=virtual_machine.id)
+        self.debug("Verify listVirtualMachines response for virtual machine: %s" % virtual_machine.id)
+
+        self.assertEqual(isinstance(list_vm_response, list), True, 'Response did not return
a valid list')
+        self.assertNotEqual(len(list_vm_response), 0, 'List of VMs is empty')
+
+        vm_response = list_vm_response[0]
+        self.assertEqual(vm_response.id, virtual_machine.id, 'Virtual machine in response
does not match request')
+        self.assertEqual(vm_response.state, 'Running', 'VM is not in Running state')
+
+    @attr(tags = ["advanced", "smoke", "nicira"], required_hardware="true")
+    def test_05_nicira_shared_networks_lrouter_uuid_vlan_id(self):
+        """
+            Shared Networks Support
+            CASE 2) Logical Router's UUID as VLAN_ID provided in network creation
+        """
+        self.debug("Starting test case 2 for Shared Networks")
+        self.add_nicira_device_l2gateway(self.nicira_master_controller)
+        network = self.create_guest_shared_network_uuid_vlanid()
+        virtual_machine = self.create_virtual_machine_shared_networks(network)
+		
+        list_vm_response = VirtualMachine.list(self.api_client, id=virtual_machine.id)
+        self.debug("Verify listVirtualMachines response for virtual machine: %s" % virtual_machine.id)
+
+        self.assertEqual(isinstance(list_vm_response, list), True, 'Response did not return
a valid list')
+        self.assertNotEqual(len(list_vm_response), 0, 'List of VMs is empty')
+
+        vm_response = list_vm_response[0]
+        self.assertEqual(vm_response.id, virtual_machine.id, 'Virtual machine in response
does not match request')
+        self.assertEqual(vm_response.state, 'Running', 'VM is not in Running state')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ac27377/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index ab15a78..379ecd9 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -3853,7 +3853,7 @@ class NiciraNvp:
 
     @classmethod
     def add(cls, apiclient, services, physicalnetworkid,
-            hostname=None, username=None, password=None, transportzoneuuid=None):
+            hostname=None, username=None, password=None, transportzoneuuid=None, l2gatewayserviceuuid=None):
         cmd = addNiciraNvpDevice.addNiciraNvpDeviceCmd()
         cmd.physicalnetworkid = physicalnetworkid
         if hostname:
@@ -3876,7 +3876,12 @@ class NiciraNvp:
         else:
             cmd.transportzoneuuid = services['transportZoneUuid']
 
-        return NiciraNvp(apiclient.addNiciraNvpDevice(cmd).__dict__)
+        if l2gatewayserviceuuid:
+            cmd.l2gatewayserviceuuid = l2gatewayserviceuuid
+        else:
+            cmd.l2gatewayserviceuuid = services['l2gatewayserviceuuid']
+
+	return NiciraNvp(apiclient.addNiciraNvpDevice(cmd).__dict__)
 
     def delete(self, apiclient):
         cmd = deleteNiciraNvpDevice.deleteNiciraNvpDeviceCmd()


Mime
View raw message