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

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

nvazquez commented on a change in pull request #2295: CLOUDSTACK-10109: Enable 
dedication of public IPs to SSVM and CPVM
URL: https://github.com/apache/cloudstack/pull/2295#discussion_r147038752
 
 

 ##########
 File path: test/integration/smoke/test_public_ip_range.py
 ##########
 @@ -147,3 +149,194 @@ def test_dedicatePublicIpRange(self):
 
         return
 
+    @attr(tags = ["advanced", "publiciprange", "dedicate", "release"], 
required_hardware="false")
+    def test_dedicate_public_ip_range_for_system_vms(self):
+        """Test public IP range dedication for SSVM and CPVM
+        """
+
+        # Validate the following:
+        # 1. Create a Public IP range for system vms
+        # 2. Created IP range should be present and marked as 
forsystemvms=true, verify with listVlanIpRanges
+        # 7. Delete the Public IP range
+        
+        services = {
+            "gateway":"192.168.99.1",
+            "netmask":"255.255.255.0",
+            "startip":"192.168.99.2",
+            "endip":"192.168.99.200",
+            "forvirtualnetwork":self.services["forvirtualnetwork"],
+            "zoneid":self.services["zoneid"],
+            "vlan":self.services["vlan"]
+        }
+        public_ip_range = PublicIpRange.create(
+            self.apiclient,
+            services,
+            forsystemvms = True
+        )
+        created_ip_range_response = PublicIpRange.list(
+            self.apiclient,
+            id = public_ip_range.vlan.id
+        )
+        self.assertEqual(
+            len(created_ip_range_response),
+            1,
+            "Check listVlanIpRanges response"
+        )
+        self.assertTrue(
+            created_ip_range_response[0].forsystemvms,
+            "Check forsystemvms parameter in created vlan ip range"
+        )
+        
+        # Delete range
+        public_ip_range.delete(self.apiclient)
+        
+    def get_ip_as_number(self, ip_string):
+        """ Return numeric value for ip (passed as a string)
+        """
+        packed_ip = inet_aton(ip_string)
+        return unpack(">L", packed_ip)[0]
+    
+    def is_ip_in_range(self, start_ip, end_ip, ip_to_test):
+        """ Check whether ip_to_test belongs to IP range between start_ip and 
end_ip
+        """
+        start = self.get_ip_as_number(start_ip)
+        end = self.get_ip_as_number(end_ip)
+        ip = self.get_ip_as_number(ip_to_test)
+        return start <= ip and ip <= end
+    
+    def wait_for_system_vm_start(self, domain_id, srv_timeout, srv_sleep):
+        """ Wait until system vm is Running
+        """
+        timeout = srv_timeout
+        while True:
+            list_cpvm_response = list_ssvms(
+                self.apiclient,
+                systemvmtype='consoleproxy',
+                domainid=domain_id
+            )
+            if isinstance(list_cpvm_response, list):
+                if list_cpvm_response[0].state == 'Running':
+                    return list_cpvm_response[0].id
+            if timeout == 0:
+                raise Exception("List CPVM call failed!")
+
+            time.sleep(srv_sleep)
+            timeout = timeout - 1
+        return None
+        
+    @attr(tags = ["advanced", "publiciprange", "dedicate", "release"], 
required_hardware="false")
+    def test_dedicate_public_ip_range_for_system_vms_cpvm(self):
 
 Review comment:
   Done, thanks

----------------------------------------------------------------
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


> Enable dedication of public IPs to SSVM and CPVM
> ------------------------------------------------
>
>                 Key: CLOUDSTACK-10109
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10109
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Nicolas Vazquez
>            Assignee: Nicolas Vazquez
>
> It is required to dedicate a public IP range for SSVM and CPVM in order to 
> apply firewall rules to control inbound access.



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

Reply via email to