Skip to content

Commit 614e653

Browse files
Merge branch 'loadbalancers' of github.com:softlayer/softlayer-python into loadbalancers
2 parents 8448ccd + 8dfee70 commit 614e653

File tree

9 files changed

+703
-33
lines changed

9 files changed

+703
-33
lines changed

SoftLayer/CLI/loadbal/health.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import SoftLayer
55
from SoftLayer.CLI import environment
66
from SoftLayer.CLI import exceptions
7+
from SoftLayer.exceptions import SoftLayerAPIError
78
from SoftLayer import utils
89

910

@@ -55,9 +56,9 @@ def cli(env, identifier, uuid, interval, retry, timeout, url):
5556
for key in clean_template.keys():
5657
check[key] = clean_template[key]
5758

58-
result = mgr.update_lb_health_monitors(lb_uuid, [check])
59-
60-
if result:
59+
try:
60+
mgr.update_lb_health_monitors(lb_uuid, [check])
6161
click.secho('Health Check {} updated successfully'.format(uuid), fg='green')
62-
else:
63-
click.secho('ERROR: Failed to update {}'.format(uuid), fg='red')
62+
except SoftLayerAPIError as exception:
63+
click.secho('Failed to update {}'.format(uuid), fg='red')
64+
click.secho("ERROR: {}".format(exception.faultString), fg='red')

SoftLayer/fixtures/SoftLayer_Account.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,32 @@
323323
'subnetType': 'PRIMARY',
324324
'ipAddressCount': 10,
325325
'virtualGuests': [],
326-
'hardware': []
327-
}]
326+
'hardware': [],
327+
"podName": "dal05.pod04",
328+
"networkVlan": {
329+
"accountId": 123,
330+
"id": 2581232,
331+
"modifyDate": "2019-07-17T01:09:51+08:00",
332+
"vlanNumber": 795
333+
}
334+
},
335+
{
336+
"gateway": "5.111.11.111",
337+
"id": '111',
338+
"modifyDate": "2018-07-24T17:14:57+08:00",
339+
'networkIdentifier': '10.0.0.1',
340+
'ipAddressCount': 10,
341+
'cidr': '/24',
342+
'virtualGuests': [],
343+
'hardware': [],
344+
"networkVlanId": 22222,
345+
"sortOrder": "2",
346+
"subnetType": "SECONDARY_ON_VLAN",
347+
"totalIpAddresses": "8",
348+
"usableIpAddressCount": "5",
349+
"version": 4
350+
}
351+
]
328352

329353
getSshKeys = [{'id': '100', 'label': 'Test 1'},
330354
{'id': '101', 'label': 'Test 2',

SoftLayer/fixtures/SoftLayer_Network_Application_Delivery_Controller.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,45 @@
1313
'longName': 'Dallas 9',
1414
'name': 'dal09',
1515
},
16+
"networkVlans": [
17+
{
18+
"accountId": 11111,
19+
"id": 33333,
20+
"modifyDate": "2019-07-17T01:09:38+08:00",
21+
"name": "FirewallTesting",
22+
"primarySubnetId": 91111,
23+
"vlanNumber": 1711
24+
},
25+
{
26+
"accountId": 11111,
27+
"id": 862222,
28+
"modifyDate": "2019-07-17T01:09:42+08:00",
29+
"primarySubnetId": 502211,
30+
"vlanNumber": 722
31+
}
32+
],
1633
'password': {
1734
'password': 'aaaaa',
1835
'username': 'root'
1936
},
37+
"subnets": [
38+
{
39+
"broadcastAddress": "",
40+
"cidr": 32,
41+
"gateway": "",
42+
"id": 74222,
43+
"modifyDate": "2016-10-26T23:39:12+08:00",
44+
"netmask": "255.255.255.255",
45+
"networkIdentifier": "159.253.111.111",
46+
"networkVlanId": 3611111,
47+
"sortOrder": "4",
48+
"subnetType": "STATIC_IP_ROUTED",
49+
"totalIpAddresses": "2",
50+
"usableIpAddressCount": "2",
51+
"version": 4,
52+
"addressSpace": "PUBLIC"
53+
}
54+
],
2055
'type': {
2156
'keyName': 'NETSCALER_VPX',
2257
'name': 'NetScaler VPX'
Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,42 @@
1-
createL7Pool = {}
2-
deleteObject = {}
1+
createL7Pool = {'accountId': 1234,
2+
'address': '01-307608-ams01.clb.appdomain.cloud',
3+
'createDate': '2019-08-12T07:49:43-06:00',
4+
'id': 1111111,
5+
'isPublic': 0,
6+
'locationId': 265592,
7+
'modifyDate': '2019-08-13T16:26:06-06:00',
8+
'name': 'dcabero-01',
9+
'operatingStatus': 'ONLINE',
10+
'provisioningStatus': 'ACTIVE',
11+
'type': 0,
12+
'useSystemPublicIpPool': 1,
13+
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
14+
'listenerCount': 4,
15+
'memberCount': 1,
16+
'datacenter': {
17+
'id': 265592,
18+
'longName': 'Amsterdam 1',
19+
'name': 'ams01',
20+
'statusId': 2
21+
}}
22+
deleteObject = {'accountId': 1234,
23+
'address': '01-307608-ams01.clb.appdomain.cloud',
24+
'createDate': '2019-08-12T07:49:43-06:00',
25+
'id': 1111111,
26+
'isPublic': 0,
27+
'locationId': 265592,
28+
'modifyDate': '2019-08-13T16:26:06-06:00',
29+
'name': 'dcabero-01',
30+
'operatingStatus': 'ONLINE',
31+
'provisioningStatus': 'ACTIVE',
32+
'type': 0,
33+
'useSystemPublicIpPool': 1,
34+
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
35+
'listenerCount': 4,
36+
'memberCount': 1,
37+
'datacenter': {
38+
'id': 265592,
39+
'longName': 'Amsterdam 1',
40+
'name': 'ams01',
41+
'statusId': 2
42+
}}
Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
11
# https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_LBaaS_Listener/
2-
updateLoadBalancerProtocols = {}
3-
deleteLoadBalancerProtocols = {}
2+
updateLoadBalancerProtocols = {'accountId': 1234,
3+
'address': '01-307608-ams01.clb.appdomain.cloud',
4+
'createDate': '2019-08-12T07:49:43-06:00',
5+
'id': 1111111,
6+
'isPublic': 0,
7+
'locationId': 265592,
8+
'modifyDate': '2019-08-13T16:26:06-06:00',
9+
'name': 'dcabero-01',
10+
'operatingStatus': 'ONLINE',
11+
'provisioningStatus': 'ACTIVE',
12+
'type': 0,
13+
'useSystemPublicIpPool': 1,
14+
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
15+
'listenerCount': 4,
16+
'memberCount': 1,
17+
'datacenter': {
18+
'id': 265592,
19+
'longName': 'Amsterdam 1',
20+
'name': 'ams01',
21+
'statusId': 2
22+
}}
23+
deleteLoadBalancerProtocols = {'accountId': 1234,
24+
'address': '01-307608-ams01.clb.appdomain.cloud',
25+
'createDate': '2019-08-12T07:49:43-06:00',
26+
'id': 1111111,
27+
'isPublic': 0,
28+
'locationId': 265592,
29+
'modifyDate': '2019-08-13T16:26:06-06:00',
30+
'name': 'dcabero-01',
31+
'operatingStatus': 'ONLINE',
32+
'provisioningStatus': 'ACTIVE',
33+
'type': 0,
34+
'useSystemPublicIpPool': 1,
35+
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
36+
'listenerCount': 4,
37+
'memberCount': 1,
38+
'datacenter': {
39+
'id': 265592,
40+
'longName': 'Amsterdam 1',
41+
'name': 'ams01',
42+
'statusId': 2
43+
}}

SoftLayer/fixtures/SoftLayer_Network_LBaaS_LoadBalancer.py

Lines changed: 133 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,140 @@
11
getObject = {
2-
'accountId': 1234,
3-
'address': '01-307608-ams01.clb.appdomain.cloud',
4-
'createDate': '2019-08-12T07:49:43-06:00',
5-
'id': 1111111,
6-
'isPublic': 0,
7-
'locationId': 265592,
8-
'modifyDate': '2019-08-13T16:26:06-06:00',
9-
'name': 'dcabero-01',
10-
'operatingStatus': 'ONLINE',
11-
'provisioningStatus': 'ACTIVE',
12-
'type': 0,
13-
'useSystemPublicIpPool': 1,
14-
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
15-
'listenerCount': 4,
16-
'memberCount': 1,
17-
'datacenter': {
18-
'id': 265592,
19-
'longName': 'Amsterdam 1',
20-
'name': 'ams01',
21-
'statusId': 2
2+
'accountId': 1234,
3+
'address': '01-307608-ams01.clb.appdomain.cloud',
4+
'createDate': '2019-08-12T07:49:43-06:00',
5+
'id': 1111111,
6+
'isPublic': 0,
7+
'locationId': 265592,
8+
'modifyDate': '2019-08-13T16:26:06-06:00',
9+
'name': 'dcabero-01',
10+
'operatingStatus': 'ONLINE',
11+
'provisioningStatus': 'ACTIVE',
12+
'type': 0,
13+
'useSystemPublicIpPool': 1,
14+
'uuid': '1a1aa111-4474-4e16-9f02-4de959229b85',
15+
'listenerCount': 4,
16+
'memberCount': 1,
17+
'previousErrorText': 'test',
18+
'datacenter': {
19+
'id': 265592,
20+
'longName': 'Amsterdam 1',
21+
'name': 'ams01',
22+
'statusId': 2
23+
},
24+
'healthMonitors': [
25+
{
26+
'createDate': '2019-08-20T18:05:09-04:00',
27+
'interval': 5,
28+
'maxRetries': 2,
29+
'modifyDate': '2019-08-20T18:05:18-04:00',
30+
'monitorType': 'HTTP',
31+
'provisioningStatus': 'ACTIVE',
32+
'timeout': 2,
33+
'urlPath': '/',
34+
'uuid': 'c11111c1-f5ab-4c15-ba96-d7b95dc7c824'
2235
}
23-
}
36+
],
37+
'l7Pools': [
38+
{
39+
'createDate': '2019-08-19T16:33:37-04:00',
40+
'id': 222222,
41+
'loadBalancingAlgorithm': 'ROUNDROBIN',
42+
'modifyDate': None,
43+
'name': 'test',
44+
'protocol': 'HTTP',
45+
'provisioningStatus': 'ACTIVE',
46+
'uuid': 'a1111111-c5e7-413f-9f78-84f6c5e1ca04'
47+
}
48+
],
49+
'listeners': [
50+
{
51+
'defaultPool': {
52+
'healthMonitor': {
53+
'uuid': '222222ab-bbcc-4f32-9b31-1b6d3a1959c8'
54+
},
55+
'protocol': 'HTTP',
56+
'protocolPort': 256,
57+
'uuid': 'ab1a1abc-0e83-4690-b5d4-1359625dba8f',
58+
}
59+
},
60+
{'connectionLimit': None,
61+
'createDate': '2019-08-21T17:19:25-04:00',
62+
'defaultPool': {'createDate': '2019-08-21T17:19:25-04:00',
63+
'healthMonitor': {'createDate': '2019-08-21T17:17:04-04:00',
64+
'id': 859330,
65+
'interval': 5,
66+
'maxRetries': 2,
67+
'modifyDate': '2019-08-21T17:17:15-04:00',
68+
'monitorType': 'HTTP',
69+
'provisioningStatus': 'ACTIVE',
70+
'timeout': 2,
71+
'urlPath': '/',
72+
'uuid': '55e00152-75fd-4f94-9263-cb4c6e005f12'},
73+
'loadBalancingAlgorithm': 'ROUNDROBIN',
74+
'members': [{'address': '10.136.4.220',
75+
'createDate': '2019-08-12T09:49:43-04:00',
76+
'id': 1023118,
77+
'modifyDate': '2019-08-12T09:52:54-04:00',
78+
'provisioningStatus': 'ACTIVE',
79+
'uuid': 'ba23a166-faa4-4eb2-96e7-ef049d65ce60',
80+
'weight': 50}],
81+
'modifyDate': '2019-08-21T17:19:33-04:00',
82+
'protocol': 'HTTP',
83+
'protocolPort': 230,
84+
'provisioningStatus': 'ACTIVE',
85+
'uuid': '1c5f3ba6-ec7d-4cf8-8815-9bb174224a76'},
86+
'id': 889072,
87+
'l7Policies': [{'action': 'REJECT',
88+
'createDate': '2019-08-21T18:17:41-04:00',
89+
'id': 215204,
90+
'modifyDate': None,
91+
'name': 'trestst',
92+
'priority': 1,
93+
'redirectL7PoolId': None,
94+
'uuid': 'b8c30aae-3979-49a7-be8c-fb70e43a6b4b'}],
95+
'modifyDate': '2019-08-22T10:58:02-04:00',
96+
'protocol': 'HTTP',
97+
'protocolPort': 110,
98+
'provisioningStatus': 'ACTIVE',
99+
'tlsCertificateId': None,
100+
'uuid': 'a509723d-a3cb-4ae4-bc5b-5ecf04f890ff'}
101+
],
102+
'members': [
103+
{
104+
'address': '10.0.0.1',
105+
'createDate': '2019-08-12T09:49:43-04:00',
106+
'modifyDate': '2019-08-12T09:52:54-04:00',
107+
'provisioningStatus': 'ACTIVE',
108+
'uuid': 'ba23a166-faa4-4eb2-96e7-ef049d65ce60',
109+
'weight': 50
110+
}
111+
],
112+
'sslCiphers': [
113+
{
114+
'id': 2, 'name': 'ECDHE-RSA-AES256-GCM-SHA384'
115+
}
116+
],
117+
}
24118
getAllObjects = [getObject]
25119

120+
getLoadBalancer = {
121+
"accountId": 3071234,
122+
"createDate": "2019-08-12T21:49:43+08:00",
123+
"id": 81234,
124+
"isPublic": 0,
125+
"locationId": 265592,
126+
"modifyDate": "2019-08-14T06:26:06+08:00",
127+
"name": "dcabero-01",
128+
"uuid": "0a2da082-4474-4e16-9f02-4de11111",
129+
"datacenter": {
130+
"id": 265592,
131+
"longName": "Amsterdam 1",
132+
"name": "ams01",
133+
"statusId": 2
134+
}
135+
}
136+
137+
cancelLoadBalancer = True
26138

27139
getLoadBalancerMemberHealth = [
28140
{

0 commit comments

Comments
 (0)