Repository: libcloud
Updated Branches:
  refs/heads/trunk 94ab917f1 -> 5187b06a5


fix audit log report url and add tests


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

Branch: refs/heads/trunk
Commit: 4a20d349fe7d02a07b8dd074f725db400535dc56
Parents: 4897933
Author: Anthony Shaw <anthonys...@apache.org>
Authored: Wed Oct 12 09:34:48 2016 +1100
Committer: Anthony Shaw <anthonys...@apache.org>
Committed: Wed Oct 12 09:34:48 2016 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py       |  2 +-
 .../fixtures/dimensiondata/audit_log.csv        | 25 ++++++++++++++++++++
 libcloud/test/compute/test_dimensiondata.py     | 11 +++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4a20d349/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py 
b/libcloud/compute/drivers/dimensiondata.py
index 5e6fe76..073a896 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -2504,7 +2504,7 @@ class DimensionDataNodeDriver(NodeDriver):
         :rtype: ``list`` of ``list``
         """
         result = self.connection.raw_request_with_orgId_api_1(
-            'report/auditlog?startDate=%s&endDate=%s' % (
+            'auditlog?startDate=%s&endDate=%s' % (
                 start_date, end_date))
         return self._format_csv(result.response)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4a20d349/libcloud/test/compute/fixtures/dimensiondata/audit_log.csv
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/audit_log.csv 
b/libcloud/test/compute/fixtures/dimensiondata/audit_log.csv
new file mode 100644
index 0000000..6410373
--- /dev/null
+++ b/libcloud/test/compute/fixtures/dimensiondata/audit_log.csv
@@ -0,0 +1,25 @@
+UUID,Time,Create User,Department,Customer Defined 1,Customer Defined 
2,Type,Name,Action,Details,Response Code
+af779880-0531-45d3-be56-df41c459aa09,2016-09-11 
23:59:37,ashaw_plat,,,,SERVER,ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7],Deploy
 Server,ATTEMPT: DEPLOY_SERVER 
'ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7]',
+d127748c-948f-41f0-b6a7-c0b5a2438bd6,2016-09-12 
00:06:00,OEC_SYSTEM,,,,SERVER,ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7],Deploy
 Server,DEPLOY_SERVER 
'ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7]',OK
+85f978b2-0e2a-4ba3-a6ce-7567e329e842,2016-09-12 
00:22:48,ashaw_plat,,,,SERVER,ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7],Start
 Server,ATTEMPT: START_SERVER 
'ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7]',
+afc67c82-381a-4ba1-b25e-2285a916d513,2016-09-12 
00:23:00,OEC_SYSTEM,,,,SERVER,ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7],Start
 Server,START_SERVER 'ST2-DEV[10-0-0-5_8bf3420c-73cf-45ab-a923-a461ad87daf7]',OK
+7378b530-9d37-4339-88d5-19428431fe07,2016-09-12 
05:10:47,ashaw_plat,,,,IP_BLOCK,168.128.37.196,Add IP Block,ATTEMPT: 
ADD_PUBLIC_IP_BLOCK '168.128.37.196',
+f978f690-13e8-4d7d-8ce3-1ca7e232df69,2016-09-12 
05:10:48,ashaw_plat,,,,IP_BLOCK,168.128.37.196,Add IP Block,ADD_PUBLIC_IP_BLOCK 
'168.128.37.196',OK
+822b7483-bb59-4659-9ab1-7a1ad25bacd7,2016-09-12 
05:10:58,ashaw_plat,,,,NAT_RULE,10.0.0.5,Create NAT Rule,ATTEMPT: 
CREATE_NAT_RULE 
'10.0.0.5'(requestId:au_20160912T151058137+1000_07422779-ec2a-448e-81f4-87a333b79f3c),
+2f29ebd2-2ee0-463f-9a46-2e62f09fcc74,2016-09-12 
05:10:59,ashaw_plat,,,,NAT_RULE,10.0.0.5,Create NAT Rule,CREATE_NAT_RULE 
'10.0.0.5'(requestId:au_20160912T151058137+1000_07422779-ec2a-448e-81f4-87a333b79f3c),OK
+503aa140-6da9-4fbe-b94e-b118fc5a473a,2016-09-13 
04:08:55,mgreenwood_plat,,,,NAT_RULE,10.208.136.11,Add NAT Rule,ATTEMPT: 
ADD_NAT_RULE '10.208.136.11',
+bb73bb95-a20c-46f8-9962-3862496793ff,2016-09-13 
04:09:00,OEC_SYSTEM,,,,NAT_RULE,10.208.136.11,Add NAT Rule,ADD_NAT_RULE 
'10.208.136.11',OK
+276ab194-ffb3-4516-920d-96cc068dfcfa,2016-09-13 
04:11:54,mgreenwood_plat,,,,NAT_RULE,10.208.136.11,Delete NAT Rule,ATTEMPT: 
DELETE_NAT_RULE '10.208.136.11',
+3bb0e6ad-48e1-4268-9423-4cd680edc404,2016-09-13 
04:11:57,OEC_SYSTEM,,,,NAT_RULE,10.208.136.11,Delete NAT Rule,DELETE_NAT_RULE 
'10.208.136.11',OK
+f9f2684a-796c-4f28-9448-949900f8f4fb,2016-09-13 
04:16:22,mgreenwood_plat,,,,NAT_RULE,10.208.136.11,Add NAT Rule,ATTEMPT: 
ADD_NAT_RULE '10.208.136.11',
+0bfbe81f-35fc-445e-a33e-f12a46c25115,2016-09-13 
04:16:27,OEC_SYSTEM,,,,NAT_RULE,10.208.136.11,Add NAT Rule,ADD_NAT_RULE 
'10.208.136.11',OK
+629da5f4-7fdc-4bc6-a408-66ab96f539c0,2016-09-13 
04:27:19,mgreenwood_plat,,,,ACL_RULE,AD LDAP Port - For Testing,Add Acl 
Rule,ATTEMPT: Add Acl Rule AD LDAP Port - For Testing to network Aperture,
+ecee1409-ce7d-496d-a41b-67662d884598,2016-09-13 
04:27:22,mgreenwood_plat,,,,ACL_RULE,AD LDAP Port - For Testing,Add Acl 
Rule,Add Acl Rule AD LDAP Port - For Testing to network Aperture,OK
+f6e84763-b911-4189-bf69-138e9a23de7a,2016-09-14 
03:05:15,aakbar_plat,,,,SERVER,CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62]',OK
+ef43056e-1cd0-48bf-80f6-12a4cad8e1c6,2016-09-14 
03:05:24,aakbar_plat,,,,SERVER,CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62]',OK
+13f38aa4-a86c-45c2-909f-2a6b96c0c761,2016-09-14 
03:13:21,aakbar_plat,,,,SERVER,CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244]',OK
+22aa854c-17a2-4f48-82a1-c10a052dd932,2016-09-14 
05:42:04,mkumar_plat,,,,SERVER,CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62]',OK
+6c7f3847-e2e8-47c8-8fd0-8c444015ad19,2016-09-14 
05:51:58,mkumar_plat,,,,SERVER,CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244]',OK
+69ddc5a5-b815-439b-9d32-a1d60345355b,2016-09-14 
06:02:50,mkumar_plat,,,,SERVER,CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-CI[10-209-120-16_ce81b50b-70d4-44ae-94d8-c2af8c22b244]',OK
+4ffa5524-926b-4747-9924-581c316b6a60,2016-09-14 
06:05:49,mkumar_plat,,,,SERVER,CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62]',OK
+599718fe-f58c-439b-87ae-86fb1347708e,2016-09-14 
06:06:21,mkumar_plat,,,,SERVER,CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62],Get
 Console Access Session Token,GENERATE_CONSOLE_ACCESS_SESSION_TOKEN 
'CaaS-QA[10-209-120-14_e772c8c0-ee55-4e8f-82f9-22576b494a62]',OK

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4a20d349/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py 
b/libcloud/test/compute/test_dimensiondata.py
index 36e9a63..5316e7b 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -1382,6 +1382,12 @@ class DimensionDataTests(unittest.TestCase, 
TestCaseMixin):
         self.assertEqual(len(report_content), 42)
         self.assertEqual(len(report_content[0]), 4)
 
+    def test_audit_log_report(self):
+        report = self.driver.ex_audit_log_report('2016-06-01', '2016-06-30')
+        report_content = report
+        self.assertEqual(len(report_content), 25)
+        self.assertEqual(report_content[2][2], 'OEC_SYSTEM')
+
     def test_ex_list_ip_address_list(self):
         net_domain = self.driver.ex_list_network_domains()[0]
         ip_list = self.driver.ex_list_ip_address_list(
@@ -1767,6 +1773,11 @@ class DimensionDataMockRawResponse(MockRawResponse):
         )
         return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
 
+    def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_auditlog(self, method, 
url, body, headers):
+        body = self.fixtures.load(
+            'audit_log.csv'
+        )
+        return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
 
 class DimensionDataMockHttp(StorageMockHttp, MockHttp):
 

Reply via email to