From ef21b2eefb917952146fd59f313e86640daa5715 Mon Sep 17 00:00:00 2001 From: stackman Date: Tue, 6 Aug 2019 23:58:36 +0000 Subject: [PATCH 01/23] Reload/interface settings for octavia --- acos_client/v30/action.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 339929cc..8b6e7cc1 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -45,3 +45,12 @@ def clideploy(self, commandlist, **kwargs): "commandlist": commandlist } return self._post("/clideploy/", payload, **kwargs) + + def reload(self): + self._post("/reload", "") + + def setInterface(self, interface): + data = {"ethernet":{"ifnum": str(interface), "name": "DataPort", "action":"enable", "ip": {"dhcp":1}}} + url = "/interface/ethernet/" + str(interface) + self._post (url, data) + From b97043b622a6482dda02207bcc979840739e4a7c Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Tue, 17 Sep 2019 17:15:28 +0530 Subject: [PATCH 02/23] changes to support a10-octavia driver --- acos_client/v30/action.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 8b6e7cc1..3f8f43d3 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -49,8 +49,26 @@ def clideploy(self, commandlist, **kwargs): def reload(self): self._post("/reload", "") + def reboot(self): + self._post("/reboot", "") + def setInterface(self, interface): data = {"ethernet":{"ifnum": str(interface), "name": "DataPort", "action":"enable", "ip": {"dhcp":1}}} url = "/interface/ethernet/" + str(interface) - self._post (url, data) + self._post(url, data) + + def configureVRRP(self, device_id, set_id): + data = {"common": { "device-id": device_id, "set-id": set_id, "action":"enable"}} + url = "/vrrp-a/common" + self._post(url, data) + + def configureVRID(self, vrid): + data = { "vrid": { "vrid-val": vrid, "blade-parameters": { "priority":150} } } + url = "/vrrp-a/vrid" + self._post(url, data) + def configSynch(self, ip_address, username, password): + data = {"sync" : { "address" : ip_address, "auto-authentication" : 1, + "type" : "all", "usr" : username, "pwd" : password}} + url = "/configure/sync" + self._post(url, data) From fa5f1638cd031578c7f2b10ae1c2c0939c3247dd Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Tue, 17 Sep 2019 17:26:18 +0530 Subject: [PATCH 03/23] adding only required functions --- acos_client/v30/action.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 3f8f43d3..1bb1d8d6 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -20,11 +20,11 @@ class Action(base.BaseV30): - def write_memory(self, partition="all", destination="primary", **kwargs): + def write_memory(self, **kwargs): payload = { "memory": { - "destination": destination, - "partition": partition + "destination": "primary", + "partition": "all" } } try: @@ -37,8 +37,8 @@ def write_memory(self, partition="all", destination="primary", **kwargs): # If the retry loop missed this, catch it next time. pass - def activate_and_write(self, partition="all", destination="primary", **kwargs): - self.write_memory(partition, destination) + def activate_and_write(self, partition, **kwargs): + self.write_memory() def clideploy(self, commandlist, **kwargs): payload = { From 44161a60f6070035190235e47f8f5edfc10e2439 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Wed, 18 Sep 2019 16:33:19 +0530 Subject: [PATCH 04/23] pep8 checks --- acos_client/v30/action.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 1bb1d8d6..bb015461 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -53,22 +53,25 @@ def reboot(self): self._post("/reboot", "") def setInterface(self, interface): - data = {"ethernet":{"ifnum": str(interface), "name": "DataPort", "action":"enable", "ip": {"dhcp":1}}} + data = {"ethernet": {"ifnum": str(interface), "name": "DataPort", + "action": "enable", "ip": {"dhcp": 1}}} url = "/interface/ethernet/" + str(interface) self._post(url, data) def configureVRRP(self, device_id, set_id): - data = {"common": { "device-id": device_id, "set-id": set_id, "action":"enable"}} + data = {"common": {"device-id": device_id, "set-id": set_id, + "action": "enable"}} url = "/vrrp-a/common" self._post(url, data) def configureVRID(self, vrid): - data = { "vrid": { "vrid-val": vrid, "blade-parameters": { "priority":150} } } + data = {"vrid": {"vrid-val": vrid, + "blade-parameters": {"priority": 150}}} url = "/vrrp-a/vrid" self._post(url, data) def configSynch(self, ip_address, username, password): - data = {"sync" : { "address" : ip_address, "auto-authentication" : 1, - "type" : "all", "usr" : username, "pwd" : password}} + data = {"sync": {"address": ip_address, "auto-authentication": 1, + "type": "all", "usr": username, "pwd": password}} url = "/configure/sync" self._post(url, data) From 7fbe4dfd9fe15a3c4ada033a5385361a8cb9e17d Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Fri, 20 Sep 2019 18:53:32 +0530 Subject: [PATCH 05/23] aVCS config automation APIs --- acos_client/v30/action.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index bb015461..578fcb4b 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -75,3 +75,24 @@ def configSynch(self, ip_address, username, password): "type": "all", "usr": username, "pwd": password}} url = "/configure/sync" self._post(url, data) + + def set_vcs_device(self, device_id, priority): + data = {"device": {"device": device_id, "priority": priority, + "management": 1, "enable": 1}} + url = "/vcs/device/" + self._post(url, data) + + def set_vcs_para(self, floating_ip, floating_ip_mask): + data = {"vcs-para": {"floating-ip-cfg": [{"floating-ip": floating_ip, + "floating-ip-mask": floating_ip_mask}]}} + url = "/vcs/vcs-para" + self._post(url, data) + + def vcs_enable(self): + data = {"action": {"action": "enable"}} + url = "/vcs/action" + self._post(url, data) + + def vcs_reload(self): + url = "/vcs/reload" + self._post(url) From 578136e1a9bd08cb4a5a700972407fcb458aa571 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Wed, 13 Nov 2019 11:09:17 +0530 Subject: [PATCH 06/23] added HA code support --- acos_client/v30/action.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 578fcb4b..6bd0340f 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -96,3 +96,11 @@ def vcs_enable(self): def vcs_reload(self): url = "/vcs/reload" self._post(url) + + def check_vrrp_status(self): + url = "/vrrp-a" + data = self._get(url) + if "common" in data["vrrp-a"].keys() and "action" in data["vrrp-a"]["common"].keys() and data["vrrp-a"]["common"]["action"] == "enable": + return True + else: + return False From a79eaaa18edd360ea6699d2823d4aea61ce60e27 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Wed, 13 Nov 2019 11:22:18 +0530 Subject: [PATCH 07/23] pep8 correction --- acos_client/v30/action.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 6bd0340f..88efac43 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -100,7 +100,9 @@ def vcs_reload(self): def check_vrrp_status(self): url = "/vrrp-a" data = self._get(url) - if "common" in data["vrrp-a"].keys() and "action" in data["vrrp-a"]["common"].keys() and data["vrrp-a"]["common"]["action"] == "enable": + if "common" in data["vrrp-a"].keys() and \ + "action" in data["vrrp-a"]["common"].keys() and \ + data["vrrp-a"]["common"]["action"] == "enable": return True else: return False From 8eb805bf6d8de6afb0dc301a7e20117630a6fa29 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Wed, 13 Nov 2019 11:26:15 +0530 Subject: [PATCH 08/23] confilcts resolution --- acos_client/v30/action.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index 88efac43..fc92dd94 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -49,15 +49,15 @@ def clideploy(self, commandlist, **kwargs): def reload(self): self._post("/reload", "") - def reboot(self): - self._post("/reboot", "") - def setInterface(self, interface): data = {"ethernet": {"ifnum": str(interface), "name": "DataPort", "action": "enable", "ip": {"dhcp": 1}}} url = "/interface/ethernet/" + str(interface) self._post(url, data) + def reboot(self): + self._post("/reboot", "") + def configureVRRP(self, device_id, set_id): data = {"common": {"device-id": device_id, "set-id": set_id, "action": "enable"}} From 5eb76c5a4384e8f8a9b57b4a730c8eff54a1f08c Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Tue, 31 Dec 2019 07:57:39 +0000 Subject: [PATCH 09/23] Added hm related changes --- acos_client/v30/slb/hm.py | 19 +++++++++++++------ acos_client/v30/slb/server.py | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index 567484b2..10fc59b3 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -23,6 +23,7 @@ class HealthMonitor(base.BaseV30): # Valid method objects + UDP = 'udp' ICMP = 'icmp' TCP = 'tcp' HTTP = 'http' @@ -32,6 +33,11 @@ class HealthMonitor(base.BaseV30): _method_objects = { ICMP: { "icmp": 1 + }, + UDP: { + "udp": 1, + "udp-port": 5555, + "force-up-with-single-healthcheck": 0 }, HTTP: { "http": 1, @@ -62,7 +68,7 @@ def get(self, name, **kwargs): return self._get(self.url_prefix + name, **kwargs) def _set(self, action, name, mon_method, interval, timeout, max_retries, - method=None, url=None, expect_code=None, port=None, update=False, + method=None, url=None, expect_code=None, port=None, ipv4=None, update=False, **kwargs): params = { "monitor": { @@ -72,7 +78,8 @@ def _set(self, action, name, mon_method, interval, timeout, max_retries, "timeout": int(timeout), "method": { mon_method: self._method_objects[mon_method] - } + }, + "override-ipv4" : ipv4 } } if method: @@ -103,7 +110,7 @@ def _set(self, action, name, mon_method, interval, timeout, max_retries, self._post(action, params, **kwargs) def create(self, name, mon_type, interval, timeout, max_retries, - method=None, url=None, expect_code=None, port=None, **kwargs): + method=None, url=None, expect_code=None, port=None, ipv4=None, **kwargs): try: self.get(name) except acos_errors.NotFound: @@ -112,13 +119,13 @@ def create(self, name, mon_type, interval, timeout, max_retries, raise acos_errors.Exists() self._set(self.url_prefix, name, mon_type, interval, timeout, - max_retries, method, url, expect_code, port, **kwargs) + max_retries, method, url, expect_code, port, ipv4, update=False, **kwargs) def update(self, name, mon_type, interval, timeout, max_retries, - method=None, url=None, expect_code=None, port=None, **kwargs): + method=None, url=None, expect_code=None, port=None, ipv4=None, **kwargs): self.get(name) # We want a NotFound if it does not exist self._set(self.url_prefix, name, mon_type, interval, timeout, - max_retries, method, url, expect_code, port, update=True, + max_retries, method, url, expect_code, port, ipv4, update=True, **kwargs) def delete(self, name): diff --git a/acos_client/v30/slb/server.py b/acos_client/v30/slb/server.py index 8e111ea2..5a1f53a7 100644 --- a/acos_client/v30/slb/server.py +++ b/acos_client/v30/slb/server.py @@ -35,6 +35,7 @@ def create(self, name, ip_address, status=1, server_templates=None, **kwargs): "action": 'enable' if status else 'disable', "conn-resume": kwargs.get("conn_resume", None), "conn-limit": kwargs.get("conn_limit", 8000000), + "health-check" : kwargs.get("health_check") } } From 60d650b15bca5f989ad312a3727fcea3af0c6a8f Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Thu, 2 Jan 2020 06:50:24 +0000 Subject: [PATCH 10/23] resolving build failure --- acos_client/v30/slb/hm.py | 4 ++-- acos_client/v30/slb/server.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index 10fc59b3..c17c30e7 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -34,7 +34,7 @@ class HealthMonitor(base.BaseV30): ICMP: { "icmp": 1 }, - UDP: { + UDP: { "udp": 1, "udp-port": 5555, "force-up-with-single-healthcheck": 0 @@ -79,7 +79,7 @@ def _set(self, action, name, mon_method, interval, timeout, max_retries, "method": { mon_method: self._method_objects[mon_method] }, - "override-ipv4" : ipv4 + "override-ipv4": ipv4 } } if method: diff --git a/acos_client/v30/slb/server.py b/acos_client/v30/slb/server.py index 5a1f53a7..c294fbca 100644 --- a/acos_client/v30/slb/server.py +++ b/acos_client/v30/slb/server.py @@ -35,7 +35,7 @@ def create(self, name, ip_address, status=1, server_templates=None, **kwargs): "action": 'enable' if status else 'disable', "conn-resume": kwargs.get("conn_resume", None), "conn-limit": kwargs.get("conn_limit", 8000000), - "health-check" : kwargs.get("health_check") + "health-check": kwargs.get("health_check") } } From 810efcb08a90c95f151eddf4577223df5ca0480f Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Thu, 2 Jan 2020 07:17:09 +0000 Subject: [PATCH 11/23] build failure 2 --- acos_client/v30/slb/hm.py | 2 +- acos_client/v30/slb/server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index c17c30e7..336b6903 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -68,7 +68,7 @@ def get(self, name, **kwargs): return self._get(self.url_prefix + name, **kwargs) def _set(self, action, name, mon_method, interval, timeout, max_retries, - method=None, url=None, expect_code=None, port=None, ipv4=None, update=False, + method=None, url=None, expect_code=None, port=None, ipv4=None, update=False, **kwargs): params = { "monitor": { diff --git a/acos_client/v30/slb/server.py b/acos_client/v30/slb/server.py index c294fbca..607c9c9c 100644 --- a/acos_client/v30/slb/server.py +++ b/acos_client/v30/slb/server.py @@ -35,7 +35,7 @@ def create(self, name, ip_address, status=1, server_templates=None, **kwargs): "action": 'enable' if status else 'disable', "conn-resume": kwargs.get("conn_resume", None), "conn-limit": kwargs.get("conn_limit", 8000000), - "health-check": kwargs.get("health_check") + "health-check": kwargs.get("health_check") } } From b704a581fc230091390afd7c3c27f7da3bec8714 Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Fri, 3 Jan 2020 06:51:55 +0000 Subject: [PATCH 12/23] mended unit test for slb_server --- acos_client/tests/unit/v30/test_slb_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acos_client/tests/unit/v30/test_slb_server.py b/acos_client/tests/unit/v30/test_slb_server.py index 6e306e02..df9c2a18 100644 --- a/acos_client/tests/unit/v30/test_slb_server.py +++ b/acos_client/tests/unit/v30/test_slb_server.py @@ -183,6 +183,7 @@ def test_server_create(self, mocked_get): 'conn-resume': None, 'server-ipv6-addr': '2001:baad:deed:bead:daab:daad:cead:100e', 'name': VSERVER_NAME, + 'health-check': 'ping' } } @@ -216,6 +217,7 @@ def test_server_create_with_template(self, mocked_get): 'conn-resume': None, 'host': '192.168.2.254', 'name': VSERVER_NAME, + 'health-check': 'ping', 'template-server': 'test-template-server' } } From 9ab80f7c90b69bf6bccd4ee2370875832e761970 Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Sun, 5 Jan 2020 17:12:06 +0000 Subject: [PATCH 13/23] set health-check to none for resolving build failure --- acos_client/tests/unit/v30/test_slb_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acos_client/tests/unit/v30/test_slb_server.py b/acos_client/tests/unit/v30/test_slb_server.py index df9c2a18..10a876d7 100644 --- a/acos_client/tests/unit/v30/test_slb_server.py +++ b/acos_client/tests/unit/v30/test_slb_server.py @@ -181,9 +181,9 @@ def test_server_create(self, mocked_get): 'action': 'enable', 'conn-limit': 8000000, 'conn-resume': None, + 'health-check': None, 'server-ipv6-addr': '2001:baad:deed:bead:daab:daad:cead:100e', 'name': VSERVER_NAME, - 'health-check': 'ping' } } @@ -217,7 +217,7 @@ def test_server_create_with_template(self, mocked_get): 'conn-resume': None, 'host': '192.168.2.254', 'name': VSERVER_NAME, - 'health-check': 'ping', + 'health-check': None, 'template-server': 'test-template-server' } } From 50fc3262830ae1c38739d846e3567149829db5f9 Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Sun, 5 Jan 2020 17:17:59 +0000 Subject: [PATCH 14/23] fix another set of unit test --- acos_client/tests/unit/v30/test_slb_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acos_client/tests/unit/v30/test_slb_server.py b/acos_client/tests/unit/v30/test_slb_server.py index 10a876d7..6ad9836d 100644 --- a/acos_client/tests/unit/v30/test_slb_server.py +++ b/acos_client/tests/unit/v30/test_slb_server.py @@ -53,6 +53,7 @@ def test_server_create(self, mocked_get): 'action': 'enable', 'conn-limit': 8000000, 'conn-resume': None, + 'health-check': None, 'host': '192.168.2.254', 'name': VSERVER_NAME, } @@ -88,6 +89,7 @@ def test_server_create_with_template(self, mocked_get): 'conn-resume': None, 'host': '192.168.2.254', 'name': VSERVER_NAME, + 'health-check': None, 'template-server': 'test-template-server' } } From 0484d6b2f48818778ee65d65033c0916ae6d1932 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Thu, 16 Jan 2020 13:23:34 +0530 Subject: [PATCH 15/23] support for generic UDP health monitor --- acos_client/v30/slb/hm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index 336b6903..59c60421 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -29,6 +29,7 @@ class HealthMonitor(base.BaseV30): HTTP = 'http' HTTPS = 'https' url_prefix = "/health/monitor/" + UDP_CONNECT = 'udp' _method_objects = { ICMP: { @@ -39,6 +40,8 @@ class HealthMonitor(base.BaseV30): "udp-port": 5555, "force-up-with-single-healthcheck": 0 }, + UDP_CONNECT:{ + }, HTTP: { "http": 1, "http-port": 80, From ee2d04f90d57dfc0e514017720506cd24a5c59b9 Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Thu, 16 Jan 2020 07:56:56 +0000 Subject: [PATCH 16/23] flake8 failure fix --- acos_client/v30/slb/hm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index 59c60421..51d38b78 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -40,7 +40,7 @@ class HealthMonitor(base.BaseV30): "udp-port": 5555, "force-up-with-single-healthcheck": 0 }, - UDP_CONNECT:{ + UDP_CONNECT: { }, HTTP: { "http": 1, From d4b2eac5f4f2fa91b353518dac3f6c80905e879c Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Tue, 21 Jan 2020 12:43:26 +0530 Subject: [PATCH 17/23] support for cookie name attribute in app cookie session persistence --- acos_client/v30/slb/template/persistence.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acos_client/v30/slb/template/persistence.py b/acos_client/v30/slb/template/persistence.py index 147f42ae..eac767b7 100644 --- a/acos_client/v30/slb/template/persistence.py +++ b/acos_client/v30/slb/template/persistence.py @@ -37,7 +37,8 @@ def exists(self, name): def create(self, name, **kwargs): if self.exists(name): raise acos_errors.Exists - self._post(self.prefix, self.get_params(name), **kwargs) + cookie_name = kwargs.get("cookie_name", None) + self._post(self.prefix, self.get_params(name, cookie_name), **kwargs) def delete(self, name, **kwargs): self._delete(self.prefix + name, **kwargs) @@ -64,7 +65,7 @@ def __init__(self, client): self.pers_type = 'source-ip' super(SourceIpPersistence, self).__init__(client) - def get_params(self, name): + def get_params(self, name, cookie_name=None): return { "source-ip": { "name": name From 4f9ec8853223c83213d05ed056e261059517acb5 Mon Sep 17 00:00:00 2001 From: omkartelee01 Date: Mon, 3 Feb 2020 14:33:43 +0530 Subject: [PATCH 18/23] Fix HM for Octavia. --- acos_client/v30/slb/hm.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index 51d38b78..c810299d 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -29,7 +29,6 @@ class HealthMonitor(base.BaseV30): HTTP = 'http' HTTPS = 'https' url_prefix = "/health/monitor/" - UDP_CONNECT = 'udp' _method_objects = { ICMP: { @@ -37,11 +36,9 @@ class HealthMonitor(base.BaseV30): }, UDP: { "udp": 1, - "udp-port": 5555, + "udp-port": 5550, "force-up-with-single-healthcheck": 0 }, - UDP_CONNECT: { - }, HTTP: { "http": 1, "http-port": 80, From e51a303535bd8eb34ab834a957b552c0b79d2584 Mon Sep 17 00:00:00 2001 From: afrin-chakure Date: Thu, 6 Feb 2020 14:56:51 +0530 Subject: [PATCH 19/23] Added return statements for hm module methods --- acos_client/v30/slb/hm.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/acos_client/v30/slb/hm.py b/acos_client/v30/slb/hm.py index c810299d..97bee1a7 100644 --- a/acos_client/v30/slb/hm.py +++ b/acos_client/v30/slb/hm.py @@ -107,7 +107,7 @@ def _set(self, action, name, mon_method, interval, timeout, max_retries, if update: action += name - self._post(action, params, **kwargs) + return self._post(action, params, **kwargs) def create(self, name, mon_type, interval, timeout, max_retries, method=None, url=None, expect_code=None, port=None, ipv4=None, **kwargs): @@ -118,15 +118,16 @@ def create(self, name, mon_type, interval, timeout, max_retries, else: raise acos_errors.Exists() - self._set(self.url_prefix, name, mon_type, interval, timeout, - max_retries, method, url, expect_code, port, ipv4, update=False, **kwargs) + return self._set(self.url_prefix, name, mon_type, interval, timeout, + max_retries, method, url, expect_code, port, ipv4, update=False, + **kwargs) def update(self, name, mon_type, interval, timeout, max_retries, method=None, url=None, expect_code=None, port=None, ipv4=None, **kwargs): self.get(name) # We want a NotFound if it does not exist - self._set(self.url_prefix, name, mon_type, interval, timeout, - max_retries, method, url, expect_code, port, ipv4, update=True, - **kwargs) + return self._set(self.url_prefix, name, mon_type, interval, timeout, + max_retries, method, url, expect_code, port, ipv4, update=True, + **kwargs) def delete(self, name): - self._delete(self.url_prefix + name) + return self._delete(self.url_prefix + name) From 971fc5482c3af35ac897dffda32117947325147e Mon Sep 17 00:00:00 2001 From: omkartelee01 <45809890+omkartelee01@users.noreply.github.com> Date: Thu, 16 Apr 2020 10:57:48 +0530 Subject: [PATCH 20/23] Reverted unnecessary write memory changes Removed changes in following functions: activate_and_write() write_memory() --- acos_client/v30/action.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acos_client/v30/action.py b/acos_client/v30/action.py index fc92dd94..615bfc4e 100644 --- a/acos_client/v30/action.py +++ b/acos_client/v30/action.py @@ -20,11 +20,11 @@ class Action(base.BaseV30): - def write_memory(self, **kwargs): + def write_memory(self, partition="all", destination="primary", **kwargs): payload = { "memory": { - "destination": "primary", - "partition": "all" + "destination": destination, + "partition": partition } } try: @@ -37,8 +37,8 @@ def write_memory(self, **kwargs): # If the retry loop missed this, catch it next time. pass - def activate_and_write(self, partition, **kwargs): - self.write_memory() + def activate_and_write(self, partition="all", destination="primary", **kwargs): + self.write_memory(partition, destination) def clideploy(self, commandlist, **kwargs): payload = { From af0aff6d0c63189109111e7a00ae5ac6448ac742 Mon Sep 17 00:00:00 2001 From: omkartelee01 <45809890+omkartelee01@users.noreply.github.com> Date: Thu, 16 Apr 2020 10:59:40 +0530 Subject: [PATCH 21/23] Removed ssl key changes as incorporated in other relesase --- acos_client/v30/slb/template/ssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acos_client/v30/slb/template/ssl.py b/acos_client/v30/slb/template/ssl.py index 7afce7a7..54562313 100644 --- a/acos_client/v30/slb/template/ssl.py +++ b/acos_client/v30/slb/template/ssl.py @@ -52,8 +52,8 @@ def _set(self, name, cert="", key="", passphrase="", update=False, else: obj_params = { "name": name, - "cert-str": cert, - "key-str": key, + "cert": cert, + "key": key, self.passphrase: passphrase, # Unimplemented options: # "encrypted": encrypted, From 9f127afa22079c911d9bede8196b6b253bb9ad21 Mon Sep 17 00:00:00 2001 From: omkartelee01 <45809890+omkartelee01@users.noreply.github.com> Date: Thu, 16 Apr 2020 13:21:26 +0530 Subject: [PATCH 22/23] Converted cookie name to be part of kwargs --- acos_client/v30/slb/template/persistence.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/acos_client/v30/slb/template/persistence.py b/acos_client/v30/slb/template/persistence.py index eac767b7..2e8aeed3 100644 --- a/acos_client/v30/slb/template/persistence.py +++ b/acos_client/v30/slb/template/persistence.py @@ -38,7 +38,7 @@ def create(self, name, **kwargs): if self.exists(name): raise acos_errors.Exists cookie_name = kwargs.get("cookie_name", None) - self._post(self.prefix, self.get_params(name, cookie_name), **kwargs) + self._post(self.prefix, self.get_params(name, cookie_name=cookie_name), **kwargs) def delete(self, name, **kwargs): self._delete(self.prefix + name, **kwargs) @@ -50,7 +50,8 @@ def __init__(self, client): self.pers_type = 'cookie' super(CookiePersistence, self).__init__(client) - def get_params(self, name, cookie_name=None): + def get_params(self, name, **kwargs): + cookie_name = kwargs.get("cookie_name", None) return { "cookie": { "name": name, @@ -65,7 +66,7 @@ def __init__(self, client): self.pers_type = 'source-ip' super(SourceIpPersistence, self).__init__(client) - def get_params(self, name, cookie_name=None): + def get_params(self, name, **kwargs): return { "source-ip": { "name": name From 8121dbd2a845af6b8ac98948747e098e16b67ba1 Mon Sep 17 00:00:00 2001 From: Hunter Thompson Date: Thu, 16 Apr 2020 08:48:23 +0000 Subject: [PATCH 23/23] Refactored template presistence module --- acos_client/v30/slb/template/persistence.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/acos_client/v30/slb/template/persistence.py b/acos_client/v30/slb/template/persistence.py index 2e8aeed3..3a57179a 100644 --- a/acos_client/v30/slb/template/persistence.py +++ b/acos_client/v30/slb/template/persistence.py @@ -37,8 +37,10 @@ def exists(self, name): def create(self, name, **kwargs): if self.exists(name): raise acos_errors.Exists - cookie_name = kwargs.get("cookie_name", None) - self._post(self.prefix, self.get_params(name, cookie_name=cookie_name), **kwargs) + self._post(self.prefix, + self.get_params(name, + cookie_name=kwargs.get("cookie_name")), + **kwargs) def delete(self, name, **kwargs): self._delete(self.prefix + name, **kwargs) @@ -51,11 +53,10 @@ def __init__(self, client): super(CookiePersistence, self).__init__(client) def get_params(self, name, **kwargs): - cookie_name = kwargs.get("cookie_name", None) return { "cookie": { "name": name, - "cookie-name": cookie_name + "cookie-name": kwargs.get("cookie_name") } }