Skip to content

Commit d1c0245

Browse files
author
Fernando Ojeda
committed
Fix create subnet static for ipv4 price.
1 parent 48306c4 commit d1c0245

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

SoftLayer/managers/network.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ def add_subnet(self, subnet_type, quantity=None, endpoint_id=None, version=4,
171171
item.get('capacity') == quantity_str,
172172
version == 4 or (version == 6 and
173173
desc in item['description'])]):
174-
price_id = item['prices'][0]['id']
174+
if version == 4 and subnet_type == 'static':
175+
price_id = item['prices'][1]['id']
176+
else:
177+
price_id = item['prices'][0]['id']
175178
break
176179

177180
order = {

tests/managers/network_tests.py

+8
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ def test_add_subnet_for_ipv4(self):
100100

101101
self.assertEqual(fixtures.SoftLayer_Product_Order.verifyOrder, result)
102102

103+
result = self.network.add_subnet('static',
104+
quantity=8,
105+
endpoint_id=1234,
106+
version=4,
107+
test_order=True)
108+
109+
self.assertEqual(fixtures.SoftLayer_Product_Order.verifyOrder, result)
110+
103111
def test_add_subnet_for_ipv6(self):
104112
# Test a public IPv6 order
105113
result = self.network.add_subnet('public',

0 commit comments

Comments
 (0)