[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16249967#comment-16249967
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10102:
---------------------------------------------

nvazquez commented on a change in pull request #2281: CLOUDSTACK-10102: New 
network type (L2)
URL: https://github.com/apache/cloudstack/pull/2281#discussion_r150627669
 
 

 ##########
 File path: test/integration/smoke/test_network.py
 ##########
 @@ -1271,3 +1271,225 @@ def test_network_rules_acquired_public_ip(self, value):
                 delay=0
             )
         return
+
+class TestL2Networks(cloudstackTestCase):
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.services["network"]["networkoffering"] = self.network_offering.id
+
+        self.l2_network = Network.create(
+            self.apiclient,
+            self.services["l2-network"],
+            zoneid=self.zone.id,
+            networkofferingid=self.network_offering.id
+        )
+        self.cleanup = [
+            self.l2_network]
+
+    def tearDown(self):
+        cleanup_resources(self.apiclient, self.cleanup)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestL2Networks, cls).getClsTestClient()
+        cls.apiclient = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        cls.services['mode'] = cls.zone.networktype
+        # Create Accounts & networks
+        cls.account = Account.create(
+            cls.apiclient,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
+        cls.template = get_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.service_offering = ServiceOffering.create(
+            cls.apiclient,
+            cls.services["service_offerings"]["tiny"]
+        )
+        cls.services["network"]["zoneid"] = cls.zone.id
+
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.services["l2-network_offering"],
+        )
+        # Enable Network offering
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+
+        cls._cleanup = [
+            cls.account,
+            cls.network_offering,
+            cls.service_offering
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.apiclient, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="false")
+    def test_deploy_vm_l2network(self):
+        """Creates an l2 network and verifies user is able to deploy a VM in 
it"""
+
+        # Validate the following:
+        # 1. Deploys a VM
+        # 2. There are no network services available since this is L2 Network
+
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            templateid=self.template.id,
+            serviceofferingid=self.service_offering.id,
+            networkids=self.l2_network.id,
+            zoneid=self.zone.id
+        )
+
+        self.cleanup.insert(0, self.virtual_machine)
+
+        list_vm = list_virtual_machines(
+            self.apiclient,
+            id = self.virtual_machine.id
+        )
+        self.assertEqual(
+            isinstance(list_vm, list),
+            True,
+            "Check if virtual machine is present"
+        )
+
+        self.assertEqual(
+            list_vm[0].nic[0].type,
+            'L2',
+            "Check Correct Network type is available"
+        )
+
+        self.assertFalse(
+            'gateway' in str(list_vm[0].nic[0])
+        )
+
+        self.assertFalse(
+            'ipaddress' in str(list_vm[0].nic[0])
+        )
+
+        return
+
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="false")
+    def test_delete_network_while_vm_on_it(self):
+        """It verifies the user is not able to delete network which has 
running vms"""
+
+        # Validate the following:
+        # 1. Deploys a VM
+        # 2. Tries to delete network and expects exception to appear
+
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            templateid=self.template.id,
+            serviceofferingid=self.service_offering.id,
+            networkids=self.l2_network.id,
+            zoneid=self.zone.id
+        )
+
+        self.cleanup.insert(0, self.virtual_machine)
+
+        list_vm = list_virtual_machines(
+            self.apiclient,
+            id = self.virtual_machine.id
+        )
+        self.assertEqual(
+            isinstance(list_vm, list),
+            True,
+            "Check if virtual machine is present"
+        )
+
+        try:
+            self.l2_network.delete(self.apiclient)
+        except Exception:
+            pass
+        else:
+            self.fail("Expected an exception to be thrown, failing")
+
+        return
+
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="false")
+    def test_l2network_restart(self):
+        """It verifies the user is not able to delete network which has 
running vms"""
 
 Review comment:
   Duplicated test description, can we refactor this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> New Network Type (L2)
> ---------------------
>
>                 Key: CLOUDSTACK-10102
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10102
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Nicolas Vazquez
>            Assignee: Nicolas Vazquez
>
> Feature Specification: 
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=74680920



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to