Skip to content

Commit

Permalink
Implement review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-v committed Aug 4, 2021
1 parent 1aca6d8 commit b85588b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
23 changes: 19 additions & 4 deletions delfin/drivers/dell_emc/vmax/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,15 @@ def list_controllers(self, storage_id):
status = constants.ControllerStatus.OFFLINE

controller = {
'name': 'director_'
+ str(director_info.get('director_number')),
'name': director_info['directorId'],
'storage_id': storage_id,
'native_controller_id': director_info['directorId'],
'status': status,
'location':
'slot_' +
str(director_info.get('director_slot_number')),
'soft_version': None,
'cpu_info': 'number_of_cores_'
'cpu_info': 'Cores-'
+ str(director_info.get('num_of_cores')),
'memory_size': None

Expand All @@ -332,6 +331,11 @@ def list_ports(self, storage_id):
# Get list of Directors
directors = self.rest.get_director_list(self.array_id,
self.uni_version)
switcher = {
'A': constants.PortLogicalType.MANAGEMENT,
'B': constants.PortLogicalType.SERVICE,
'C': constants.PortLogicalType.BACKEND,
}
port_list = []
for director in directors:
port_keys = self.rest.get_port_list(
Expand All @@ -356,6 +360,17 @@ def list_ports(self, storage_id):

name = "{0}:{1}".format(port_key['directorId'],
port_key['portId'])

director_emulation = port_key['directorId'][4]
logical_type = switcher.get(
director_emulation, constants.PortLogicalType.OTHER)
if logical_type == constants.PortLogicalType.OTHER:
port_prefix = port_key['directorId'][:2]
if port_prefix in ['FA', 'FE', 'EA', 'EF', 'SE']:
logical_type = constants.PortLogicalType.FRONTEND
if port_prefix in ['DA', 'DF', 'DX']:
logical_type = constants.PortLogicalType.BACKEND

speed = int(port_info.get('negotiated_speed',
'0')) * units.Gi
max_speed = int(port_info.get('max_speed',
Expand All @@ -368,7 +383,7 @@ def list_ports(self, storage_id):
'connection_status': connection_status,
'health_status': constants.PortHealthStatus.NORMAL,
'type': port_type,
'logical_type': None,
'logical_type': logical_type,
'speed': speed,
'max_speed': max_speed,
'native_parent_id': port_key['directorId'],
Expand Down
14 changes: 7 additions & 7 deletions delfin/tests/unit/drivers/dell_emc/vmax/test_vmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ def test_list_controllers(self, mock_unisphere_version,
mock_array, mock_res):
expected = [
{
'name': 'director_1',
'name': 'DF-1C',
'storage_id': '12345',
'native_controller_id': 'DF-1C',
'status': 'offline',
'location': 'slot_10',
'soft_version': None,
'cpu_info': 'number_of_cores_64',
'cpu_info': 'Cores-64',
'memory_size': None
}
]
Expand Down Expand Up @@ -426,17 +426,17 @@ def test_list_ports(self, mock_unisphere_version,
mock_version,
mock_array, mock_dirs, mock_res):
expected = [{
'name': 'DF-1C:30',
'name': 'DF-1D:30',
'storage_id': '12345',
'native_port_id': '30',
'location': 'director_DF-1C',
'location': 'director_DF-1D',
'connection_status': 'connected',
'health_status': 'normal',
'type': 'other',
'logical_type': None,
'logical_type': 'backend',
'speed': 0,
'max_speed': 10737418240,
'native_parent_id': 'DF-1C',
'native_parent_id': 'DF-1D',
'wwn': None,
'mac_address': None,
'ipv4': None,
Expand All @@ -453,7 +453,7 @@ def test_list_ports(self, mock_unisphere_version,
{
'symmetrixPortKey': [
{
'directorId': 'DF-1C',
'directorId': 'DF-1D',
'portId': '30'
},
{
Expand Down

0 comments on commit b85588b

Please sign in to comment.