You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/08/22 09:09:13 UTC
[1/2] git commit: updated refs/heads/4.2-forward to 64460df
Updated Branches:
refs/heads/4.2-forward 5528ba4b2 -> 64460df55
CLOUDSTACK-4442: Include a test for creating networks with sourcenat only
The test attempts to create a network with offering serving only
dhcp,dns and sourcenat. However the source NAT functionality itself
isn't tested as reported in the bug. So the test will pass.
TODO: come up with a way to test source nat without enabling additional
services for pf/staticnat
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e2122b72
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e2122b72
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e2122b72
Branch: refs/heads/4.2-forward
Commit: e2122b72300b3e490ad1eb03450ff589b10f66ca
Parents: 5528ba4
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Aug 22 12:34:19 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Aug 22 12:38:50 2013 +0530
----------------------------------------------------------------------
.../component/test_network_offering.py | 143 +++++++++++++++++++
1 file changed, 143 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2122b72/test/integration/component/test_network_offering.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py
index 31a5c7d..e8a7b97 100644
--- a/test/integration/component/test_network_offering.py
+++ b/test/integration/component/test_network_offering.py
@@ -89,6 +89,19 @@ class Services:
"StaticNat": 'VirtualRouter',
},
},
+ "network_offering_sourcenat" : {
+ "name": 'Network offering - SourceNat only',
+ "displaytext": 'Network offering - SourceNat only',
+ "guestiptype": 'Isolated',
+ "supportedservices": 'SourceNat,Dhcp,Dns',
+ "traffictype": 'GUEST',
+ "availability": 'Optional',
+ "serviceProviderList": {
+ "Dhcp": 'VirtualRouter',
+ "Dns": 'VirtualRouter',
+ "SourceNat": 'VirtualRouter',
+ },
+ },
"network": {
"name": "Test Network",
"displaytext": "Test Network",
@@ -1794,4 +1807,134 @@ class TestNetworkUpgrade(cloudstackTestCase):
return
+class TestNOWithOnlySourceNAT(cloudstackTestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.apiclient = super(
+ TestNOWithOnlySourceNAT,
+ cls
+ ).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.apiclient, cls.services)
+ cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.services['mode'] = cls.zone.networktype
+ cls.template = get_template(
+ cls.apiclient,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.services["virtual_machine"]["template"] = cls.template.id
+
+ cls.service_offering = ServiceOffering.create(
+ cls.apiclient,
+ cls.services["service_offering"]
+ )
+
+ cls.cleanup = [
+ 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"])
+ def test_create_network_with_snat(self):
+ """Test to create a network with SourceNAT service only"""
+
+ # Validate the following
+ # 1. create a network offering with source nat service
+ # 2. create a network and deploy a vm within the network
+ # 3. deployment and network creation should be successful
+ # 4. attempt to create a fw rule. should fail since offering hasn't allowed it
+ # 5. try to ping out of the guest to www.google.com to check SourceNAT is working
+
+ self.account = Account.create(
+ self.apiclient,
+ self.services["account"],
+ admin=False,
+ domainid=self.domain.id
+ )
+ self.cleanup.append(self.account)
+
+ # Create a network offering VR and only SourceNAT service
+ self.debug(
+ "creating network offering with source NAT only"
+ )
+ self.network_offering = NetworkOffering.create(
+ self.apiclient,
+ self.services["network_offering_sourcenat"]
+ )
+ # Enable Network offering
+ self.network_offering.update(self.apiclient, state='Enabled')
+ self.debug("Created n/w offering with ID: %s" %
+ self.network_offering.id)
+
+ # Creating network using the network offering created
+ self.debug("Creating network with network offering: %s" %
+ self.network_offering.id)
+ self.network = Network.create(
+ self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=self.network_offering.id,
+ zoneid=self.zone.id
+ )
+ self.debug("Created guest network with ID: %s within account %s" % (self.network.id, self.account.name))
+
+ self.debug("Deploying VM in account: %s on the network %s" % (self.account.name, self.network.id))
+ # Spawn an instance in that network
+ virtual_machine = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(self.network.id)]
+ )
+ self.debug("Deployed VM in network: %s" % self.network.id)
+
+ src_nat_list = PublicIPAddress.list(
+ self.apiclient,
+ associatednetworkid=self.network.id,
+ account=self.account.name,
+ domainid=self.account.domainid,
+ listall=True,
+ issourcenat=True,
+ )
+ self.assertEqual(
+ isinstance(src_nat_list, list),
+ True,
+ "List Public IP should return a valid source NAT"
+ )
+ self.assertNotEqual(
+ len(src_nat_list),
+ 0,
+ "Length of response from listPublicIp should not be 0"
+ )
+
+ src_nat = src_nat_list[0]
+
+ self.debug("Successfully implemented network with source NAT IP: %s" %
+ src_nat.ipaddress)
+
+ with self.assertRaises(Exception):
+ FireWallRule.create(
+ self.apiclient,
+ ipaddressid=src_nat.id,
+ protocol='TCP',
+ cidrlist=[self.services["fw_rule"]["cidr"]],
+ startport=self.services["fw_rule"]["startport"],
+ endport=self.services["fw_rule"]["endport"]
+ )
+ return
[2/2] git commit: updated refs/heads/4.2-forward to 64460df
Posted by ts...@apache.org.
CLOUDSTACK-4437: Fix iso usage event count to match the number of image stores
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/64460df5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/64460df5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/64460df5
Branch: refs/heads/4.2-forward
Commit: 64460df554343a73e956af589d2215e217d7e511
Parents: e2122b7
Author: SrikanteswaraRao Talluri <ka...@gmail.com>
Authored: Thu Aug 22 11:15:47 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Aug 22 12:38:59 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_project_usage.py | 5 +++--
test/integration/component/test_usage.py | 6 +++---
2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64460df5/test/integration/component/test_project_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 1422feb..e836768 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -970,16 +970,17 @@ class TestISOUsage(cloudstackTestCase):
qresult = str(qresultset)
self.debug("Query result: %s" % qresult)
+ imageStores = ImageStore.list(self.api_client,zoneid=self.zone.id)
# Check for ISO.CREATE, ISO.DELETE events in cloud.usage_event table
self.assertEqual(
qresult.count('ISO.CREATE'),
- 1,
+ len(imageStores),
"Check ISO.CREATE event in events table"
)
self.assertEqual(
qresult.count('ISO.DELETE'),
- 1,
+ len(imageStores),
"Check ISO.DELETE in events table"
)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64460df5/test/integration/component/test_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py
index 5a42559..75326f7 100644
--- a/test/integration/component/test_usage.py
+++ b/test/integration/component/test_usage.py
@@ -904,17 +904,17 @@ class TestISOUsage(cloudstackTestCase):
qresult = str(qresultset)
self.debug("Query result: %s" % qresult)
-
+ imageStores = ImageStore.list(self.api_client,zoneid=self.zone.id)
# Check for ISO.CREATE, ISO.DELETE events in cloud.usage_event table
self.assertEqual(
qresult.count('ISO.CREATE'),
- 1,
+ len(imageStores),
"Check ISO.CREATE event in events table"
)
self.assertEqual(
qresult.count('ISO.DELETE'),
- 1,
+ len(imageStores),
"Check ISO.DELETE in events table"
)
return