from cinder.volume import configuration as conf
import cinder.zonemanager.drivers.cisco.cisco_fc_san_lookup_service \
as cisco_lookup
+import cinder.zonemanager.drivers.cisco.fc_zone_constants as ZoneConstant
from cinder.zonemanager.utils import get_formatted_wwn
nsshow = '20:1a:00:05:1e:e8:e3:29'
'fc-zone-manager')
self.configuration.fc_fabric_names = 'CISCO_FAB_2'
self.create_configuration()
+ self.fabric_vsan = '304'
# override some of the functions
def __init__(self, *args, **kwargs):
return_wwn_list.append(get_formatted_wwn(wwn_list[0]))
self.assertEqual(return_wwn_list, expected_wwn_list)
+ @mock.patch.object(cisco_lookup.CiscoFCSanLookupService,
+ '_run_ssh')
+ def test__get_switch_info(self, run_ssh_mock):
+ cmd_list = [ZoneConstant.FCNS_SHOW, self.fabric_vsan,
+ ' | no-more']
+ nsshow_list = [nsshow]
+ run_ssh_mock.return_value = (Stream(nsshow), Stream())
+ switch_data = self._get_switch_info(cmd_list)
+ self.assertEqual(switch_data, nsshow_list)
+ run_ssh_mock.assert_called_once_with(cmd_list, True, 1)
+
class Channel(object):
def recv_exit_status(self):
def readlines(self):
return self.buffer
+ def splitlines(self):
+ return self.buffer.splitlines()
+
def close(self):
pass
cli_output = None
nsinfo_list = []
try:
- cmd = ZoneConstant.FCNS_SHOW + fabric_vsan + ' | no-more'
+ cmd = ([ZoneConstant.FCNS_SHOW, fabric_vsan, ' | no-more'])
cli_output = self._get_switch_info(cmd)
except exception.FCSanLookupServiceException:
with excutils.save_and_reraise_exception():