Data Science Python Modules.
Pandas -- For data formatting, Its also having "numpy"
Mataplotlib -- Module for virtual data or for graphs.
Scikit --- for data normalization, to print digital images of digits.
NLTK -- For Languages. to tokenize or to play on word and sentences
Networkx -- For Social Network Analysis, to find your connections or friends.
BeautifulSoup Parser -- For pulling data from html and xml ("Requests" packages also required with it for human readable format.)
ArcGIS --- To print or see World Maps etc.
To install above packages you can run below command on "cmd" prompt on windows 10.
C:\> py -m pip install pandas
C:\> py -m pip install mataplotlib
C:\> py -m pip install scikit-learn
C:\> py -m pip install nltk
C:\> py -m pip install networkx
C:\> py -m pip install beautifulsoup4
C:\> py -m pip install requests
C:\> py -m pip install arcgis
Above will install following packages;;
Installing collected packages: ipython-genutils, decorator, traitlets, jupyter-core, jsonschema, nbformat, pygments, pickleshare, parso, jedi, colorama, wcwidth, prompt-toolkit, backcall, ipython, tornado, pyzmq, jupyter-client, ipykernel, MarkupSafe, jinja2, pandocfilters, defusedxml, mistune, entrypoints, testpath, webencodings, bleach, nbconvert, Send2Trash, prometheus-client, pywinpty, terminado, notebook, widgetsnbextension, ipywidgets, pyshp, pywin32-ctypes, keyring, jupyterlab-server, jupyterlab, winkerberos, arcgis
PySpark -- It creates a cluster to run applications like docker container also used for Big Data.
***********************************************
Basic Scripts
First Script:
##########################################################################
# Description : This script is to deploy Netapp Cluster #
# Author : Devender Singh, #
################### Warning ##############################################
# Before running below commands,Please install licenses, #
# check OS version, system configuration etc. #
# Required Files with this main file: main.csv,
Link For Required File #
https://drive.google.com/file/d/1bXbVRNlEc29fixwTmcIfEVK4aXNTUM0I/view?usp=sharing
#
##########################################################################
# Modules Required
import os
import csv
import itertools
#Static Variables
host='ssh admin@192.168.10.1'
#Getting details from file "test.csv"
#
with open('main.csv') as fo:
data=csv.DictReader(fo)
for record in data:
# Dynamic Variables
cluster=record['cluster']
nodes=[record['cluster']+'-01',record['cluster']+'-02']
spips=[record['spip1'],record['spip2']]
nodeips=[record['node1ip'],record['node2ip']]
netmask=record['netmask']
gateway=record['gw']
nfs_vlan=record['nfsvlan']
esx_vlan=record['esxvlan']
iscsi_vlan1=record['iscsi1vlan']
iscsi_vlan2=record['iscsi2vlan']
api_vlan=record['apivlan']
rootaggr=[record['rootaggr1'],record['rootaggr2']]
dataaggr=[record['dataaggr1'],record['dataaggr2']]
dports=[record['dport1'],record['dport2']]
ipspace=[record['ipspace1'],record['ipspace2']]
# Please validate All details you Provided
print('Please verify Your Details:\n')
print(host,cluster,nodes,spips,nodeips,netmask,gateway,nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan,rootaggr,dataaggr,dports,ipspace)
print('\n')
response = input('Do you want to Proceed with above details (y/n):')
print(response)
if (response != 'y'):
print('Provided Details are not correct, Please Try Again:')
else:
# SP Details
print('%s system node service-processor network modify -node %s -address-type IPv4 -enable true -ip-address %s -netmask %s -gateway %s'
%(host,(nodes[0]),(spips[0]),netmask,gateway))
print('%s system node service-processor network modify -node %s -address-type IPv4 -enable true -ip-address %s -netmask %s -gateway %s'
%(host,(nodes[1]),(spips[1]),netmask,gateway))
# Disable Auto Disk Assign
for n in nodes:
print('%s storage disk option modify -node %s -autoassign off' %(host,n))
# Assigning Disk Ownership, normally one shelf per controller or 50-50 # NOTE: Please modify this section if you need"
#print('storage disk assign -owner (nodes[0]) -disk 1.1.1')
#print('storage disk assign -owner (nodes[1]) -disk 1.1.2')
# creating storage pool, Note: will be created only if SSD's else check if any flash
print('%s storage pool create -storage-pool sp_01 -disk-list d.1 d.2 d.3'%(host),';storage pool show')
# Aggr: Aggr0 will be created by Netapp just modify for raid group size, snapshot.
for raggr in rootaggr:
print('%s storage aggregate rename -aggregate aggr0 -newname %s' %(host,raggr))
# Create Data Aggr
print('%s storage aggregate create -aggregate %s -diskcount 20 -raidtype raid_dp -maxraidsize 20 -simulate true -node %s' %(host,(dataaggr[0]),(nodes[0])))
print('%s storage aggregate create -aggregate %s -diskcount 20 -raidtype raid_dp -maxraidsize 20 -simulate true -node %s' %(host,(dataaggr[1]),(nodes[1])))
# Modifying snapshot schedule
for daggr in dataaggr:
print('%s storage aggregate modify -aggregate %s -percent-snapshot-space 0'%(host,daggr))
# Port Configurations
for n in nodes:
print(n)
for ports in dports:
print('%s network port broadcast-domain remove-ports -broadcast-domain Default -ports %s:%s'%(host,n,ports))#Removing data ports from default broadcast domain
print('%s network port modify -node %s -port %s -mtu 9000'%(host,n,ports)) #changing data port speeds
print('%s network port modify -node %s -port %s -role data'%(host,n,ports)) #changing data port speeds
print('%s network port ifgrp add-port -node %s -ifgrp a0a -port %s'%(host,n,ports)) #Adding ports to port group
print('%s network port modify -node %s -port a0a -mtu 9000'%(host,n)) #changing ifgroup port speeds
print('%s network port modify -node %s -port e0M -mtu 1500'%(host,n)) #changing mgmt port speeds
print('%s network port ifgrp create -node %s -ifgrp a0a -distr-func ip -mode multimode_lacp'%(host,n)) # Creating Ifgroup
# Failover Group Creation
print('%s network interface failover-groups create -failover-group fg_vlan-%s -node %s -port a0a-%s'%(host,nfs_vlan,n,nfs_vlan)) # NFS failover group
# Configuring vlan
for vlans in (nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan):
print('%s vlan create -node %s -vlan-name a0a-%s'%(host,n,vlans)) # Creating All Vlan's
print('%s network port modify -node %s -port a0a-%s -mtu 9000'%(host,n,vlans)) #Changing vlan's speed
print('%s network port modify -node %s -port a0a-%s -mtu 1500'%(host,n,api_vlan)) #changing vlan's speed
print("%s system node autosupport modify -from %s@equant.com -to dev.singh@orange.com -node %s -mail-hosts x.x.x.x"%(host,cluster,n)) # Autosupport
# Ipsapce and Broadcast Domain Creation
for space in ipspace:
print('%s ipspace create %s'%(host,space))
for vlans in (nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan):
print('%s network port broadcast-domain create -broadcast-domain bcast_vlan-%s -mtu 9000 -ipspace %s -ports %s:a0a-%s,%s:a0a-%s'%(host,vlans,(ipspace[0]),(nodes[0]),vlans,(nodes[1]),vlans))
# Configuring Management & Cluster Interfaces: would be done by Netapp Engg.
print('%s network interfaces show'%(host))
## Firewall Policies & Routing Group
print('%s system services firewall policy create -vserver %s -policy api -service http -allow-list 0.0.0.0/0'%(host,cluster))
print('%s system services firewall policy create -vserver %s -policy api -service https -allow-list 0.0.0.0/0'%(host,cluster))
# "services ndmp modify -vserver $cname -enable true"
print("%s system snmp community add -community-name public -type ro -vserver %s"%(host,cluster))
print("%s system snmp traphost add -peer-address x.x.x.x"%(host))
print("%s system snmp contact ocb_ops_pco_gpcsc_elite@orange.com"%(host))
print("%s cluster time-service ntp server create -server x.x.x.x"%(host))
for n in nodes:
print("%s autosupport modify -node %s -perf true -transport smtp"%(host,n))
print("%s ping -lif cluster_mgmt -vserver %s -destination x.x.x.x"%(host,cluster))
print("%s ping -lif cluster_mgmt -vserver %s -destination x.x.x.x"%(host,cluster))
print("%s vserver nfs modify -vserver %s -vstorage enabled"%(host,cluster))
print("%s vserver nfs show"%(host))
print("%s vserver iscsi show"%(host))
# Calling roles file and creating them
#print(os.system('python roles.py'))
print('python roles.py')
2nd Script:
##############################################################################################
# Description : This script is to create volumes, qtree's & lun on Netapp Cluster #
# Author : Devender Singh, dev.singh@orange.com
#################### Warning ###################################################
# Before running below commands,Please install licenses, #
# check OS version, system configuration etc. #
# Required Files with this main file: bootlun.csv, bootlun.csv,svmvols.txt,infravols.txt #
https://drive.google.com/file/d/11UK8fcFxFUQ8VM3SMJ-Y0U2RD4NQ2qD-/view?usp=sharing
https://drive.google.com/file/d/1YxKMyllSHkUa7_CsiVfC5GibO9ENahrd/view?usp=sharing
https://drive.google.com/file/d/1a8ONl4pC-lLXrphN4TlK201X8SvBoGlC/view?usp=sharing
##############################################################################################
# Modules Required
import os
import csv
import itertools
#Getting details from file "test.csv"
#
#Static Variables
host='ssh admin@192.168.10.1'
with open('bootlun.csv') as fo: # Fetching variables from CSV file
data=csv.DictReader(fo)
for record in data:
# Dynamic Variables
cluster=record['cluster']
nodes=[record['cluster']+'-01',record['cluster']+'-02']
svmname=record['svmname']
svmrootvol=record['rootvol']
svmaggr=record['svmaggr']
nfsesxip=record['nfsesxip']
nfsnet=record['esxsubnet']
nfsesxmask=record['netmask']
gateway=record['gw']
iscsiips=[record['iscsiip1'],record['iscsiip2']]
inetmask=record['iscsinetmask']
nfs_vlan=record['nfsvlan']
esx_vlan=record['esxvlan']
ipspace=record['ipspace']
# vol=[record['svvol1'],record['svvol2'],record['svvol3'],record['svvol4'],record['svvol5'],record['svvol6'],record['svvol7']]
# Please validate All details you Provided
print('Please verify Your Details:\n')
print(host,cluster,nodes,svmname,svmrootvol,svmaggr,nfsesxip,nfsnet,gateway,iscsiips,inetmask,nfs_vlan,esx_vlan,ipspace)
print('\n')
response = input('Do you want to Proceed with above details (y/n):')
if (response != 'y'):
print('Provided Details are not correct, Please Try Again:')
else:
# creating SVM
print('%s vserver create -vserver %s -aggregate %s -rootvolume %s -subtype default -ipspace %s -rootvolume-security-style unix -language C.UTF-8 -ns-switch file -nm-switch file -snapshot-policy default -is-repository false'
%(host,svmname,svmaggr,svmrootvol,ipspace))
print('%s vserver modify -vserver %s -allowed-protocols nfs,iscsi' %(host,svmname))
print('%s server status')
print('%s vol modify -vserver %s -volume %s -snapshot-policy default'%(host,svmname,svmrootvol))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'%(host,svmrootvol,svmname,))
print('%s vserver export-policy create -policyname export_policy_01'%(host))
print('%s vserver export-policy create -policyname export_policy_02'%(host))
# Export Policy
print('%s vserver export-policy rule create -vserver %s -policyname export_policy_01 -ruleindex 1 -protocol any -clientmatch %s/27" -rorule sys -rwrule none -superuser sys'%(host,svmname,nfsnet))
print('%s vserver export-policy rule create -vserver %s -policyname export_policy_02 -ruleindex 2 -protocol any -clientmatch %s/27" -rorule sys -rwrule sys -superuser sys'%(host,svmname,nfsnet))
print('%s vserver nfs create -vserver %s -access true'%(host,svmname))
#
with open ('svmvols.txt', 'rt') as svmvols:
for v in svmvols:
print('%s vol create -volume %s -aggregate %s -size 700GB -state online -type RW -junction-path /%s -vserver %s -space-guarantee none -snapshot-policy none -comment "ESX Boost on SCSI"'
%(host,v,svmaggr,v,svmname))
print('%s sis on -vserver %s -volume %s'%(host,svmname,v))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'%(host,v,svmname))
# Creating data interface
print('%s network interface create -vserver %s -lif lif_file_%s_01 -home-node %s -home-port a0a-%s -failover-group bcast_vlan-%s -data-protocol nfs -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,nfs_vlan,nodes[0],nfs_vlan,nfs_vlan,nfsesxip,nfsesxmask))
print('%s network interface create -vserver %s -lif lif_file_%s_01 -home-node %s -home-port a0a-%s -data-protocol iscsi -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,esx_vlan,nodes[0],esx_vlan,iscsiips[0],inetmask))
print('%s network interface create -vserver %s -lif lif_file_%s_02 -home-node %s -home-port a0a-%s -data-protocol iscsi -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,esx_vlan,nodes[1],esx_vlan,iscsiips[1],inetmask))
#
# Note: verify size of volumes as per LLD
with open ('svminfravols.txt', 'rt') as svminfravols:
for svmvolinfra in svminfravols:
print('%s vol create -volume %s -aggregate %s -size 2tb -state online -type RW -junction-path /%s -vserver $svm -snapshot-policy none -policy export_policy_01 -comment "Infra datastore Tier1-OBSVM"'
%(host,svmvolinfra,svmaggr,svmvolinfra))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'
%(host,svmvolinfra,svmname))
print('%s sis on -vserver %s -volume %s'%(host,svmname,svmvolinfra))
# for qtrevol in svminfravols:
print('%s qtree create -vserver %s -volume %s -qtree qt01 -security-style unix -export-policy export_policy_02'
%(host,svmname,svmvolinfra))
# for qtrevol1 in svminfravols:
print('%s vol modify -volume %s -policy export_policy_01'%(host,svmvolinfra))
print('%s qtree modify -vserver %s -volume %s -qtree qt01 -export-policy export_policy_02'%(host,svmname,svmvolinfra))
print('%s vol modify -vserver %s -volume %s -policy export_policy_01'%(host,svmname,svmrootvol))
# Qtree Creation & Export Policy
with open ('svmvols.txt', 'rt') as svmvols:
for qtrevol1 in svmvols:
print('%s qtree create -vserver %s -volume %s -qtree qt01 -security-style unix'%(host,svmname,qtrevol1))
# Lun Creation
print('%s lun create -vserver %s -path /vol/%s/qt01/lun01.lun -size 16G -ostype vmware'%(host,svmname,qtrevol1))
print('%s lun modify -vserver %s -path /vol/%s/qt01/lun01.lun -space-reserve disabled'%(host,svmname,qtrevol1))
#
print('%s iscsi create -target-alias %s -status-admin up'%(host,svmname))
Pandas -- For data formatting, Its also having "numpy"
Mataplotlib -- Module for virtual data or for graphs.
Scikit --- for data normalization, to print digital images of digits.
NLTK -- For Languages. to tokenize or to play on word and sentences
Networkx -- For Social Network Analysis, to find your connections or friends.
BeautifulSoup Parser -- For pulling data from html and xml ("Requests" packages also required with it for human readable format.)
ArcGIS --- To print or see World Maps etc.
To install above packages you can run below command on "cmd" prompt on windows 10.
C:\> py -m pip install pandas
C:\> py -m pip install mataplotlib
C:\> py -m pip install scikit-learn
C:\> py -m pip install nltk
C:\> py -m pip install networkx
C:\> py -m pip install beautifulsoup4
C:\> py -m pip install requests
C:\> py -m pip install arcgis
Above will install following packages;;
Installing collected packages: ipython-genutils, decorator, traitlets, jupyter-core, jsonschema, nbformat, pygments, pickleshare, parso, jedi, colorama, wcwidth, prompt-toolkit, backcall, ipython, tornado, pyzmq, jupyter-client, ipykernel, MarkupSafe, jinja2, pandocfilters, defusedxml, mistune, entrypoints, testpath, webencodings, bleach, nbconvert, Send2Trash, prometheus-client, pywinpty, terminado, notebook, widgetsnbextension, ipywidgets, pyshp, pywin32-ctypes, keyring, jupyterlab-server, jupyterlab, winkerberos, arcgis
PySpark -- It creates a cluster to run applications like docker container also used for Big Data.
***********************************************
Basic Scripts
First Script:
##########################################################################
# Description : This script is to deploy Netapp Cluster #
# Author : Devender Singh, #
################### Warning ##############################################
# Before running below commands,Please install licenses, #
# check OS version, system configuration etc. #
# Required Files with this main file: main.csv,
Link For Required File #
https://drive.google.com/file/d/1bXbVRNlEc29fixwTmcIfEVK4aXNTUM0I/view?usp=sharing
#
##########################################################################
# Modules Required
import os
import csv
import itertools
#Static Variables
host='ssh admin@192.168.10.1'
#Getting details from file "test.csv"
#
with open('main.csv') as fo:
data=csv.DictReader(fo)
for record in data:
# Dynamic Variables
cluster=record['cluster']
nodes=[record['cluster']+'-01',record['cluster']+'-02']
spips=[record['spip1'],record['spip2']]
nodeips=[record['node1ip'],record['node2ip']]
netmask=record['netmask']
gateway=record['gw']
nfs_vlan=record['nfsvlan']
esx_vlan=record['esxvlan']
iscsi_vlan1=record['iscsi1vlan']
iscsi_vlan2=record['iscsi2vlan']
api_vlan=record['apivlan']
rootaggr=[record['rootaggr1'],record['rootaggr2']]
dataaggr=[record['dataaggr1'],record['dataaggr2']]
dports=[record['dport1'],record['dport2']]
ipspace=[record['ipspace1'],record['ipspace2']]
# Please validate All details you Provided
print('Please verify Your Details:\n')
print(host,cluster,nodes,spips,nodeips,netmask,gateway,nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan,rootaggr,dataaggr,dports,ipspace)
print('\n')
response = input('Do you want to Proceed with above details (y/n):')
print(response)
if (response != 'y'):
print('Provided Details are not correct, Please Try Again:')
else:
# SP Details
print('%s system node service-processor network modify -node %s -address-type IPv4 -enable true -ip-address %s -netmask %s -gateway %s'
%(host,(nodes[0]),(spips[0]),netmask,gateway))
print('%s system node service-processor network modify -node %s -address-type IPv4 -enable true -ip-address %s -netmask %s -gateway %s'
%(host,(nodes[1]),(spips[1]),netmask,gateway))
# Disable Auto Disk Assign
for n in nodes:
print('%s storage disk option modify -node %s -autoassign off' %(host,n))
# Assigning Disk Ownership, normally one shelf per controller or 50-50 # NOTE: Please modify this section if you need"
#print('storage disk assign -owner (nodes[0]) -disk 1.1.1')
#print('storage disk assign -owner (nodes[1]) -disk 1.1.2')
# creating storage pool, Note: will be created only if SSD's else check if any flash
print('%s storage pool create -storage-pool sp_01 -disk-list d.1 d.2 d.3'%(host),';storage pool show')
# Aggr: Aggr0 will be created by Netapp just modify for raid group size, snapshot.
for raggr in rootaggr:
print('%s storage aggregate rename -aggregate aggr0 -newname %s' %(host,raggr))
# Create Data Aggr
print('%s storage aggregate create -aggregate %s -diskcount 20 -raidtype raid_dp -maxraidsize 20 -simulate true -node %s' %(host,(dataaggr[0]),(nodes[0])))
print('%s storage aggregate create -aggregate %s -diskcount 20 -raidtype raid_dp -maxraidsize 20 -simulate true -node %s' %(host,(dataaggr[1]),(nodes[1])))
# Modifying snapshot schedule
for daggr in dataaggr:
print('%s storage aggregate modify -aggregate %s -percent-snapshot-space 0'%(host,daggr))
# Port Configurations
for n in nodes:
print(n)
for ports in dports:
print('%s network port broadcast-domain remove-ports -broadcast-domain Default -ports %s:%s'%(host,n,ports))#Removing data ports from default broadcast domain
print('%s network port modify -node %s -port %s -mtu 9000'%(host,n,ports)) #changing data port speeds
print('%s network port modify -node %s -port %s -role data'%(host,n,ports)) #changing data port speeds
print('%s network port ifgrp add-port -node %s -ifgrp a0a -port %s'%(host,n,ports)) #Adding ports to port group
print('%s network port modify -node %s -port a0a -mtu 9000'%(host,n)) #changing ifgroup port speeds
print('%s network port modify -node %s -port e0M -mtu 1500'%(host,n)) #changing mgmt port speeds
print('%s network port ifgrp create -node %s -ifgrp a0a -distr-func ip -mode multimode_lacp'%(host,n)) # Creating Ifgroup
# Failover Group Creation
print('%s network interface failover-groups create -failover-group fg_vlan-%s -node %s -port a0a-%s'%(host,nfs_vlan,n,nfs_vlan)) # NFS failover group
# Configuring vlan
for vlans in (nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan):
print('%s vlan create -node %s -vlan-name a0a-%s'%(host,n,vlans)) # Creating All Vlan's
print('%s network port modify -node %s -port a0a-%s -mtu 9000'%(host,n,vlans)) #Changing vlan's speed
print('%s network port modify -node %s -port a0a-%s -mtu 1500'%(host,n,api_vlan)) #changing vlan's speed
print("%s system node autosupport modify -from %s@equant.com -to dev.singh@orange.com -node %s -mail-hosts x.x.x.x"%(host,cluster,n)) # Autosupport
# Ipsapce and Broadcast Domain Creation
for space in ipspace:
print('%s ipspace create %s'%(host,space))
for vlans in (nfs_vlan,esx_vlan,iscsi_vlan1,iscsi_vlan2,api_vlan):
print('%s network port broadcast-domain create -broadcast-domain bcast_vlan-%s -mtu 9000 -ipspace %s -ports %s:a0a-%s,%s:a0a-%s'%(host,vlans,(ipspace[0]),(nodes[0]),vlans,(nodes[1]),vlans))
# Configuring Management & Cluster Interfaces: would be done by Netapp Engg.
print('%s network interfaces show'%(host))
## Firewall Policies & Routing Group
print('%s system services firewall policy create -vserver %s -policy api -service http -allow-list 0.0.0.0/0'%(host,cluster))
print('%s system services firewall policy create -vserver %s -policy api -service https -allow-list 0.0.0.0/0'%(host,cluster))
# "services ndmp modify -vserver $cname -enable true"
print("%s system snmp community add -community-name public -type ro -vserver %s"%(host,cluster))
print("%s system snmp traphost add -peer-address x.x.x.x"%(host))
print("%s system snmp contact ocb_ops_pco_gpcsc_elite@orange.com"%(host))
print("%s cluster time-service ntp server create -server x.x.x.x"%(host))
for n in nodes:
print("%s autosupport modify -node %s -perf true -transport smtp"%(host,n))
print("%s ping -lif cluster_mgmt -vserver %s -destination x.x.x.x"%(host,cluster))
print("%s ping -lif cluster_mgmt -vserver %s -destination x.x.x.x"%(host,cluster))
print("%s vserver nfs modify -vserver %s -vstorage enabled"%(host,cluster))
print("%s vserver nfs show"%(host))
print("%s vserver iscsi show"%(host))
# Calling roles file and creating them
#print(os.system('python roles.py'))
print('python roles.py')
2nd Script:
##############################################################################################
# Description : This script is to create volumes, qtree's & lun on Netapp Cluster #
# Author : Devender Singh, dev.singh@orange.com
#################### Warning ###################################################
# Before running below commands,Please install licenses, #
# check OS version, system configuration etc. #
# Required Files with this main file: bootlun.csv, bootlun.csv,svmvols.txt,infravols.txt #
https://drive.google.com/file/d/11UK8fcFxFUQ8VM3SMJ-Y0U2RD4NQ2qD-/view?usp=sharing
https://drive.google.com/file/d/1YxKMyllSHkUa7_CsiVfC5GibO9ENahrd/view?usp=sharing
https://drive.google.com/file/d/1a8ONl4pC-lLXrphN4TlK201X8SvBoGlC/view?usp=sharing
##############################################################################################
# Modules Required
import os
import csv
import itertools
#Getting details from file "test.csv"
#
#Static Variables
host='ssh admin@192.168.10.1'
with open('bootlun.csv') as fo: # Fetching variables from CSV file
data=csv.DictReader(fo)
for record in data:
# Dynamic Variables
cluster=record['cluster']
nodes=[record['cluster']+'-01',record['cluster']+'-02']
svmname=record['svmname']
svmrootvol=record['rootvol']
svmaggr=record['svmaggr']
nfsesxip=record['nfsesxip']
nfsnet=record['esxsubnet']
nfsesxmask=record['netmask']
gateway=record['gw']
iscsiips=[record['iscsiip1'],record['iscsiip2']]
inetmask=record['iscsinetmask']
nfs_vlan=record['nfsvlan']
esx_vlan=record['esxvlan']
ipspace=record['ipspace']
# vol=[record['svvol1'],record['svvol2'],record['svvol3'],record['svvol4'],record['svvol5'],record['svvol6'],record['svvol7']]
# Please validate All details you Provided
print('Please verify Your Details:\n')
print(host,cluster,nodes,svmname,svmrootvol,svmaggr,nfsesxip,nfsnet,gateway,iscsiips,inetmask,nfs_vlan,esx_vlan,ipspace)
print('\n')
response = input('Do you want to Proceed with above details (y/n):')
if (response != 'y'):
print('Provided Details are not correct, Please Try Again:')
else:
# creating SVM
print('%s vserver create -vserver %s -aggregate %s -rootvolume %s -subtype default -ipspace %s -rootvolume-security-style unix -language C.UTF-8 -ns-switch file -nm-switch file -snapshot-policy default -is-repository false'
%(host,svmname,svmaggr,svmrootvol,ipspace))
print('%s vserver modify -vserver %s -allowed-protocols nfs,iscsi' %(host,svmname))
print('%s server status')
print('%s vol modify -vserver %s -volume %s -snapshot-policy default'%(host,svmname,svmrootvol))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'%(host,svmrootvol,svmname,))
print('%s vserver export-policy create -policyname export_policy_01'%(host))
print('%s vserver export-policy create -policyname export_policy_02'%(host))
# Export Policy
print('%s vserver export-policy rule create -vserver %s -policyname export_policy_01 -ruleindex 1 -protocol any -clientmatch %s/27" -rorule sys -rwrule none -superuser sys'%(host,svmname,nfsnet))
print('%s vserver export-policy rule create -vserver %s -policyname export_policy_02 -ruleindex 2 -protocol any -clientmatch %s/27" -rorule sys -rwrule sys -superuser sys'%(host,svmname,nfsnet))
print('%s vserver nfs create -vserver %s -access true'%(host,svmname))
#
with open ('svmvols.txt', 'rt') as svmvols:
for v in svmvols:
print('%s vol create -volume %s -aggregate %s -size 700GB -state online -type RW -junction-path /%s -vserver %s -space-guarantee none -snapshot-policy none -comment "ESX Boost on SCSI"'
%(host,v,svmaggr,v,svmname))
print('%s sis on -vserver %s -volume %s'%(host,svmname,v))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'%(host,v,svmname))
# Creating data interface
print('%s network interface create -vserver %s -lif lif_file_%s_01 -home-node %s -home-port a0a-%s -failover-group bcast_vlan-%s -data-protocol nfs -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,nfs_vlan,nodes[0],nfs_vlan,nfs_vlan,nfsesxip,nfsesxmask))
print('%s network interface create -vserver %s -lif lif_file_%s_01 -home-node %s -home-port a0a-%s -data-protocol iscsi -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,esx_vlan,nodes[0],esx_vlan,iscsiips[0],inetmask))
print('%s network interface create -vserver %s -lif lif_file_%s_02 -home-node %s -home-port a0a-%s -data-protocol iscsi -role data -firewall-policy data -address %s -netmask %s -status-admin up'
%(host,svmname,esx_vlan,nodes[1],esx_vlan,iscsiips[1],inetmask))
#
# Note: verify size of volumes as per LLD
with open ('svminfravols.txt', 'rt') as svminfravols:
for svmvolinfra in svminfravols:
print('%s vol create -volume %s -aggregate %s -size 2tb -state online -type RW -junction-path /%s -vserver $svm -snapshot-policy none -policy export_policy_01 -comment "Infra datastore Tier1-OBSVM"'
%(host,svmvolinfra,svmaggr,svmvolinfra))
print('%s snapshot autodelete modify -volume %s -vserver %s -defer-delete none -target-free-space 15 -enabled true'
%(host,svmvolinfra,svmname))
print('%s sis on -vserver %s -volume %s'%(host,svmname,svmvolinfra))
# for qtrevol in svminfravols:
print('%s qtree create -vserver %s -volume %s -qtree qt01 -security-style unix -export-policy export_policy_02'
%(host,svmname,svmvolinfra))
# for qtrevol1 in svminfravols:
print('%s vol modify -volume %s -policy export_policy_01'%(host,svmvolinfra))
print('%s qtree modify -vserver %s -volume %s -qtree qt01 -export-policy export_policy_02'%(host,svmname,svmvolinfra))
print('%s vol modify -vserver %s -volume %s -policy export_policy_01'%(host,svmname,svmrootvol))
# Qtree Creation & Export Policy
with open ('svmvols.txt', 'rt') as svmvols:
for qtrevol1 in svmvols:
print('%s qtree create -vserver %s -volume %s -qtree qt01 -security-style unix'%(host,svmname,qtrevol1))
# Lun Creation
print('%s lun create -vserver %s -path /vol/%s/qt01/lun01.lun -size 16G -ostype vmware'%(host,svmname,qtrevol1))
print('%s lun modify -vserver %s -path /vol/%s/qt01/lun01.lun -space-reserve disabled'%(host,svmname,qtrevol1))
#
print('%s iscsi create -target-alias %s -status-admin up'%(host,svmname))
No comments:
Post a Comment