def get_connection_port(self, sp=None, port_id=None, vport_id=None): cmd = 'connection -getport -all'.split() if sp is not None: cmd += ['-sp', VNXSPEnum.get_sp_index(sp)] cmd += int_var('-portid', port_id) if port_id is not None: cmd += int_var('-vportid', vport_id) return cmd
def delete_iscsi_ip(self, sp, port_id, vport_id=None): if vport_id is None: vport_id = 0 cmd = ['connection', '-delport'] cmd += ['-sp', VNXSPEnum.get_sp_index(sp)] cmd += int_var('-portid', port_id) cmd += int_var('-vportid', vport_id) cmd.append('-o') return cmd
def set_path(self, sg_name, hba_uid, sp, port_id, ip, host, vport_id=None): cmd = ['storagegroup', '-setpath'] cmd += text_var('-gname', sg_name) cmd += text_var('-hbauid', hba_uid) cmd += ['-sp', VNXSPEnum.get_sp_index(sp)] cmd += int_var('-spport', port_id) cmd += int_var('-spvport', vport_id) cmd += text_var('-ip', ip) cmd += text_var('-host', host) cmd.append('-o') return cmd
def set_path(self, sg_name, hba_uid, sp, port_id, ip, host, vport_id=None): cmd = ['storagegroup', '-setpath'] cmd += text_var('-gname', sg_name) cmd += text_var('-hbauid', hba_uid) cmd += ['-sp', VNXSPEnum.get_sp_index(sp)] cmd += int_var('-spport', port_id) cmd += int_var('-spvport', vport_id) cmd += ['-ip', ip] cmd += text_var('-host', host) cmd.append('-o') return cmd
def ping_node(self, address, sp, port_id, vport_id=None, packet_size=None, count=None, timeout=None, delay=None): if vport_id is None: vport_id = 0 cmd = ['connection', '-pingnode'] sp = VNXSPEnum.get_sp_index(sp) cmd += text_var('-sp', sp) cmd += int_var('-portid', port_id) cmd += int_var('-vportid', vport_id) cmd += text_var('-address', address) cmd += int_var('-packetSize', packet_size) cmd += int_var('-count', count) cmd += int_var('-timeout', timeout) cmd += int_var('-delay', delay) return cmd
def config_iscsi_ip(self, sp, port_id, ip, netmask, gateway, vport_id=None, vlan_id=None): if vport_id is None: vport_id = 0 cmd = ['connection', '-setport', '-iscsi'] cmd += ['-sp', VNXSPEnum.get_sp_index(sp)] cmd += int_var('-portid', port_id) cmd += int_var('-vportid', vport_id) cmd += int_var('-vlanid', vlan_id) cmd += text_var('-address', ip) cmd += text_var('-subnetmask', netmask) cmd += text_var('-gateway', gateway) cmd.append('-o') return cmd
def get_sp_index(self): return VNXSPEnum.get_sp_index(self.sp)
def test_get_sp_index(self): assert_that(VNXSPEnum.get_sp_index('spa'), equal_to('a'))
def f(): VNXSPEnum.get_sp_index('abc')
def sp_network_status(self, sp): sp = VNXSPEnum.get_sp_index(sp) return 'networkadmin -get -sp {} -all'.format(sp).split()