Name

global.FixPatternLoadBalancersModel

Description

Add Missing relations to Load Balancers when moving from probes to patterns. should add missing relations for IRE

Script

var FixPatternLoadBalancersModel = Class.create();
FixPatternLoadBalancersModel.prototype = Object.extendsObject(FixPatternsModelBasic, {
  
  addMissingRelationsForLoadBalancers : function() {
  	this.stepsCompleted = this.getStepsCompleted();
  	this.startLogRecord(this.scriptNames.LB);

  	//Do quick Prerequisite check to make sure we can run this migration
  	this.quickPrerequisiteCheck();
  	this.recordArray = [];
  	this.addLoadBalancerClassifiersToArray();

  	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("Load Balancer Migration start");

  		var lbClassyArr = [];
  		lbClassyArr.push('cmdb_ci_lb_bigip');
  		lbClassyArr.push('cmdb_ci_lb_a10');
  		lbClassyArr.push('cmdb_ci_lb_alteon');
  		lbClassyArr.push('cmdb_ci_lb_netscaler');
  		lbClassyArr.push('cmdb_ci_lb_ace');
  		lbClassyArr.push('cmdb_ci_lb_radware');

  		switch(this.stepsCompleted) {
  			case 0:
  				this.infoMsg('Load Balancer: Adding Network Adapter Relationships');
  				this.addNetworkAdapter(lbClassyArr);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 1:
  				this.infoMsg('Load Balancer: Adding IP Address Relationships');
  				this.addIpAddress(lbClassyArr);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 2:
  				this.infoMsg('Load Balancer: Adding Router Interface Relationships');
  				this.addRouterInterface(lbClassyArr);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 3:
  				this.infoMsg('Load Balancer: Adding Load Balancer Pool Relationships');
  				this.addPools(lbClassyArr);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 4:
  				this.infoMsg('Load Balancer: Adding Load Balancer Interface Relationships');
  				this.addNetworkInterface(lbClassyArr);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 5:
  				this.infoMsg('Load Balancer: Adding Load Balancer VLAN Relationships');
  				this.addVlans(lbClassyArr);
  				this.saveLeftOversRelationsToCMDBRelCI();
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 6:
  				this.infoMsg('Load Balancer: Updating Existing Pool Member Relationships');
  				this.changeRelationship('cmdb_ci_lb_pool', 'cmdb_ci_lb_pool_member', this.MEMBERS, this.OWNS);
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  			case 7:
  				this.infoMsg('Load Balancer: Adding Load Balancer Pool Member Relationships');
  				this.addPoolMember(lbClassyArr);
  				this.saveLeftOversRelationsToCMDBRelCI();
  				this.stepsCompleted++;
  				this.updateStepsCompleted(this.stepsCompleted);
  				break;
  			case 8:
  				this.infoMsg('Load Balancer: All previous steps have been completed. Moving to enable patterns');
  				break;
  			default:
  				this.infoMsg('Load Balancer migration step count check FAILED - Please check probe_to_pattern_log for issues.');
  		}

  		//Migrate Load Balancer 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('Load Balancer Migration took: ' + formattedTime);
  	} else
  		this.infoMsg('Load Balancer migration prerequisite check FAILED - Please run ProbeToPatternPrerequisiteScript to check for issues.');
  	this.endLogs();
  },

  type: 'FixPatternLoadBalancersModel'
});

Sys ID

d4e3db1f9f321300ed6191aec32e7026

Offical Documentation

Official Docs: