Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E367D1061A for ; Wed, 8 May 2013 12:00:21 +0000 (UTC) Received: (qmail 23818 invoked by uid 500); 8 May 2013 12:00:12 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 23363 invoked by uid 500); 8 May 2013 12:00:11 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 8824 invoked by uid 99); 8 May 2013 11:59:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 11:59:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 27C588899F0; Wed, 8 May 2013 11:59:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Date: Wed, 08 May 2013 12:00:53 -0000 Message-Id: <8a428a3ed26b4c809bbfffdae2c4505c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [84/90] [abbrv] git commit: updated refs/heads/marvin_refactor to 26ea081 CLOUDSTACK-702: Tests for Multiple IP Ranges-R4 Add ip range overlapped with two ip ranges in the exiting cidr Signed-off-by: sanjeevneelarapu Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53e49651 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53e49651 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53e49651 Branch: refs/heads/marvin_refactor Commit: 53e496517ed51bab2c81084a02f49b0408b19a37 Parents: b8358e1 Author: sanjeevneelarapu Authored: Mon May 6 20:38:54 2013 +0530 Committer: Prasanna Santhanam Committed: Wed May 8 14:37:29 2013 +0530 ---------------------------------------------------------------------- .../component/test_multiple_ip_ranges.py | 58 +++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53e49651/test/integration/component/test_multiple_ip_ranges.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_multiple_ip_ranges.py b/test/integration/component/test_multiple_ip_ranges.py index 29942bd..7e9eeb1 100644 --- a/test/integration/component/test_multiple_ip_ranges.py +++ b/test/integration/component/test_multiple_ip_ranges.py @@ -368,3 +368,61 @@ class TestMultipleIpRanges(cloudstackTestCase): #Test will reach here there is a bug in overlap ip range checking self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed") return + + @attr(tags=["advanced_sg", "sg"]) + def test_06_add_ip_range_overlapped_with_two_ranges(self): + """Test adding overlapped ip range in existing cidr + + 1.Add ip range in new cidr e.g:10.147.40.2-10.147.40.10 + 2.Add another ip range in the same cidr e.g:10.147.40.20-10.147.40.30 + 2.Add ip range overlapped with both the ip ranges e.g.10.147.40.10-20 + """ + #call increment_cidr function to get exiting cidr from the setup and increment it + ip2 = self.increment_cidr() + test_nw = ip2.network + ip = IPAddress(test_nw) + #Add IP range in the new CIDR + test_gateway = ip.__add__(1) + test_startIp = ip.__add__(2) + test_endIp = ip.__add__(10) + test_startIp2 = ip.__add__(20) + test_endIp2 = ip.__add__(30) + test_startIp3 = ip.__add__(10) + test_endIp3 = ip.__add__(20) + #Populating services with new IP range + self.services["vlan_ip_range"]["startip"] = test_startIp + self.services["vlan_ip_range"]["endip"] = test_endIp + self.services["vlan_ip_range"]["gateway"] = test_gateway + self.services["vlan_ip_range"]["netmask"] = self.netmask + self.services["vlan_ip_range"]["zoneid"] = self.zone.id + self.services["vlan_ip_range"]["podid"] = self.pod.id + #create new vlan ip range + new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp)) + self.cleanup.append(new_vlan) + new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id) + #Compare list output with configured values + self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"]) + #Add 2nd IP range in the same CIDR + self.services["vlan_ip_range"]["startip"] = test_startIp2 + self.services["vlan_ip_range"]["endip"] = test_endIp2 + new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2)) + self.cleanup.append(new_vlan) + new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id) + #Compare list output with configured values + self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"]) + #Add ip range which will overlap with two existing ip ranges in the same CIDR + #Populating services with new IP range + self.services["vlan_ip_range"]["startip"] = test_startIp3 + self.services["vlan_ip_range"]["endip"] = test_endIp3 + #Try to create ip range overlapped with exiting ip range + try: + PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + except cloudstackAPIException as cs: + self.debug(cs.errorMsg) + self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr") + return + #Test will reach here there is a bug in overlap ip range checking + self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed") + return