Name
global.FixWindowsModelForPatterns
Description
Should add missing relations for IRE for Windows
Script
var FixWindowsModelForPatterns = Class.create();
FixWindowsModelForPatterns.prototype = Object.extendsObject(FixPatternsModelBasic, {
addMissingRelationsForWindows : function() {
this.stepsCompleted = this.getStepsCompleted();
this.startLogRecord(this.scriptNames.WINDOWS);
//Do quick Prerequisite check to make sure we can run this migration
this.quickPrerequisiteCheck();
this.recordArray = [];
this.addWindowsClassifiersToArray();
this.clusterClass = 'cmdb_ci_win_cluster';
for (var i = 0; i < this.recordArray.length; i++) {
if (this.recordArray[i].status.equals(this.checkResult.FAIL))
this.classifierCheck = false;
}
var passLog = this.getPassLog("Classifier", this.classifierCheck);
this.infoMsg(passLog);
if (this.PASS_ALL) {
var startTime = new Date();
this.infoMsg("Windows migration start");
//Update records for Windows Servers/Computers/Clusters
this.addMissingRelationsForWindowsType();
//Migrate Windows Classifications to Patterns
for (var j = 0; j < this.recordArray.length; j++)
this.enablePatternObj(this.recordArray[j]);
this.setPropertyForOSProbes('glide.discovery.ip_based.active', 'false');
this.updateDNSIPAddresses();
var endTime = new Date();
var totalTime = endTime.getTime() - startTime.getTime();
var formattedTime = this.msToTime(totalTime);
this.infoMsg('Windows Migration took: ' + formattedTime);
} else
this.infoMsg('Windows migration prerequisite check FAILED - Please run ProbeToPatternPrerequisiteScript to check for issues.');
this.endLogs();
},
addMissingRelationsForWindowsType : function() {
switch(this.stepsCompleted) {
case 0:
this.infoMsg('Windows: Adding Network Adapter Relationships');
this.addNetworkAdapter('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 1:
this.infoMsg('Windows: Adding File System Relationships');
this.addFileSystem('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 2:
this.infoMsg('Windows: Adding IP Address Relationships');
this.addIpAddress('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 3:
this.infoMsg('Windows: Adding Memory Module Relationships');
this.addMemoryModule('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 4:
this.infoMsg('Windows: Adding Storage Relationships');
this.addStorage('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 5:
this.infoMsg('Windows: Adding Disk Partition Relationships');
this.addDiskPartitions('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 6:
this.infoMsg('Windows: Adding Exit Interface Relationships');
this.addExitInterfaceRule('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 7:
this.infoMsg('Windows: Adding Next Hop Relationships');
this.addNextHopRule('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 8:
this.infoMsg('Windows: Adding HBA Relationships');
this.addHBA('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 9:
this.infoMsg('Windows: Adding Fibre Channel Relationships');
this.addFiberChannel('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 10:
this.infoMsg('Windows: Adding Router Interface Relationships');
this.addRouterInterface('');
this.saveLeftOversRelationsToCMDBRelCI();
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 11:
this.infoMsg('Windows: Adding Cluster Resource Relationships');
this.addRelationToCi('cmdb_ci_win_cluster_resource', 'cluster', this.clusterClass, this.DEFINE_RESOURCE_FOR);
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 12:
this.infoMsg('Windows: Adding Cluster VIP Relationships');
this.addRelationToCi('cmdb_ci_cluster_vip', 'cluster', this.clusterClass, this.VIRTUALIZED);
this.saveLeftOversRelationsToCMDBRelCI();
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 13:
this.infoMsg('Windows: Updating Existing Cluster Relationships');
this.flipRelationship(this.clusterClass, 'cmdb_ci_win_cluster_node', this.MEMBERS);
this.flipRelationship(this.clusterClass, 'cmdb_ci_win_cluster_resource', this.DEFINE_RESOURCE_FOR);
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 14:
this.infoMsg('Windows: Updating Existing Relationships');
this.flipLayeredRelationship('cmdb_ci_storage_device', 'cmdb_ci_file_system', this.PROVIDES, '', 'computer', 'computer');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 15:
this.infoMsg('Windows: Updating File Systems');
this.updateFileSystems('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 16:
this.infoMsg('Windows: Updating Exit Interface Route Names');
this.updateRouteInterfaceName('', 'short_description');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 17:
this.infoMsg('Windows: Updating Exit Interface Route Mac Address');
this.updateRouteInterfaceMacAddress('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 18:
this.infoMsg('Windows: Updating Dest IP Network Values');
this.fixDestIpNetwork('');
this.stepsCompleted++;
this.updateStepsCompleted(this.stepsCompleted);
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
//Update records for Hyper-V
var hyperScript = new FixHyperVModelForPatterns();
hyperScript.setLogRecord(this.logSysId);
hyperScript.addMissingRelationsForHyperV();
break;
case 36:
this.infoMsg('Windows: All previous steps have been completed. Moving to enable patterns');
break;
default:
this.infoMsg('Windows migration step count check FAILED - Please check probe_to_pattern_log for issues.');
}
},
type: 'FixWindowsModelForPatterns'
});
Sys ID
d22423149f6313004deb91aec32e7081