body
stringlengths 26
98.2k
| body_hash
int64 -9,222,864,604,528,158,000
9,221,803,474B
| docstring
stringlengths 1
16.8k
| path
stringlengths 5
230
| name
stringlengths 1
96
| repository_name
stringlengths 7
89
| lang
stringclasses 1
value | body_without_docstring
stringlengths 20
98.2k
|
---|---|---|---|---|---|---|---|
def test_ap_max_num_sta_no_probe_resp(dev, apdev, params):
'Maximum STA count and limit on Probe Response frames'
logdir = params['logdir']
dev[0].flush_scan_cache()
ssid = 'max'
params = {}
params['ssid'] = ssid
params['beacon_int'] = '2000'
params['max_num_sta'] = '1'
params['no_probe_resp_if_max_sta'] = '1'
hostapd.add_ap(apdev[0], params)
dev[1].connect(ssid, key_mgmt='NONE', scan_freq='2412')
dev[0].scan(freq=2412, type='ONLY')
dev[0].scan(freq=2412, type='ONLY')
seen = (dev[0].get_bss(apdev[0]['bssid']) != None)
dev[1].scan(freq=2412, type='ONLY')
if seen:
out = run_tshark(os.path.join(logdir, 'hwsim0.pcapng'), 'wlan.fc.type_subtype == 5', ['wlan.da'])
if out:
if (dev[0].own_addr() not in out):
seen = False
if (dev[1].own_addr() not in out):
raise Exception('No Probe Response frames to dev[1] seen')
if seen:
raise Exception('AP found unexpectedly') | 7,729,895,577,941,109,000 | Maximum STA count and limit on Probe Response frames | tests/hwsim/test_ap_params.py | test_ap_max_num_sta_no_probe_resp | AreedAhmed/fragattacks | python | def test_ap_max_num_sta_no_probe_resp(dev, apdev, params):
logdir = params['logdir']
dev[0].flush_scan_cache()
ssid = 'max'
params = {}
params['ssid'] = ssid
params['beacon_int'] = '2000'
params['max_num_sta'] = '1'
params['no_probe_resp_if_max_sta'] = '1'
hostapd.add_ap(apdev[0], params)
dev[1].connect(ssid, key_mgmt='NONE', scan_freq='2412')
dev[0].scan(freq=2412, type='ONLY')
dev[0].scan(freq=2412, type='ONLY')
seen = (dev[0].get_bss(apdev[0]['bssid']) != None)
dev[1].scan(freq=2412, type='ONLY')
if seen:
out = run_tshark(os.path.join(logdir, 'hwsim0.pcapng'), 'wlan.fc.type_subtype == 5', ['wlan.da'])
if out:
if (dev[0].own_addr() not in out):
seen = False
if (dev[1].own_addr() not in out):
raise Exception('No Probe Response frames to dev[1] seen')
if seen:
raise Exception('AP found unexpectedly') |
@remote_compatible
def test_ap_tx_queue_params(dev, apdev):
'Open AP with TX queue params set'
ssid = 'tx'
params = {}
params['ssid'] = ssid
params['tx_queue_data2_aifs'] = '4'
params['tx_queue_data2_cwmin'] = '7'
params['tx_queue_data2_cwmax'] = '1023'
params['tx_queue_data2_burst'] = '4.2'
params['tx_queue_data1_aifs'] = '4'
params['tx_queue_data1_cwmin'] = '7'
params['tx_queue_data1_cwmax'] = '1023'
params['tx_queue_data1_burst'] = '2'
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) | -7,183,378,452,323,885,000 | Open AP with TX queue params set | tests/hwsim/test_ap_params.py | test_ap_tx_queue_params | AreedAhmed/fragattacks | python | @remote_compatible
def test_ap_tx_queue_params(dev, apdev):
ssid = 'tx'
params = {}
params['ssid'] = ssid
params['tx_queue_data2_aifs'] = '4'
params['tx_queue_data2_cwmin'] = '7'
params['tx_queue_data2_cwmax'] = '1023'
params['tx_queue_data2_burst'] = '4.2'
params['tx_queue_data1_aifs'] = '4'
params['tx_queue_data1_cwmin'] = '7'
params['tx_queue_data1_cwmax'] = '1023'
params['tx_queue_data1_burst'] = '2'
hapd = hostapd.add_ap(apdev[0], params)
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) |
def test_ap_tx_queue_params_invalid(dev, apdev):
'Invalid TX queue params set (cwmin/cwmax)'
ssid = 'tx'
params = {}
params['ssid'] = ssid
params['tx_queue_data2_aifs'] = '4'
params['tx_queue_data2_cwmin'] = '7'
params['tx_queue_data2_cwmax'] = '1023'
params['tx_queue_data2_burst'] = '4.2'
params['wmm_ac_bk_cwmin'] = '4'
params['wmm_ac_bk_cwmax'] = '10'
params['wmm_ac_bk_aifs'] = '7'
params['wmm_ac_bk_txop_limit'] = '0'
params['wmm_ac_bk_acm'] = '0'
hapd = hostapd.add_ap(apdev[0], params)
hapd.set('wmm_ac_be_cwmin', '3')
if ('FAIL' not in hapd.request('SET tx_queue_data2_cwmax 3')):
raise Exception('TX cwMax < cwMin accepted')
if ('FAIL' not in hapd.request('SET wmm_ac_bk_cwmax 3')):
raise Exception('AC cwMax < cwMin accepted') | -5,426,384,064,626,456,000 | Invalid TX queue params set (cwmin/cwmax) | tests/hwsim/test_ap_params.py | test_ap_tx_queue_params_invalid | AreedAhmed/fragattacks | python | def test_ap_tx_queue_params_invalid(dev, apdev):
ssid = 'tx'
params = {}
params['ssid'] = ssid
params['tx_queue_data2_aifs'] = '4'
params['tx_queue_data2_cwmin'] = '7'
params['tx_queue_data2_cwmax'] = '1023'
params['tx_queue_data2_burst'] = '4.2'
params['wmm_ac_bk_cwmin'] = '4'
params['wmm_ac_bk_cwmax'] = '10'
params['wmm_ac_bk_aifs'] = '7'
params['wmm_ac_bk_txop_limit'] = '0'
params['wmm_ac_bk_acm'] = '0'
hapd = hostapd.add_ap(apdev[0], params)
hapd.set('wmm_ac_be_cwmin', '3')
if ('FAIL' not in hapd.request('SET tx_queue_data2_cwmax 3')):
raise Exception('TX cwMax < cwMin accepted')
if ('FAIL' not in hapd.request('SET wmm_ac_bk_cwmax 3')):
raise Exception('AC cwMax < cwMin accepted') |
def test_ap_beacon_rate_legacy(dev, apdev):
'Open AP with Beacon frame TX rate 5.5 Mbps'
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 8796093022208) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', '55')
hapd.enable()
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='2412')
time.sleep(0.5) | -1,313,347,115,724,432,100 | Open AP with Beacon frame TX rate 5.5 Mbps | tests/hwsim/test_ap_params.py | test_ap_beacon_rate_legacy | AreedAhmed/fragattacks | python | def test_ap_beacon_rate_legacy(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 8796093022208) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', '55')
hapd.enable()
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='2412')
time.sleep(0.5) |
def test_ap_beacon_rate_legacy2(dev, apdev):
'Open AP with Beacon frame TX rate 12 Mbps in VHT BSS'
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 8796093022208) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', '120')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', '')
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() | -5,419,189,492,823,366,000 | Open AP with Beacon frame TX rate 12 Mbps in VHT BSS | tests/hwsim/test_ap_params.py | test_ap_beacon_rate_legacy2 | AreedAhmed/fragattacks | python | def test_ap_beacon_rate_legacy2(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 8796093022208) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', '120')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', )
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() |
def test_ap_beacon_rate_ht(dev, apdev):
'Open AP with Beacon frame TX rate HT-MCS 0'
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 17592186044416) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'ht:0')
hapd.enable()
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='2412')
time.sleep(0.5) | 860,116,091,604,281,300 | Open AP with Beacon frame TX rate HT-MCS 0 | tests/hwsim/test_ap_params.py | test_ap_beacon_rate_ht | AreedAhmed/fragattacks | python | def test_ap_beacon_rate_ht(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 17592186044416) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'ht:0')
hapd.enable()
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='2412')
time.sleep(0.5) |
def test_ap_beacon_rate_ht2(dev, apdev):
'Open AP with Beacon frame TX rate HT-MCS 1 in VHT BSS'
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 17592186044416) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'ht:1')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', '')
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() | -3,207,896,841,398,671,400 | Open AP with Beacon frame TX rate HT-MCS 1 in VHT BSS | tests/hwsim/test_ap_params.py | test_ap_beacon_rate_ht2 | AreedAhmed/fragattacks | python | def test_ap_beacon_rate_ht2(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 17592186044416) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'ht:1')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', )
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() |
def test_ap_beacon_rate_vht(dev, apdev):
'Open AP with Beacon frame TX rate VHT-MCS 0'
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 35184372088832) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'vht:0')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', '')
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() | -1,072,627,460,875,605,400 | Open AP with Beacon frame TX rate VHT-MCS 0 | tests/hwsim/test_ap_params.py | test_ap_beacon_rate_vht | AreedAhmed/fragattacks | python | def test_ap_beacon_rate_vht(dev, apdev):
hapd = hostapd.add_ap(apdev[0], {'ssid': 'beacon-rate'})
res = hapd.get_driver_status_field('capa.flags')
if ((int(res, 0) & 35184372088832) == 0):
raise HwsimSkip('Setting Beacon frame TX rate not supported')
hapd.disable()
hapd.set('beacon_rate', 'vht:0')
hapd.set('country_code', 'DE')
hapd.set('hw_mode', 'a')
hapd.set('channel', '36')
hapd.set('ieee80211n', '1')
hapd.set('ieee80211ac', '1')
hapd.set('ht_capab', '[HT40+]')
hapd.set('vht_capab', )
hapd.set('vht_oper_chwidth', '0')
hapd.set('vht_oper_centr_freq_seg0_idx', '0')
try:
hapd.enable()
dev[0].scan_for_bss(hapd.own_addr(), freq='5180')
dev[0].connect('beacon-rate', key_mgmt='NONE', scan_freq='5180')
time.sleep(0.5)
finally:
dev[0].request('DISCONNECT')
hapd.request('DISABLE')
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() |
def test_ap_wep_to_wpa(dev, apdev):
'WEP to WPA2-PSK configuration change in hostapd'
check_wep_capa(dev[0])
hapd = hostapd.add_ap(apdev[0], {'ssid': 'wep-to-wpa', 'wep_key0': '"hello"'})
dev[0].flush_scan_cache()
dev[0].connect('wep-to-wpa', key_mgmt='NONE', wep_key0='"hello"', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].request('DISCONNECT')
dev[0].wait_disconnected()
hapd.disable()
hapd.set('wep_key0', '')
hapd.set('wpa_passphrase', '12345678')
hapd.set('wpa', '2')
hapd.set('wpa_key_mgmt', 'WPA-PSK')
hapd.set('rsn_pairwise', 'CCMP')
hapd.enable()
dev[0].connect('wep-to-wpa', psk='12345678', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) | -851,790,213,543,807,200 | WEP to WPA2-PSK configuration change in hostapd | tests/hwsim/test_ap_params.py | test_ap_wep_to_wpa | AreedAhmed/fragattacks | python | def test_ap_wep_to_wpa(dev, apdev):
check_wep_capa(dev[0])
hapd = hostapd.add_ap(apdev[0], {'ssid': 'wep-to-wpa', 'wep_key0': '"hello"'})
dev[0].flush_scan_cache()
dev[0].connect('wep-to-wpa', key_mgmt='NONE', wep_key0='"hello"', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd)
dev[0].request('DISCONNECT')
dev[0].wait_disconnected()
hapd.disable()
hapd.set('wep_key0', )
hapd.set('wpa_passphrase', '12345678')
hapd.set('wpa', '2')
hapd.set('wpa_key_mgmt', 'WPA-PSK')
hapd.set('rsn_pairwise', 'CCMP')
hapd.enable()
dev[0].connect('wep-to-wpa', psk='12345678', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) |
def test_ap_missing_psk(dev, apdev):
'WPA2-PSK AP and no PSK configured'
ssid = 'test-wpa2-psk'
params = hostapd.wpa2_params(ssid=ssid)
try:
hostapd.add_ap(apdev[0], params)
raise Exception('AP setup succeeded unexpectedly')
except Exception as e:
if ('Failed to enable hostapd' in str(e)):
pass
else:
raise | 4,701,002,200,531,703,000 | WPA2-PSK AP and no PSK configured | tests/hwsim/test_ap_params.py | test_ap_missing_psk | AreedAhmed/fragattacks | python | def test_ap_missing_psk(dev, apdev):
ssid = 'test-wpa2-psk'
params = hostapd.wpa2_params(ssid=ssid)
try:
hostapd.add_ap(apdev[0], params)
raise Exception('AP setup succeeded unexpectedly')
except Exception as e:
if ('Failed to enable hostapd' in str(e)):
pass
else:
raise |
def test_ap_eapol_version(dev, apdev):
'hostapd eapol_version configuration'
passphrase = 'asdfghjkl'
params = hostapd.wpa2_params(ssid='test1', passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
params = hostapd.wpa2_params(ssid='test2', passphrase=passphrase)
params['eapol_version'] = '1'
hapd2 = hostapd.add_ap(apdev[1], params)
hapd.request('SET ext_eapol_frame_io 1')
dev[0].connect('test1', psk=passphrase, scan_freq='2412', wait_connect=False)
ev1 = hapd.wait_event(['EAPOL-TX'], timeout=15)
if (ev1 is None):
raise Exception('Timeout on EAPOL-TX from hostapd')
hapd.request('SET ext_eapol_frame_io 0')
hapd2.request('SET ext_eapol_frame_io 1')
dev[1].connect('test2', psk=passphrase, scan_freq='2412', wait_connect=False)
ev2 = hapd2.wait_event(['EAPOL-TX'], timeout=15)
if (ev2 is None):
raise Exception('Timeout on EAPOL-TX from hostapd')
hapd2.request('SET ext_eapol_frame_io 0')
dev[0].wait_connected()
dev[1].wait_connected()
ver1 = ev1.split(' ')[2][0:2]
ver2 = ev2.split(' ')[2][0:2]
if (ver1 != '02'):
raise Exception(('Unexpected default eapol_version: ' + ver1))
if (ver2 != '01'):
raise Exception(('eapol_version did not match configuration: ' + ver2)) | -2,448,627,823,356,065,300 | hostapd eapol_version configuration | tests/hwsim/test_ap_params.py | test_ap_eapol_version | AreedAhmed/fragattacks | python | def test_ap_eapol_version(dev, apdev):
passphrase = 'asdfghjkl'
params = hostapd.wpa2_params(ssid='test1', passphrase=passphrase)
hapd = hostapd.add_ap(apdev[0], params)
params = hostapd.wpa2_params(ssid='test2', passphrase=passphrase)
params['eapol_version'] = '1'
hapd2 = hostapd.add_ap(apdev[1], params)
hapd.request('SET ext_eapol_frame_io 1')
dev[0].connect('test1', psk=passphrase, scan_freq='2412', wait_connect=False)
ev1 = hapd.wait_event(['EAPOL-TX'], timeout=15)
if (ev1 is None):
raise Exception('Timeout on EAPOL-TX from hostapd')
hapd.request('SET ext_eapol_frame_io 0')
hapd2.request('SET ext_eapol_frame_io 1')
dev[1].connect('test2', psk=passphrase, scan_freq='2412', wait_connect=False)
ev2 = hapd2.wait_event(['EAPOL-TX'], timeout=15)
if (ev2 is None):
raise Exception('Timeout on EAPOL-TX from hostapd')
hapd2.request('SET ext_eapol_frame_io 0')
dev[0].wait_connected()
dev[1].wait_connected()
ver1 = ev1.split(' ')[2][0:2]
ver2 = ev2.split(' ')[2][0:2]
if (ver1 != '02'):
raise Exception(('Unexpected default eapol_version: ' + ver1))
if (ver2 != '01'):
raise Exception(('eapol_version did not match configuration: ' + ver2)) |
def test_ap_dtim_period(dev, apdev):
'DTIM period configuration'
ssid = 'dtim-period'
params = {'ssid': ssid, 'dtim_period': '10'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
for i in range(10):
dev[0].scan(freq='2412')
bss = dev[0].get_bss(bssid)
if ('beacon_ie' in bss):
break
time.sleep(0.2)
if ('beacon_ie' not in bss):
raise Exception('Did not find Beacon IEs')
ie = parse_ie(bss['beacon_ie'])
if (5 not in ie):
raise Exception('TIM element missing')
(count, period) = struct.unpack('BB', ie[5][0:2])
logger.info(('DTIM count %d DTIM period %d' % (count, period)))
if (period != 10):
raise Exception(('Unexpected DTIM period: %d' % period))
if (count >= period):
raise Exception(('Unexpected DTIM count: %d' % count)) | -8,895,648,275,307,081,000 | DTIM period configuration | tests/hwsim/test_ap_params.py | test_ap_dtim_period | AreedAhmed/fragattacks | python | def test_ap_dtim_period(dev, apdev):
ssid = 'dtim-period'
params = {'ssid': ssid, 'dtim_period': '10'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
for i in range(10):
dev[0].scan(freq='2412')
bss = dev[0].get_bss(bssid)
if ('beacon_ie' in bss):
break
time.sleep(0.2)
if ('beacon_ie' not in bss):
raise Exception('Did not find Beacon IEs')
ie = parse_ie(bss['beacon_ie'])
if (5 not in ie):
raise Exception('TIM element missing')
(count, period) = struct.unpack('BB', ie[5][0:2])
logger.info(('DTIM count %d DTIM period %d' % (count, period)))
if (period != 10):
raise Exception(('Unexpected DTIM period: %d' % period))
if (count >= period):
raise Exception(('Unexpected DTIM count: %d' % count)) |
def test_ap_no_probe_resp(dev, apdev):
'AP with Probe Response frame sending from hostapd disabled'
ssid = 'no-probe-resp'
params = {'ssid': ssid, 'send_probe_response': '0'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412', passive=True)
dev[0].scan_for_bss(bssid, freq='2412', force_scan=True)
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
bss = dev[0].get_bss(bssid)
if (('ie' in bss) and ('beacon_ie' in bss) and (len(bss['ie']) != len(bss['beacon_ie']))):
raise Exception('Probe Response frames seen') | -2,416,089,279,393,881,000 | AP with Probe Response frame sending from hostapd disabled | tests/hwsim/test_ap_params.py | test_ap_no_probe_resp | AreedAhmed/fragattacks | python | def test_ap_no_probe_resp(dev, apdev):
ssid = 'no-probe-resp'
params = {'ssid': ssid, 'send_probe_response': '0'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412', passive=True)
dev[0].scan_for_bss(bssid, freq='2412', force_scan=True)
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
bss = dev[0].get_bss(bssid)
if (('ie' in bss) and ('beacon_ie' in bss) and (len(bss['ie']) != len(bss['beacon_ie']))):
raise Exception('Probe Response frames seen') |
def test_ap_long_preamble(dev, apdev):
'AP with long preamble'
ssid = 'long-preamble'
params = {'ssid': ssid, 'preamble': '0', 'hw_mode': 'b', 'ieee80211n': '0', 'supported_rates': '10', 'basic_rates': '10'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) | 4,794,612,974,865,863,000 | AP with long preamble | tests/hwsim/test_ap_params.py | test_ap_long_preamble | AreedAhmed/fragattacks | python | def test_ap_long_preamble(dev, apdev):
ssid = 'long-preamble'
params = {'ssid': ssid, 'preamble': '0', 'hw_mode': 'b', 'ieee80211n': '0', 'supported_rates': '10', 'basic_rates': '10'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) |
def test_ap_wmm_uapsd(dev, apdev):
'AP with U-APSD advertisement'
ssid = 'uapsd'
params = {'ssid': ssid, 'uapsd_advertisement_enabled': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) | 4,158,757,356,695,964,700 | AP with U-APSD advertisement | tests/hwsim/test_ap_params.py | test_ap_wmm_uapsd | AreedAhmed/fragattacks | python | def test_ap_wmm_uapsd(dev, apdev):
ssid = 'uapsd'
params = {'ssid': ssid, 'uapsd_advertisement_enabled': '1'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) |
def test_ap_wowlan_triggers(dev, apdev):
'AP with wowlan_triggers'
ssid = 'wowlan'
params = {'ssid': ssid, 'wowlan_triggers': 'any'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) | -517,504,297,163,085,200 | AP with wowlan_triggers | tests/hwsim/test_ap_params.py | test_ap_wowlan_triggers | AreedAhmed/fragattacks | python | def test_ap_wowlan_triggers(dev, apdev):
ssid = 'wowlan'
params = {'ssid': ssid, 'wowlan_triggers': 'any'}
hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr()
dev[0].scan_for_bss(bssid, freq='2412')
dev[0].connect(ssid, key_mgmt='NONE', scan_freq='2412')
hwsim_utils.test_connectivity(dev[0], hapd) |
def ui_getgroup_discovery_auth(self, auth_attr):
"\n This is the backend method for getting discovery_auth attributes.\n @param auth_attr: The auth attribute to get the value of.\n @type auth_attr: str\n @return: The auth attribute's value\n @rtype: str\n "
if (auth_attr == 'enable'):
return self.rtsnode.discovery_enable_auth
else:
return getattr(self.rtsnode, ('discovery_' + auth_attr)) | -428,389,979,132,026,600 | This is the backend method for getting discovery_auth attributes.
@param auth_attr: The auth attribute to get the value of.
@type auth_attr: str
@return: The auth attribute's value
@rtype: str | targetcli/ui_target.py | ui_getgroup_discovery_auth | JonnyJD/targetcli | python | def ui_getgroup_discovery_auth(self, auth_attr):
"\n This is the backend method for getting discovery_auth attributes.\n @param auth_attr: The auth attribute to get the value of.\n @type auth_attr: str\n @return: The auth attribute's value\n @rtype: str\n "
if (auth_attr == 'enable'):
return self.rtsnode.discovery_enable_auth
else:
return getattr(self.rtsnode, ('discovery_' + auth_attr)) |
def ui_setgroup_discovery_auth(self, auth_attr, value):
"\n This is the backend method for setting discovery auth attributes.\n @param auth_attr: The auth attribute to set the value of.\n @type auth_attr: str\n @param value: The auth's value\n @type value: str\n "
self.assert_root()
if (value is None):
value = ''
if (auth_attr == 'enable'):
self.rtsnode.discovery_enable_auth = value
else:
setattr(self.rtsnode, ('discovery_' + auth_attr), value) | 2,033,422,283,248,719,400 | This is the backend method for setting discovery auth attributes.
@param auth_attr: The auth attribute to set the value of.
@type auth_attr: str
@param value: The auth's value
@type value: str | targetcli/ui_target.py | ui_setgroup_discovery_auth | JonnyJD/targetcli | python | def ui_setgroup_discovery_auth(self, auth_attr, value):
"\n This is the backend method for setting discovery auth attributes.\n @param auth_attr: The auth attribute to set the value of.\n @type auth_attr: str\n @param value: The auth's value\n @type value: str\n "
self.assert_root()
if (value is None):
value =
if (auth_attr == 'enable'):
self.rtsnode.discovery_enable_auth = value
else:
setattr(self.rtsnode, ('discovery_' + auth_attr), value) |
def ui_command_create(self, wwn=None):
'\n Creates a new target. The I{wwn} format depends on the transport(s)\n supported by the fabric module. If the I{wwn} is ommited, then a\n target will be created using either a randomly generated WWN of the\n proper type, or the first unused WWN in the list of possible WWNs if\n one is available. If WWNs are constrained to a list (i.e. for hardware\n targets addresses) and all WWNs are in use, the target creation will\n fail. Use the B{info} command to get more information abour WWN type\n and possible values.\n\n SEE ALSO\n ========\n B{info}\n '
self.assert_root()
target = Target(self.rtsnode, wwn, mode='create')
wwn = target.wwn
if target.has_feature('tpgts'):
ui_target = UIMultiTPGTarget(target, self)
self.shell.log.info(('Created target %s.' % wwn))
return ui_target.ui_command_create()
else:
ui_target = UITarget(target, self)
self.shell.log.info(('Created target %s.' % wwn))
return self.new_node(ui_target) | -8,167,071,948,282,582,000 | Creates a new target. The I{wwn} format depends on the transport(s)
supported by the fabric module. If the I{wwn} is ommited, then a
target will be created using either a randomly generated WWN of the
proper type, or the first unused WWN in the list of possible WWNs if
one is available. If WWNs are constrained to a list (i.e. for hardware
targets addresses) and all WWNs are in use, the target creation will
fail. Use the B{info} command to get more information abour WWN type
and possible values.
SEE ALSO
========
B{info} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, wwn=None):
'\n Creates a new target. The I{wwn} format depends on the transport(s)\n supported by the fabric module. If the I{wwn} is ommited, then a\n target will be created using either a randomly generated WWN of the\n proper type, or the first unused WWN in the list of possible WWNs if\n one is available. If WWNs are constrained to a list (i.e. for hardware\n targets addresses) and all WWNs are in use, the target creation will\n fail. Use the B{info} command to get more information abour WWN type\n and possible values.\n\n SEE ALSO\n ========\n B{info}\n '
self.assert_root()
target = Target(self.rtsnode, wwn, mode='create')
wwn = target.wwn
if target.has_feature('tpgts'):
ui_target = UIMultiTPGTarget(target, self)
self.shell.log.info(('Created target %s.' % wwn))
return ui_target.ui_command_create()
else:
ui_target = UITarget(target, self)
self.shell.log.info(('Created target %s.' % wwn))
return self.new_node(ui_target) |
def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if ((current_param == 'wwn') and (self.rtsnode.wwns is not None)):
existing_wwns = [child.wwn for child in self.rtsnode.targets]
completions = [wwn for wwn in self.rtsnode.wwns if wwn.startswith(text) if (wwn not in existing_wwns)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -4,366,552,901,151,617,500 | Parameter auto-completion method for user command create.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_create | JonnyJD/targetcli | python | def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if ((current_param == 'wwn') and (self.rtsnode.wwns is not None)):
existing_wwns = [child.wwn for child in self.rtsnode.targets]
completions = [wwn for wwn in self.rtsnode.wwns if wwn.startswith(text) if (wwn not in existing_wwns)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_delete(self, wwn):
'\n Recursively deletes the target with the specified I{wwn}, and all\n objects hanging under it.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
target = Target(self.rtsnode, wwn, mode='lookup')
target.delete()
self.shell.log.info(('Deleted Target %s.' % wwn))
self.refresh() | 1,548,543,410,676,903,700 | Recursively deletes the target with the specified I{wwn}, and all
objects hanging under it.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, wwn):
'\n Recursively deletes the target with the specified I{wwn}, and all\n objects hanging under it.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
target = Target(self.rtsnode, wwn, mode='lookup')
target.delete()
self.shell.log.info(('Deleted Target %s.' % wwn))
self.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn'):
wwns = [child.name for child in self.children]
completions = [wwn for wwn in wwns if wwn.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -2,530,395,537,950,787,000 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn'):
wwns = [child.name for child in self.children]
completions = [wwn for wwn in wwns if wwn.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_info(self):
'\n Displays information about the fabric module, notably the supported\n transports(s) and accepted B{wwn} format(s), as long as supported\n features.\n '
fabric = self.rtsnode
self.shell.log.info(('Fabric module name: %s' % self.name))
self.shell.log.info(('ConfigFS path: %s' % self.rtsnode.path))
self.shell.log.info(('Allowed WWN types: %s' % ', '.join(fabric.wwn_types)))
if (fabric.wwns is not None):
self.shell.log.info(('Allowed WWNs list: %s' % ', '.join(fabric.wwns)))
self.shell.log.info(('Fabric module features: %s' % ', '.join(fabric.features)))
self.shell.log.info(('Corresponding kernel module: %s' % fabric.kernel_module)) | -745,181,533,260,759,200 | Displays information about the fabric module, notably the supported
transports(s) and accepted B{wwn} format(s), as long as supported
features. | targetcli/ui_target.py | ui_command_info | JonnyJD/targetcli | python | def ui_command_info(self):
'\n Displays information about the fabric module, notably the supported\n transports(s) and accepted B{wwn} format(s), as long as supported\n features.\n '
fabric = self.rtsnode
self.shell.log.info(('Fabric module name: %s' % self.name))
self.shell.log.info(('ConfigFS path: %s' % self.rtsnode.path))
self.shell.log.info(('Allowed WWN types: %s' % ', '.join(fabric.wwn_types)))
if (fabric.wwns is not None):
self.shell.log.info(('Allowed WWNs list: %s' % ', '.join(fabric.wwns)))
self.shell.log.info(('Fabric module features: %s' % ', '.join(fabric.features)))
self.shell.log.info(('Corresponding kernel module: %s' % fabric.kernel_module)) |
def ui_command_version(self):
'\n Displays the target fabric module version.\n '
version = ('Target fabric module %s: %s' % (self.rtsnode.name, self.rtsnode.version))
self.shell.con.display(version.strip()) | -6,436,868,984,167,109,000 | Displays the target fabric module version. | targetcli/ui_target.py | ui_command_version | JonnyJD/targetcli | python | def ui_command_version(self):
'\n \n '
version = ('Target fabric module %s: %s' % (self.rtsnode.name, self.rtsnode.version))
self.shell.con.display(version.strip()) |
def ui_command_create(self, tag=None):
'\n Creates a new Target Portal Group within the target. The I{tag} must be\n a strictly positive integer value. If omitted, the next available\n Target Portal Group Tag (TPGT) will be used.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
tpg = TPG(self.rtsnode, tag, mode='create')
if self.shell.prefs['auto_enable_tpgt']:
tpg.enable = True
if tpg.has_feature('auth'):
tpg.set_attribute('authentication', 0)
self.shell.log.info(('Created TPG %s.' % tpg.tag))
ui_tpg = UITPG(tpg, self)
return self.new_node(ui_tpg) | 708,355,341,026,810,200 | Creates a new Target Portal Group within the target. The I{tag} must be
a strictly positive integer value. If omitted, the next available
Target Portal Group Tag (TPGT) will be used.
SEE ALSO
========
B{delete} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, tag=None):
'\n Creates a new Target Portal Group within the target. The I{tag} must be\n a strictly positive integer value. If omitted, the next available\n Target Portal Group Tag (TPGT) will be used.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
tpg = TPG(self.rtsnode, tag, mode='create')
if self.shell.prefs['auto_enable_tpgt']:
tpg.enable = True
if tpg.has_feature('auth'):
tpg.set_attribute('authentication', 0)
self.shell.log.info(('Created TPG %s.' % tpg.tag))
ui_tpg = UITPG(tpg, self)
return self.new_node(ui_tpg) |
def ui_command_delete(self, tag):
'\n Deletes the Target Portal Group with TPGT I{tag} from the target. The\n I{tag} must be a positive integer matching an existing TPGT.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
if tag.startswith('tpg'):
tag = tag[3:]
tpg = TPG(self.rtsnode, int(tag), mode='lookup')
tpg.delete()
self.shell.log.info(('Deleted TPGT %s.' % tag))
self.refresh() | -3,500,856,850,928,905,700 | Deletes the Target Portal Group with TPGT I{tag} from the target. The
I{tag} must be a positive integer matching an existing TPGT.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, tag):
'\n Deletes the Target Portal Group with TPGT I{tag} from the target. The\n I{tag} must be a positive integer matching an existing TPGT.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
if tag.startswith('tpg'):
tag = tag[3:]
tpg = TPG(self.rtsnode, int(tag), mode='lookup')
tpg.delete()
self.shell.log.info(('Deleted TPGT %s.' % tag))
self.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'tag'):
tags = [child.name[4:] for child in self.children]
completions = [tag for tag in tags if tag.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -8,931,737,022,832,035,000 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'tag'):
tags = [child.name[4:] for child in self.children]
completions = [tag for tag in tags if tag.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_enable(self):
'\n Enables the TPG.\n\n SEE ALSO\n ========\n B{disable status}\n '
self.assert_root()
if self.rtsnode.enable:
self.shell.log.info('The TPGT is already enabled.')
else:
try:
self.rtsnode.enable = True
self.shell.log.info('The TPGT has been enabled.')
except:
self.shell.log.error('The TPGT could not be enabled.') | -7,627,088,746,327,111,000 | Enables the TPG.
SEE ALSO
========
B{disable status} | targetcli/ui_target.py | ui_command_enable | JonnyJD/targetcli | python | def ui_command_enable(self):
'\n Enables the TPG.\n\n SEE ALSO\n ========\n B{disable status}\n '
self.assert_root()
if self.rtsnode.enable:
self.shell.log.info('The TPGT is already enabled.')
else:
try:
self.rtsnode.enable = True
self.shell.log.info('The TPGT has been enabled.')
except:
self.shell.log.error('The TPGT could not be enabled.') |
def ui_command_disable(self):
'\n Disables the TPG.\n\n SEE ALSO\n ========\n B{enable status}\n '
self.assert_root()
if self.rtsnode.enable:
self.rtsnode.enable = False
self.shell.log.info('The TPGT has been disabled.')
else:
self.shell.log.info('The TPGT is already disabled.') | -1,396,484,538,751,393,500 | Disables the TPG.
SEE ALSO
========
B{enable status} | targetcli/ui_target.py | ui_command_disable | JonnyJD/targetcli | python | def ui_command_disable(self):
'\n Disables the TPG.\n\n SEE ALSO\n ========\n B{enable status}\n '
self.assert_root()
if self.rtsnode.enable:
self.rtsnode.enable = False
self.shell.log.info('The TPGT has been disabled.')
else:
self.shell.log.info('The TPGT is already disabled.') |
def ui_command_create(self, wwn, add_mapped_luns=None):
"\n Creates a Node ACL for the initiator node with the specified I{wwn}.\n The node's I{wwn} must match the expected WWN Type of the target's\n fabric module.\n\n If I{add_mapped_luns} is omitted, the global parameter\n B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n accepted. If B{true}, then after creating the ACL, mapped LUNs will be\n automatically created for all existing LUNs.\n\n SEE ALSO\n ========\n B{delete}\n "
self.assert_root()
add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
node_acl = NodeACL(self.tpg, wwn, mode='create')
ui_node_acl = UINodeACL(node_acl.node_wwn, self)
self.shell.log.info(('Created Node ACL for %s' % node_acl.node_wwn))
if add_mapped_luns:
for lun in self.tpg.luns:
MappedLUN(node_acl, lun.lun, lun.lun, write_protect=False)
self.shell.log.info(('Created mapped LUN %d.' % lun.lun))
self.refresh()
return self.new_node(ui_node_acl) | -869,287,265,829,643,100 | Creates a Node ACL for the initiator node with the specified I{wwn}.
The node's I{wwn} must match the expected WWN Type of the target's
fabric module.
If I{add_mapped_luns} is omitted, the global parameter
B{auto_add_mapped_luns} will be used, else B{true} or B{false} are
accepted. If B{true}, then after creating the ACL, mapped LUNs will be
automatically created for all existing LUNs.
SEE ALSO
========
B{delete} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, wwn, add_mapped_luns=None):
"\n Creates a Node ACL for the initiator node with the specified I{wwn}.\n The node's I{wwn} must match the expected WWN Type of the target's\n fabric module.\n\n If I{add_mapped_luns} is omitted, the global parameter\n B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n accepted. If B{true}, then after creating the ACL, mapped LUNs will be\n automatically created for all existing LUNs.\n\n SEE ALSO\n ========\n B{delete}\n "
self.assert_root()
add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
node_acl = NodeACL(self.tpg, wwn, mode='create')
ui_node_acl = UINodeACL(node_acl.node_wwn, self)
self.shell.log.info(('Created Node ACL for %s' % node_acl.node_wwn))
if add_mapped_luns:
for lun in self.tpg.luns:
MappedLUN(node_acl, lun.lun, lun.lun, write_protect=False)
self.shell.log.info(('Created mapped LUN %d.' % lun.lun))
self.refresh()
return self.new_node(ui_node_acl) |
def ui_command_delete(self, wwn):
'\n Deletes the Node ACL with the specified I{wwn}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
node_acl = NodeACL(self.tpg, wwn, mode='lookup')
node_acl.delete()
self.shell.log.info(('Deleted Node ACL %s.' % wwn))
self.refresh() | -2,510,247,993,732,344,300 | Deletes the Node ACL with the specified I{wwn}.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, wwn):
'\n Deletes the Node ACL with the specified I{wwn}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
node_acl = NodeACL(self.tpg, wwn, mode='lookup')
node_acl.delete()
self.shell.log.info(('Deleted Node ACL %s.' % wwn))
self.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn'):
wwns = [acl.node_wwn for acl in self.tpg.node_acls]
completions = [wwn for wwn in wwns if wwn.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | 7,596,755,099,753,558,000 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn'):
wwns = [acl.node_wwn for acl in self.tpg.node_acls]
completions = [wwn for wwn in wwns if wwn.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_tag(self, wwn_or_tag, new_tag):
"\n Tag a NodeACL.\n\n Usage: tag <wwn_or_tag> <new_tag>\n\n Tags help manage initiator WWNs. A tag can apply to one or\n more WWNs. This can give a more meaningful name to a single\n initiator's configuration, or allow multiple initiators with\n identical settings to be configured en masse.\n\n The WWNs described by <wwn_or_tag> will be given the new\n tag. If new_tag already exists, its new members will adopt the\n current tag's configuration.\n\n Within a tag, the 'info' command shows the WWNs the tag applies to.\n\n Use 'untag' to remove tags.\n\n NOTE: tags are only supported in kernel 3.8 and above.\n "
if (wwn_or_tag == new_tag):
return
if ('.' in new_tag):
self.shell.log.error("'.' not permitted in tag names.")
return
src = list(self.find_tagged(wwn_or_tag))
if (not src):
self.shell.log.error(('wwn_or_tag %s not found.' % wwn_or_tag))
return
old_tag_members = list(self.find_tagged(new_tag))
src_wwns = [na.node_wwn for na in src]
old_tag_members = [old for old in old_tag_members if (old.node_wwn not in src_wwns)]
for na in src:
na.tag = new_tag
if old_tag_members:
model = old_tag_members[0]
for mlun in na.mapped_luns:
mlun.delete()
for mlun in model.mapped_luns:
MappedLUN(na, mlun.mapped_lun, mlun.tpg_lun, mlun.write_protect)
if self.parent.rtsnode.has_feature('auth'):
for param in auth_params:
setattr(na, ('chap_' + param), getattr(model, ('chap_' + param)))
for item in model.list_attributes(writable=True):
na.set_attribute(item, model.get_attribute(item))
for item in model.list_parameters(writable=True):
na.set_parameter(item, model.get_parameter(item))
self.refresh() | -7,903,740,075,520,124,000 | Tag a NodeACL.
Usage: tag <wwn_or_tag> <new_tag>
Tags help manage initiator WWNs. A tag can apply to one or
more WWNs. This can give a more meaningful name to a single
initiator's configuration, or allow multiple initiators with
identical settings to be configured en masse.
The WWNs described by <wwn_or_tag> will be given the new
tag. If new_tag already exists, its new members will adopt the
current tag's configuration.
Within a tag, the 'info' command shows the WWNs the tag applies to.
Use 'untag' to remove tags.
NOTE: tags are only supported in kernel 3.8 and above. | targetcli/ui_target.py | ui_command_tag | JonnyJD/targetcli | python | def ui_command_tag(self, wwn_or_tag, new_tag):
"\n Tag a NodeACL.\n\n Usage: tag <wwn_or_tag> <new_tag>\n\n Tags help manage initiator WWNs. A tag can apply to one or\n more WWNs. This can give a more meaningful name to a single\n initiator's configuration, or allow multiple initiators with\n identical settings to be configured en masse.\n\n The WWNs described by <wwn_or_tag> will be given the new\n tag. If new_tag already exists, its new members will adopt the\n current tag's configuration.\n\n Within a tag, the 'info' command shows the WWNs the tag applies to.\n\n Use 'untag' to remove tags.\n\n NOTE: tags are only supported in kernel 3.8 and above.\n "
if (wwn_or_tag == new_tag):
return
if ('.' in new_tag):
self.shell.log.error("'.' not permitted in tag names.")
return
src = list(self.find_tagged(wwn_or_tag))
if (not src):
self.shell.log.error(('wwn_or_tag %s not found.' % wwn_or_tag))
return
old_tag_members = list(self.find_tagged(new_tag))
src_wwns = [na.node_wwn for na in src]
old_tag_members = [old for old in old_tag_members if (old.node_wwn not in src_wwns)]
for na in src:
na.tag = new_tag
if old_tag_members:
model = old_tag_members[0]
for mlun in na.mapped_luns:
mlun.delete()
for mlun in model.mapped_luns:
MappedLUN(na, mlun.mapped_lun, mlun.tpg_lun, mlun.write_protect)
if self.parent.rtsnode.has_feature('auth'):
for param in auth_params:
setattr(na, ('chap_' + param), getattr(model, ('chap_' + param)))
for item in model.list_attributes(writable=True):
na.set_attribute(item, model.get_attribute(item))
for item in model.list_parameters(writable=True):
na.set_parameter(item, model.get_parameter(item))
self.refresh() |
def ui_command_untag(self, wwn_or_tag):
'\n Untag a NodeACL.\n\n Usage: untag <tag>\n\n Remove the tag given to one or more initiator WWNs. They will\n return to being displayed by WWN in the configuration tree, and\n will maintain settings from when they were tagged.\n '
for na in list(self.find_tagged(wwn_or_tag)):
na.tag = None
self.refresh() | -465,505,140,759,942,900 | Untag a NodeACL.
Usage: untag <tag>
Remove the tag given to one or more initiator WWNs. They will
return to being displayed by WWN in the configuration tree, and
will maintain settings from when they were tagged. | targetcli/ui_target.py | ui_command_untag | JonnyJD/targetcli | python | def ui_command_untag(self, wwn_or_tag):
'\n Untag a NodeACL.\n\n Usage: untag <tag>\n\n Remove the tag given to one or more initiator WWNs. They will\n return to being displayed by WWN in the configuration tree, and\n will maintain settings from when they were tagged.\n '
for na in list(self.find_tagged(wwn_or_tag)):
na.tag = None
self.refresh() |
def ui_complete_tag(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command tag\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn_or_tag'):
completions = [n for n in self.all_names() if n.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | 8,104,764,837,451,866,000 | Parameter auto-completion method for user command tag
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_tag | JonnyJD/targetcli | python | def ui_complete_tag(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command tag\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'wwn_or_tag'):
completions = [n for n in self.all_names() if n.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_getgroup_auth(self, auth_attr):
"\n This is the backend method for getting auths attributes.\n @param auth_attr: The auth attribute to get the value of.\n @type auth_attr: str\n @return: The auth attribute's value\n @rtype: str\n "
return getattr(self.rtsnodes[0], ('chap_' + auth_attr)) | -4,589,136,002,350,191,000 | This is the backend method for getting auths attributes.
@param auth_attr: The auth attribute to get the value of.
@type auth_attr: str
@return: The auth attribute's value
@rtype: str | targetcli/ui_target.py | ui_getgroup_auth | JonnyJD/targetcli | python | def ui_getgroup_auth(self, auth_attr):
"\n This is the backend method for getting auths attributes.\n @param auth_attr: The auth attribute to get the value of.\n @type auth_attr: str\n @return: The auth attribute's value\n @rtype: str\n "
return getattr(self.rtsnodes[0], ('chap_' + auth_attr)) |
def ui_setgroup_auth(self, auth_attr, value):
"\n This is the backend method for setting auths attributes.\n @param auth_attr: The auth attribute to set the value of.\n @type auth_attr: str\n @param value: The auth's value\n @type value: str\n "
self.assert_root()
if (value is None):
value = ''
for na in self.rtsnodes:
setattr(na, ('chap_' + auth_attr), value) | 8,853,643,272,738,521,000 | This is the backend method for setting auths attributes.
@param auth_attr: The auth attribute to set the value of.
@type auth_attr: str
@param value: The auth's value
@type value: str | targetcli/ui_target.py | ui_setgroup_auth | JonnyJD/targetcli | python | def ui_setgroup_auth(self, auth_attr, value):
"\n This is the backend method for setting auths attributes.\n @param auth_attr: The auth attribute to set the value of.\n @type auth_attr: str\n @param value: The auth's value\n @type value: str\n "
self.assert_root()
if (value is None):
value =
for na in self.rtsnodes:
setattr(na, ('chap_' + auth_attr), value) |
def ui_command_create(self, mapped_lun, tpg_lun_or_backstore, write_protect=None):
'\n Creates a mapping to one of the TPG LUNs for the initiator referenced\n by the ACL. The provided I{tpg_lun_or_backstore} will appear to that\n initiator as LUN I{mapped_lun}. If the I{write_protect} flag is set to\n B{1}, the initiator will not have write access to the Mapped LUN.\n\n A storage object may also be given for the I{tpg_lun_or_backstore} parameter,\n in which case the TPG LUN will be created for that backstore before\n mapping the LUN to the initiator. If a TPG LUN for the backstore already\n exists, the Mapped LUN will map to that TPG LUN.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
try:
mapped_lun = int(mapped_lun)
except ValueError:
self.shell.log.error('mapped_lun must be an integer')
return
try:
if tpg_lun_or_backstore.startswith('lun'):
tpg_lun_or_backstore = tpg_lun_or_backstore[3:]
tpg_lun = int(tpg_lun_or_backstore)
except ValueError:
try:
so = self.get_node(tpg_lun_or_backstore).rtsnode
except ValueError:
self.shell.log.error('LUN or storage object not found')
return
ui_tpg = self.parent.parent
for lun in ui_tpg.rtsnode.luns:
if (so == lun.storage_object):
tpg_lun = lun.lun
break
else:
lun_object = LUN(ui_tpg.rtsnode, storage_object=so)
self.shell.log.info(('Created LUN %s.' % lun_object.lun))
ui_lun = UILUN(lun_object, ui_tpg.get_node('luns'))
tpg_lun = ui_lun.rtsnode.lun
if (tpg_lun in (ml.tpg_lun.lun for ml in self.rtsnodes[0].mapped_luns)):
self.shell.log.warning(('Warning: TPG LUN %d already mapped to this NodeACL' % tpg_lun))
for na in self.rtsnodes:
mlun = MappedLUN(na, mapped_lun, tpg_lun, write_protect)
ui_mlun = UIMappedLUN(mlun, self)
self.shell.log.info(('Created Mapped LUN %s.' % mlun.mapped_lun))
return self.new_node(ui_mlun) | 4,118,147,091,507,668,000 | Creates a mapping to one of the TPG LUNs for the initiator referenced
by the ACL. The provided I{tpg_lun_or_backstore} will appear to that
initiator as LUN I{mapped_lun}. If the I{write_protect} flag is set to
B{1}, the initiator will not have write access to the Mapped LUN.
A storage object may also be given for the I{tpg_lun_or_backstore} parameter,
in which case the TPG LUN will be created for that backstore before
mapping the LUN to the initiator. If a TPG LUN for the backstore already
exists, the Mapped LUN will map to that TPG LUN.
SEE ALSO
========
B{delete} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, mapped_lun, tpg_lun_or_backstore, write_protect=None):
'\n Creates a mapping to one of the TPG LUNs for the initiator referenced\n by the ACL. The provided I{tpg_lun_or_backstore} will appear to that\n initiator as LUN I{mapped_lun}. If the I{write_protect} flag is set to\n B{1}, the initiator will not have write access to the Mapped LUN.\n\n A storage object may also be given for the I{tpg_lun_or_backstore} parameter,\n in which case the TPG LUN will be created for that backstore before\n mapping the LUN to the initiator. If a TPG LUN for the backstore already\n exists, the Mapped LUN will map to that TPG LUN.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
try:
mapped_lun = int(mapped_lun)
except ValueError:
self.shell.log.error('mapped_lun must be an integer')
return
try:
if tpg_lun_or_backstore.startswith('lun'):
tpg_lun_or_backstore = tpg_lun_or_backstore[3:]
tpg_lun = int(tpg_lun_or_backstore)
except ValueError:
try:
so = self.get_node(tpg_lun_or_backstore).rtsnode
except ValueError:
self.shell.log.error('LUN or storage object not found')
return
ui_tpg = self.parent.parent
for lun in ui_tpg.rtsnode.luns:
if (so == lun.storage_object):
tpg_lun = lun.lun
break
else:
lun_object = LUN(ui_tpg.rtsnode, storage_object=so)
self.shell.log.info(('Created LUN %s.' % lun_object.lun))
ui_lun = UILUN(lun_object, ui_tpg.get_node('luns'))
tpg_lun = ui_lun.rtsnode.lun
if (tpg_lun in (ml.tpg_lun.lun for ml in self.rtsnodes[0].mapped_luns)):
self.shell.log.warning(('Warning: TPG LUN %d already mapped to this NodeACL' % tpg_lun))
for na in self.rtsnodes:
mlun = MappedLUN(na, mapped_lun, tpg_lun, write_protect)
ui_mlun = UIMappedLUN(mlun, self)
self.shell.log.info(('Created Mapped LUN %s.' % mlun.mapped_lun))
return self.new_node(ui_mlun) |
def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'tpg_lun_or_backstore'):
completions = []
for backstore in self.get_node('/backstores').children:
for storage_object in backstore.children:
completions.append(storage_object.path)
completions.extend((lun.name for lun in self.parent.parent.get_node('luns').children))
completions = [c for c in completions if c.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -8,400,418,617,958,182,000 | Parameter auto-completion method for user command create.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_create | JonnyJD/targetcli | python | def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'tpg_lun_or_backstore'):
completions = []
for backstore in self.get_node('/backstores').children:
for storage_object in backstore.children:
completions.append(storage_object.path)
completions.extend((lun.name for lun in self.parent.parent.get_node('luns').children))
completions = [c for c in completions if c.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_delete(self, mapped_lun):
'\n Deletes the specified I{mapped_lun}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
for na in self.rtsnodes:
mlun = MappedLUN(na, mapped_lun)
mlun.delete()
self.shell.log.info(('Deleted Mapped LUN %s.' % mapped_lun))
self.refresh() | -4,413,366,055,445,287,000 | Deletes the specified I{mapped_lun}.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, mapped_lun):
'\n Deletes the specified I{mapped_lun}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
for na in self.rtsnodes:
mlun = MappedLUN(na, mapped_lun)
mlun.delete()
self.shell.log.info(('Deleted Mapped LUN %s.' % mapped_lun))
self.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'mapped_lun'):
mluns = [str(mlun.mapped_lun) for mlun in self.rtsnodes[0].mapped_luns]
completions = [mlun for mlun in mluns if mlun.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | 3,590,268,007,504,116,700 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'mapped_lun'):
mluns = [str(mlun.mapped_lun) for mlun in self.rtsnodes[0].mapped_luns]
completions = [mlun for mlun in mluns if mlun.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_info(self):
"\n Since we don't have a self.rtsnode we can't use the base implementation\n of this method. We also want to not print node_wwn, but list *all*\n wwns for this entry.\n "
info = self.rtsnodes[0].dump()
for item in ('attributes', 'parameters', 'node_wwn'):
if (item in info):
del info[item]
for (name, value) in sorted(info.iteritems()):
if (not isinstance(value, (dict, list))):
self.shell.log.info(('%s: %s' % (name, value)))
self.shell.log.info('wwns:')
for na in self.parent.find_tagged(self.name):
self.shell.log.info(na.node_wwn) | -6,148,042,047,004,151,000 | Since we don't have a self.rtsnode we can't use the base implementation
of this method. We also want to not print node_wwn, but list *all*
wwns for this entry. | targetcli/ui_target.py | ui_command_info | JonnyJD/targetcli | python | def ui_command_info(self):
"\n Since we don't have a self.rtsnode we can't use the base implementation\n of this method. We also want to not print node_wwn, but list *all*\n wwns for this entry.\n "
info = self.rtsnodes[0].dump()
for item in ('attributes', 'parameters', 'node_wwn'):
if (item in info):
del info[item]
for (name, value) in sorted(info.iteritems()):
if (not isinstance(value, (dict, list))):
self.shell.log.info(('%s: %s' % (name, value)))
self.shell.log.info('wwns:')
for na in self.parent.find_tagged(self.name):
self.shell.log.info(na.node_wwn) |
def ui_command_create(self, storage_object, lun=None, add_mapped_luns=None):
'\n Creates a new LUN in the Target Portal Group, attached to a storage\n object. If the I{lun} parameter is omitted, the first available LUN in\n the TPG will be used. If present, it must be a number greater than 0.\n Alternatively, the syntax I{lunX} where I{X} is a positive number is\n also accepted.\n\n The I{storage_object} must be the path of an existing storage object,\n i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage\n object of the virtual HBA B{pscsi0}.\n\n If I{add_mapped_luns} is omitted, the global parameter\n B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n accepted. If B{true}, then after creating the LUN, mapped LUNs will be\n automatically created for all existing node ACLs, mapping the new LUN.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
try:
so = self.get_node(storage_object).rtsnode
except ValueError:
self.shell.log.error(('Invalid storage object %s.' % storage_object))
return
if (so in (l.storage_object for l in self.parent.rtsnode.luns)):
raise ExecutionError(('lun for storage object %s already exists' % storage_object))
if (lun and lun.lower().startswith('lun')):
lun = lun[3:]
lun_object = LUN(self.tpg, lun, so)
self.shell.log.info(('Created LUN %s.' % lun_object.lun))
ui_lun = UILUN(lun_object, self)
if add_mapped_luns:
for acl in self.tpg.node_acls:
if lun:
mapped_lun = lun
else:
mapped_lun = 0
existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns]
if (mapped_lun in existing_mluns):
mapped_lun = None
for possible_mlun in xrange(LUN.MAX_LUN):
if (possible_mlun not in existing_mluns):
mapped_lun = possible_mlun
break
if (mapped_lun == None):
self.shell.log.warning(('Cannot map new lun %s into ACL %s' % (lun_object.lun, acl.node_wwn)))
else:
mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False)
self.shell.log.info(('Created LUN %d->%d mapping in node ACL %s' % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)))
self.parent.refresh()
return self.new_node(ui_lun) | 3,469,891,210,186,383,000 | Creates a new LUN in the Target Portal Group, attached to a storage
object. If the I{lun} parameter is omitted, the first available LUN in
the TPG will be used. If present, it must be a number greater than 0.
Alternatively, the syntax I{lunX} where I{X} is a positive number is
also accepted.
The I{storage_object} must be the path of an existing storage object,
i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage
object of the virtual HBA B{pscsi0}.
If I{add_mapped_luns} is omitted, the global parameter
B{auto_add_mapped_luns} will be used, else B{true} or B{false} are
accepted. If B{true}, then after creating the LUN, mapped LUNs will be
automatically created for all existing node ACLs, mapping the new LUN.
SEE ALSO
========
B{delete} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, storage_object, lun=None, add_mapped_luns=None):
'\n Creates a new LUN in the Target Portal Group, attached to a storage\n object. If the I{lun} parameter is omitted, the first available LUN in\n the TPG will be used. If present, it must be a number greater than 0.\n Alternatively, the syntax I{lunX} where I{X} is a positive number is\n also accepted.\n\n The I{storage_object} must be the path of an existing storage object,\n i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage\n object of the virtual HBA B{pscsi0}.\n\n If I{add_mapped_luns} is omitted, the global parameter\n B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n accepted. If B{true}, then after creating the LUN, mapped LUNs will be\n automatically created for all existing node ACLs, mapping the new LUN.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
try:
so = self.get_node(storage_object).rtsnode
except ValueError:
self.shell.log.error(('Invalid storage object %s.' % storage_object))
return
if (so in (l.storage_object for l in self.parent.rtsnode.luns)):
raise ExecutionError(('lun for storage object %s already exists' % storage_object))
if (lun and lun.lower().startswith('lun')):
lun = lun[3:]
lun_object = LUN(self.tpg, lun, so)
self.shell.log.info(('Created LUN %s.' % lun_object.lun))
ui_lun = UILUN(lun_object, self)
if add_mapped_luns:
for acl in self.tpg.node_acls:
if lun:
mapped_lun = lun
else:
mapped_lun = 0
existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns]
if (mapped_lun in existing_mluns):
mapped_lun = None
for possible_mlun in xrange(LUN.MAX_LUN):
if (possible_mlun not in existing_mluns):
mapped_lun = possible_mlun
break
if (mapped_lun == None):
self.shell.log.warning(('Cannot map new lun %s into ACL %s' % (lun_object.lun, acl.node_wwn)))
else:
mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False)
self.shell.log.info(('Created LUN %d->%d mapping in node ACL %s' % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)))
self.parent.refresh()
return self.new_node(ui_lun) |
def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'storage_object'):
storage_objects = []
for backstore in self.get_node('/backstores').children:
for storage_object in backstore.children:
storage_objects.append(storage_object.path)
completions = [so for so in storage_objects if so.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | 1,159,211,410,238,183,400 | Parameter auto-completion method for user command create.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_create | JonnyJD/targetcli | python | def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'storage_object'):
storage_objects = []
for backstore in self.get_node('/backstores').children:
for storage_object in backstore.children:
storage_objects.append(storage_object.path)
completions = [so for so in storage_objects if so.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_delete(self, lun):
'\n Deletes the supplied LUN from the Target Portal Group. The I{lun} must\n be a positive number matching an existing LUN.\n\n Alternatively, the syntax I{lunX} where I{X} is a positive number is\n also accepted.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
if lun.lower().startswith('lun'):
lun = lun[3:]
try:
lun_object = LUN(self.tpg, lun)
except:
raise RTSLibError('Invalid LUN')
lun_object.delete()
self.shell.log.info(('Deleted LUN %s.' % lun))
self.parent.refresh() | -2,440,860,537,880,900,000 | Deletes the supplied LUN from the Target Portal Group. The I{lun} must
be a positive number matching an existing LUN.
Alternatively, the syntax I{lunX} where I{X} is a positive number is
also accepted.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, lun):
'\n Deletes the supplied LUN from the Target Portal Group. The I{lun} must\n be a positive number matching an existing LUN.\n\n Alternatively, the syntax I{lunX} where I{X} is a positive number is\n also accepted.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
if lun.lower().startswith('lun'):
lun = lun[3:]
try:
lun_object = LUN(self.tpg, lun)
except:
raise RTSLibError('Invalid LUN')
lun_object.delete()
self.shell.log.info(('Deleted LUN %s.' % lun))
self.parent.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'lun'):
luns = [str(lun.lun) for lun in self.tpg.luns]
completions = [lun for lun in luns if lun.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -4,566,488,228,194,943,500 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
if (current_param == 'lun'):
luns = [str(lun.lun) for lun in self.tpg.luns]
completions = [lun for lun in luns if lun.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def _canonicalize_ip(self, ip_address):
'\n rtslib expects ipv4 addresses as a dotted-quad string, and IPv6\n addresses surrounded by brackets.\n '
if ('.' in ip_address):
return ip_address
return (('[' + ip_address) + ']') | 8,775,318,467,225,478,000 | rtslib expects ipv4 addresses as a dotted-quad string, and IPv6
addresses surrounded by brackets. | targetcli/ui_target.py | _canonicalize_ip | JonnyJD/targetcli | python | def _canonicalize_ip(self, ip_address):
'\n rtslib expects ipv4 addresses as a dotted-quad string, and IPv6\n addresses surrounded by brackets.\n '
if ('.' in ip_address):
return ip_address
return (('[' + ip_address) + ']') |
def ui_command_create(self, ip_address=None, ip_port=None):
'\n Creates a Network Portal with specified I{ip_address} and\n I{ip_port}. If I{ip_port} is omitted, the default port for\n the target fabric will be used. If I{ip_address} is omitted,\n INADDR_ANY (0.0.0.0) will be used.\n\n Choosing IN6ADDR_ANY (::0) will listen on all IPv6 interfaces\n as well as IPv4, assuming IPV6_V6ONLY sockopt has not been\n set.\n\n Note: Portals on Link-local IPv6 addresses are currently not\n supported.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
ip_port = self.ui_eval_param(ip_port, 'number', 3260)
ip_address = self.ui_eval_param(ip_address, 'string', '0.0.0.0')
if (ip_port == 3260):
self.shell.log.info(('Using default IP port %d' % ip_port))
if (ip_address == '0.0.0.0'):
self.shell.log.info('Binding to INADDR_ANY (0.0.0.0)')
portal = NetworkPortal(self.tpg, self._canonicalize_ip(ip_address), ip_port, mode='create')
self.shell.log.info(('Created network portal %s:%d.' % (ip_address, ip_port)))
ui_portal = UIPortal(portal, self)
return self.new_node(ui_portal) | -2,108,989,325,025,310,200 | Creates a Network Portal with specified I{ip_address} and
I{ip_port}. If I{ip_port} is omitted, the default port for
the target fabric will be used. If I{ip_address} is omitted,
INADDR_ANY (0.0.0.0) will be used.
Choosing IN6ADDR_ANY (::0) will listen on all IPv6 interfaces
as well as IPv4, assuming IPV6_V6ONLY sockopt has not been
set.
Note: Portals on Link-local IPv6 addresses are currently not
supported.
SEE ALSO
========
B{delete} | targetcli/ui_target.py | ui_command_create | JonnyJD/targetcli | python | def ui_command_create(self, ip_address=None, ip_port=None):
'\n Creates a Network Portal with specified I{ip_address} and\n I{ip_port}. If I{ip_port} is omitted, the default port for\n the target fabric will be used. If I{ip_address} is omitted,\n INADDR_ANY (0.0.0.0) will be used.\n\n Choosing IN6ADDR_ANY (::0) will listen on all IPv6 interfaces\n as well as IPv4, assuming IPV6_V6ONLY sockopt has not been\n set.\n\n Note: Portals on Link-local IPv6 addresses are currently not\n supported.\n\n SEE ALSO\n ========\n B{delete}\n '
self.assert_root()
ip_port = self.ui_eval_param(ip_port, 'number', 3260)
ip_address = self.ui_eval_param(ip_address, 'string', '0.0.0.0')
if (ip_port == 3260):
self.shell.log.info(('Using default IP port %d' % ip_port))
if (ip_address == '0.0.0.0'):
self.shell.log.info('Binding to INADDR_ANY (0.0.0.0)')
portal = NetworkPortal(self.tpg, self._canonicalize_ip(ip_address), ip_port, mode='create')
self.shell.log.info(('Created network portal %s:%d.' % (ip_address, ip_port)))
ui_portal = UIPortal(portal, self)
return self.new_node(ui_portal) |
def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
def list_eth_ips():
if (not ethtool):
return []
devcfgs = ethtool.get_interfaces_info(ethtool.get_devices())
addrs = set()
for d in devcfgs:
if d.ipv4_address:
addrs.add(d.ipv4_address)
addrs.add('0.0.0.0')
for ip6 in d.get_ipv6_addresses():
addrs.add(ip6.address)
addrs.add('::0')
return sorted(addrs)
if (current_param == 'ip_address'):
completions = [addr for addr in list_eth_ips() if addr.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | -8,283,435,244,329,514,000 | Parameter auto-completion method for user command create.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_create | JonnyJD/targetcli | python | def ui_complete_create(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command create.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
def list_eth_ips():
if (not ethtool):
return []
devcfgs = ethtool.get_interfaces_info(ethtool.get_devices())
addrs = set()
for d in devcfgs:
if d.ipv4_address:
addrs.add(d.ipv4_address)
addrs.add('0.0.0.0')
for ip6 in d.get_ipv6_addresses():
addrs.add(ip6.address)
addrs.add('::0')
return sorted(addrs)
if (current_param == 'ip_address'):
completions = [addr for addr in list_eth_ips() if addr.startswith(text)]
else:
completions = []
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_delete(self, ip_address, ip_port):
'\n Deletes the Network Portal with specified I{ip_address} and I{ip_port}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
portal = NetworkPortal(self.tpg, self._canonicalize_ip(ip_address), ip_port, mode='lookup')
portal.delete()
self.shell.log.info(('Deleted network portal %s:%s' % (ip_address, ip_port)))
self.refresh() | -8,962,729,779,088,687,000 | Deletes the Network Portal with specified I{ip_address} and I{ip_port}.
SEE ALSO
========
B{create} | targetcli/ui_target.py | ui_command_delete | JonnyJD/targetcli | python | def ui_command_delete(self, ip_address, ip_port):
'\n Deletes the Network Portal with specified I{ip_address} and I{ip_port}.\n\n SEE ALSO\n ========\n B{create}\n '
self.assert_root()
portal = NetworkPortal(self.tpg, self._canonicalize_ip(ip_address), ip_port, mode='lookup')
portal.delete()
self.shell.log.info(('Deleted network portal %s:%s' % (ip_address, ip_port)))
self.refresh() |
def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
completions = []
portals = {}
all_ports = set([])
for portal in self.tpg.network_portals:
all_ports.add(str(portal.port))
portal_ip = portal.ip_address.strip('[]')
if (not (portal_ip in portals)):
portals[portal_ip] = []
portals[portal_ip].append(str(portal.port))
if (current_param == 'ip_address'):
completions = [addr for addr in portals if addr.startswith(text)]
if ('ip_port' in parameters):
port = parameters['ip_port']
completions = [addr for addr in completions if (port in portals[addr])]
elif (current_param == 'ip_port'):
if ('ip_address' in parameters):
addr = parameters['ip_address']
if (addr in portals):
completions = [port for port in portals[addr] if port.startswith(text)]
else:
completions = [port for port in all_ports if port.startswith(text)]
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions | 7,385,780,887,844,157,000 | Parameter auto-completion method for user command delete.
@param parameters: Parameters on the command line.
@type parameters: dict
@param text: Current text of parameter being typed by the user.
@type text: str
@param current_param: Name of parameter to complete.
@type current_param: str
@return: Possible completions
@rtype: list of str | targetcli/ui_target.py | ui_complete_delete | JonnyJD/targetcli | python | def ui_complete_delete(self, parameters, text, current_param):
'\n Parameter auto-completion method for user command delete.\n @param parameters: Parameters on the command line.\n @type parameters: dict\n @param text: Current text of parameter being typed by the user.\n @type text: str\n @param current_param: Name of parameter to complete.\n @type current_param: str\n @return: Possible completions\n @rtype: list of str\n '
completions = []
portals = {}
all_ports = set([])
for portal in self.tpg.network_portals:
all_ports.add(str(portal.port))
portal_ip = portal.ip_address.strip('[]')
if (not (portal_ip in portals)):
portals[portal_ip] = []
portals[portal_ip].append(str(portal.port))
if (current_param == 'ip_address'):
completions = [addr for addr in portals if addr.startswith(text)]
if ('ip_port' in parameters):
port = parameters['ip_port']
completions = [addr for addr in completions if (port in portals[addr])]
elif (current_param == 'ip_port'):
if ('ip_address' in parameters):
addr = parameters['ip_address']
if (addr in portals):
completions = [port for port in portals[addr] if port.startswith(text)]
else:
completions = [port for port in all_ports if port.startswith(text)]
if (len(completions) == 1):
return [(completions[0] + ' ')]
else:
return completions |
def ui_command_enable_iser(self, boolean):
'\n Enables or disables iSER for this NetworkPortal.\n\n If iSER is not supported by the kernel, this command will do nothing.\n '
boolean = self.ui_eval_param(boolean, 'bool', False)
self.rtsnode.iser = boolean
self.shell.log.info(('iSER enable now: %s' % self.rtsnode.iser)) | -4,840,049,299,673,736,000 | Enables or disables iSER for this NetworkPortal.
If iSER is not supported by the kernel, this command will do nothing. | targetcli/ui_target.py | ui_command_enable_iser | JonnyJD/targetcli | python | def ui_command_enable_iser(self, boolean):
'\n Enables or disables iSER for this NetworkPortal.\n\n If iSER is not supported by the kernel, this command will do nothing.\n '
boolean = self.ui_eval_param(boolean, 'bool', False)
self.rtsnode.iser = boolean
self.shell.log.info(('iSER enable now: %s' % self.rtsnode.iser)) |
def reset_maze():
'Resets any cells that are VISITED or PATH to EMPTY again, so that we\n can commence a search on a potentially partially completed board'
for col in range(COLS):
for row in range(ROWS):
grid[(col, row)] = (EMPTY if (grid[(col, row)] in [VISITED, PATH]) else grid[(col, row)]) | 6,756,376,070,153,066,000 | Resets any cells that are VISITED or PATH to EMPTY again, so that we
can commence a search on a potentially partially completed board | src/MazePy/MazePy/MazePy.py | reset_maze | James-P-D/Maze | python | def reset_maze():
'Resets any cells that are VISITED or PATH to EMPTY again, so that we\n can commence a search on a potentially partially completed board'
for col in range(COLS):
for row in range(ROWS):
grid[(col, row)] = (EMPTY if (grid[(col, row)] in [VISITED, PATH]) else grid[(col, row)]) |
def list_managed_cluster_admin_credentials(resource_group_name: Optional[str]=None, resource_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableListManagedClusterAdminCredentialsResult:
'\n The list of credential result response.\n\n\n :param str resource_group_name: The name of the resource group.\n :param str resource_name: The name of the managed cluster resource.\n '
__args__ = dict()
__args__['resourceGroupName'] = resource_group_name
__args__['resourceName'] = resource_name
if (opts is None):
opts = pulumi.InvokeOptions()
if (opts.version is None):
opts.version = _utilities.get_version()
__ret__ = pulumi.runtime.invoke('azure-native:containerservice/v20200301:listManagedClusterAdminCredentials', __args__, opts=opts, typ=ListManagedClusterAdminCredentialsResult).value
return AwaitableListManagedClusterAdminCredentialsResult(kubeconfigs=__ret__.kubeconfigs) | -3,990,908,143,610,687,000 | The list of credential result response.
:param str resource_group_name: The name of the resource group.
:param str resource_name: The name of the managed cluster resource. | sdk/python/pulumi_azure_native/containerservice/v20200301/list_managed_cluster_admin_credentials.py | list_managed_cluster_admin_credentials | pulumi-bot/pulumi-azure-native | python | def list_managed_cluster_admin_credentials(resource_group_name: Optional[str]=None, resource_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableListManagedClusterAdminCredentialsResult:
'\n The list of credential result response.\n\n\n :param str resource_group_name: The name of the resource group.\n :param str resource_name: The name of the managed cluster resource.\n '
__args__ = dict()
__args__['resourceGroupName'] = resource_group_name
__args__['resourceName'] = resource_name
if (opts is None):
opts = pulumi.InvokeOptions()
if (opts.version is None):
opts.version = _utilities.get_version()
__ret__ = pulumi.runtime.invoke('azure-native:containerservice/v20200301:listManagedClusterAdminCredentials', __args__, opts=opts, typ=ListManagedClusterAdminCredentialsResult).value
return AwaitableListManagedClusterAdminCredentialsResult(kubeconfigs=__ret__.kubeconfigs) |
@property
@pulumi.getter
def kubeconfigs(self) -> Sequence['outputs.CredentialResultResponseResult']:
'\n Base64-encoded Kubernetes configuration file.\n '
return pulumi.get(self, 'kubeconfigs') | -6,675,086,597,413,303,000 | Base64-encoded Kubernetes configuration file. | sdk/python/pulumi_azure_native/containerservice/v20200301/list_managed_cluster_admin_credentials.py | kubeconfigs | pulumi-bot/pulumi-azure-native | python | @property
@pulumi.getter
def kubeconfigs(self) -> Sequence['outputs.CredentialResultResponseResult']:
'\n \n '
return pulumi.get(self, 'kubeconfigs') |
def __init__(self, id=None):
'CreateFilepoolPolicyResponse - a model defined in Swagger'
self._id = None
self.discriminator = None
self.id = id | 3,684,511,779,427,807,000 | CreateFilepoolPolicyResponse - a model defined in Swagger | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | __init__ | Isilon/isilon_sdk_python | python | def __init__(self, id=None):
self._id = None
self.discriminator = None
self.id = id |
@property
def id(self):
'Gets the id of this CreateFilepoolPolicyResponse. # noqa: E501\n\n The name of the new policy # noqa: E501\n\n :return: The id of this CreateFilepoolPolicyResponse. # noqa: E501\n :rtype: str\n '
return self._id | 6,179,939,631,479,362,000 | Gets the id of this CreateFilepoolPolicyResponse. # noqa: E501
The name of the new policy # noqa: E501
:return: The id of this CreateFilepoolPolicyResponse. # noqa: E501
:rtype: str | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | id | Isilon/isilon_sdk_python | python | @property
def id(self):
'Gets the id of this CreateFilepoolPolicyResponse. # noqa: E501\n\n The name of the new policy # noqa: E501\n\n :return: The id of this CreateFilepoolPolicyResponse. # noqa: E501\n :rtype: str\n '
return self._id |
@id.setter
def id(self, id):
'Sets the id of this CreateFilepoolPolicyResponse.\n\n The name of the new policy # noqa: E501\n\n :param id: The id of this CreateFilepoolPolicyResponse. # noqa: E501\n :type: str\n '
if (id is None):
raise ValueError('Invalid value for `id`, must not be `None`')
self._id = id | -3,222,869,455,165,774,000 | Sets the id of this CreateFilepoolPolicyResponse.
The name of the new policy # noqa: E501
:param id: The id of this CreateFilepoolPolicyResponse. # noqa: E501
:type: str | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | id | Isilon/isilon_sdk_python | python | @id.setter
def id(self, id):
'Sets the id of this CreateFilepoolPolicyResponse.\n\n The name of the new policy # noqa: E501\n\n :param id: The id of this CreateFilepoolPolicyResponse. # noqa: E501\n :type: str\n '
if (id is None):
raise ValueError('Invalid value for `id`, must not be `None`')
self._id = id |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items()))
else:
result[attr] = value
return result | -2,772,352,302,133,010,000 | Returns the model properties as a dict | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | to_dict | Isilon/isilon_sdk_python | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map((lambda item: ((item[0], item[1].to_dict()) if hasattr(item[1], 'to_dict') else item)), value.items()))
else:
result[attr] = value
return result |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | to_str | Isilon/isilon_sdk_python | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | __repr__ | Isilon/isilon_sdk_python | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, CreateFilepoolPolicyResponse)):
return False
return (self.__dict__ == other.__dict__) | -165,149,286,153,699,040 | Returns true if both objects are equal | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | __eq__ | Isilon/isilon_sdk_python | python | def __eq__(self, other):
if (not isinstance(other, CreateFilepoolPolicyResponse)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | __ne__ | Isilon/isilon_sdk_python | python | def __ne__(self, other):
return (not (self == other)) |
def CloneCore(self, *args):
'\n CloneCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a clone (deep copy) of the specified System.Windows.Freezable using base \n\n (non-animated) property values.\n\n \n\n \n\n sourceFreezable: The object to clone.\n '
pass | -7,250,117,982,268,489,000 | CloneCore(self: Freezable,sourceFreezable: Freezable)
Makes the instance a clone (deep copy) of the specified System.Windows.Freezable using base
(non-animated) property values.
sourceFreezable: The object to clone. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | CloneCore | BCSharp/ironpython-stubs | python | def CloneCore(self, *args):
'\n CloneCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a clone (deep copy) of the specified System.Windows.Freezable using base \n\n (non-animated) property values.\n\n \n\n \n\n sourceFreezable: The object to clone.\n '
pass |
def CloneCurrentValueCore(self, *args):
'\n CloneCurrentValueCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a modifiable clone (deep copy) of the specified System.Windows.Freezable \n\n using current property values.\n\n \n\n \n\n sourceFreezable: The System.Windows.Freezable to be cloned.\n '
pass | 4,703,367,837,075,787,000 | CloneCurrentValueCore(self: Freezable,sourceFreezable: Freezable)
Makes the instance a modifiable clone (deep copy) of the specified System.Windows.Freezable
using current property values.
sourceFreezable: The System.Windows.Freezable to be cloned. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | CloneCurrentValueCore | BCSharp/ironpython-stubs | python | def CloneCurrentValueCore(self, *args):
'\n CloneCurrentValueCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a modifiable clone (deep copy) of the specified System.Windows.Freezable \n\n using current property values.\n\n \n\n \n\n sourceFreezable: The System.Windows.Freezable to be cloned.\n '
pass |
def CreateInstance(self, *args):
'\n CreateInstance(self: Freezable) -> Freezable\n\n \n\n Initializes a new instance of the System.Windows.Freezable class.\n\n Returns: The new instance.\n '
pass | 435,400,249,170,371,650 | CreateInstance(self: Freezable) -> Freezable
Initializes a new instance of the System.Windows.Freezable class.
Returns: The new instance. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | CreateInstance | BCSharp/ironpython-stubs | python | def CreateInstance(self, *args):
'\n CreateInstance(self: Freezable) -> Freezable\n\n \n\n Initializes a new instance of the System.Windows.Freezable class.\n\n Returns: The new instance.\n '
pass |
def CreateInstanceCore(self, *args):
'\n CreateInstanceCore(self: ElasticEase) -> Freezable\n\n \n\n Creates a new instance of the System.Windows.Freezable derived class. When creating a derived \n\n class,you must override this method.\n\n \n\n Returns: The new instance.\n '
pass | -554,420,358,212,224,600 | CreateInstanceCore(self: ElasticEase) -> Freezable
Creates a new instance of the System.Windows.Freezable derived class. When creating a derived
class,you must override this method.
Returns: The new instance. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | CreateInstanceCore | BCSharp/ironpython-stubs | python | def CreateInstanceCore(self, *args):
'\n CreateInstanceCore(self: ElasticEase) -> Freezable\n\n \n\n Creates a new instance of the System.Windows.Freezable derived class. When creating a derived \n\n class,you must override this method.\n\n \n\n Returns: The new instance.\n '
pass |
def EaseInCore(self, *args):
'\n EaseInCore(self: ElasticEase,normalizedTime: float) -> float\n\n \n\n Provides the logic portion of the easing function that you can override to produce the \n\n System.Windows.Media.Animation.EasingMode.EaseIn mode of the custom easing function.\n\n \n\n \n\n normalizedTime: Normalized time (progress) of the animation.\n\n Returns: A double that represents the transformed progress.\n '
pass | -185,526,622,460,867,800 | EaseInCore(self: ElasticEase,normalizedTime: float) -> float
Provides the logic portion of the easing function that you can override to produce the
System.Windows.Media.Animation.EasingMode.EaseIn mode of the custom easing function.
normalizedTime: Normalized time (progress) of the animation.
Returns: A double that represents the transformed progress. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | EaseInCore | BCSharp/ironpython-stubs | python | def EaseInCore(self, *args):
'\n EaseInCore(self: ElasticEase,normalizedTime: float) -> float\n\n \n\n Provides the logic portion of the easing function that you can override to produce the \n\n System.Windows.Media.Animation.EasingMode.EaseIn mode of the custom easing function.\n\n \n\n \n\n normalizedTime: Normalized time (progress) of the animation.\n\n Returns: A double that represents the transformed progress.\n '
pass |
def FreezeCore(self, *args):
'\n FreezeCore(self: Freezable,isChecking: bool) -> bool\n\n \n\n Makes the System.Windows.Freezable object unmodifiable or tests whether it can be made \n\n unmodifiable.\n\n \n\n \n\n isChecking: true to return an indication of whether the object can be frozen (without actually freezing it); \n\n false to actually freeze the object.\n\n \n\n Returns: If isChecking is true,this method returns true if the System.Windows.Freezable can be made \n\n unmodifiable,or false if it cannot be made unmodifiable. If isChecking is false,this method \n\n returns true if the if the specified System.Windows.Freezable is now unmodifiable,or false if \n\n it cannot be made unmodifiable.\n '
pass | -7,378,950,880,676,148,000 | FreezeCore(self: Freezable,isChecking: bool) -> bool
Makes the System.Windows.Freezable object unmodifiable or tests whether it can be made
unmodifiable.
isChecking: true to return an indication of whether the object can be frozen (without actually freezing it);
false to actually freeze the object.
Returns: If isChecking is true,this method returns true if the System.Windows.Freezable can be made
unmodifiable,or false if it cannot be made unmodifiable. If isChecking is false,this method
returns true if the if the specified System.Windows.Freezable is now unmodifiable,or false if
it cannot be made unmodifiable. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | FreezeCore | BCSharp/ironpython-stubs | python | def FreezeCore(self, *args):
'\n FreezeCore(self: Freezable,isChecking: bool) -> bool\n\n \n\n Makes the System.Windows.Freezable object unmodifiable or tests whether it can be made \n\n unmodifiable.\n\n \n\n \n\n isChecking: true to return an indication of whether the object can be frozen (without actually freezing it); \n\n false to actually freeze the object.\n\n \n\n Returns: If isChecking is true,this method returns true if the System.Windows.Freezable can be made \n\n unmodifiable,or false if it cannot be made unmodifiable. If isChecking is false,this method \n\n returns true if the if the specified System.Windows.Freezable is now unmodifiable,or false if \n\n it cannot be made unmodifiable.\n '
pass |
def GetAsFrozenCore(self, *args):
'\n GetAsFrozenCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a frozen clone of the specified System.Windows.Freezable using base \n\n (non-animated) property values.\n\n \n\n \n\n sourceFreezable: The instance to copy.\n '
pass | 7,686,788,764,447,632,000 | GetAsFrozenCore(self: Freezable,sourceFreezable: Freezable)
Makes the instance a frozen clone of the specified System.Windows.Freezable using base
(non-animated) property values.
sourceFreezable: The instance to copy. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | GetAsFrozenCore | BCSharp/ironpython-stubs | python | def GetAsFrozenCore(self, *args):
'\n GetAsFrozenCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the instance a frozen clone of the specified System.Windows.Freezable using base \n\n (non-animated) property values.\n\n \n\n \n\n sourceFreezable: The instance to copy.\n '
pass |
def GetCurrentValueAsFrozenCore(self, *args):
'\n GetCurrentValueAsFrozenCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the current instance a frozen clone of the specified System.Windows.Freezable. If the \n\n object has animated dependency properties,their current animated values are copied.\n\n \n\n \n\n sourceFreezable: The System.Windows.Freezable to copy and freeze.\n '
pass | -8,445,468,058,691,852,000 | GetCurrentValueAsFrozenCore(self: Freezable,sourceFreezable: Freezable)
Makes the current instance a frozen clone of the specified System.Windows.Freezable. If the
object has animated dependency properties,their current animated values are copied.
sourceFreezable: The System.Windows.Freezable to copy and freeze. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | GetCurrentValueAsFrozenCore | BCSharp/ironpython-stubs | python | def GetCurrentValueAsFrozenCore(self, *args):
'\n GetCurrentValueAsFrozenCore(self: Freezable,sourceFreezable: Freezable)\n\n Makes the current instance a frozen clone of the specified System.Windows.Freezable. If the \n\n object has animated dependency properties,their current animated values are copied.\n\n \n\n \n\n sourceFreezable: The System.Windows.Freezable to copy and freeze.\n '
pass |
def OnChanged(self, *args):
'\n OnChanged(self: Freezable)\n\n Called when the current System.Windows.Freezable object is modified.\n '
pass | -335,148,503,967,337,300 | OnChanged(self: Freezable)
Called when the current System.Windows.Freezable object is modified. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | OnChanged | BCSharp/ironpython-stubs | python | def OnChanged(self, *args):
'\n OnChanged(self: Freezable)\n\n Called when the current System.Windows.Freezable object is modified.\n '
pass |
def OnFreezablePropertyChanged(self, *args):
'\n OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject,property: DependencyProperty)\n\n This member supports the Windows Presentation Foundation (WPF) infrastructure and is not \n\n intended to be used directly from your code.\n\n \n\n \n\n oldValue: The previous value of the data member.\n\n newValue: The current value of the data member.\n\n property: The property that changed.\n\n OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject)\n\n Ensures that appropriate context pointers are established for a \n\n System.Windows.DependencyObjectType data member that has just been set.\n\n \n\n \n\n oldValue: The previous value of the data member.\n\n newValue: The current value of the data member.\n '
pass | -1,911,521,129,522,426,400 | OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject,property: DependencyProperty)
This member supports the Windows Presentation Foundation (WPF) infrastructure and is not
intended to be used directly from your code.
oldValue: The previous value of the data member.
newValue: The current value of the data member.
property: The property that changed.
OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject)
Ensures that appropriate context pointers are established for a
System.Windows.DependencyObjectType data member that has just been set.
oldValue: The previous value of the data member.
newValue: The current value of the data member. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | OnFreezablePropertyChanged | BCSharp/ironpython-stubs | python | def OnFreezablePropertyChanged(self, *args):
'\n OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject,property: DependencyProperty)\n\n This member supports the Windows Presentation Foundation (WPF) infrastructure and is not \n\n intended to be used directly from your code.\n\n \n\n \n\n oldValue: The previous value of the data member.\n\n newValue: The current value of the data member.\n\n property: The property that changed.\n\n OnFreezablePropertyChanged(self: Freezable,oldValue: DependencyObject,newValue: DependencyObject)\n\n Ensures that appropriate context pointers are established for a \n\n System.Windows.DependencyObjectType data member that has just been set.\n\n \n\n \n\n oldValue: The previous value of the data member.\n\n newValue: The current value of the data member.\n '
pass |
def OnPropertyChanged(self, *args):
'\n OnPropertyChanged(self: Freezable,e: DependencyPropertyChangedEventArgs)\n\n Overrides the System.Windows.DependencyObject implementation of \n\n System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventAr\n\n gs) to also invoke any System.Windows.Freezable.Changed handlers in response to a changing \n\n dependency property of type System.Windows.Freezable.\n\n \n\n \n\n e: Event data that contains information about which property changed,and its old and new values.\n '
pass | -1,558,016,768,189,584,400 | OnPropertyChanged(self: Freezable,e: DependencyPropertyChangedEventArgs)
Overrides the System.Windows.DependencyObject implementation of
System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventAr
gs) to also invoke any System.Windows.Freezable.Changed handlers in response to a changing
dependency property of type System.Windows.Freezable.
e: Event data that contains information about which property changed,and its old and new values. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | OnPropertyChanged | BCSharp/ironpython-stubs | python | def OnPropertyChanged(self, *args):
'\n OnPropertyChanged(self: Freezable,e: DependencyPropertyChangedEventArgs)\n\n Overrides the System.Windows.DependencyObject implementation of \n\n System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventAr\n\n gs) to also invoke any System.Windows.Freezable.Changed handlers in response to a changing \n\n dependency property of type System.Windows.Freezable.\n\n \n\n \n\n e: Event data that contains information about which property changed,and its old and new values.\n '
pass |
def ReadPreamble(self, *args):
'\n ReadPreamble(self: Freezable)\n\n Ensures that the System.Windows.Freezable is being accessed from a valid thread. Inheritors of \n\n System.Windows.Freezable must call this method at the beginning of any API that reads data \n\n members that are not dependency properties.\n '
pass | 6,114,302,746,442,280,000 | ReadPreamble(self: Freezable)
Ensures that the System.Windows.Freezable is being accessed from a valid thread. Inheritors of
System.Windows.Freezable must call this method at the beginning of any API that reads data
members that are not dependency properties. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | ReadPreamble | BCSharp/ironpython-stubs | python | def ReadPreamble(self, *args):
'\n ReadPreamble(self: Freezable)\n\n Ensures that the System.Windows.Freezable is being accessed from a valid thread. Inheritors of \n\n System.Windows.Freezable must call this method at the beginning of any API that reads data \n\n members that are not dependency properties.\n '
pass |
def ShouldSerializeProperty(self, *args):
'\n ShouldSerializeProperty(self: DependencyObject,dp: DependencyProperty) -> bool\n\n \n\n Returns a value that indicates whether serialization processes should serialize the value for \n\n the provided dependency property.\n\n \n\n \n\n dp: The identifier for the dependency property that should be serialized.\n\n Returns: true if the dependency property that is supplied should be value-serialized; otherwise,false.\n '
pass | 1,699,890,618,178,116,900 | ShouldSerializeProperty(self: DependencyObject,dp: DependencyProperty) -> bool
Returns a value that indicates whether serialization processes should serialize the value for
the provided dependency property.
dp: The identifier for the dependency property that should be serialized.
Returns: true if the dependency property that is supplied should be value-serialized; otherwise,false. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | ShouldSerializeProperty | BCSharp/ironpython-stubs | python | def ShouldSerializeProperty(self, *args):
'\n ShouldSerializeProperty(self: DependencyObject,dp: DependencyProperty) -> bool\n\n \n\n Returns a value that indicates whether serialization processes should serialize the value for \n\n the provided dependency property.\n\n \n\n \n\n dp: The identifier for the dependency property that should be serialized.\n\n Returns: true if the dependency property that is supplied should be value-serialized; otherwise,false.\n '
pass |
def WritePostscript(self, *args):
'\n WritePostscript(self: Freezable)\n\n Raises the System.Windows.Freezable.Changed event for the System.Windows.Freezable and invokes \n\n its System.Windows.Freezable.OnChanged method. Classes that derive from System.Windows.Freezable \n\n should call this method at the end of any API that modifies class members that are not stored as \n\n dependency properties.\n '
pass | -6,452,189,753,897,149,000 | WritePostscript(self: Freezable)
Raises the System.Windows.Freezable.Changed event for the System.Windows.Freezable and invokes
its System.Windows.Freezable.OnChanged method. Classes that derive from System.Windows.Freezable
should call this method at the end of any API that modifies class members that are not stored as
dependency properties. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | WritePostscript | BCSharp/ironpython-stubs | python | def WritePostscript(self, *args):
'\n WritePostscript(self: Freezable)\n\n Raises the System.Windows.Freezable.Changed event for the System.Windows.Freezable and invokes \n\n its System.Windows.Freezable.OnChanged method. Classes that derive from System.Windows.Freezable \n\n should call this method at the end of any API that modifies class members that are not stored as \n\n dependency properties.\n '
pass |
def WritePreamble(self, *args):
'\n WritePreamble(self: Freezable)\n\n Verifies that the System.Windows.Freezable is not frozen and that it is being accessed from a \n\n valid threading context. System.Windows.Freezable inheritors should call this method at the \n\n beginning of any API that writes to data members that are not dependency properties.\n '
pass | -5,041,179,406,798,103,000 | WritePreamble(self: Freezable)
Verifies that the System.Windows.Freezable is not frozen and that it is being accessed from a
valid threading context. System.Windows.Freezable inheritors should call this method at the
beginning of any API that writes to data members that are not dependency properties. | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | WritePreamble | BCSharp/ironpython-stubs | python | def WritePreamble(self, *args):
'\n WritePreamble(self: Freezable)\n\n Verifies that the System.Windows.Freezable is not frozen and that it is being accessed from a \n\n valid threading context. System.Windows.Freezable inheritors should call this method at the \n\n beginning of any API that writes to data members that are not dependency properties.\n '
pass |
def __init__(self, *args):
' x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature '
pass | -90,002,593,062,007,400 | x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | __init__ | BCSharp/ironpython-stubs | python | def __init__(self, *args):
' '
pass |
def dictfetchall(cursor: connection.cursor) -> List[Dict[(str, Any)]]:
'Returns all rows from a cursor as a dict'
desc = cursor.description
return [dict(zip((col[0] for col in desc), row)) for row in cursor.fetchall()] | 7,323,352,981,243,201,000 | Returns all rows from a cursor as a dict | analytics/views.py | dictfetchall | ArunSankarKs/zulip | python | def dictfetchall(cursor: connection.cursor) -> List[Dict[(str, Any)]]:
desc = cursor.description
return [dict(zip((col[0] for col in desc), row)) for row in cursor.fetchall()] |
def _create_clone_schema_function(self):
'\n Creates a postgres function `clone_schema` that copies a schema and its\n contents. Will replace any existing `clone_schema` functions owned by the\n `postgres` superuser.\n '
cursor = connection.cursor()
cursor.execute(CLONE_SCHEMA_FUNCTION)
cursor.close() | 7,416,902,549,030,459,000 | Creates a postgres function `clone_schema` that copies a schema and its
contents. Will replace any existing `clone_schema` functions owned by the
`postgres` superuser. | django_tenants/clone.py | _create_clone_schema_function | geekashu/django-tenants | python | def _create_clone_schema_function(self):
'\n Creates a postgres function `clone_schema` that copies a schema and its\n contents. Will replace any existing `clone_schema` functions owned by the\n `postgres` superuser.\n '
cursor = connection.cursor()
cursor.execute(CLONE_SCHEMA_FUNCTION)
cursor.close() |
def clone_schema(self, base_schema_name, new_schema_name):
'\n Creates a new schema `new_schema_name` as a clone of an existing schema\n `old_schema_name`.\n '
connection.set_schema_to_public()
cursor = connection.cursor()
try:
cursor.execute("SELECT 'clone_schema'::regproc")
except ProgrammingError:
self._create_clone_schema_function()
transaction.commit()
sql = 'SELECT clone_schema(%(base_schema)s, %(new_schema)s, TRUE)'
cursor.execute(sql, {'base_schema': base_schema_name, 'new_schema': new_schema_name})
cursor.close() | 8,490,984,310,061,625,000 | Creates a new schema `new_schema_name` as a clone of an existing schema
`old_schema_name`. | django_tenants/clone.py | clone_schema | geekashu/django-tenants | python | def clone_schema(self, base_schema_name, new_schema_name):
'\n Creates a new schema `new_schema_name` as a clone of an existing schema\n `old_schema_name`.\n '
connection.set_schema_to_public()
cursor = connection.cursor()
try:
cursor.execute("SELECT 'clone_schema'::regproc")
except ProgrammingError:
self._create_clone_schema_function()
transaction.commit()
sql = 'SELECT clone_schema(%(base_schema)s, %(new_schema)s, TRUE)'
cursor.execute(sql, {'base_schema': base_schema_name, 'new_schema': new_schema_name})
cursor.close() |
def __init__(self, breach_date=None, collection_date=None, description=None, disclosure_date=None, external_sources=None, internal_sources=None, name=None, record_count=None, victims=None, local_vars_configuration=None):
'CredentialSetSchemaData - a model defined in OpenAPI'
if (local_vars_configuration is None):
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_configuration
self._breach_date = None
self._collection_date = None
self._description = None
self._disclosure_date = None
self._external_sources = None
self._internal_sources = None
self._name = None
self._record_count = None
self._victims = None
self.discriminator = None
if (breach_date is not None):
self.breach_date = breach_date
if (collection_date is not None):
self.collection_date = collection_date
if (description is not None):
self.description = description
if (disclosure_date is not None):
self.disclosure_date = disclosure_date
if (external_sources is not None):
self.external_sources = external_sources
if (internal_sources is not None):
self.internal_sources = internal_sources
if (name is not None):
self.name = name
if (record_count is not None):
self.record_count = record_count
if (victims is not None):
self.victims = victims | -301,920,461,992,171,900 | CredentialSetSchemaData - a model defined in OpenAPI | titan_client/models/credential_set_schema_data.py | __init__ | intel471/titan-client-python | python | def __init__(self, breach_date=None, collection_date=None, description=None, disclosure_date=None, external_sources=None, internal_sources=None, name=None, record_count=None, victims=None, local_vars_configuration=None):
if (local_vars_configuration is None):
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_configuration
self._breach_date = None
self._collection_date = None
self._description = None
self._disclosure_date = None
self._external_sources = None
self._internal_sources = None
self._name = None
self._record_count = None
self._victims = None
self.discriminator = None
if (breach_date is not None):
self.breach_date = breach_date
if (collection_date is not None):
self.collection_date = collection_date
if (description is not None):
self.description = description
if (disclosure_date is not None):
self.disclosure_date = disclosure_date
if (external_sources is not None):
self.external_sources = external_sources
if (internal_sources is not None):
self.internal_sources = internal_sources
if (name is not None):
self.name = name
if (record_count is not None):
self.record_count = record_count
if (victims is not None):
self.victims = victims |
@property
def breach_date(self):
'Gets the breach_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of breach. # noqa: E501\n\n :return: The breach_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._breach_date | 377,846,609,730,880,300 | Gets the breach_date of this CredentialSetSchemaData. # noqa: E501
Date of breach. # noqa: E501
:return: The breach_date of this CredentialSetSchemaData. # noqa: E501
:rtype: int | titan_client/models/credential_set_schema_data.py | breach_date | intel471/titan-client-python | python | @property
def breach_date(self):
'Gets the breach_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of breach. # noqa: E501\n\n :return: The breach_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._breach_date |
@breach_date.setter
def breach_date(self, breach_date):
'Sets the breach_date of this CredentialSetSchemaData.\n\n Date of breach. # noqa: E501\n\n :param breach_date: The breach_date of this CredentialSetSchemaData. # noqa: E501\n :type breach_date: int\n '
self._breach_date = breach_date | 7,281,651,080,608,293,000 | Sets the breach_date of this CredentialSetSchemaData.
Date of breach. # noqa: E501
:param breach_date: The breach_date of this CredentialSetSchemaData. # noqa: E501
:type breach_date: int | titan_client/models/credential_set_schema_data.py | breach_date | intel471/titan-client-python | python | @breach_date.setter
def breach_date(self, breach_date):
'Sets the breach_date of this CredentialSetSchemaData.\n\n Date of breach. # noqa: E501\n\n :param breach_date: The breach_date of this CredentialSetSchemaData. # noqa: E501\n :type breach_date: int\n '
self._breach_date = breach_date |
@property
def collection_date(self):
'Gets the collection_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of collection. # noqa: E501\n\n :return: The collection_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._collection_date | 1,226,745,722,972,331,300 | Gets the collection_date of this CredentialSetSchemaData. # noqa: E501
Date of collection. # noqa: E501
:return: The collection_date of this CredentialSetSchemaData. # noqa: E501
:rtype: int | titan_client/models/credential_set_schema_data.py | collection_date | intel471/titan-client-python | python | @property
def collection_date(self):
'Gets the collection_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of collection. # noqa: E501\n\n :return: The collection_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._collection_date |
@collection_date.setter
def collection_date(self, collection_date):
'Sets the collection_date of this CredentialSetSchemaData.\n\n Date of collection. # noqa: E501\n\n :param collection_date: The collection_date of this CredentialSetSchemaData. # noqa: E501\n :type collection_date: int\n '
self._collection_date = collection_date | 778,422,300,070,670,700 | Sets the collection_date of this CredentialSetSchemaData.
Date of collection. # noqa: E501
:param collection_date: The collection_date of this CredentialSetSchemaData. # noqa: E501
:type collection_date: int | titan_client/models/credential_set_schema_data.py | collection_date | intel471/titan-client-python | python | @collection_date.setter
def collection_date(self, collection_date):
'Sets the collection_date of this CredentialSetSchemaData.\n\n Date of collection. # noqa: E501\n\n :param collection_date: The collection_date of this CredentialSetSchemaData. # noqa: E501\n :type collection_date: int\n '
self._collection_date = collection_date |
@property
def description(self):
'Gets the description of this CredentialSetSchemaData. # noqa: E501\n\n Description of the credential set. # noqa: E501\n\n :return: The description of this CredentialSetSchemaData. # noqa: E501\n :rtype: str\n '
return self._description | -6,017,834,775,243,082,000 | Gets the description of this CredentialSetSchemaData. # noqa: E501
Description of the credential set. # noqa: E501
:return: The description of this CredentialSetSchemaData. # noqa: E501
:rtype: str | titan_client/models/credential_set_schema_data.py | description | intel471/titan-client-python | python | @property
def description(self):
'Gets the description of this CredentialSetSchemaData. # noqa: E501\n\n Description of the credential set. # noqa: E501\n\n :return: The description of this CredentialSetSchemaData. # noqa: E501\n :rtype: str\n '
return self._description |
@description.setter
def description(self, description):
'Sets the description of this CredentialSetSchemaData.\n\n Description of the credential set. # noqa: E501\n\n :param description: The description of this CredentialSetSchemaData. # noqa: E501\n :type description: str\n '
self._description = description | 3,545,821,377,833,811,500 | Sets the description of this CredentialSetSchemaData.
Description of the credential set. # noqa: E501
:param description: The description of this CredentialSetSchemaData. # noqa: E501
:type description: str | titan_client/models/credential_set_schema_data.py | description | intel471/titan-client-python | python | @description.setter
def description(self, description):
'Sets the description of this CredentialSetSchemaData.\n\n Description of the credential set. # noqa: E501\n\n :param description: The description of this CredentialSetSchemaData. # noqa: E501\n :type description: str\n '
self._description = description |
@property
def disclosure_date(self):
'Gets the disclosure_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of disclosure. # noqa: E501\n\n :return: The disclosure_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._disclosure_date | 742,058,485,638,081,500 | Gets the disclosure_date of this CredentialSetSchemaData. # noqa: E501
Date of disclosure. # noqa: E501
:return: The disclosure_date of this CredentialSetSchemaData. # noqa: E501
:rtype: int | titan_client/models/credential_set_schema_data.py | disclosure_date | intel471/titan-client-python | python | @property
def disclosure_date(self):
'Gets the disclosure_date of this CredentialSetSchemaData. # noqa: E501\n\n Date of disclosure. # noqa: E501\n\n :return: The disclosure_date of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._disclosure_date |
@disclosure_date.setter
def disclosure_date(self, disclosure_date):
'Sets the disclosure_date of this CredentialSetSchemaData.\n\n Date of disclosure. # noqa: E501\n\n :param disclosure_date: The disclosure_date of this CredentialSetSchemaData. # noqa: E501\n :type disclosure_date: int\n '
self._disclosure_date = disclosure_date | -7,311,366,917,149,317,000 | Sets the disclosure_date of this CredentialSetSchemaData.
Date of disclosure. # noqa: E501
:param disclosure_date: The disclosure_date of this CredentialSetSchemaData. # noqa: E501
:type disclosure_date: int | titan_client/models/credential_set_schema_data.py | disclosure_date | intel471/titan-client-python | python | @disclosure_date.setter
def disclosure_date(self, disclosure_date):
'Sets the disclosure_date of this CredentialSetSchemaData.\n\n Date of disclosure. # noqa: E501\n\n :param disclosure_date: The disclosure_date of this CredentialSetSchemaData. # noqa: E501\n :type disclosure_date: int\n '
self._disclosure_date = disclosure_date |
@property
def external_sources(self):
'Gets the external_sources of this CredentialSetSchemaData. # noqa: E501\n\n List of external sources. # noqa: E501\n\n :return: The external_sources of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataExternalSources]\n '
return self._external_sources | -4,864,565,207,375,524,000 | Gets the external_sources of this CredentialSetSchemaData. # noqa: E501
List of external sources. # noqa: E501
:return: The external_sources of this CredentialSetSchemaData. # noqa: E501
:rtype: list[CredentialSetSchemaDataExternalSources] | titan_client/models/credential_set_schema_data.py | external_sources | intel471/titan-client-python | python | @property
def external_sources(self):
'Gets the external_sources of this CredentialSetSchemaData. # noqa: E501\n\n List of external sources. # noqa: E501\n\n :return: The external_sources of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataExternalSources]\n '
return self._external_sources |
@external_sources.setter
def external_sources(self, external_sources):
'Sets the external_sources of this CredentialSetSchemaData.\n\n List of external sources. # noqa: E501\n\n :param external_sources: The external_sources of this CredentialSetSchemaData. # noqa: E501\n :type external_sources: list[CredentialSetSchemaDataExternalSources]\n '
self._external_sources = external_sources | -1,229,045,151,979,290,400 | Sets the external_sources of this CredentialSetSchemaData.
List of external sources. # noqa: E501
:param external_sources: The external_sources of this CredentialSetSchemaData. # noqa: E501
:type external_sources: list[CredentialSetSchemaDataExternalSources] | titan_client/models/credential_set_schema_data.py | external_sources | intel471/titan-client-python | python | @external_sources.setter
def external_sources(self, external_sources):
'Sets the external_sources of this CredentialSetSchemaData.\n\n List of external sources. # noqa: E501\n\n :param external_sources: The external_sources of this CredentialSetSchemaData. # noqa: E501\n :type external_sources: list[CredentialSetSchemaDataExternalSources]\n '
self._external_sources = external_sources |
@property
def internal_sources(self):
'Gets the internal_sources of this CredentialSetSchemaData. # noqa: E501\n\n List of internal sources. # noqa: E501\n\n :return: The internal_sources of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataInternalSources]\n '
return self._internal_sources | 1,612,947,535,305,152,500 | Gets the internal_sources of this CredentialSetSchemaData. # noqa: E501
List of internal sources. # noqa: E501
:return: The internal_sources of this CredentialSetSchemaData. # noqa: E501
:rtype: list[CredentialSetSchemaDataInternalSources] | titan_client/models/credential_set_schema_data.py | internal_sources | intel471/titan-client-python | python | @property
def internal_sources(self):
'Gets the internal_sources of this CredentialSetSchemaData. # noqa: E501\n\n List of internal sources. # noqa: E501\n\n :return: The internal_sources of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataInternalSources]\n '
return self._internal_sources |
@internal_sources.setter
def internal_sources(self, internal_sources):
'Sets the internal_sources of this CredentialSetSchemaData.\n\n List of internal sources. # noqa: E501\n\n :param internal_sources: The internal_sources of this CredentialSetSchemaData. # noqa: E501\n :type internal_sources: list[CredentialSetSchemaDataInternalSources]\n '
self._internal_sources = internal_sources | -7,630,793,116,548,209,000 | Sets the internal_sources of this CredentialSetSchemaData.
List of internal sources. # noqa: E501
:param internal_sources: The internal_sources of this CredentialSetSchemaData. # noqa: E501
:type internal_sources: list[CredentialSetSchemaDataInternalSources] | titan_client/models/credential_set_schema_data.py | internal_sources | intel471/titan-client-python | python | @internal_sources.setter
def internal_sources(self, internal_sources):
'Sets the internal_sources of this CredentialSetSchemaData.\n\n List of internal sources. # noqa: E501\n\n :param internal_sources: The internal_sources of this CredentialSetSchemaData. # noqa: E501\n :type internal_sources: list[CredentialSetSchemaDataInternalSources]\n '
self._internal_sources = internal_sources |
@property
def name(self):
'Gets the name of this CredentialSetSchemaData. # noqa: E501\n\n Name of the credential set. # noqa: E501\n\n :return: The name of this CredentialSetSchemaData. # noqa: E501\n :rtype: str\n '
return self._name | 7,766,079,550,446,051,000 | Gets the name of this CredentialSetSchemaData. # noqa: E501
Name of the credential set. # noqa: E501
:return: The name of this CredentialSetSchemaData. # noqa: E501
:rtype: str | titan_client/models/credential_set_schema_data.py | name | intel471/titan-client-python | python | @property
def name(self):
'Gets the name of this CredentialSetSchemaData. # noqa: E501\n\n Name of the credential set. # noqa: E501\n\n :return: The name of this CredentialSetSchemaData. # noqa: E501\n :rtype: str\n '
return self._name |
@name.setter
def name(self, name):
'Sets the name of this CredentialSetSchemaData.\n\n Name of the credential set. # noqa: E501\n\n :param name: The name of this CredentialSetSchemaData. # noqa: E501\n :type name: str\n '
self._name = name | -62,531,053,906,224,904 | Sets the name of this CredentialSetSchemaData.
Name of the credential set. # noqa: E501
:param name: The name of this CredentialSetSchemaData. # noqa: E501
:type name: str | titan_client/models/credential_set_schema_data.py | name | intel471/titan-client-python | python | @name.setter
def name(self, name):
'Sets the name of this CredentialSetSchemaData.\n\n Name of the credential set. # noqa: E501\n\n :param name: The name of this CredentialSetSchemaData. # noqa: E501\n :type name: str\n '
self._name = name |
@property
def record_count(self):
'Gets the record_count of this CredentialSetSchemaData. # noqa: E501\n\n Number of records. # noqa: E501\n\n :return: The record_count of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._record_count | -463,459,791,761,958,400 | Gets the record_count of this CredentialSetSchemaData. # noqa: E501
Number of records. # noqa: E501
:return: The record_count of this CredentialSetSchemaData. # noqa: E501
:rtype: int | titan_client/models/credential_set_schema_data.py | record_count | intel471/titan-client-python | python | @property
def record_count(self):
'Gets the record_count of this CredentialSetSchemaData. # noqa: E501\n\n Number of records. # noqa: E501\n\n :return: The record_count of this CredentialSetSchemaData. # noqa: E501\n :rtype: int\n '
return self._record_count |
@record_count.setter
def record_count(self, record_count):
'Sets the record_count of this CredentialSetSchemaData.\n\n Number of records. # noqa: E501\n\n :param record_count: The record_count of this CredentialSetSchemaData. # noqa: E501\n :type record_count: int\n '
self._record_count = record_count | 7,318,459,635,416,779,000 | Sets the record_count of this CredentialSetSchemaData.
Number of records. # noqa: E501
:param record_count: The record_count of this CredentialSetSchemaData. # noqa: E501
:type record_count: int | titan_client/models/credential_set_schema_data.py | record_count | intel471/titan-client-python | python | @record_count.setter
def record_count(self, record_count):
'Sets the record_count of this CredentialSetSchemaData.\n\n Number of records. # noqa: E501\n\n :param record_count: The record_count of this CredentialSetSchemaData. # noqa: E501\n :type record_count: int\n '
self._record_count = record_count |
@property
def victims(self):
'Gets the victims of this CredentialSetSchemaData. # noqa: E501\n\n List of purported victims. # noqa: E501\n\n :return: The victims of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataVictims]\n '
return self._victims | 1,238,393,837,892,704,300 | Gets the victims of this CredentialSetSchemaData. # noqa: E501
List of purported victims. # noqa: E501
:return: The victims of this CredentialSetSchemaData. # noqa: E501
:rtype: list[CredentialSetSchemaDataVictims] | titan_client/models/credential_set_schema_data.py | victims | intel471/titan-client-python | python | @property
def victims(self):
'Gets the victims of this CredentialSetSchemaData. # noqa: E501\n\n List of purported victims. # noqa: E501\n\n :return: The victims of this CredentialSetSchemaData. # noqa: E501\n :rtype: list[CredentialSetSchemaDataVictims]\n '
return self._victims |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.