Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unit Tests
Covered Unit tests for ISCSI and snapshot related operations
  • Loading branch information
aparnapatil committed Mar 27, 2014
commit df978c2c8d96d7b15e494be88c78b7c9ffedf228
8 changes: 0 additions & 8 deletions SoftLayer/CLI/modules/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class CreateiSCSI(CLIRunnable):
required_params = ['--size', '--dc']

def execute(self, args):
import pdb
pdb.set_trace()
iscsi = ISCSIManager(self.client)

self._validate_create_args(args)
Expand Down Expand Up @@ -131,8 +129,6 @@ class CanceliSCSI(CLIRunnable):
options = ['confirm']

def execute(self, args):
import pdb
pdb.set_trace()
iscsi = ISCSIManager(self.client)
iscsi_id = resolve_id(
iscsi.resolve_ids,
Expand Down Expand Up @@ -211,8 +207,6 @@ class IscsiCreateSnapshot(CLIRunnable):
action = 'create_snapshot'

def execute(self, args):
import pdb
pdb.set_trace()
iscsi = ISCSIManager(self.client)
iscsi_id = resolve_id(iscsi.resolve_ids,
args.get('<identifier>'),
Expand All @@ -236,8 +230,6 @@ class OrderIscsiSpace(CLIRunnable):
required_params = ['--capacity']

def execute(self, args):
import pdb
pdb.set_trace()
iscsi = ISCSIManager(self.client)
invalid_args = [k for k in self.required_params if args.get(k) is None]
if invalid_args:
Expand Down
7 changes: 7 additions & 0 deletions SoftLayer/managers/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def get_iscsi(self, volume_id, **kwargs):

def cancel_iscsi(self, volume_id, reason='unNeeded', immediate=False):
"""Cancels the given iSCSI volume.

:param integer volume_id: the volume ID
"""
iscsi = self.get_iscsi(
volume_id,
Expand All @@ -100,12 +102,17 @@ def cancel_iscsi(self, volume_id, reason='unNeeded', immediate=False):

def create_snapshot(self, volume_id, notes='unNeeded'):
""" Orders a snapshot for given volume

:param integer volume_id: the volume ID
"""

self.iscsi.createSnapshot(notes, id=volume_id)

def order_snapshot_space(self, volume_id, capacity):
""" Orders a snapshot space for given volume

:param integer volume_id: the volume ID
:param integer capacity: capacity in ~GB
"""
item_price = self._find_item_prices(int(capacity),'~iSCSI SAN Snapshot Space')
result = self.get_iscsi(volume_id, mask='mask[id,capacityGb,serviceResource[datacenter]]')
Expand Down
11 changes: 0 additions & 11 deletions SoftLayer/tests/managers/iscsi_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ def test_cancel_iscsi_without_reason(self):
result = self.iscsi.cancel_iscsi(iscsi_id)
f = self.client['Billing_Item'].cancelItem
f.assert_called_once_with(False,True,'unNeeded',id=iscsi_id)
#self.assertEqual(result,Billing_Item.cancelItem)

def test_cancel_iscsi_with_reason(self):
iscsi_id=6327
reason='Network Performance'
result = self.iscsi.cancel_iscsi(iscsi_id,reason)
f = self.client['Billing_Item'].cancelItem
f.assert_called_once_with(False,True,reason,id=iscsi_id)
#self.assertEqual(result,Billing_Item.cancelItem)

def test_order_iscsi_without_recurringFee(self):
self.iscsi.order_iscsi(test=1, verify=1)
Expand All @@ -52,15 +50,6 @@ def test_order_iscsi_without_recurringFee(self):
'packageId': 0,
'complexType': 'SoftLayer_Container_Product_Order_Network_Storage_Iscsi'})

"""def test_order_iscsi_with_recurringFee(self):
self.iscsi.order_iscsi(test=1, verify=1)
f = self.client['Product_Order'].placeOrder
f.assert_called_once_with({'prices': [{'id': 22441}],
'quantity': 1,
'location': None,
'packageId': 0,
'complexType': 'SoftLayer_Container_Product_Order_Network_Storage_Iscsi'})"""

def test_delete_snapshot(self):
self.iscsi.delete_snapshot(1)
self.client['Network_Storage_Iscsi'].deleteObject.assert_called_once_with(id=1)
Expand Down